Skip to main content
One process hosts three parts: a bundled engine (state store, streams, HTTP triggers), a memory worker that registers every mem::* function against it, and the viewer. Agent integrations talk to the REST surface or the MCP server; both dispatch to the same worker functions.

Capture

Integrations post every prompt and tool call to POST /agentmemory/observe. mem::observe stamps session, project, agent id, and an origin channel (user, agent, tool, import, shared), then hands the record to compression. Without an LLM key mem::compress falls back to synthetic compression (heuristic title, files, narrative); with a key the model writes richer facts and concepts. Compressed observations enter the BM25 index immediately and the vector index when embeddings are available, and stream to the viewer over mem-live.

Recall

mem::search and mem::smart-search fuse three streams per query: BM25 keyword, vector similarity, and graph adjacency. Weights normalize per item over the streams that matched it, cross-stream agreement earns a small bonus, and ties resolve deterministically. Session diversity caps stop one session from filling a page. Superseded memory versions never surface; the version chain stays in the store. When context injection is on (AGENTMEMORY_INJECT_CONTEXT=true), mem::context assembles the session-start block in a fixed order: pinned memory slots first, then the project profile (top concepts, key files, conventions, common errors), then up to 10 lessons ranked by confidence with project-scoped ones boosted over global ones, then summaries of the most recent sessions in the same project. Blocks are packed against the token budget (TOKEN_BUDGET, default 2000); whatever doesn’t fit is dropped whole rather than truncated mid-block.

Distillation

Session end triggers the slow path: Consolidation runs when its flag and an LLM provider key are set. Graph extraction runs unconditionally at session end: a deterministic structural pass turns files and concepts into nodes and links co-occurrences within an observation as related_to edges, so the graph populates with zero LLM keys. GRAPH_EXTRACTION_ENABLED=true plus a provider key layers an additional LLM pass on top that adds typed relations. Everything above the distillation line works keyless. Crystals outlive their raw observations, which retention sweeps eventually prune.

Runtime surfaces

The worker registers 264 functions in total; the families are listed in the REST API reference and the MCP tool reference.
Last modified on August 15, 2026