Jeff Kazzee
The interacting Penguin and Egg galaxies, photographed by the James Webb Space Telescope.

Let the agent decide what stays in its context.

← Context Engine project

alpha · pre-release 0.1.6, Linux only

Context Engine is an experimental plugin for Claude Code and Codex. It keeps the agent’s working notes in a plain file, the Working Context, and the agent edits that file with its ordinary tools. Claude Code rebuilds the request from the file at the next user turn. Codex rebuilds it when the agent calls new_context. After a rebuild, text the agent deleted or saved elsewhere is not sent again.

Arp 142 · NASA, ESA, CSA, STScI · CC BY 4.0. Cropped for this banner. Image policy.

How a turn works

  1. The agent edits a file

    Its notes live in context.md, the Working Context. It uses the same Read, Edit and Write tools it uses on code.

  2. The core checks the edit

    Each accepted edit becomes a numbered revision. The core refuses a bad edit and restores the last good revision.

  3. The request is rebuilt from the file

    In Claude Code this happens at the next user turn. In Codex it happens when the agent calls new_context. The rebuilt request holds the pinned prefix, the Working Context and the new input. Earlier turns are not in it.

Inside a turn, an edit produces a short notice with the revision number and a SHA-256 digest. The notice holds no Working Context text. The agent can read the new revision in the same turn with the core CLI.

Try it

This runs in your browser. No model is called and nothing is sent anywhere. The sessions are made up. The behavior follows the Claude Code default mode in the README.

The simulation needs JavaScript. The recorded run further down does not.

Long work, kept in one file

An agent on a long job collects things it no longer needs: a long test log, three abandoned openings for a chapter, every status report from every worker. In a plain conversation all of it is sent again with each request. With Context Engine the agent keeps what matters and moves the rest to files it can open later.

Claude Code and Codex are coding agents. People also use them to write, edit and coordinate other agents. The Working Context is plain Markdown, so the same edit works on a test log, a chapter draft or a status board. When a writer makes a call, the agent can write it down as a decision and keep it at the top of the file.

What a real run showed

Claude Code 2.1.300 with Claude Haiku, on a Linux server, October 16, 2026. Reconstructed from the run’s receipts. The strings are the real test strings.

  1. First prompt CE_READY

    The model replied with the exact string. The runner recorded revision 1.

  2. Next turn <working_context …>

    The request opened with the Working Context frame as a user message.

  3. Second prompt CE_EDIT_DONE

    The model read the whole file, made one Edit, and replied with the exact string. Revision 2 is the model’s own edit.

  4. Next turn revision 3

    The replacement frame carried the edited Working Context.

  5. Third prompt CE_B7R_TEST

    The prompt asked for the value without naming it. The model answered from the edited context, with no tool call.

  6. Request check 2 messages

    The recall request held the Working Context frame and the prompt. The earlier turns were not in it.

The Codex version passed its own live check on October 15, 2026. The recorded requests after an edit carry the full edited Working Context, and after a reset the discarded history is gone from them.

What it does not do

  • It runs only on Linux with /proc mounted and Node 24 or newer. On Windows and macOS it stops with an error before it changes anything.
  • It starts off in every project. You enable it one project at a time.
  • It makes no accuracy, speed or token-saving claim, and it does not claim the paper’s benchmark results.
  • It never reads, copies or stores credentials. It uses the login your runner already has.
  • A packet over 32,000 bytes is refused, never truncated.

Try it on your own machine

Each repository README starts with a prompt you can give your agent. It tells the agent to check your Node and runner versions, install into a throwaway project first, and prove with test strings that an edit changes the next request before it touches a real project.

Where the idea comes from

Context Engine adapts the mechanism of Context Language Models by Rulin Shao, Shannon Zejiang Shen, Junjie Oscar Yin, Yuetai Li, Minheng Wang, Hamish Ivison, Radha Poovendran, Nathan Lambert, Teng Xiao, Mike Lewis, Wen-tau Yih, Luke Zettlemoyer and Pang Wei Koh (arXiv:2609.37725, CC BY 4.0). Their code is published separately under CC BY-NC 4.0. None of it is copied here. Context Engine re-implements parts of the behavior from a prose description, and it is MIT-licensed.