Like Johnny, your agent carries more than its head can hold — and keeps working for hours.
A real coding session — a canvas tower-defense game built from scratch by Qwen3.8 Flash Next (IQ3_XXS) on a single 12 GB RTX 4070 Ti — with the proxy in between. Nothing was summarized away: every message, tool call and output stays on disk, verbatim, and the model can pull any of it back.
Developed and benchmarked primarily with Strata, by Niko1221 and contributors. mnemonic-proxy is an independently maintained project that also supports llama-server, ds4-server and other OpenAI-compatible backends; saved engine state depends on what the backend supports.
Replay of a real exchange (GIF). Three hours and two segment switches in, one recall call — resolved inside the proxy in 61 ms — brings back the verbatim first version of the boss block, message 20. No model summarized anything.
Magenta: the full history of the session. Cyan: what the model actually reads on each request. Dashed lines: the two segment switches (≈2 minutes each, written handoff notes). Data from the proxy journal, 5 Oct 2026.
An OpenAI / Anthropic / Responses-compatible HTTP proxy. Your agent talks to it exactly as it would talk to the model. No summaries written by a model, no vector database required.
Old tool outputs and reasoning leave the prompt in stable blocks and become one-line receipts with an id. The prefix stays byte-identical between blocks, so the engine's KV cache keeps working.
A recall tool searches the verbatim archive: first write of a file, its full edit timeline, command → output, the reasoning behind an edit — every hit tagged with message number and segment.
When even the masked window fills up, the model writes its own notes, the segment is sealed and a fresh one starts. Pinned lines (!!) survive every switch.
On engines that support it (llama-server, Strata) the KV state is saved to disk: resuming after a pause, a restart or another client takes 1–3 s instead of a full re-read.
Old state files are rebuilt bit-for-bit from content-addressed zstd blocks: −36% disk on our sessions, sha256-verified before every restore.
Agents ship tens of thousands of tokens of tool definitions. The proxy keeps the core ones and loads the rest by name: 25.6K → 6.2K tokens on every request.
"In the courier business you don't read the payload. You carry it, and you give it back exactly as it was."— the design rule. Hidden content is never paraphrased; it is either in the prompt or retrievable verbatim.
71 questions about past sessions, each with the known location of the evidence (including 8 with no answer in the archive). Held-out split:
| keyword search | structured recall | |
|---|---|---|
| evidence found within 5 calls | 90% | 100% |
| tokens returned per question | 5,940 | 2,737 |
| "not in the archive" recognised | 1 / 4 | 4 / 4 |
The benchmark guided development, so read it as a regression suite, not an independent score.
Resuming a conversation instead of re-reading it:
| case | saved | re-read |
|---|---|---|
| Strata (session-files branch), 110K tokens, RTX 4070 Ti | 1.4 s | ≈50 s |
| Strata (session-files branch), 69K tokens, after restart | 2.9 s | 33 s |
| llama-server, 8.2K tokens, CPU, Qwen3-0.6B | 1.9 s | 28.6 s |
Context restore only; loading the model is separate.
| on Strata, 12 GB GPU | Claude Code | Codex |
|---|---|---|
| session | 1 h 41 min, 339 requests, 0 proxy errors | 20 requests |
| prompt tokens from the engine cache | 92.6% | 93.9% |
| context | 328K virtual, ≤46K in the prompt, 14 segment switches | exact recall: 36 tests, 8/8 messages |
Claude Code 2.1.284 on a low-threshold test config (masking at 36K) so that segments switch. Facts scattered in 16K–122K prompts on Strata alone: 151/160 exact, 0 wrong, 9 omitted (all ≥ 64K).
Why it matters. Without saved state, the whole prefill of a long conversation is paid again every time the engine loses it — after a restart, when another client used the engine in between, when the proxy returns to a sealed segment. On a 12 GB GPU that is close to a minute for 100K tokens; restoring takes a second or two, from disk, not VRAM. Any client of a local engine benefits, not just this proxy. llama-server has it (--slot-save-path); Strata has it since 0.1.40 (PR #668), opt-in with --slot-save-path.
Recall only helps if the model uses it without being told. Short scripted tasks where a value needed at the end exists only in an old, masked tool output — not on disk, not reproducible — and the final request never says "remember" or "earlier": a random script output, a file read once then deleted, the old version of an overwritten config, an error from a service that is then shut down, and a long session with several segment switches.
| client · Qwen3.8 Flash Next on Strata 0.1.40, RTX 4070 Ti 12 GB, proxy 0.3.1 | short episodes: right values | long session |
|---|---|---|
| Claude Code 2.1.284 | 8 / 8, all via recall the model chose to call | 127K virtual, 3 segment switches: right |
| pi 0.87.1 | 3 / 3, all via recall | 231K virtual, 6 segment switches: right |
| omp 18.10.1 (oh-my-pi) | 4 / 4, all with recall ¹ | 82K virtual, 2 segment switches: right |
¹ With omp the model repeated some of the values in its own one-line answers, so in two episodes recall was strictly needed only for part of them. Across 18 real sessions the need is rare: 5 spontaneous recalls against 108 after a question about the past; when a file can be re-read, the model re-reads it. One model, one run of each long session, scaled-down thresholds (32K window) for the long ones. Details in the benchmarks.
Measured by users on their own hardware, shared with permission, not reproduced by us.
| u/Swimming-Farmer7815 | |
|---|---|
| hardware | RTX 5060 Ti 16 GB, Xeon E5-2699 v3, 64 GB |
| engine · client | Strata, Qwen3.8-Flash-Next IQ3_XXS, 128K · Cline |
| session | 13 h, ~280K tokens of history, ~77K in the last request |
| saved state | ~58K tokens restored in < 4 s (≈1 min 15 s to re-read) |
recall | 8 calls, all used — only when asked for a summary of the day |
Share your numbers, especially with clients and models we have not tested: open an issue with the user report template.
Proxy vs pi's own compaction, ds4-server on a Ryzen AI Max+ 395 (128 GB), 32K window, one run per side:
| 16-step task | with proxy | pi alone |
|---|---|---|
| Qwen3.8 Flash Next Q2: steps in 2 h | 16 / 16 | 14 / 16 |
| re-reads from token 0 | 0 | 23 |
| tokens read by the engine | 167K | 267K |
| DeepSeek V4 Flash Q2 (official ds4) | 16 / 16, 0 re-reads | not run |
A 29-step, 4-hour run gave 29/29 vs 10/29 and 1 vs 38 re-reads, but it is not a clean quality result: with the client's 4,096 max output tokens Qwen3.8's reasoning was cut before acting and unanswered steps piled up. Give reasoning models room (8192+ output tokens). Details in the engines.
Python ≥ 3.10, standard library only (optional: tokenizers for exact counts). Point it at any OpenAI-compatible engine; with llama-server you also get saved state. Engine window: at least 16K, 32K or more recommended — below 16K the proxy refuses to start.
# 1. an engine — llama.cpp with slot saving $ llama-server -m model.gguf -c 131072 --slot-save-path ./slots --port 8095 # 2. the proxy $ pip install mnemonic-proxy # or: uvx mnemonic-proxy demo $ mnemonic-proxy --upstream http://127.0.0.1:8095 --port 8096 --data ./data # 3. your agent → http://127.0.0.1:8096 $ OPENAI_BASE_URL=http://127.0.0.1:8096/v1 pi # Chat Completions $ ANTHROPIC_BASE_URL=http://127.0.0.1:8096 claude # Anthropic Messages $ codex -c model_providers.local.base_url=http://127.0.0.1:8096/v1 \ -c model_providers.local.wire_api=responses # Responses
Every engine (Strata, llama-server, llama-server in router mode, ds4-server, any OpenAI-compatible server), every agent and every OS, with the config file to copy: Install in the documentation (agents: Connect your agent). llama-server router mode (several models, loaded on demand; since 0.3.7): the window is read from each model's own context before the prompt is built, and saved state is kept per model.
The recommended README and ds4 example configs keep auto_recall: false: retrieval is requested by the model. The 100-question AgentLongBench confirmation run logged 379 model-requested recall calls and zero auto_recall events. Automatic hints are opt-in: auto_recall_hint: true only selects hint mode and also requires auto_recall: true; it does not enable retrieval by itself.
| client \ engine | Strata | llama-server | ds4-server | any OpenAI-compatible |
|---|---|---|---|---|
| Chat Completions (pi, omp, Hermes, Continue…) | tested · full | tested on CPU · full | tested with pi · engine keeps its own state | base (no saved state) |
| Claude Code (Anthropic Messages) | tested live | experimental | experimental | experimental |
| Codex (Responses) | tested live | experimental | experimental | experimental |
| MCP recall server (Claude Code, Codex, Hermes) | tested read-only on a real archive | |||
ds4-server (antirez/ds4) with pi on a Ryzen AI Max+ 395, 8K window: GLM 5.3 Flash Q2 recalled an error line removed from the prompt (right id and shard, plus an invented timestamp), and after each recall ds4 read only the new 614–634 tokens. The 8K window was chosen to stress recall; the proxy now requires at least 16K. Long 32K sessions on ds4 are above. mnemonic-proxy is a separate tool, compatible with ds4-server; it is not part of the ds4 project.
--slot-save-path. Our restore times were measured on the 0.1.38 + PR #668 build; on 0.1.40 the proxy ran the AgentLongBench benchmark and the recall tests, but restore times were not re-measured.NameError). 0.3.0 blocks these writes; tested on a mock engine, not yet live.