Repository navigation
context-graph: serve recall to Claude Code and Codex over MCP - #426
Merged
Merged
Conversation
agent-context-graph gains a tool surface: components register tools under the new `agent_context_graph.tools` entry point, `agent-context-graph mcp` serves them over stdio MCP (new `mcp` extra), and `agent-context-graph recall [--json]` runs recall from a shell. sessions-graph registers `recall(question)`; the user and `[recall]` overrides come from the config file only, never from the call. At SessionStart the hook adds one line telling the model the tool exists. Both plugins bundle the server via `.mcp.json`, and bootstrap installs the `mcp` extra. `config set`/bootstrap now keep `[recall]` widths when they rewrite the config, and `doctor` checks the server. Results carry text only: verified end to end that Claude Code and Codex both show the model structuredContent instead of the text when both are sent, and the text is the benchmarked form. JSON stays in `--json`. Closes #418
This was referenced Oct 5, 2026
antejavor
added a commit
that referenced
this pull request
Oct 5, 2026
Resolve the claude_code/codex adapter conflicts with #427 by keeping this branch's declarative adapters and carrying #427's reply rules into the shared turn_end rule: a blank reply records nothing, and the reply's text is not duplicated into its metadata. #427's tests now expect a turn end, not a session end, after the reply. main's sessions-graph spawns the no-LLM `embed` step on SessionEnd (#422), which Codex recall (#426, #427) relied on via the per-turn Stop. Since a Stop is now a TurnEnd, sessions-graph spawns `embed` on TurnEnd too, so every runtime's turns are embedded as they end, including runtimes with no session-end hook. LLM reconciliation stays on SessionEnd only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #418. Part of #390; implements #394 points 1, 2, 4 and 9.
What
agent_context_graph.toolsentry-point group (tools.py).agent-context-graph mcpserves them over stdio MCP, behind a newmcpextra.agent-context-graph recall "<question>" [--json]runs recall from a shell.recall(question)in sessions-graph (sessions_graph/tool.py): the user and the[recall]lane and width overrides come fromconfig.toml, never from the call, so a model can only read its own user's memory..mcp.json, and bothbootstrap.shscripts installagent-context-graph[mcp].config setand bootstrap now keep hand-edited[recall]keys when they rewrite the file, anddoctorchecks that the server can start and servesrecall.CONTEXT.mdglossary entry, andAGENTS.md.Change from #394 point 4: results are text only
#394 chose "text for the model, JSON beside it". Checked end to end, that choice backfires: when a result has both, Claude Code and Codex both show the model the
structuredContentJSON instead of the text. Codex's source does this explicitly (as_function_call_output_payloadprefersstructured_content), and Claude Code was observed sending the model the JSON. Sending both meant the model never saw the benchmarked text. The MCP result now carries only the text; the JSON is printed byrecall --json.Checked and written down (#418 "done when")
.mcp.jsonat the plugin root; tool appears asmcp__plugin_context-graph_context-graph__recall"mcpServers": "./.mcp.json"in.codex-plugin/plugin.jsonadditionalContextrecallwithout being told about memoryCodex specifics, now in the plugin README:
/hooks);codex execnever prompts.recallcall asks for approval unlessdefault_tools_approval_mode = "approve"is set..mcp.jsonforwardsCONTEXT_GRAPH_CONFIGviaenv_vars.End-to-end runs
Both runs used a fresh MAGE Memgraph and the worktree plugins.
embedding_status = completed). In session 2 the model calledrecalland answered correctly from the text result.recallwithout being prompted and answered from the Claude Code session's memory.Tests
test_tools.pycovers the MCP server through an in-memory client, the CLI, the SessionStart hint, and[recall]surviving rewrites.test_e2e_recall_tool.pyruns against a real Memgraph: own user only, config widths, refusals, and registration.Not in this PR
Stop'slast_assistant_messageis ignored), so in real sessions recall only sees user turns.>=0.1.9pin inbootstrap.shneed bumping whenagent-context-graphwithmcpis published.