Context Mode sits between your coding agents and the model. Each request costs less, sessions carry what they learned, and your rules decide what runs.
npx @context-mode/cli1,000 requests free, every feature, no card. Works with Claude Code, Codex, OpenCode, Pi and their desktop apps. Set up your app
From the team behind the free Context Mode Engine: 33K GitHub stars
600 tests, 1 to fix17.0 KB → 1.2 KBfoldedcat .envstopped before the shellblocked2 h laterpicked up, full historyrecalled7 MB registry file407 B back to the modelin codegit push origin mainprotected branchblockeddeploy target?Render, not Hetznerrememberedturn this plan into ticketsto-tickets loadedskillContext Mode acts at three points on each request: before it goes out, before a tool runs, and when a result comes back.
Your agent runs 600 tests. 1 fails.
Sent to the model
Kept in your archive
Your agent reads an API response with 800 orders.
Sent to the model
Kept in your archive
One session, 30 steps. Tokens sent on each call.
Sent to the model
Kept in your archive
Tool output is folded before the model reads it. The full output is archived.
Features Context Saving → Thinking in Code → Active Context → Prompt caching → How saving works →| Fact | Value | Valid from | Until |
|---|---|---|---|
production deployed_to | Hetzner Cloud, Falkenstein | 21:14:38 | 21:15:09 |
production deployed_to | Render, Oregon region | 21:15:09 | now |
The old value closes. Every agent gets the new one.
Older work goes to the archive, word for word.
⚡ context-mode · picked up after a 2 h pause, full history kept
⏺ context-mode · skill to-tickets auto-loaded
Matched on name and description. One skill per turn.
Sessions don’t compact. Facts and skills carry across agents and machines.
Features Recall → Memory → Skills → Search → Session resume →.env and .env.*. Examples and templates are allowed.
⛔ context-mode Cage blocked this command, so it was NOT executed:
Blocked by your team’s policy: Read environment files. .env files hold secrets.main, master, production and release/*.
⛔ context-mode Cage blocked this command, so it was NOT executed:
Blocked by your team’s policy: Push to protected branches. Protected branches change through reviewed pull requests.Read through sudo, sh -c and about 130 other wrappers.
The inner host is checked too.
A project folder is fine. Only losses you can't undo are blocked.
Nothing is blocked until you choose rules.
Rules for what agents may run, read and fetch. Nothing is blocked until you choose them.
Features Protect → Rules and presets → Instructions →Claude Code on Opus 5.5. Each task ran direct to Anthropic and through Context Mode, back to back. Cost at API list price.
Every pair counts. No figure for Codex yet. Method, 95% ranges and Haiku 4.5 →
Add two env lines to the job that runs your agent. Same agent, same prompt, same model. Pick a job, set your runs, see the saving.
22.8% lower cost per run
A test fails on a pull request. The agent reads the logs, finds the cause and pushes a fix.
Sonnet 5.5 · 16 tasks · 95% range 11.6 to 32.2% · proof
Each month is the runs you set times the measured cost per run.
Works with Claude Code, Claude Desktop, Codex, Codex Desktop, T3 Code, OpenCode and Pi. Install your app the way its makers say. Then one command signs you in, finds it, and shows each change before it writes. Your own model account still pays the model.
Use its makers’ own install. Pick your app to see how its makers install it.
It signs you in, asks which apps to connect, and keeps a backup of each file.
npx @context-mode/cliStart a new session. Work as before. The console shows tokens, cost and saving for every request. Open the console →
1 Install Claude Code from its makers: Claude Code setup →
2 Connect Context Mode
npx @context-mode/cli setup --agent claudeWrites ~/.claude/settings.json
You need Your Claude login, a subscription or an API key. Restart Claude Code.
1 Install Claude Desktop from its makers: Download Claude →
2 Connect Context Mode
npx @context-mode/cli setup --agent claude-desktopWrites Developer → Configure Third-Party Inference… (an entry named contextmode)
You need Quit the app fully (Cmd+Q) and open it again. The Code and Cowork tabs go through Context Mode.
1 Install Codex from its makers: Codex CLI →
2 Connect Context Mode
npx @context-mode/cli setup --agent codexWrites ~/.codex/config.toml
You need Your Codex login: ChatGPT, or an API key stored with codex login --with-api-key. A key that is only exported in your shell is not sent.
1 Install Codex Desktop from its makers: ChatGPT desktop app for macOS and Linux →
winget install --id 9PLM9XGG6VKS -s msstoreWindows2 Connect Context Mode
npx @context-mode/cli setup --agent codex-desktopWrites ~/.codex/config.toml (the same file as the Codex CLI)
You need Your Codex login. Quit the app fully (Cmd+Q) and open it again.
1 Install T3 Code from its makers: T3 Code install docs →
brew install --cask t3-codedesktop app, macOScurl -fsSL https://t3.codes/install.sh | shCLI, macOS and Linuxwinget install T3Tools.T3CodeWindows2 Connect Context Mode
npx @context-mode/cli setup --agent t3codeWrites ~/.claude/settings.json and ~/.codex/config.toml
You need T3 Code runs the Claude Code and Codex you have, with their logins. In Settings → Providers, keep CODEX_HOME at ~/.codex and leave Shadow home empty.
1 Install OpenCode from its makers: OpenCode docs →
curl -fsSL https://opencode.ai/install | bashnpm install -g opencode-aibrew install anomalyco/tap/opencode2 Store your API key with OpenCode’s own login
opencode auth loginpick Anthropic, or set ANTHROPIC_API_KEY3 Connect Context Mode
npx @context-mode/cli setup --agent opencodeWrites ~/.config/opencode/opencode.json
You need Your own Anthropic API key. OpenCode has no Claude sign-in, so a Claude subscription does not work here. No key is written to the file.
1 Install Pi from its makers: Pi on GitHub →
npm install -g @earendil-works/pi-coding-agentcurl -fsSL https://pi.dev/install.sh | sh2 Store your API key
Start pi, then type /login in Pi, not in your shell. Or set ANTHROPIC_API_KEY or OPENAI_API_KEY.
3 Connect Context Mode
npx @context-mode/cli setup --agent piWrites ~/.pi/agent/models.json
You need Your own Anthropic or OpenAI API key. A Claude subscription does not go through Pi. If you use one, setup sets only OpenAI.
npx @context-mode/cli disconnectQuick start →Protect checks every command, file read, web fetch and tool-server call from Claude Code and Codex before it runs. The hook stops a blocked call before your shell. In every plan, Free included. How Protect works →
npx @context-mode/cliOnly the base URL changes.
Nothing is blocked until you pick one.
The agent reads why a call was blocked. You see it in the log.
See before you rule.7 run
git push origin mainRunscat .envRunsrm -rf ~Runsterraform destroyRunsaws s3 rm s3://backups --recursiveRunsWebFetch example.comRunsnpm testRunsNothing is blocked. Activity lists the programs, sites and tool servers your agents used, each with Block and Allow.
Where most developers start.4 blocked · 1 logged · 2 run
git push origin mainBlockedPush to protected branchescat .envBlockedRead environment filesrm -rf ~BlockedCore protectionsterraform destroyBlockedDestroy infrastructureaws s3 rm s3://backups --recursiveLoggedChange cloud resourcesWebFetch example.comRunsOther sites allowednpm testRunsThe hook stops a blocked call before your shell: the agent reads the rule and why, and carries on. Logged means it ran, and the log says it would have been blocked.
For regulated teams and unattended agents.6 blocked · 1 run
git push origin mainBlockedPush to protected branchescat .envBlockedRead environment filesrm -rf ~BlockedCore protectionsterraform destroyBlockedDestroy infrastructureaws s3 rm s3://backups --recursiveBlockedChange cloud resourcesWebFetch example.comBlockedOnly sites on your listnpm testRunsOnly the sites and tool servers on your list are reached. Public package registries stay open.
Or write your own rules for sites, commands, scripts, files and tool servers, and test each one before you save it. Rule types →
For you Free · Pro, from $20 a month
For your team Team · Enterprise
Tested in real Claude Code sessions with Claude Opus 5.5 (2026-10-02) and Claude Haiku 4.5 (2026-10-04): every run blocked the push to main and the read of .env, and the work still shipped on a branch. Try it in 5 minutes →
Protect reads the call, not the program: a script file or a compiled program gets past it. Keep your agent’s sandbox on.
Context Mode Engine runs on your machine with ten coding agents. It keeps raw tool output in a local sandbox and index, so only the answer enters the context. The source is on GitHub, open to read.
~/.context-mode.33K GitHub stars and 718K npm downloads. Daily stats · Method and sources
Pick your agent to see its own install command.
Plugin. Context Mode installs with the agent's own plugin command.
Install
claude plugin marketplace add mksglu/context-mode
claude plugin install context-mode@context-modeCheck
/ctx-doctorUpdate
claude plugin update context-mode@context-modeRemove
context-mode setup --remove --agents claude-codeThe hook check passed on 2026-10-26 with Claude Code 2.1.309. Source: the install guide
Plugin. Context Mode installs with the agent's own plugin command.
Install
codex plugin marketplace add mksglu/context-mode
codex plugin add context-mode@context-modeNext, trust the hooks
npm i -g context-mode
context-mode setup --agents codexCheck
/ctx-doctorUpdate
codex plugin marketplace upgrade context-modeRemove
context-mode setup --remove --agents codexThe hook check passed on 2026-10-26 with Codex 0.164.0. Source: the install guide
Plugin. Context Mode installs with the agent's own plugin command.
Install
gemini extensions install https://github.com/mksglu/context-modeCheck
/ctx-doctorUpdate
gemini extensions update context-modeRemove
context-mode setup --remove --agents gemini
gemini extensions uninstall context-modeThe hook check passed on 2026-10-26 with Gemini CLI 0.65.0. Source: the install guide
Plugin. Context Mode installs with the agent's own plugin command.
Install
qwen extensions install https://github.com/mksglu/context-mode:context-modeCheck
/ctx-doctorUpdate
qwen extensions update context-modeRemove
context-mode setup --remove --agents qwen
qwen extensions uninstall context-modeThe hook check passed on 2026-10-26 with Qwen Code 0.26.1. Source: the install guide
Plugin inside the agent. The agent loads Context Mode as a plugin in its own process. Its tools come from that plugin.
Install
pi install npm:context-modeCheck
pi listUpdate
pi update --extensionsRemove
pi remove npm:context-modeThe hook check passed on 2026-10-26 with Pi 0.73.1. Source: the install guide
Plugin inside the agent. The agent loads Context Mode as a plugin in its own process. Its tools come from that plugin.
Install
opencode plugin add context-modeopencode plugin context-mode --globalCheck
/ctx-doctorUpdate
opencode plugin updateRemove
opencode plugin remove context-mode
context-mode setup --remove --agents opencodeThe hook check passed on 2026-10-26. Install and hooks are checked. The plugin's tool name gets its check in a live OpenCode session next. Source: the install guide
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents copilot-cliCheck
/ctx-doctorUpdate
context-mode upgradeRemove
context-mode setup --remove --agents copilot-cliThe hook check passed on 2026-10-26 with Copilot CLI 1.0.103. Source: the install guide
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents kiroCheck
/ctx-doctorUpdate
context-mode upgradeRemove
context-mode setup --remove --agents kiroChecked at hook setup on 2026-10-26. A live run in the host app comes next. Source: the install guide
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents vscodeCheck
/ctx-doctorUpdate
context-mode upgradeRemove
context-mode setup --remove --agents vscodeChecked at hook setup on 2026-10-26. A live run in the host app comes next. Source: the install guide
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents zcodeCheck
/ctx-doctorUpdate
context-mode upgradeRemove
context-mode setup --remove --agents zcodeThe hook check passed on 2026-10-26. Source: the install guide
Start free: 1,000 requests, every feature, no card. When you run out, nothing breaks.