Skip to content
Agentic Levels
Start hereLevelsTracksPromptsAbout
Get my levelGet my level

  • Start hereYour first useful task with AI.
  • Level quiz8 questions. No AI needed.
  • Fluency ScoreYour Level and a score, from your own AI.

  • LevelsThe 11 levels, in order.
  • LessonsShort lessons, filter by level.
  • TracksGuided paths by tool, role or goal.
  • Set up your AI tool
  • Starter packFree files that help AI remember.

  • PromptsReady prompts to copy and adapt.
  • ChatGPT vs Claude vs GeminiPick the right one for the job.
  • How-tos
  • ReferenceCommands for Claude Code, Codex, Antigravity.
  • ResourcesHand-picked reading and tools.

  • Your progress
  • Your next moveAn interview that picks your next skill.
  • Your next lessonsThe next lessons at your level.
  • Updates

  • Pricing
  • About
  • FAQ & Feedback
  • Work with us
  • How we handle your data
Sign inPreferences
AboutPricingHow-tosPromptsStarter packMy stackHow we handle your data

© 2026 Fuentes Studio

PrivacyTermsRefundsAccessibilityAI content policyCredits
yourCouncil
Ready to help
✦

What do you want to understand?

Ask anything about what you're learning.

←How-to guides
  1. Resources
  2. ›How-to guides

How to use context-mode

MCP server that slashes context usage by up to 98%: sandbox execution, SQLite session continuity, and automatic routing keep raw data out of your conversation.

Levels 4 to 6On GitHub

Context window bloat is the main reason Claude Code sessions degrade over time: tool output, file contents, and search results accumulate until quality drops. Context Mode solves this as an MCP server with four capabilities: sandbox execution that runs code in isolated subprocesses (56 KB Playwright snapshot becomes 299 bytes in context), FTS5 full-text search over a local SQLite knowledge base, session continuity that tracks all file edits and decisions across compactions, and automatic routing hooks that intercept tool calls and steer data-heavy operations away from the conversation. With hooks enabled, context savings reach 98%. Works offline, stores locally, integrates with 15 platforms.

Before you start

Claude Code with MCP support. Node.js 18+ or Python 3.10+. Install via npm: npm install -g context-mode-mcp then add the server to your Claude Code settings.json.

  1. 1Install and add to Claude Code MCP config
  2. 2Enable routing hooks for maximum context savings
  3. 3Use sandbox execution for data-heavy tool calls
  4. 4Search the FTS5 knowledge base instead of re-reading files
  5. 5Recover session state after a compaction

Steps

01

Install and add to Claude Code MCP config

Install Context Mode globally and add it to your Claude Code settings.json as an MCP server. Restart Claude Code after adding. You should see context-mode tools appear in your session. The server stores everything locally with no cloud sync.

Install and configure
npm install -g context-mode-mcp # Add to ~/.claude/settings.json under mcpServers: { "mcpServers": { "context-mode": { "command": "context-mode-mcp" } } }
02

Enable routing hooks for maximum context savings

Without hooks, Context Mode saves ~60% of context by redirecting data to sandbox. With routing hooks enabled, savings reach 98%. Hooks intercept every tool call and automatically route data-heavy operations away from the conversation. Add the hooks to your Claude Code settings.json after verifying the MCP server is working.

Enable routing hooks
# In your Claude Code settings.json, add to hooks: { "hooks": { "PreToolUse": [{ "command": "context-mode-mcp route-check" }] } }
03

Use sandbox execution for data-heavy tool calls

Instead of letting large outputs enter conversation history, route them through the sandbox. The sandbox executes code in an isolated subprocess across 11 language runtimes and returns only the relevant portion to context. A full Playwright snapshot (56 KB) becomes a 299-byte extract.

Run code in sandbox
# Ask Claude to use context-mode sandbox for this task: Run [SCRIPT_OR_COMMAND] using the context-mode sandbox and return only [WHAT_YOU_NEED_FROM_OUTPUT].
[SCRIPT_OR_COMMAND]Code or command to execute e.g. the Playwright snapshot of https://example.com
[WHAT_YOU_NEED_FROM_OUTPUT]What you actually need from the output e.g. the page title and all button text
04

Search the FTS5 knowledge base instead of re-reading files

Context Mode indexes your project files into an SQLite FTS5 knowledge base. Instead of reading large files into context, ask Claude to search the knowledge base for relevant snippets. BM25 scoring with Porter stemming returns the most relevant passages, not the whole file.

Search knowledge base
# Claude will use context-mode search automatically with hooks. # Or manually: Search the context-mode knowledge base for [SEARCH_QUERY] and return the top 3 results.
[SEARCH_QUERY]What to find e.g. authentication middleware configuration
05

Recover session state after a compaction

Context Mode tracks every file edit, git operation, task, and decision in SQLite. When Claude Code compacts or you start a new session, ask Context Mode to restore the session snapshot. It reconstructs the working state without re-reading every file.

Restore session state
Restore my session state from context-mode. Show me what was in progress, recent file changes, and any open tasks.

How do you know it worked?

  • context-mode tools appear in your Claude Code session after MCP configuration.
  • Sandbox execution returns a small output from a large tool call, verify by comparing to the raw output size.
  • Knowledge base search returns relevant results without reading full files into context.
  • Session state restores correctly after a compaction or new session start.
  • Context usage in a long session stays lower than equivalent sessions without Context Mode.

If something looks off

Hooks require careful testing before enabling
Routing hooks intercept all tool calls. Test the hook configuration on a non-critical project first and verify that the hook does not block tools you need. A misconfigured hook can silently drop tool calls.
Knowledge base needs indexing before searching
The FTS5 knowledge base is built from your project files, but only after indexing. Run the initial index command after setup. The server does not auto-discover files without it.
Sandbox isolation means no access to local credentials
Sandbox subprocesses are isolated. They do not inherit your shell environment or API keys. For tasks requiring credentials, use the local backend or pass credentials explicitly as arguments.

Skills & Commands Reference

Core Context Mode MCP capabilities for reducing context bloat.

Command / SkillWhat it doesWhen to use it
Sandbox executionRun code in isolated subprocesses across 11 language runtimes, only stdout enters contextAny tool call with large output: web scraping, test runs, log analysis, file parsing
FTS5 knowledge base searchBM25 full-text search over indexed project files, returns relevant passages, not full filesFinding specific code patterns, config values, or decisions without reading entire files
Session snapshot recoveryadvancedSQLite-tracked session state (file edits, git ops, tasks, decisions) survives compactionStarting a new session or after context compaction, restores working state instantly
Routing hooksadvancedPreToolUse hooks that automatically redirect data-heavy operations to sandbox (~98% context savings)Enable after verifying MCP server works, provides maximum context reduction automatically
15 platform integrationsadvancedWorks with Claude Code, Antigravity CLI, VS Code Copilot, Cursor, JetBrains, and 10+ othersSwitching AI tools, the same MCP server and knowledge base work across platforms

What you'll do, 5 steps

  1. 1Install and add to Claude Code MCP config
  2. 2Enable routing hooks for maximum context savings
  3. 3Use sandbox execution for data-heavy tool calls
  4. 4Search the FTS5 knowledge base instead of re-reading files
  5. 5Recover session state after a compaction

Was this helpful?