First session
Your first session with Context Mode Engine
You installed Context Mode Engine, and you want to see it work. Ask your agent to run your tests or read a big web page. The big output goes to a local sandbox, and the agent reads a short reply. Then call ctx_stats, the Context Mode tool that counts bytes: it shows how many bytes stayed out of the context window. In our benchmark, a 265 KB web page is what the agent would have sent to the model; the agent read 0.4 KB instead (median of 5 runs). Your own session gives your own numbers.
Free · Local · Private · Forever
Context Mode Engine is source-available under the Elastic License 2.0. Free to use, for all time. It runs on your machine and keeps your data in ~/.context-mode.
Key facts
- What it is
- A first run of Context Mode Engine: one big tool output, one short reply, one
ctx_statsreport. - Who it is for
- Anyone who installed the Engine and wants to see the bytes it keeps out of the context.
- Agents
- Claude Code, Codex, Gemini CLI, Qwen Code, Copilot CLI, VS Code, Kiro, ZCode, OpenCode and Pi.
- Measured result
- A test run of 1106 tests went from 61.4 KB to 0.4 KB. A 265 KB web page would have sent 265.4 KB, and the agent read 0.4 KB. Median of 5 runs, benchmark of 2026-11-01 (raw file).
- Scope
ctx_statscounts bytes on your machine, for this session, this project and all time. It reads the database of the project you work in.
The question after install
The install is done and the doctor shows PASS. Now you ask: "How do I know it works?"
The answer takes two steps. First, give the agent a task with big output. Then, ask the agent for ctx_stats. The report shows the bytes that stayed in the sandbox and the bytes that reached the model.
To install first, use your agent's own command on the install page. Restart the agent, then run this in a terminal:
context-mode doctorStep 1: run your tests
A test suite prints a long log. Ask your agent to run it through the sandbox and print only what you need:
Run the test suite with ctx_execute and print only the names of the tests that need a fix.
The agent writes a short script. ctx_execute runs it as you, in your project folder. Only what the script prints comes back to the agent.
In the benchmark, a vitest run of 1106 tests printed 61.4 KB. The agent read 0.4 KB. That is the median of 5 runs on an Apple M1 Pro (raw file, source on GitHub).
Or: read a big web page
Ask your agent to read a long docs page. The PreToolUse hook (a small script that runs before each tool call) sends the WebFetch call to ctx_index and ctx_search. The page goes into the local index, and the agent searches it for the part it needs.
In the benchmark, a WebFetch of a 265 KB guide page would have sent 265.4 KB to the model. The agent read 0.4 KB. That is the median of 5 runs (raw file).
What happens to the output
Each big tool call takes the same short path. Step through it below.
Agent call
Your agent calls Bash:
npm test.Sandbox
The sandbox runs the tests as you, in your project. Output: 61.4 KB.
Reply
The agent reads 0.4 KB: a short summary and a search hint.
Test run row: 61.4 KB to 0.4 KB, median of 5 runs (raw file).
Step 2: read ctx_stats
Ask your agent for the numbers:
Call ctx_stats and tell me how many bytes stayed out of the context in this session.
On agents with slash commands, /ctx-stats calls the same tool for you. The report shows the bytes kept out of the context at three levels:
- Session: the work you did since the agent started.
- Project: every session in this project.
- All time: every session the Engine logged on this machine.
What you get
You see the proof in your own session: big output in, short reply out. The full output stays in the index on your machine, so the agent can search it later with ctx_search. Your context window keeps its room for your work.
Try it: eight requests
Paste any of these into your agent. Each is a plain request, and each has a result from a live run.
Measured on 2026-11-02 with Context Mode 2.0.0-next.26 in Claude Code 2.1.312 and the model claude-haiku-5-5, one run per prompt, each in an empty folder. Saved is 1 minus (bytes the model read, divided by the raw bytes). Every answer matched the ground truth from git, the GitHub API, node or grep. Raw file.
The agent used Context Mode tools
On https://react.dev/reference/react/useEffect, show me the example that connects to a chat server and cleans up, and list the rules for the dependency array.
Result: 601,984 B of raw data, 20,860 B read by the model, 96.5% saved. The agent used ctx tools.
Fetch https://jsonplaceholder.typicode.com/photos. Which photo has the longest title (give its id and title), and how many photos have a title that contains the word "est"?
Result: 1,039,898 B of raw data, 393 B read by the model, 99.96% saved. The agent used ctx tools.
Here is a Linux syslog sample: https://raw.githubusercontent.com/logpai/loghub/master/Linux/Linux_2k.log. How many authentication failures does it contain, and which 3 remote hosts caused the most?
Result: 216,485 B of raw data, 566 B read by the model, 99.7% saved. The agent used ctx tools.
What are the top 10 stories on the Hacker News front page right now? Give title, points and domain for each.
Result: 35,087 B of raw data, 1,501 B read by the model, 95.7% saved. The agent used ctx tools.
The agent cut the output with a shell pipe
In these four runs the agent chose a shell pipe over a Context Mode tool. The saving comes from that pipe, and the answers match the ground truth.
Look at the last 300 commits of https://github.com/vitejs/vite. Who are the top 5 committers, and which 5 files changed most often?
Result: 359,090 B of raw data, 486 B read by the model, 99.9% saved. The agent used shell pipe.
Which 10 open issues in vercel/next.js have the most comments? Give me the issue number, title and comment count for each.
Result: 68,984 B of raw data, 1,639 B read by the model, 97.6% saved. The agent used shell pipe.
Clone https://github.com/expressjs/express, install it and run its test suite. How many tests passed, failed and were skipped?
Result: 71,119 B of raw data, 1,495 B read by the model, 97.9% saved. The agent used shell pipe.
Clone https://github.com/honojs/hono. Which 5 files in src/ have the most lines, and what does each one do?
Result: 2,612,115 B of raw data, 4,882 B read by the model, 99.8% saved. The agent used shell pipe.
To see the savings in your own session, type /ctx-stats in your agent.
Prompts to give your agent
Paste one into your agent. Each prompt shows in full.
Run the test suite with ctx_execute and print only the names of the tests that need a fix.
Call ctx_stats and tell me how many bytes stayed out of the context in this session.