AI Coding Agents
context-mode Plugin Review for Coding Agents
context-mode runs selected tool work locally and stores bulky output in a SQLite index so the agent can request only the evidence it needs. It can also restore a small state snapshot after the client compacts a conversation. The plugin is most promising for long sessions with large tool results, where avoided input can outweigh tool definitions and retrieval calls.
At a glance
| Question | Answer |
|---|---|
| What is it? | A plugin that executes selected tool work locally and indexes bulky results in SQLite. |
| What cost does it target? | Input from large results that the agent needs only a small part of. |
| Where does it act? | Hooks redirect eligible calls. The agent can use local execution and search through the plugin’s tools. |
| How do you try it? | Install the npm package and run its setup for a supported agent. |
| What can you retrieve? | Use ctx_search for indexed excerpts and ctx_resume for a state snapshot after compaction. Check access to full originals separately. |
| What license is stated? | The project labels the free local plugin source-available under ELv2. |
| When is it a good fit? | Long sessions where an agent repeatedly reads large outputs to answer narrow questions. |
| When should you skip it? | Your results are already small, or you need the full ordered output throughout the task. |
Run the work locally and return the result the model needs
If the agent needs a count and a few examples from a long log, it can compute the count locally and print only those facts. context-mode calls this Code Mode. The model writes a short script for ctx_execute, the plugin runs it using a local runtime in the project directory, and the model gets the printed result subject to an output cap. Script arguments and printed results can still appear in model requests. Check what the agent is asking the script to do, especially if the task involves secrets or files outside the working set. The README describes a child process with a timeout and an inherited environment with certain preload variables removed. Review that execution model against your own permissions requirements. context-mode architecture
Hooks can also redirect eligible calls. The README describes a pre-tool hook that can stop a large full-file read and tell the model which ctx_execute call to make instead. An explicit line-range read can run normally. For certain file and fetch operations the plugin can index content and search it. Some host tool output can be externalized after it runs. Check the trace to see which path your client used, since an attempted native call followed by a replacement may add work to the session.
Search the index and recover state after compaction
The local database lives under ~/.context-mode, with a context.db for each project. The README describes chunking indexed output for SQLite FTS5 full-text search. Markdown chunks stay within a heading section, and code blocks that fit can stay together. The agent can pull excerpts using ctx_search. For example, after a large build, the agent can search for a specific failed target and retrieve the relevant errors. A good trial pairs that search with a check that the excerpt includes enough nearby output to interpret the error.
Compaction introduces a separate problem. When the host condenses a long conversation, the agent can lose track of earlier results and pending decisions. The plugin describes saving a small state snapshot at compaction and exposing it through ctx_resume. Earlier indexed material remains searchable with ctx_search. In a resumed debugging session, check that the model can name the last failed check, find the corresponding output, and continue with the remaining task. The compact state snapshot and the evidence index serve different purposes, so exercise both in that test. Long-session behavior
Search also changes the question the agent must ask. A broad request to explain a failed deploy may span records with different keywords, while a lookup for a known service identifier can be precise. For a multi-stage failure, ask the agent to retrieve the matching events and reconstruct their order from the original timestamps. Before approving the resulting diagnosis, compare it with the full log. If useful evidence depends on adjacent records that the initial query missed, capture the extra searches and the time they take. Use a local fixture with a known sequence so the same chronology can be checked in both trial conditions.
Install, confirm the hook, and remove the test setup
The README lists support for Claude Code, Codex, Gemini CLI, Qwen Code, Pi, OMP, OpenCode, Copilot CLI, Kiro, VS Code with Copilot, and ZCode. It describes checks on macOS, Linux, and Windows, with Node 24.15.0 or later and Git for Windows for shell tools on that platform. The project labels the free local plugin source-available under ELv2. Its hosted Gateway has a separate subscription. Review the plugin license for your intended distribution or deployment. context-mode repository and license
The npm setup path is documented for supported agents. Save the client configuration before setup and check the plan before accepting it.
npm i -g context-mode
context-mode setup
Restart the agent and run the documented health check. Test on a local log with a known failure and ask for the specific error. Confirm the agent used the redirected or indexed path and that its answer matches the original file.
/ctx-doctor
Use /ctx-stats on Claude Code or $ctx-stats on Codex to inspect the session report. The README gives these removal commands for the npm setup path. Restart and confirm the plugin’s hooks and tools no longer appear. Review the project database separately if the trial indexed material you need to retain or remove.
context-mode setup --remove
npm rm -g context-mode
What the benchmark measures
The project reports a median reduction of 99.4% in output bytes reaching context for 36 rows with at least 10 KB of raw output. Retrieval rows had a lower reported median reduction of 77.2% because search returned matching text. Its scripted debugging session went from 281,261 raw bytes to 3,266 bytes reaching context. The session continuity case separately shows a 2,019-byte resume block after a 442,893-byte transcript. These are project benchmark results from selected scenarios. The local evidence contains no independent session-level billing comparison for the plugin. context-mode benchmark data
The choice of denominator explains the headline. A script can read every record locally and return a small count, so the raw-to-returned ratio can be large. A baseline agent could also compute the count locally if its standard shell is available. Use your usual workflow as the control and look for a change in provider-reported input. Account for every retrieval, including cases where a broad query returns more text than the agent needs.
Price the MCP overhead and the cache effects
Tool definitions can add input on any request that carries them. The instructions for redirected calls, script arguments, and search excerpts also take context. A closed issue title says the ctx_* tool descriptions were about 80% steering prose and took roughly 6,200 tokens per call on Pi. Measure what your client sends, since that report covers one host and the count can change with the build or tool set. Tool-description overhead report MCP tool definition token cost
For an estimate, use the project’s approximate conversion of 281,261 raw bytes to 70K tokens and 3,266 returned bytes to 817 tokens. Assume both approximate token counts represent alternative fresh inputs on a single request. At the committed Claude Sonnet rate, (70K − 817) × $2 per million input tokens is roughly fourteen cents of gross savings. Subtract added fresh input for schemas, scripts, and search, and recalculate using $0.10 per million for any comparable cache reads. The initial byte conversion is approximate and the source benchmark is a scripted session, so this calculation illustrates a billing bucket and does not price that session. Provider pricing index
What the issue tracker suggests checking
An open issue requests a way to return a stored source in full. If your workflow needs exact full-file review, check how the agent can access the original through the client or filesystem. Another open report requests database retention and describes growth and a hook timeout. Keep an eye on disk use and hook latency over repeated sessions, especially if the same project produces large logs regularly. Full-source retrieval request Database retention report
Who should trial it and what to record
Try it when the agent repeatedly ingests large outputs to answer narrow questions or when compaction disrupts long sessions. Keep your usual tools if reads are already small, you need the full ordered output throughout the task, or the agent already computes small answers locally. Prefer a disposable project for checking what gets stored and how it is recovered.
- Run the same large-output task with and without the plugin. Hold the model, repository, prompt, and acceptance criteria fixed.
- Include a known error and a follow-up about an earlier result after compaction. Check the answers against the original output.
- Record input, cache writes, cache reads, output, turns, redirects, retrievals, and elapsed time. Include local disk growth and failures.
- Repeat on a small task to see how overhead behaves when there is little output to reduce. Compare cost per accepted task. How to measure coding agent token savings
Alternatives for other interception points
RTK shortens output from covered shell commands. Headroom can shrink eligible request content at a proxy or library boundary with on-demand retrieval of originals. If your agent already reaches the right evidence through its normal tools, compare those approaches with deploying an index and search tools. RTK review Headroom review
Sources
- context-mode repository and README (GitHub, accessed 2026-11-30)
- context-mode project benchmark (GitHub, accessed 2026-11-30)
- MCP tool-description overhead report (GitHub, accessed 2026-11-30)
- Full-source retrieval request (GitHub, accessed 2026-11-30)
- Database retention report (GitHub, accessed 2026-11-30)
How this note was produced
Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.
context-mode Plugin Review for Coding Agents. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/context-mode-plugin-review/