Skip to content

fix(#302): REST shims at /api/memory/{add,search,list,delete} + repoint Hermes/CLI/dashboard#303

Merged
thinmintdev merged 1 commit into
mainfrom
fix/302-memory-rest-shims-v2
May 23, 2026
Merged

fix(#302): REST shims at /api/memory/{add,search,list,delete} + repoint Hermes/CLI/dashboard#303
thinmintdev merged 1 commit into
mainfrom
fix/302-memory-rest-shims-v2

Conversation

@thinmintdev
Copy link
Copy Markdown
Contributor

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).

…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>
@thinmintdev thinmintdev merged commit 62550c8 into main May 23, 2026
2 of 4 checks passed
@thinmintdev thinmintdev deleted the fix/302-memory-rest-shims-v2 branch May 23, 2026 23:46
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.

fix(mcp): bootstrap + CLI + dashboard use wrong MCP transport path + missing session handshake

1 participant