The complete surface area.

Every MCP tool, every HTTP endpoint, every CLI command — categorized, cross-referenced, signed off. 43 + 50 + 40 = 133 operations exposed across three protocol fronts. One implementation underneath, three ways to call it.

43MCP tools 50HTTP endpoints 40CLI commands 4operational modes
4 Operational Modes

One binary. Four ways to run it.

Same Rust binary, four startup mode flags. The mode determines which IPC surface is active and which background loops run. Switch by changing one CLI flag — no config file edits required.

📡
MODE 1 · Foreground stdio
MCP server
ai-memory mcp --tier semantic
JSON-RPC over stdio. Spawned by Claude Code, Cursor, Codex, etc. as a subprocess. Lives the lifetime of the host AI session.
🌐
MODE 2 · Background daemon
HTTP daemon
ai-memory serve --port 9077 --mtls-cert ...
REST + SSE on TCP. mTLS-aware with fingerprint allowlist. Federation peers reach this surface. Shared multi-client server.
🔁
MODE 3 · Background daemon
Sync daemon
ai-memory sync-daemon --peers https://node-2,https://node-3
Periodic pull-and-push against peers. W-of-N quorum. Each cycle exchanges memories observed since last cursor.
🤖
MODE 4 · Background daemon
Curator daemon
ai-memory curator --daemon --interval-secs 1800 --tier autonomous
Auto-tag, contradiction detection, consolidation. Tier-gated: smart adds LLM tagging, autonomous adds rerank + auto-merge.
43 MCP Tools

Every tool a host AI can call.

Auto-discovered by Claude Code, Cursor, Codex, Continue, Gemini CLI, Windsurf, and any MCP-compliant client. Tool names follow memory_<verb> convention.

READ — recall, search, list
WRITE — store, update, delete
ADMIN — stats, capabilities, gc
KG — knowledge graph
FED — federation / subscriptions
GOV — governance / pending
▸ READ
memory_recall
Hybrid recall: FTS5 + HNSW vector + cross-encoder rerank. The agent reasoning hot-path.
context, namespace?, limit?, tags?, since?, until?, tier?, as_agent?, budget_tokens?, context_tokens?[]
▸ READ
memory_search
Pure FTS5 keyword search with BM25 ranking. Faster than recall, no vector cost.
query, namespace?, tier?, limit?, tags?, since?, until?, agent_id?
▸ READ
memory_get
Fetch a single memory by ID (full or 8-char prefix). Includes outbound links.
id
▸ READ
memory_list
Paginated list with namespace / tier / tags filters. Backfills HNSW for unembedded memories on read.
namespace?, tier?, limit?, offset?, since?, until?, tags?, agent_id?
▸ READ
memory_get_taxonomy
Hierarchical namespace tree with per-node memory counts. Rooted at any prefix.
namespace_prefix?, depth?, limit?
▸ READ
memory_check_duplicate
Pre-write similarity check. Returns nearest-neighbor cosine + above-threshold flag.
title, content, namespace, threshold?
▸ READ
memory_get_links
All inbound and outbound typed links for a memory. Filters on relation type.
memory_id, relation?, direction?
▸ READ
memory_inbox
Pending notifications addressed to this agent. Marks-as-read on read.
since_cursor?, namespace?, limit?
▸ WRITE
memory_store
Insert with tier (short/mid/long), tags, priority 1-10, confidence 0-1, scope, expires_at.
title, content, namespace, tier?, tags?, priority?, confidence?, source?, scope?, expires_at?
▸ WRITE
memory_update
Patch existing memory. Same-source allowed; cross-source warns (governance gate).
id, title?, content?, tags?, priority?, confidence?, expires_at?
▸ WRITE
memory_delete
Single-memory soft delete to archive tier. Recoverable via restore.
id
▸ WRITE
memory_promote
Tier promotion: short → mid → long, or hierarchical-vertical (clone into ancestor namespace).
id, to_namespace?
▸ WRITE
memory_forget
Bulk delete by namespace / pattern / tier. Always governance-gated. Wide blast radius.
namespace?, pattern?, tier?, dry_run?
▸ WRITE
memory_consolidate
Merge N memories into 1. Creates derived_from links. Sources soft-archived.
ids[], title, summary, namespace?
▸ WRITE
memory_link
Create typed link. Relation: related_to / supersedes / refines / contradicts / derived_from / etc.
source_id, target_id, relation?
▸ WRITE
memory_notify
Send a notification message to another agent's inbox. A2A primitive.
target_agent_id, title, payload
▸ KG
memory_kg_query
Recursive CTE traverse. Time / scope / observed-by filters. Cycle detection. Up to depth 5.
source_id, max_depth?, valid_at?, allowed_agents?[]
▸ KG
memory_kg_timeline
Ordered fact timeline for an entity. Each event has valid_from / observed_by metadata.
entity_id, since?, until?, limit?
▸ KG
memory_kg_invalidate
Mark a link superseded by setting valid_until. Original link history preserved.
link_id, valid_until, reason?
▸ KG
memory_entity_register
Register a typed entity with canonical name + alias side-table. Becomes node in KG.
canonical_name, namespace, aliases?[], metadata?
▸ KG
memory_entity_get_by_alias
Resolve any alias back to canonical entity. Powers fuzzy-match lookups.
alias, namespace?
▸ ADMIN
memory_capabilities
Self-describing introspection. Schema v2 reports tier, models, tools, hooks (planned), permissions.
— (no parameters)
▸ ADMIN
memory_stats
Per-namespace counts, tier breakdown, total bytes, oldest/newest timestamps.
namespace?
▸ ADMIN
memory_session_start
Returns recent context + session_id. The Claude Code hook critical path. Sub-100ms p95.
agent_id?, namespace?, limit?
▸ ADMIN
memory_gc
Manual GC trigger. Sweeps expired short-tier memories per archive_on_gc policy.
— (no parameters)
▸ ADMIN
memory_namespace_*
3 tools: get_standard / set_standard / clear_standard. Per-namespace policy + governance hooks.
namespace, standard?
▸ FED
memory_subscribe
Register webhook for events. HMAC-signed bodies. Glob-pattern namespace filter.
url, events?[], namespace_filter?, secret?
▸ FED
memory_unsubscribe
Remove a webhook subscription by ID.
subscription_id
▸ FED
memory_list_subscriptions
Active subscriptions with dispatch_count and failure_count counters.
— (no parameters)
▸ GOV
memory_pending_list
List pending governance-gated actions awaiting human approval. Filter by status.
status?, namespace?
▸ GOV
memory_pending_approve
Approve a pending action. Executes the deferred operation.
pending_id
▸ GOV
memory_pending_reject
Reject a pending action with reason. Operation discarded.
pending_id, reason?
▸ GOV
memory_agent_register
Register agent in reserved _agents namespace. Stores type + capabilities.
agent_id, agent_type, capabilities?[]
▸ GOV
memory_agent_list
List registered agents with last_seen_at timestamps.
— (no parameters)
▸ GOV
memory_detect_contradiction
LLM-powered contradiction detection across recent memories. Smart+ tier only.
topic?, namespace?, limit?
▸ GOV
memory_auto_tag
Suggest tags for a memory via local LLM. Smart+ tier only. Returns tag list.
memory_id
▸ GOV
memory_expand_query
LLM-rewrite a query into related terms. Smart+ tier only. Powers query-time expansion.
query
50 HTTP Endpoints

REST surface for services + federation peers.

Axum-served. mTLS-aware. CORS layer. Prometheus metrics at /metrics. Body limit 2 MiB. Trace spans on every request. The same operations as MCP, plus federation-private peer endpoints.

MethodPathPurpose
GET/api/v1/healthLiveness check. Always returns 200.
GET/metricsPrometheus scrape (community convention path).
GET/api/v1/metricsPrometheus scrape (REST-consistent path).
GET/api/v1/capabilitiesSelf-describing introspection.
GET/api/v1/statsPer-namespace counts + tier breakdown.
— Memory CRUD —
GET/api/v1/memoriesList memories, paginated, filter.
POST/api/v1/memoriesCreate new memory.
POST/api/v1/memories/bulkBulk insert with partial-success semantics.
GET/api/v1/memories/{id}Fetch one memory by ID.
PUT/api/v1/memories/{id}Update existing memory.
DELETE/api/v1/memories/{id}Soft-delete to archive tier.
POST/api/v1/memories/{id}/promoteTier promotion or vertical hierarchy clone.
— Search & recall —
GET/api/v1/searchFTS5 keyword search.
GET/api/v1/recallHybrid recall (GET form for cacheability).
POST/api/v1/recallHybrid recall (POST form for large payloads).
POST/api/v1/forgetBulk delete by query.
POST/api/v1/consolidateMerge N memories into 1.
GET/api/v1/contradictionsList detected contradiction pairs.
GET/api/v1/check_duplicatePre-write similarity check.
— Knowledge graph —
POST/api/v1/linksCreate typed link.
DELETE/api/v1/linksDelete a link.
GET/api/v1/links/{id}Fetch one link.
GET/api/v1/taxonomyHierarchical namespace tree.
GET/api/v1/kg/timelineOrdered fact timeline for an entity.
POST/api/v1/kg/invalidateSet valid_until on a link.
POST/api/v1/kg/queryRecursive-CTE outbound traversal.
— Entities (Stream B) —
POST/api/v1/entitiesRegister entity with aliases.
GET/api/v1/entities/by_aliasResolve alias → canonical entity.
— Namespace policy —
GET/api/v1/namespacesList namespaces (or get standard via ?namespace=).
POST/api/v1/namespacesSet namespace standard (query-string form).
DELETE/api/v1/namespacesClear namespace standard (query-string form).
GET/api/v1/namespaces/{ns}/standardGet standard (path form, MCP parity).
POST/api/v1/namespaces/{ns}/standardSet standard (path form).
DELETE/api/v1/namespaces/{ns}/standardClear standard (path form).
— Archive & GC —
GET/api/v1/archiveList archived memories.
POST/api/v1/archiveBulk archive by IDs.
DELETE/api/v1/archiveHard purge archived > N days old.
POST/api/v1/archive/{id}/restoreRestore archived to original tier.
GET/api/v1/archive/statsArchive size + age histogram.
POST/api/v1/gcManual GC trigger.
GET/api/v1/exportJSON dump of all memories + links.
POST/api/v1/importBulk JSON import.
— Federation peer-private —
POST/api/v1/sync/pushPeer pushes a batch.
GET/api/v1/sync/sincePeer pulls since cursor.
— Subscriptions & A2A —
POST/api/v1/notifySend notification to agent inbox.
GET/api/v1/inboxRead pending notifications.
POST/api/v1/subscriptionsRegister webhook.
DELETE/api/v1/subscriptionsUnsubscribe.
GET/api/v1/subscriptionsList active subscriptions.
POST/api/v1/session/startInitialize agent session.
— Agents & pending —
GET/api/v1/agentsList registered agents.
POST/api/v1/agentsRegister agent.
GET/api/v1/pendingList pending governance actions.
POST/api/v1/pending/{id}/approveApprove pending action.
POST/api/v1/pending/{id}/rejectReject pending action.
40 CLI Commands

For humans, scripts, and CI.

Direct subcommands of the ai-memory binary. No daemon required for read/write commands. Run against any database file via --db <path>.

$ ai-memory recall "context" [--namespace ns --limit N --tier ...]
Hybrid recall from a namespace.
$ ai-memory search "query" [--namespace ns --tier ...]
FTS5 keyword search.
$ ai-memory get id-or-prefix
Fetch one memory.
$ ai-memory list [--namespace ns --tier ... --limit N --offset M]
Paginated listing.
$ ai-memory stats [--namespace ns]
DB summary or per-namespace.
$ ai-memory namespaces
All namespaces with counts.
$ ai-memory store --title "..." --content "..." [--namespace ns --tier long --priority 8]
Create memory. --content - reads stdin.
$ ai-memory update id-or-prefix [--title --content --priority ...]
Patch existing memory.
$ ai-memory delete id-or-prefix
Soft-delete to archive.
$ ai-memory forget [--namespace ns --pattern "*" --tier ...]
Bulk delete by filter.
$ ai-memory promote id [--to-namespace path]
Tier promotion or hierarchical clone.
$ ai-memory link src tgt [--relation related_to]
Create typed link.
$ ai-memory resolve winner_id loser_id
Mark one memory as superseding another.
$ ai-memory consolidate --ids id1,id2,id3 --title "..." --summary "..."
Merge memories.
$ ai-memory auto-consolidate --namespace ns --min-count 5
Threshold-based group-and-merge.
$ ai-memory gc
Manual GC sweep.
$ ai-memory archive [list --restore id --purge --older-than 90]
Manage archived memories.
$ ai-memory backup [--out path/]
SQLite VACUUM INTO + manifest.json.
$ ai-memory restore --from path/file.db [--skip-verify]
Restore from backup with sha256 verify.
$ ai-memory export
JSON dump to stdout (memories + links).
$ ai-memory import [--trust-source]
JSON import from stdin.
$ ai-memory mine --input claude-export.zip [--dry-run]
Import from Claude/ChatGPT/Slack export.
$ ai-memory bench [--baseline path.json]
Canonical workload + p50/p95/p99 vs PERFORMANCE.md.
$ ai-memory mcp --tier semantic
Start MCP stdio server.
$ ai-memory serve --port 9077 [--tls-cert ... --quorum-w 2]
Start HTTP daemon.
$ ai-memory sync --peers https://... [--dry-run]
One-shot sync against peers.
$ ai-memory sync-daemon --peers https://... --interval-secs 60
Continuous sync loop.
$ ai-memory curator [--once | --daemon] [--dry-run]
Curator pass: tag/contradict/consolidate.
$ ai-memory agents [register --type ai:claude | list]
Agent registry.
$ ai-memory pending [list | approve id | reject id]
Manage governance queue.
$ ai-memory shell
Interactive REPL with all subcommands.
$ ai-memory completions shell
Generate bash/zsh/fish/pwsh completions.
$ ai-memory man
Generate manpage.
Cross-reference

One operation, three protocol fronts.

For each logical operation, here's the MCP tool, the HTTP endpoint, and the CLI command. Every row maps to the same underlying handler in src/db.rs — three protocol fronts, one source of truth.

OperationMCP ToolHTTP EndpointCLI Command
Hybrid recallmemory_recallGET /api/v1/recallrecall <ctx>
Keyword searchmemory_searchGET /api/v1/searchsearch <q>
Get onememory_getGET /api/v1/memories/{id}get <id>
Listmemory_listGET /api/v1/memorieslist
Storememory_storePOST /api/v1/memoriesstore --title --content
Bulk storevia multiple storesPOST /api/v1/memories/bulkimport (stdin JSON)
Updatememory_updatePUT /api/v1/memories/{id}update <id>
Deletememory_deleteDELETE /api/v1/memories/{id}delete <id>
Promotememory_promotePOST /api/v1/memories/{id}/promotepromote <id>
Bulk forgetmemory_forgetPOST /api/v1/forgetforget --pattern
Consolidatememory_consolidatePOST /api/v1/consolidateconsolidate --ids
Detect contradictionmemory_detect_contradictionGET /api/v1/contradictionsvia curator
Check duplicatememory_check_duplicateGET /api/v1/check_duplicatevia store --check
Create linkmemory_linkPOST /api/v1/linkslink <src> <tgt>
Get linksmemory_get_linksGET /api/v1/links/{id}via get (auto-includes)
Taxonomymemory_get_taxonomyGET /api/v1/taxonomyvia stats
KG querymemory_kg_queryPOST /api/v1/kg/queryvia shell
KG timelinememory_kg_timelineGET /api/v1/kg/timelinevia shell
KG invalidatememory_kg_invalidatePOST /api/v1/kg/invalidateresolve <winner> <loser>
Register entitymemory_entity_registerPOST /api/v1/entitiesvia store + tag
Resolve aliasmemory_entity_get_by_aliasGET /api/v1/entities/by_aliasvia search
Statsmemory_statsGET /api/v1/statsstats
Capabilitiesmemory_capabilitiesGET /api/v1/capabilitiesvia stats --json
Session startmemory_session_startPOST /api/v1/session/startN/A
GCmemory_gcPOST /api/v1/gcgc
Archive listvia list + filterGET /api/v1/archivearchive list
Archive restorevia promotePOST /api/v1/archive/{id}/restorearchive restore --id
Archive purgevia forgetDELETE /api/v1/archivearchive purge --older-than
Exportvia list bulkGET /api/v1/exportexport
Importvia store batchPOST /api/v1/importimport
Subscribememory_subscribePOST /api/v1/subscriptionsvia shell
Unsubscribememory_unsubscribeDELETE /api/v1/subscriptionsvia shell
List subsmemory_list_subscriptionsGET /api/v1/subscriptionsvia shell
Notifymemory_notifyPOST /api/v1/notifyvia shell
Inboxmemory_inboxGET /api/v1/inboxvia shell
Register agentmemory_agent_registerPOST /api/v1/agentsagents register
List agentsmemory_agent_listGET /api/v1/agentsagents list
Pending listmemory_pending_listGET /api/v1/pendingpending list
Pending approvememory_pending_approvePOST /api/v1/pending/{id}/approvepending approve <id>
Pending rejectmemory_pending_rejectPOST /api/v1/pending/{id}/rejectpending reject <id>
Sync push (peer)peer-privatePOST /api/v1/sync/pushpeer-private
Sync since (peer)peer-privateGET /api/v1/sync/sincepeer-private