feat: align MCP retrieval contract with ra-h

- add external retrieval and confirmation-gated writeback tools across MCP surfaces
- port direct-search-first retrieval support and supporting ranking/query updates
- update MCP docs and skills to treat agent memory files as optional reinforcement

Generated with Claude Code
This commit is contained in:
“BeeRad”
2026-04-13 20:50:13 +10:00
parent 5dcb2b7df6
commit d825e7a783
19 changed files with 1875 additions and 73 deletions
+26 -1
View File
@@ -41,17 +41,35 @@ Restart Claude. Done.
## What to Expect
Once connected, Claude will:
- **Call `getContext` first** to orient itself (stats, contexts, anchors/hubs, skills)
- **Use `queryNodes` for explicit node lookup** when the user is trying to find a specific existing thing
- **Use `retrieveQueryContext` when graph context is helpful** for a broader task, question, or request
- **Use `getContext` only for orientation** when high-level graph state would actually help
- **Proactively capture knowledge** — when a new insight, decision, person, or reference surfaces, it proposes a specific node (title, description, optional context) so you can approve with minimal friction
- **Read skills for complex tasks** — skills are editable and shared across internal + external agents
- **Search before creating** to avoid duplicates
## Recommended Agent Memory Line
If you use external agents through this MCP server, add one short instruction line to your agent memory file (`AGENTS.md`, `CLAUDE.md`, etc.):
```md
Retrieve relevant context from RA-H before substantive work, and only suggest writing durable context back when it is clearly valuable and the user can confirm yes.
```
Keep the writeback prompt brief. A good pattern is:
```md
Add "X" as a node?
```
## Available Tools
| Tool | Description |
|------|-------------|
| `getContext` | Get graph overview — stats, contexts, recent activity |
| `retrieveQueryContext` | Pull relevant graph context for a broader current-turn task |
| `createNode` | Create a new node |
| `writeContext` | Save one confirmed durable context node after explicit user approval |
| `queryNodes` | Search nodes by keyword |
| `queryContexts` | List or inspect contexts |
| `getNodesById` | Load nodes by ID (includes chunk + metadata) |
@@ -87,6 +105,13 @@ Rules:
- use `captured_by = "human"` for direct user creation and user-requested agent capture
- reserve `captured_by = "agent"` for autonomous/background creation only
## Writeback Rule
- Do not ask to save every moderately useful point from the conversation.
- Only suggest a save when the context is unusually durable and valuable.
- Keep the ask terse and concrete, for example: `Add "X" as a node?`
- Never call `writeContext` unless the user has explicitly said yes.
## Skills
Skills are detailed instruction sets that teach agents how to work with your knowledge base. The default seeded skills are editable and shared by internal + external agents.