Context Mode
Context Mode is a control plane between AI coding agents and model APIs. It folds tool output before the model reads it, archives full output, persists memory and skills across sessions, and enforces rules for commands and file reads.
Visit mksglu/context-modeOverview
Context Mode is a control plane that sits between AI coding agents and model APIs. It acts before requests go out, before tool calls run, and when results return, aiming to lower request costs, carry session memory across agents and machines, and enforce rules over what agents may run, read and fetch.
Key Features
- Folds test, build, log and large tool output before the model reads it while keeping the full output in an archive.
- Runs scripts so only the answer returns to the model, and trims tool schemas.
- Maintains active context with recent work unchanged and an index of older work.
- Shares memory facts and skills across agents and machines, with session resume.
- Protect checks commands, file reads, web fetches and tool-server calls against team rules before execution.
- The console shows tokens, cost, savings and blocks for each request.
Use Cases
- Reducing model costs for long agentic coding sessions and test-fix loops.
- Handling large logs, JSON files and API responses without sending entire outputs to the model.
- Continuing long sessions after pauses or on another machine without compaction.
- Blocking access to environment files, protected branches, destructive commands and restricted sites.
Getting Started
- Run npx @context-mode/cli; it signs you in, asks which agents to connect, and keeps a backup of each file.
- Restart your agent and start a new session.
- Use the console to watch tokens, cost, saving and blocks for every request.
- To leave, run npx @context-mode/cli disconnect.
Deployment & Requirements
- Your own Anthropic or OpenAI account pays the model; Context Mode adds no fee on tokens.
- The CLI connects Claude Code and Codex by changing the base URL and writing configuration files.
- Enterprise can run on Context Mode cloud, a dedicated instance, or the customer's own Cloudflare account.
Before You Adopt
- License: Other. Review its terms before using, modifying, or distributing the project.
- Protect examines the tool call rather than the program, so script files or compiled programs can bypass its checks; the agent sandbox should stay on.
- Model usage remains billed to the user's own Anthropic or OpenAI account.
- Published benchmark comparisons include Claude Code on Opus 5.5, and no Codex benchmark figure is provided.