fix(#302): REST shims at /api/memory/{add,search,list,delete} + repoint Hermes/CLI/dashboard#303
Merged
Merged
Conversation
…nt Hermes/CLI/dashboard Per #302 found during real-hardware verification of #243 + #247: the Hermes bootstrap (_phase_namespace_register), `hal0 agent peers` CLI, and dashboard Agents > Peers tab all POSTed to /mcp/memory as one-shot JSON-RPC. Real FastMCP streamable-HTTP transport lives at /mcp/memory/mcp and requires the initialize handshake + session-tagged calls — so every call returned 405. Bootstrap's failure-tolerant path swallowed the error → identity cards were NEVER actually being written. Fix shape (REST shim, defer MCP-SDK-client refactor to v0.4): 1. **src/hal0/api/routes/memory.py** — append 4 REST routes: - POST /api/memory/add → CogneeWrapper.add - POST /api/memory/search → CogneeWrapper.search → {items: [...]} - GET /api/memory/list → CogneeWrapper.list_items - POST /api/memory/delete → CogneeWrapper.delete Validation + `_wrapper(request)` 503 envelope mirror the existing /api/memory/graph/* routes added in #287. 2. **src/hal0/agents/hermes_provision.py::_mcp_memory_call** — keep the function signature (so existing call sites don't change) but translate the `method="tools/call"`, `params.name=memory_*` shape to the REST routes. Returns `{ok, result?, error?}` with `result` = the wrapper's dict (`{items: [...]}` for search, `{id, timestamp}` for add) — call sites do `result.get("items")` etc. 3. **src/hal0/cli/agent_commands.py** — two callers: - `hal0 agent peers` → POST /api/memory/search (was /mcp/memory). - `hal0 agent uninstall hermes` cleanup → /api/memory/{search,delete} for the identity-card sweep. 4. **ui/src/dash/extras.jsx::AgentPeers** — fetch /api/memory/search, read `data.items` (was `data.result.items`). MCP transport at /mcp/memory/mcp stays available for proper MCP clients (cross-agent reach, the design goal from ADR-0011). REST shims are the parallel HTTP-only path for in-house callers. Closes #302. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 #302. Bootstrap was silently failing to write identity cards because /mcp/memory needed the FastMCP initialize handshake + session, not one-shot JSON-RPC. REST shims at /api/memory/{add,search,list,delete} unblock the bootstrap + CLI + dashboard without an MCP-SDK-client refactor (deferred to v0.4).