Context Mode
by mksglu
Context Mode sandboxes tool output in subprocesses so an agent's context window sees a cut-down summary instead of the raw multi-hundred-KB response.
Install for Claude Code
/plugin marketplace add mksglu/context-mode
About
ctx_execute and ctx_execute_file run code or process files in an isolated subprocess and only pass the resulting stdout into the model's context, so a task that would normally mean reading a 56KB Playwright snapshot or a 59KB GitHub issue thread costs a few hundred bytes instead. ctx_fetch_and_index and ctx_index pull URLs or markdown into a local SQLite database chunked for full-text search, and ctx_search retrieves from it with BM25 ranking instead of the model re-reading whole documents.
On top of that, every file edit, git operation, error, and user decision gets logged to SQLite, so when a long conversation compacts, Context Mode can index those events with FTS5 and pull back only what's relevant rather than losing the thread entirely. It covers 18+ coding platforms including Claude Code, Gemini CLI, VS Code Copilot, and Cursor, though hook coverage, and therefore how much context it actually saves, varies by platform, and everything runs locally with no telemetry or cloud sync.
Key features
- ctx_execute and ctx_execute_file run code and process files in a sandbox; only stdout reaches the model
- ctx_fetch_and_index and ctx_index chunk fetched pages or markdown into a local, searchable database
- ctx_search retrieves indexed content with BM25 ranking instead of the model re-reading whole files
- Every edit, git operation, and error is logged to SQLite so a compacted conversation can resume with context
- Supports 18+ platforms including Claude Code, Gemini CLI, VS Code Copilot, and Cursor, with hook coverage varying by platform
- Runs entirely locally in sandboxed subprocesses, no cloud sync, no telemetry
Use cases
- Keeping long coding sessions from burning through context on large tool outputs like browser snapshots or logs
- Letting an agent search a growing local knowledge base instead of re-reading files it already indexed
- Recovering session continuity after a conversation compacts, without manually re-explaining prior state
- Cutting context costs on any of the 18+ supported platforms that would otherwise paste raw tool output
Available tools
ctx_execute
Runs code in one of 12 supported languages in a sandbox; only stdout enters the model's context.
ctx_fetch_and_index
Fetches a URL and indexes its content locally instead of pasting it into context.
ctx_index
Chunks markdown or text content into a local, full-text-searchable database.
ctx_search
Searches previously indexed content using BM25-ranked full-text search.
ctx_stats
Reports context savings and indexing statistics for the current project.
Frequently asked questions
Does it work outside Claude Code?
Yes, across 18+ platforms including Gemini CLI, VS Code Copilot, JetBrains Copilot, and Cursor, though hook coverage, and the resulting context savings, varies by platform.
Is any data sent to the cloud?
No. All processing happens locally in sandboxed subprocesses, with no telemetry or account required.