← All guides
· 8 min read

Context Mode: Cut Claude Code Tool Bloat (Beginner Guide)

Install the context-mode plugin for Claude Code, verify it with ctx-doctor, and read ctx-stats so tool output stays out of your context window.

Context Mode for Claude Code: sandbox tool output

MCP tool calls and Playwright snapshots send raw payloads straight into Claude Code’s context window. The README says that after about 30 minutes of agent work, roughly 40% of context can be gone to tool noise alone. This guide installs Context Mode, confirms hooks and MCP tools with ctx-doctor, and uses ctx-stats so you can measure savings on your machine.

YouTube thumbnail from the Context Mode repo: 99% savings with Claude Code
The project’s demo thumbnail. Source: Context Mode repo.

Plan on about 15 minutes. You need Claude Code v1.0.33 or newer on macOS or Linux (Windows users can run Claude Code inside WSL the same way).

What you’re building

Context Mode is an MCP server and Claude Code plugin (Elastic License 2.0, 26k+ GitHub stars). It keeps bulky tool output in a sandbox, tracks session events in SQLite, pushes a “think in code” workflow (run a script, log only the result), and stays out of how the model phrases answers.

The numbers from the reel match the README’s headline example: in their test, 315 KB of tool output became 5.4 KB in context, which they describe as a 98% reduction. A Playwright snapshot alone is listed at 56 KB, and the README says that after about 30 minutes, 40% of context can be consumed by this kind of noise.

You  →  Claude Code + context-mode  →  raw tool output stored outside context  →  model fetches summaries when needed

Session continuity lives in SQLite with FTS5 search, so when Claude compacts the chat, indexed events can be retrieved instead of re-pasting every prior tool dump.

Before you start: the honest catch

  • Savings vary by project. The 315 KB → 5.4 KB figure is from the maintainer’s README tests, not a guarantee on your repo. After install, use /context-mode:ctx-stats on real work and treat that as your baseline.
  • License is ELv2, not MIT. You can use and modify it freely, but ELv2 has restrictions if you offer the software as a hosted service to third parties. Read the LICENSE before baking it into a product.
  • Full install needs a recent Claude Code. The plugin path requires Claude Code v1.0.33+. Older builds may not expose /plugin at all.
  • Node for some paths. The MCP-only install uses npx. Other platforms in the README ask for Node.js ≥ 22.5 (or Bun). The Claude Code plugin bundles what it needs once installed, but keep Node updated if you also use the global CLI elsewhere.

Step 1: Confirm Claude Code is new enough

In any terminal:

claude --version

You want 1.0.33 or higher. If /plugin is missing later, update with:

brew upgrade claude-code

or:

npm update -g @anthropic-ai/claude-code

Restart the terminal and run claude --version again.

Step 2: Add the Context Mode marketplace and plugin

Open Claude Code and run these two commands exactly as in the README:

/plugin marketplace add mksglu/context-mode
/plugin install context-mode@context-mode

Restart Claude Code, or run /reload-plugins if you prefer not to quit.

How to check it worked: run:

/context-mode:ctx-doctor

Every line should show [x]. The doctor checks runtimes, hooks, FTS5, and plugin registration.

Step 3: Run a small task and read ctx-stats

Start a normal coding session in a repo you own. Let Claude use tools (tests, file reads, browser snapshots if you use Playwright MCP).

Then run:

/context-mode:ctx-stats

You should see per-tool breakdown, tokens consumed, and a savings ratio for that session. Compare this to how fast your context bar moved before install.

Optional: add a status line so savings show while you work. The README documents a one-time edit to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "context-mode statusline"
  }
}

Restart Claude Code after saving. The bar shows dollars saved this session, dollars saved across sessions, and an efficiency percentage.

Step 4: Try the MCP-only path (optional)

If you want tools without automatic hook routing, the README lists:

claude mcp add context-mode -- npx -y context-mode

You get the same 11 MCP tools (ctx_execute, ctx_search, ctx_stats, ctx_doctor, and others), but the model is not nudged away from raw Bash or Read. Good for a trial before the full plugin.

Troubleshooting

/plugin is not recognized

Update Claude Code (Step 1), restart, and try again. The README ties /plugin support to v1.0.33+.

ctx-doctor shows failed checks

Run /context-mode:ctx-upgrade to pull the latest build, migrate cache, and repair hooks. Run /context-mode:ctx-doctor again until all checks pass.

I installed both the plugin and claude mcp add

The README warns that duplicate hook entries can fire twice on some clients. Pick one install path for daily use. On Cursor, context-mode doctor can warn about duplicate hook firings if you mixed Option A and Option B configs.

Savings look small on my repo

Light sessions with few tool calls will not mirror the README’s 315 KB stress test. Run a task that actually hits large outputs (browser snapshots, big logs, many file reads), then re-check /context-mode:ctx-stats.

What else you can do with it

  • Index local docs: /context-mode:ctx-index for files or folders, then /context-mode:ctx-search to query the FTS5 knowledge base.
  • Other editors: The same repo ships configs for Cursor, Gemini CLI, VS Code Copilot, Codex CLI, and more. Each section in the README lists prerequisites and a verify command (often ctx stats or context-mode doctor).
  • Team analytics: /context-mode:ctx-insight opens the hosted Insight dashboard for org-level stats (optional; account may be required on the site).

Quick recap

  1. Check Claude Code is v1.0.33+.
  2. Run /plugin marketplace add mksglu/context-mode and /plugin install context-mode@context-mode.
  3. Verify with /context-mode:ctx-doctor (all [x]).
  4. Do real work, then read /context-mode:ctx-stats for your own savings numbers.
  5. Optional: MCP-only via claude mcp add context-mode -- npx -y context-mode if you want tools without hook routing.