R4 · AGENT MEMORY · MCPIN USEAug 2025–May 2026

Long-term memory for AI agents

THE QUESTION

Can a small, fully local server give AI coding agents a memory that lasts between sessions?

Prabhakar Chandra
Founder, Bodham Labs
Updated

What did we build?

  • Nexus RAG: a local MCP server, over stdio, that gives AI coding agents long-term memory.
  • Vectors in ChromaDB with HOT, WARM and COLD tiers and time decay. An entity graph in Neo4j.
  • Small models for each job: all-MiniLM for embeddings, GLiNER for entity extraction, and Qwen3:8b only for offline consolidation.
  • Time decay in ranking: score = similarity × max(0.3, exp(−λ · age in days)). The design paper set λ = 0.05 on days since last access; the code we ran uses λ = 0.5 on days since a memory was created, so ranking strongly favours the last two or three days.
  • A surprise flag: a new chunk that is very similar to an old one but says something different is flagged. This prevents silent overwrite of decisions.
  • A router with no ML model in it, because the set of operations is small and deterministic.

What does the evidence show?

Values exactly as recorded. The source column says where each one was recorded.
WHATVALUESOURCE
Bootstrap starts505MCP server log, 9 Mar – 21 May 2026
memory_query calls111MCP server log, 9 Mar – 21 May 2026
memory_ingest calls82MCP server log, 9 Mar – 21 May 2026
Tier movesReal hot → warm → cold moves recordedMCP server log, 9 Mar – 21 May 2026
Local 8B model, generation speed on CPUabout 3.58 tokens/sCPU benchmark, cited in our internal research paper
Time to write one answer with that modelroughly 60–120 sinternal research paper
Retrieval latency, vector path (embed + search + rank)p50 16.4 ms · p95 19.1 ms · p99 20.6 msour benchmark, 103 queries × 3 passes, laptop CPU (i5-12500H), Oct 2026
Of which: embedding the questionp50 9.8 mssame benchmark
Store searched46 active chunks (hot 10, warm 36); 192 archivedsame benchmark
Cold start (load PyTorch, ChromaDB, embedding model)about 17.8 s, once per sessionsame benchmark
Process memory after loading / peak511 MB / 545 MBsame benchmark, measured

Where has it led us?

  1. The biggest change was removing synthesis from the query hot path. A local 8B model took roughly 60–120 s to write an answer. Now the server returns raw passages, and the calling agent writes the answer.

  2. A 1.7B model (SmolLM2) hallucinated entities during extraction. We switched to GLiNER, because it can only select substrings that exist in the input text.

  3. An SSE transport through a Node bridge failed. We moved to stdio.

  4. The project moved from a first cloud version (Neon and OpenAI, Aug 2025) to fully local (Mar 2026). It was then used daily until May 2026.

  5. A proper benchmark in Oct 2026 (309 timed queries) put the vector query path at about 16 ms at the median on a laptop CPU, with embedding the question the largest part. Our March figures came from 5 queries and are withdrawn.

What is still open?

  • How does latency grow with a store of thousands of chunks, and with the graph lookup and stdio transport included?
  • What is recall on real questions, rather than on text taken from the store?
  • Does the surprise flag catch the contradictions that matter, and how often does it flag by mistake?

NEXT STEP · NOT DONE YET

What would we do next?

Benchmark the full MCP path (graph lookup and stdio transport included) on a larger store, and run a recall test on real questions.

Have a problem that needs this kind of research?

Tell us about it