GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo

Context Mode Review: Does Keeping Tool Output Out of Your Coding Agent's Context Actually Save Tokens?

Context Mode claims 99% of tool output stays out of your coding agent's context. We recomputed it from the project's own data: the byte claim holds, but its own A/B tests show session tokens rose 5.6% on small tasks and fell 3.8% on large ones.

BY LUKAS HOFFMANN · FDEINTERVIEWS EDITORIAL · UPDATED NOVEMBER 12, 2026 · 8 MIN READ

PRACTICE THIS:Context window management for FDE agents ·Prompt plus documents exceed the context window ·RAG and agent design questions ·The must-know FDE questions

Context Mode is a plugin that keeps the raw output of a coding agent's tool calls out of its context window and lets the agent search or summarize it instead. Its headline, 99.4% of output bytes saved, holds up: we recomputed 99.36% from the project's own benchmark file. But that number counts bytes the model reads from large outputs, not tokens or dollars per session. The project's own A/B tests in Claude Code show session tokens 5.6% higher than no plugin on small tasks and 3.8% lower on large ones, with list-price cost down 44% on the large tasks. Install it if your sessions read big logs, JSON and pages; skip it for short sessions with small outputs.

What Context Mode does

A coding agent reads files, runs commands and fetches pages, and every result lands in the context window. A 60 KB file read or a 200 KB git log crowds out the instructions and history the agent needs, and is re-read on every later turn. Context Mode, by Mert Koseoglu, attacks that in four steps:

  1. Hooks intercept heavy calls. Before a tool runs, a PreToolUse hook checks it against a fixed order of rules: your deny list, web fetches, curl and wget, a full-file read over 16,384 bytes, and one-file shell dumps such as cat. A read with a line range passes through.
  2. The hook names a replacement call. Instead of the raw output, the agent is told which ctx_* tool to use, for example ctx_execute with the command and its intent.
  3. Work happens outside the context. ctx_execute runs a short script the agent writes, and only what the script prints comes back. The project calls this "Thinking in Code": count the failures in a 2,000-line syslog instead of reading it.
  4. Everything is indexed. Full outputs go into a per-project SQLite FTS5 database in ~/.context-mode, so ctx_search can retrieve the exact lines later, and ctx_resume restores a state block of at most 2,048 bytes after the agent compacts its history.

It ships nine MCP tools and installs into ten agents, including Claude Code, Codex, Gemini CLI, Qwen Code, Copilot CLI, VS Code, Kiro, OpenCode, Pi and ZCode. The repository passed 33,900 GitHub stars this week, with v2.1.10 released on 12 November 2026.

Here is what that looks like for a single large read, using the byte counts from one row of the project's benchmark:

One large tool call, with and without Context ModeAgent calls Read: Whole 60 KB file requested. Full output returned: 61,576 bytes enter the context. Re-read every later turn: About 15,000 tokens carried in the history until compaction. PreToolUse hook checks: Full read over 16,384 B: deny. Agent runs ctx_execute: A script reads the file locally. Only the printout returns: 374 bytes reach the context. Full text indexed: SQLite FTS5 in ~/.context-mode; ctx_search later, ctx_resume after compaction. The hook's denial and the extra ctx_execute turn are not free; on short sessions they cost more than they save (see the A/B chart below). One large tool call, with and without Context Mode A 60 KB file read. Byte counts from the project's benchmark row f-read-big-source (61,576 B raw, 374 B reached the model). WITHOUT THE PLUGIN WITH CONTEXT MODE Agent calls Read Whole 60 KB file requested Full output returned 61,576 bytes enter the context Re-read every later turn About 15,000 tokens carried in the history until compaction PreToolUse hook checks Full read over 16,384 B: deny Agent runs ctx_execute A script reads the file locally Only the printout returns 374 bytes reach the context Full text indexed SQLite FTS5 in ~/.context-mode; ctx_search later, ctx_resume after compaction The hook's denial and the extra ctx_execute turn are not free; on short sessions they cost more than they save (see the A/B chart below).

A typical replacement is a short ctx_execute call. The agent asks a question of the data instead of reading it. The argument shape is the one the README documents; the command, path and intent are our example:

json
{
  "language": "shell",
  "code": "grep -c ' ERROR ' logs/app.log; grep ' ERROR ' logs/app.log | tail -3",
  "intent": "How many errors, and what are the latest three?"
}

Only the count and three lines come back. The full log stays in the local index, so a later ctx_search for a request ID can still find the line.

This is the "write" and "select" half of context window management: persist what might be needed later outside the window, and bring back only what this step needs.

The 99.4%, recomputed

The README's rule for every headline number is stated precisely: rows with at least 10 KB of raw output, median of five runs per row, bytes the model sees against bytes the raw output would have added. We downloaded the 1 November 2026 results file (66 scenarios, 52 with byte metrics) and recomputed:

Slice of the benchmarkRowsMedian bytes saved
All rows with 10 KB or more of raw output3699.36%
The same rows, also counting the hook's own reply bytes3699.04%
Rows under 10 KB1677.1%
Search replies (retrieval group, 10 KB or more)377.25%
One row where the plugin added bytes (a 19-byte output became 81)1negative

The headline reproduces. Two caveats travel with it. Tokens in the README cards are bytes divided by four, an estimate the results file labels as such: "70K to 817 tokens" is 281,261 bytes to 3,266 bytes, not a tokenizer count. And the rows are scripted tool calls on fixed inputs, not model sessions, so they measure the mechanism, not what the agent does next.

We did not rerun the suite ourselves; this review rests on the published results file, the A/B tables in bench/RESULTS.md and the source.

What the project's own A/B tests show

Here the project deserves credit. Its bench/RESULTS.md runs real Claude Code sessions with and without the plugin and reports them plainly. The latest summary table, "Final A/B 3" from 21 October 2026, used Claude Sonnet 5.5 at low effort, three runs per task per arm, and scripted correctness checks:

MeasureSmall tasks (45 sessions)Large outputs (36 sessions)
Bytes of tool output the model read, median31 to 84,608 to 565
Session tokens, change versus no plugin5.6% more3.8% fewer
List-price cost, total for the arm$0.313 to $0.346$0.612 to $0.345
Tasks passed15 of 15 in every arm12 of 12 in every arm
Same benchmark, three different answersBytes of tool output the model read: small tasks -74.2%, large outputs -87.7% versus no plugin. Session tokens (median over tasks): small tasks 5.6%, large outputs -3.8% versus no plugin. List-price cost: small tasks 10.5%, large outputs -43.6% versus no plugin. Negative is better. The plugin always shrinks what the model reads; whether a session gets cheaper depends on how large the outputs are and how many extra turns the model spends calling the plugin's tools. Same benchmark, three different answers Context Mode v2 against no plugin, Claude Code, 3 runs per task and arm (project RESULTS.md, Final A/B 3, 21 October 2026). Change versus no plugin. Small tasks (5 tasks, 45 sessions) Large outputs (4 tasks, 36 sessions) -80% -40% 0% +20% Bytes of tool output the model read -74.2% (31 B to 8 B) -87.7% (4,608 B to 565 B) Session tokens (median over tasks) +5.6% -3.8% List-price cost +10.5% ($0.313 to $0.346) -43.6% ($0.612 to $0.345) Negative is better. The plugin always shrinks what the model reads; whether a session gets cheaper depends on how large the outputs are and how many extra turns the model spends calling the plugin's tools.

Three things explain the gap between 99% and roughly zero:

  • Fixed overhead. The plugin's tool schemas and hook text add about 2,000 tokens to every session. On a short task with small outputs nothing offsets them.
  • The output was never most of the session. A session's token count includes the system prompt, tools and history re-read on every turn. Shrinking one tool result from 4.6 KB to 0.6 KB removes about 1,000 tokens from a session of roughly 57,000.
  • Extra turns. An earlier run in the same file found the model spent additional turns calling ctx_* tools on two large tasks, pushing their tokens 29% and 74% above no plugin. The tuning between that run and Final A/B 3 removed most of the penalty.

Cost fell much faster than tokens on large tasks. That fits how the file counts tokens: the session total includes cached prefix reads, which are billed at a fraction of fresh input, so a smaller fresh payload can cut the bill while the total barely moves. The file also lists what it does not show: three runs per task, one model, one agent version, fixtures of 0.3 to 3 MB, single-task sessions. Longer sessions with many large outputs should do better, since the fixed cost is paid once, but that is a hypothesis the file does not test.

Two things to know before installing

The sandbox is not a security boundary. The README is explicit: code run through ctx_execute runs on your machine as your user, with your files, your network and your environment, minus preload variables such as NODE_OPTIONS. "Sandbox" means the output stays out of the model's context. Keep your agent's permission prompts on, and treat the plugin's hooks as code that runs on every tool call, which is the same supply-chain surface our plugin hooks question covers.

The license is source-available. Context Mode uses the Elastic License 2.0: free to use, modify and share at work, but you may not offer it to others as a hosted service. The README is careful to say "source open" rather than open source. The hosted Context Mode Gateway, a paid service with its own account, extends the idea to whole conversations; with it on, requests pass through its server. The plugin alone makes four network calls, all started by you or your agent, and the project guards that list with a test that flags any new network call site.

Pros and cons

StrengthsWeaknesses
Large outputs shrink by about 99% before the model reads themSession tokens roughly flat in the project's own A/B; small tasks cost about 6% more
Full output stays searchable locally, so nothing is truncated awayDepends on the model choosing to use ctx_* tools; extra turns can erase the saving
Unusually honest benchmark documentation, including negative results"Sandbox" runs code as you, on your host
No telemetry; a test guards the list of network callsSource-available license, not OSI open source; hosted Gateway is the business
Works across ten agents with one mechanismToken figures in the README are bytes divided by four

How we would evaluate it on your own sessions

Do not install on the strength of either number. Pick five real tasks your team runs, ideally the ones with big outputs, and run each three times with and without the plugin on the same agent and model. Record pass rate, session tokens, fresh input tokens and cost per task. The project ships the harness for exactly this (bench/live/ab-quick.mjs). If cost falls and pass rate holds, keep it. That small, paired comparison is the same discipline as an eval regression suite, applied to tooling.

The interview angle

"The agent's context fills up with tool output" is a common RAG and agent design prompt, and Context Mode is a clean worked example of one good answer: intercept, process outside the window, index, retrieve on demand, and restore a compact state after compaction. The stronger answer adds what its benchmark shows. Name the metric you would optimize (cost per successful task, not bytes saved), the fixed overhead any tool layer adds, and the risk that the model spends turns on the new tools. A candidate who says "99% fewer tokens" and stops has repeated a headline; one who separates bytes, tokens and cost has done the analysis.

Figures as of 12 November 2026: Context Mode v2.1.10, benchmark file of 1 November 2026, A/B tables of 21 October 2026. Check the repository for newer runs before quoting them.

PRACTICE THIS

Turn it into offers. Work the real questions and concepts this maps to:

FAQ

Context Mode is a plugin for coding agents such as Claude Code, Codex, Gemini CLI and OpenCode. Hooks intercept large file reads, web fetches and shell dumps, run the work in a local process, keep the full output in a per-project SQLite full-text index, and return only what the agent's script prints or a search matches. It is free and source-available under the Elastic License 2.0.

Discussion (4)

Arjun MehtaEditor

The byte metric versus the token metric is the whole lesson, and it applies to every context tool, not just this one. Bytes kept out of the window are a mechanism. Tokens billed per session and task success are the outcome. A vendor that reports only the first is not lying, but you cannot buy on it.

Cole SullivanContributor

Reader question: why would session tokens barely move if 88% fewer bytes reach the model?

Lukas HoffmannEditor

Two reasons in their data. Most of a session's tokens are the system prompt, tool schemas and history re-read on every turn, which the plugin does not shrink and slightly grows. And on two of the large tasks the model spent extra turns calling the plugin's tools, each turn re-reading that prefix. Cost still fell sharply on the large tasks, which fits cached prefix reads being cheap while the fresh input got smaller.

Hannah BryantEditor

Credit where due: the project's RESULTS.md says 'v2 does not yet cut session tokens' in plain words, next to the 99% headline. I wish more benchmark files were written like that. Read both before you put the headline in a slide.