Skip to content

devagentic-docs: MVP plugin (/doc search | write | show)#19

Merged
PowerCreek merged 1 commit into
mainfrom
devagentic-docs-plugin-mvp
May 22, 2026
Merged

devagentic-docs: MVP plugin (/doc search | write | show)#19
PowerCreek merged 1 commit into
mainfrom
devagentic-docs-plugin-mvp

Conversation

@PowerCreek

Copy link
Copy Markdown

Summary

Closes #12 (MVP scope). First proof-of-concept for the synergy-charter "agent-context federation skills exposed to hermes" item. New plugins/devagentic-docs/ is a structural sibling to plugins/devagentic-canvas/ — same env conventions, same enable/disable contract, same loss-tolerant failure semantics.

Surface

  • /doc search <query> [--tag <tag>] [--limit N]searchDocs GraphQL primitive
  • /doc write <body> [--tags a,b,c]writeDoc, auto-tagged with source:hermes-cli
  • /doc show <id> — identity-verified top-1 search match

Failure loudness

Client mirrors the last_error_text() pattern shipped for canvas in #15 + #16. Slash commands print a specific Reason: clause on any failure (auth, 404, unreachable, parse, GraphQL errors, no user_id), so operators don't have to grep DEBUG logs.

Deliberately out of scope for MVP

Filing each as its own follow-up issue would be premature; will surface them as scope deltas if #12 stays open after this lands.

Test plan

  • 25 new unit tests in tests/test_devagentic_docs_plugin.py: manifest, base-URL handling, failure-loudness (5 cases), search rendering, write tagging, dispatcher routing.
  • pytest tests/test_devagentic_docs_plugin.py → 25 passed.
  • No regression — pytest tests/test_devagentic_{canvas,skills,memory}_plugin.py tests/hermes_cli/test_doctor_devagentic_graph.py → 76 passed (43 + 27 + … existing).
  • Live end-to-end against a running devagentic blocked by devagentic#157.

Filed by hermes-maintainer (PowerCreek).

Sibling to devagentic-canvas — same env conventions, same loss-
tolerant contract, same enable/disable semantics. Surfaces three
slash commands:

  /doc search <query> [--tag t] [--limit N]
  /doc write <body>   [--tags a,b,c]      (auto-tags source:hermes-cli)
  /doc show <id>

Client mirrors the canvas plugin's last_error_text() pattern from
#15, so slash commands surface auth / 404 / unreachable / parse /
no-user-id specifically instead of opaque "command failed."

MVP scope: no /fork commands and no pre_llm_call hook — both are
in the #12 proposal and tracked as follow-up. Keeping this PR
small + verifiable per the charter.

Closes #12 (MVP scope).
@PowerCreek PowerCreek merged commit 39dde50 into main May 22, 2026
@PowerCreek PowerCreek deleted the devagentic-docs-plugin-mvp branch May 22, 2026 21:36
PowerCreek added a commit that referenced this pull request May 22, 2026
#20)

Two changes in this PR — one a defect fix, one the rest of #12's
proposed scope.

Schema fix (defect in #19 MVP):
- The actual schema is searchDocs(query, k), not (query, limit, tag).
  My PR #19 shipped invalid GraphQL that the server would reject.
  Confirmed via introspection of devagentic's live schema.
- Route /doc search differently: with --tag, hit Query.docs(tags:[t])
  and filter client-side; without --tag, hit Query.searchDocs(query, k).
- Doc shape: drop `score` (not on Doc); add `source`, `ts`.

/fork surface (#12 follow-up):
- /fork open <parent_id> [--goal "..."]  wraps forkContext, sets a
  marker at $HERMES_HOME/docs-fork-active (sibling to canvas-active).
- /fork close clears the marker.
- /fork show prints active fork tags + annotations via context(id).
- /fork pin <doc_id> appends a pinned-doc annotation via decorateContext.
- /fork render exposes renderContext(ctxId) directly — useful for
  debugging the preamble injection.

pre_llm_call hook:
- When a fork is active, calls renderContext(ctxId) and returns
  {context: header + rendered} for the host to append to the user
  message. Capped at 8000 chars hermes-side; devagentic does its
  own bounding upstream.
- Returns None (turn proceeds without preamble) on any failure
  path: no marker, render returns None, render returns "".

Tests: 45 passed (43 prior + 2 net new after schema-fix rewrites).
The fixture now eagerly pre-loads all three submodules so
monkeypatches on plugin_pkg.client reach preamble's docs_client
reference.

Closes #12 in full.
PowerCreek added a commit that referenced this pull request May 22, 2026
Mirrors the canvas-tools pattern (#56) for the just-shipped
devagentic-docs plugin (#12 / PRs #19+#20+#23). MCP-aware clients
(Claude Code, Cursor, Codex) can now writeDoc / searchDocs /
forkContext / decorateContext / renderContext against any
devagentic instance hermes is configured for.

New tools (7):
- doc_search(query, limit, tag)  → search_docs
- doc_write(content, tags, source) → write_doc
- doc_show(doc_id)               → get_doc
- fork_open(parent_id, goal, tags) → fork_context (auto-pins
                                     parent + threads goal)
- fork_decorate(ctx_id, key, value, weight) → decorate_context
- fork_get(ctx_id)               → get_context
- fork_render(ctx_id)            → render_context (envelope:
                                   {ctx_id, rendered})

Loader pattern: _resolve_docs_client() mirrors
_resolve_canvas_client at line 880 — file-path import of
plugins/devagentic-docs/client.py since the hyphenated dir
isn't a Python package.

Failure semantics: every tool returns {"error": "<msg>"} JSON.
The plugin's last_error_text() pattern (introduced in #15)
threads through via a _reason() helper, so federated agents
see the same actionable hints CLI users get — e.g. on the
canonical devbox deployment (where /graphql isn't exposed,
see #21), they'd see "not found at <url>/graphql ..." instead
of an opaque None.

Out of scope per #24: fork_close + fork_pin depend on the
session-local $HERMES_HOME/docs-fork-active marker, which
doesn't translate to MCP's stateless tool model. fork_open
auto-tags with source:hermes-mcp so MCP-authored forks are
distinguishable from CLI-authored ones (source:hermes-cli).

Tests: 22 new (tests/test_mcp_docs.py) covering registration,
plugin-missing fallback, arg routing, last_error surfacing for
the #21 case, and the real-import smoke. All passing alongside
canvas MCP suite (14 existing) and the broader devagentic-
adjacent test set (159 total).

Closes #24.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[synergy] Add devagentic-docs plugin: /doc search + /doc write + ephemeral finding-injection (sibling to devagentic-canvas)

1 participant