How a turn works
-
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.
-
The core checks the edit
Each accepted edit becomes a numbered revision. The core refuses a bad edit and restores the last good revision.
-
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.
Working Context context.md · revision 1
Agent actions
Next request turn 4
With Context Engine
Plain conversation
Sizes count the bytes of this demo’s text. They are not measurements of real sessions, and Context Engine makes no token-saving claim. Inside a turn, real history still grows. The rebuild happens at the user turn.
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.
-
First prompt
CE_READYThe model replied with the exact string. The runner recorded revision 1.
-
Next turn
<working_context …>The request opened with the Working Context frame as a user message.
-
Second prompt
CE_EDIT_DONEThe model read the whole file, made one Edit, and replied with the exact string. Revision 2 is the model’s own edit.
-
Next turn
revision 3The replacement frame carried the edited Working Context.
-
Third prompt
CE_B7R_TESTThe prompt asked for the value without naming it. The model answered from the edited context, with no tool call.
-
Request check
2 messagesThe 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
/procmounted 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.