Skip to main content
Use casesIntermediate6 min read

Turnbook: local memory for coding agents, without a single model call

i
iaLocale Team
•
Turnbook: local memory for coding agents, without a single model call

Your coding agent forgets everything when the session ends. On Monday you decided which database to use for the billing service; on Wednesday — with another agent, or the same one after a /clear — you start from zero again: same question, same answer, same time wasted.

The standard answer is to add a memory layer: the model rewrites the conversation into "facts" or notes that get retrieved later. It works, but at a hidden cost: every conversation passes through a model again, with the tokens that implies and the possibility that something is lost or invented on the way.

Turnbook (formerly Graph-MIND) takes the opposite route. It never calls a model to save: it keeps every conversation word for word in a SQLite file on your PC, and when a question needs the past, it retrieves the few lines that answer it by itself. The model you already use does only the final work.

How it works

The principle fits in one sentence: no LLM at write time, no LLM at search time.

1. Automatic capture. A background service reads your agents' transcripts (Claude Code, Codex, Cursor, Copilot CLI, Gemini CLI, OpenCode) and stores every turn word for word. No manual tagging, no judgment call on "what deserves to be remembered": if you said it, it's in memory.

2. Local search. On every message, Turnbook searches the memory with three combined signals: word search, embeddings generated by a local model (EmbeddingGemma, 300M parameters, 4-bit, ONNX format, no GPU), and when the thing was said. A small learned model re-orders the results.

3. Short handover. The agent receives a packet of a few thousand tokens — the turns that answer the question, not the entire history — and then your model answers as usual.

Under the hood it's a classic RAG over chat history, with the whole assembly already built in: collection, chunking (one turn = one chunk), local embeddings, storage in a single SQLite file, retrieval and prompt assembly via MCP. What's left to you is the piece that changes most often: the model that answers.

The numbers

The reference benchmark for long-term memory is LongMemEval: 500 questions over about 50 past sessions each. Turnbook's numbers use gpt-5-mini as the answering model and the benchmark's official judge (gpt-4o); a question left unanswered counts as wrong.

Text the answering model readsAccuracyModel tokens spent saving
3.1k tokens (default)91.8% (459/500)0
25k tokens93.0% (465/500)0

For comparison: Mastra's Observational Memory reports 94.9% with the same answering model, but the model reads about 30k tokens of observations written by another model (gemini-2.5-flash) while the conversations were saved. The point isn't to beat that number, it's that the 3-point gap is bought while spending nothing, and that saving costs literally zero.

Other numbers that matter:

  • The re-ranker makes the difference: without it (plain rank fusion, no weight fitted on any benchmark) the score drops to 87.0% of the 500 questions. It helps most where answers are spread over several sessions.
  • It holds up as it grows: on LoCoMo (1,536 questions), with the memory grown tenfold because it also contains other people's conversations, the right turn stays among the first 30 results for 92.7% of cases (92.6% before the growth). A search takes 30 ms with about 6,000 turns and 116 ms with about 56,000.
  • It doesn't slow your PC down: the background service uses about 2% of one core when nothing is happening, and an app's memory server holds about 525 MB of RAM. A search takes about 40 ms (46 ms at the 95th percentile), the first one after startup about 1.4 s.

Where it loses

The rewriting memories are stronger where Turnbook loses: of the 41 misses on LongMemEval, 33 are questions that combine several sessions, reason about dates, or need the latest value of something that changed. If your agents live mostly on "what did we decide recently, and what replaced what", the LLM-rewriting memories are still ahead — at the price of saving tokens.

Other limits to keep in mind:

  • Not multi-user: today it's the personal memory of one PC. A Python API and a multi-user server mode don't exist yet.
  • More daily use on Windows: macOS and Linux pass every test in CI on each change, but have seen less real use.
  • The embedding is Google's: EmbeddingGemma is covered by Google's Gemma terms, not by Turnbook's Apache-2.0 license.

How to try it

Zero to working, in five steps:

1. Install. On macOS or Linux: curl -LsSf https://raw.githubusercontent.com/goyohan0611-png/turnbook/main/scripts/install.sh | sh (on Windows, double-click Turnbook-Setup.cmd; the alternative is pip install turnbook && turnbook-install).

2. Restart your agents. The installer finds them and connects them on its own; after a fresh install you can read it carefully and pin a version first.

3. Let it work through a few normal sessions. Every turn is saved automatically; secrets (API keys, passwords, card numbers) are masked before they're written.

4. Open a new session — even with a different agent or a different model — and ask: "Where did we leave off yesterday?", "Which database did we pick for the billing service, and why?". If it answers with the right details, the memory works.

5. If it doesn't work, turnbook-uninstall disconnects every app and stops the service, leaving the memory in ~/.turnbook (add --purge to actually delete it).

If you only want the search tools, without the automatic capture, configure MCP by hand: claude mcp add turnbook -- python -m turnbook.mcp_server.

You can also bring your project's documents into the same search: turnbook docs add FOLDER keeps your Markdown and text files searchable beside the conversations, and up to date as they change.

In summary

Turnbook is the "all local" answer to coding-agent memory: it saves every conversation word for word without spending a token, searches with a 300M embedding model that wants no GPU, and hits 91.8% on LongMemEval reading 3.1k tokens per answer. It loses three points to the memories that rewrite with an LLM, but it buys that gap at zero saving cost, and the memory never leaves your PC. If your agents re-explain the same things every week, it's one of those cases where local infrastructure stops being an experiment.

Sources

Article generated with AI

In these reading paths

Share:

Enjoyed this article?

Subscribe to the newsletter for new tutorials and guides.

After signing up you receive a confirmation email (double opt-in). Without confirmation we send nothing. No spam, we promise.

Related Articles