SkinDeepRESEARCH
SearchSteve Seguin

Use it: the ctxkeeper proxy

Download a small free proxy that gives a long agent task notes, an archive and search, in front of any OpenAI-compatible model server.

The keeper is now a free program you can download. ctxkeeper sits between your AI agent and your model server. Your agent keeps sending its whole history; the model is shown a short, current view of it: its standing rules, up-to-date notes and the latest turns, with everything older kept word for word and searchable. A long task can carry on long after its conversation has outgrown what the model can read at once.

What it does

Think of a desk and a filing cabinet. The model works at a small desk: the opening instructions, a page of notes and the newest messages. Everything else goes into the cabinet, unchanged. Three things keep the desk useful:

  1. Notes, kept up to date. Every so often the model writes down only what changed: a new rule, a changed figure (with the working), a new open question. ctxkeeper checks each line before accepting it; a sum is recomputed, a rule can never be dropped.
  2. Search. The model gets one extra tool, recall, that searches the cabinet. ctxkeeper answers it itself; your agent never sees that step.
  3. Rules stay in force. Standing rules are repeated next to every new instruction, so a rule given hours earlier still applies.

Nothing about the model or the server changes. Anything that can be pointed at an OpenAI-compatible address can use it. Follow the keeper step by step.

Does it help?

Measured with Qwen3.8-27B on two Intel Arc Pro B70 graphics cards, with a working view of 32K tokens. Each row is a real run, graded by the task’s own checker.

TaskWith ctxkeeperWithout it
Fix 40 real bugs in a Python library, one ticket at a time, under three house rules; then 7 questions about the earliest fixes40/40 fixed, 40/40 kept every rule, 7/7 right; 16 to 38 min, by settingsLatest 32K only: 22 to 35 of 40 kept the rules, 0/7 right
The same task through a separate agent program that manages nothing itself40/40, 40/40, 7/7; 31 to 33 min, about 3M tokens readWhole history in a 262K window: same score; 55 min, 29.9M read
228 questions about things said up to a million tokens earlier226/228; 50 min200K window: 166/228, all 29 rule questions wrong; 228 min
Two million tokens with planted traps (values that change and change back, corrections)351/382 (92%); none of 12 traps takenNo window holds it

One model on one machine. The repair task in detail · The million-token runs · The two-million-token stream.

Try it

You need Python 3.10 or newer (or Docker) and a model server that speaks the OpenAI API: vLLM, llama.cpp’s server, SGLang, Ollama’s OpenAI endpoint and others. ctxkeeper uses Python’s standard library only.

R=https://github.com/steveseguin/b70-optimization-lab/releases/download/ctxkeeper-v1.0.0
pip install $R/ctxkeeper-1.0.0-py3-none-any.whl
# or with Docker: docker build -t ctxkeeper $R/ctxkeeper-1.0.0.tar.gz

ctxkeeper --upstream http://127.0.0.1:8000 --recipe agent

Give --upstream your server’s address without /v1. Then point your agent or app at http://127.0.0.1:18200/v1 instead of the server. To see it work, run the demo: it holds a conversation several working views long, says a codename, a budget and a standing rule at the start, and asks about all three at the end.

curl -LO $R/long_chat.py
python3 long_chat.py --base-url http://127.0.0.1:18200/v1

Use it with your agent or app

It works with anything that takes an OpenAI-compatible base URL, if the program:

  • uses Chat Completions (/v1/chat/completions); other requests pass straight through, unmanaged;
  • sends its whole history each time, with its own trimming or summarizing turned off;
  • asks for one reply at a time. Streaming works, but the reply arrives in one piece at the end.
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:18200/v1", api_key="unused")
reply = client.chat.completions.create(model="your-model", messages=history)

If new instructions arrive inside tool results, such as tickets, emails or files, tell ctxkeeper what they look like so it repeats the rules after each one: --recite-when '(?m)^TICKET \d+'. The bug-fixing task did not need it: its tickets arrive that way, and the rules held from the notes alone.

Settings

A recipe is a set of options that were measured together; any option you give still wins.

RecipeUse it forMeasured on the repair task
--recipe agentAny OpenAI-compatible server40/40 clean, 7/7; 36 to 38 min
--recipe qwenQwen3 behind vLLM40/40 clean, 7/7; 16 min

The Qwen recipe writes its notes without thinking and keeps the prompt identical, so the server’s cache does most of the note-taking work. Both use a 32K working view. On the repair task 24K did as well (13 minutes); at 16K one rule slipped once. A bigger view is slower, because the model reads more on every turn.

Tested before release

Version 1.0.0 was installed the way you would install it and run as its instructions say:

CheckResult
The bug-fixing task above, through a separate agent program, with --recipe qwen and nothing else40 of 40 fixed, all 40 following every rule, 7 of 7 questions, in 31 minutes
The demo through the Docker image, 300K tokens: longer than the model server itself can hold4 of 4, in 4 minutes
The OpenAI library example aboveOrdinary reply, tool call and streaming all worked
A different model and server: Gemma 4 26B on llama.cpp, 100K tokens4 of 4, in 4.5 minutes (one quick run, not a measurement)

Limits

  • Measured on one model family and one machine. Other models should work if they use tools reliably and can keep the notes format; that has not been measured.
  • The notes are written by the model, so they can be wrong. On the hardest test about 1 notes line in 130 was silently wrong; on the million-token test, 1 in 1,435. The originals stay searchable, but nothing forces the model to look.
  • No login, and everything is stored as plain text on the machine running it. It listens only on the local machine unless you tell it otherwise.
  • The opening instructions are always kept, so they must fit well inside the working view.
Downloads, source and records
  • Release 1.0.0The package, the source archive, the two program files and the demo, with checksums. Public domain.
  • Full instructionsEvery option, the status page, where state is kept, and how to run the tests.
  • SourceTwo Python files, their tests against a scripted model, and the build history.
  • Release test recordsThe test script, each check’s output and the proxy’s counters.
  • Lab noteEvery campaign that shaped the defaults, including what failed.