Context window optimization for Cowork. Sandboxes tool output, compresses what returns with a self-learning 3-stage pipeline, and routes tools automatically — reducing context consumption by 30–60% in typical sessions, more in research-heavy ones.
Use context-mode tools (ctx_execute, ctx_execute_file) instead of Bash/cat when processing large outputs. Triggers: "analyze logs", "summarize output", "process data", "parse JSON", "filter results", "extract errors", "check build output", "analyze dependencies", "process API response", "large file analysis", "page snapshot", "browser snapshot", "DOM structure", "inspect page", "accessibility tree", "Playwright snapshot", "run tests", "test output", "coverage report", "git log", "recent commits", "diff between branches", "list containers", "pod status", "disk usage", "fetch docs", "API reference", "index documentation", "call API", "check response", "query results", "find TODOs", "count lines", "codebase statistics", "security audit", "outdated packages", "dependency tree", "cloud resources", "CI/CD output". Also triggers on ANY MCP tool output that may exceed 20 lines. Subagent routing is handled automatically via PreToolUse hook.
Run context-mode diagnostics. Checks runtimes, hooks, FTS5, plugin registration, npm and marketplace versions. Trigger: /context-mode:ctx-doctor
Purge the context-mode knowledge base. Permanently deletes all indexed content and resets session stats. This is destructive and cannot be undone. Trigger: /context-mode:ctx-purge
Show how much context window context-mode saved this session. Displays token consumption, context savings ratio, and per-tool breakdown. Read-only — shows stats only, no reset capability. To wipe the knowledge base entirely, use ctx_purge instead. Trigger: /context-mode:ctx-stats
Matches all tools
Hooks run on every tool call, not just specific ones
Admin access level
Server config contains admin-level keywords
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Executes bash commands
Hook triggers when Bash tool is used
Executes bash commands
Hook triggers when Bash tool is used
Uses power tools
Uses Bash, Write, or Edit tools
Uses power tools
Uses Bash, Write, or Edit tools
Context window optimization plugin for Claude Code in Cowork. Sandboxes tool output, compresses what returns with a self-learning 3-stage pipeline, indexes content into a local knowledge base, and tracks session state to reduce context consumption by 30–60% in typical developer sessions and more in research-heavy ones (run /context-mode:ctx-stats to see your actual savings in tokens and dollars). Current version: 1.6.0.
Long Claude Code sessions consume context rapidly. Every file read, web fetch, and shell command dumps raw output into the context window. Context-mode solves this with seven capabilities:
ctx_stats to see learner accuracy and lifetime savings.start.js bootstrapper handles version self-healing, ABI dependency checks, and pure-JS package installation before starting the server on every session.context-mode skill provides an in-session decision tree, tool-selection patterns, and anti-patterns so Claude consistently picks the right tool. A CLAUDE.md file (shipped with the plugin) gives Claude the "Think in Code" directive and tool-selection rules. A .claude/settings.json ships deny/allow permission rules so Claude Code behaves safely out of the box.Quickest — one command:
npx --yes --package=github:scottconverse/context-mode context-mode
The installer runs 7 steps automatically: copies the plugin to cache, creates a marketplace entry, registers the plugin, enables it in settings, installs native dependencies, verifies FTS5, and probes the MCP server to confirm all 9 tools respond. After it completes, start a new Claude Code session.
In Claude Code or Cowork:
/plugin marketplace add scottconverse/context-mode
/plugin install context-mode@scottconverse-context-mode
Start a new session. Verify with /context-mode:ctx-doctor.
Manual install:
git clone https://github.com/scottconverse/context-mode.git
cd context-mode
node install.js
Once installed, Claude automatically prefers context-saving tools. You can also use them directly:
ctx_execute — run code in a sandbox instead of reading files into contextctx_search — search indexed content instead of re-reading filesctx_fetch_and_index — fetch and index a web page instead of raw WebFetchContext-mode registers PreToolUse hooks that intercept 18 tool and command patterns before they execute. Every rule is defined declaratively in hooks/core/routing-rules.js — the table below is auto-generated from that file on every release.
npx claudepluginhub scottconverse/context-mode --plugin context-modeCowork-installable port of Sting25/claude-code-handoff (MIT, Christopher Chadwick). Auto-snapshot session state to .claude/handoff_current.md on session exit; auto-load it on the next session start. Plus /handoff for manual invocation at clean boundaries. Snapshot logic and skill spec are upstream's; this port adds the plugin manifest, hooks/hooks.json wiring, an atomic mkdir-based lock to replace flock, and a Perl JSON::PP helper to replace jq. See repo CREDITS.md for full attribution.
Governor: always-on compact professional output, telemetry, context slimming, tool-output filtering, prompt guidance, and drift guardrails for Claude Code Max users.
Context management with save and restore capabilities
MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.
Open-source, local-first Claude Code plugin for token reduction, context compression, and cost optimization using hybrid RAG retrieval (BM25 + vector search), reranking, AST-aware chunking, and compact context packets.
Persistent local memory for Claude Code. Cross-session recall with vector search, automatic archiving, zero cloud dependencies.
Opus 4.8-aware context optimization: silent-by-default hooks, honest NET token savings, big-file map-then-load, Context Control Center, per-task tracking, prompt coach