# Context Mode > Context Mode is a gateway between Claude Code or Codex and the model API. It folds tool output the first time the model sees it, checks tool calls against your rules, and shows what every request cost. Three products. Context Mode is the hosted control plane between coding agents and models. Start free: 1,000 requests, every feature, no card; then Starter, Pro, Team or Enterprise (https://contextmode.ai/pricing.md). Your own Claude or OpenAI account pays the model. Context Mode Engine is the free context-mode plugin under the Elastic License 2.0, and runs on your machine. Context Mode Insight shows how a team works with AI coding agents, from Engine events. Every page below is Markdown: the same text as the HTML page at the URL without .md. All of it in one file: https://contextmode.ai/llms-full.txt When to use Context Mode: connect a coding agent to it when Claude Code or Codex runs up token cost on large tool output, loses earlier work when a long session compacts, forgets facts between sessions, or needs risky tool calls checked before they run. How an agent calls it: one command, npx @context-mode/cli, connects Claude Code or Codex, and every request then routes through the gateway at gateway.context-mode.com while the agent keeps its own model and provider account. Set it up from https://contextmode.ai/docs/quick-start.md and see every command at https://contextmode.ai/docs/cli.md. Skip it for a one-off chat with no tools and no project to remember. Developer resources: Context Mode has no public REST API of its own and no SDK; agents reach it as a model base URL. Connection and authentication (the base URL https://gateway.context-mode.com, the x-cm-device-key header and the device key) are in the CLI reference at https://contextmode.ai/docs/cli.md. Protect rules and their API key limits are at https://contextmode.ai/docs/protect.md. Plans and limits are at https://contextmode.ai/docs/plans-and-limits.md. How to cite: give the page URL (the HTML page, not its .md copy) and the date. A page's last change date is its lastmod in https://contextmode.ai/sitemap.xml and its "Last changed" line in https://contextmode.ai/llms-full.txt. ## Context Mode - [Context Mode: The Control Plane for Coding Agents](https://contextmode.ai/index.md): The control plane between your coding agents and models. Spend less on context, remember across sessions, and run only what you allow. - [Pricing: Free, Starter, Pro, Team and Enterprise](https://contextmode.ai/pricing.md): Start free with 1,000 requests, no card. Starter is $20 a month for 10,000 requests, Pro $49 for 50,000. More only with a budget you set. - [Context Mode docs: what it is and how it works](https://contextmode.ai/docs.md): Context Mode is a gateway between your coding agent, Claude Code or Codex, and the model. It folds tool output, keeps memory and checks every tool call. - [Quick start for Claude Code and Codex](https://contextmode.ai/docs/quick-start.md): One command signs you in and connects Claude Code and Codex. You keep your agent, your model and your provider account. - [Context Mode CLI for Claude Code and Codex](https://contextmode.ai/docs/cli.md): Every command of npx @context-mode/cli: sign in, set up Claude Code and Codex, check them, sign out, and disconnect. What it writes, and how to undo it. - [Why Claude Code uses so many tokens](https://contextmode.ai/docs/how-saving-works.md): Where an agent's tokens go: tool output, tool schemas and cache rewrites. What Context Mode folds, what it never touches, and 10 to 64% lower cost. - [Prompt caching in Claude Code and Codex](https://contextmode.ai/docs/prompt-caching.md): Why cache writes cost more than reads, what makes Claude Code write the same prompt again, and where Context Mode places cache marks. - [How Active Context works](https://contextmode.ai/docs/active-context.md): What happens at 89% and at 100% of your limit, what stays in the thread, what moves to the archive, and why 1M costs less than 200K. - [Recall docs: context window without compaction](https://contextmode.ai/docs/recall.md): How Recall keeps a long Claude Code or Codex session in full: recent work in view, an index, an exact archive, and search by id, words and time. - [Agent memory docs: facts with two clocks](https://contextmode.ai/docs/memory.md): How Context Mode keeps facts across sessions, closes a changed fact instead of deleting it, and how that compares with append-only and overwrite stores. - [Search docs: sessions and tool output](https://contextmode.ai/docs/search.md): Search Claude Code and Codex sessions in the console or from your agent, and read archived tool output back, with secrets and e-mail addresses masked. - [Session resume docs: claude --resume anywhere](https://contextmode.ai/docs/session-resume.md): How Context Mode keeps each conversation, and how one command rebuilds it as a native Claude Code or Codex session on any machine. - [Skills docs: one catalog for every agent](https://contextmode.ai/docs/skills.md): Import skills from GitHub once. The gateway keeps them for your account and loads the one that matches your message, in Claude Code and Codex. - [Protect docs: rules for coding agent tool calls](https://contextmode.ai/docs/protect.md): Protect rule types, presets, packs and enforcement for Claude Code and Codex. Each tool call is read by what it does, across 22 capabilities. - [How Instructions work](https://contextmode.ai/docs/instructions.md): Where to set Instructions, how they reach every Claude Code and Codex request, what they cost, and how they differ from Memory and CLAUDE.md. - [Plans and limits: Free, Starter, Pro and Team](https://contextmode.ai/docs/plans-and-limits.md): Start free: 1,000 requests, every feature, no card. What Starter, Pro and Team include, the pause at the limit, the budget, refunds. - [Claude Code cost benchmarks](https://contextmode.ai/docs/benchmarks.md): Pre-registered paired runs of Claude Code direct and through Context Mode. 65.5% lower cost on a long Opus 5.5 session, $7.20 to $2.49. ## Features - [Context Saving: cut Claude Code and Codex token costs](https://contextmode.ai/context-saving.md): Context Saving folds test, build and log output before the model reads it. Errors stay in full. A minitest fix loop cost 61% less, $0.157 to $0.061. - [Thinking in Code: code mode for coding agents](https://contextmode.ai/thinking-in-code.md): Your agent writes a short script and only what it prints reaches the model: a 7 MB document becomes 407 bytes. 64% lower cost on data analysis. - [Protect: block risky tool calls from coding agents](https://contextmode.ai/protect.md): Protect checks every Claude Code and Codex tool call before it runs: .env reads, pushes to main, rm -rf on your home folder. One policy for the whole org. - [Memory shared across Claude Code and Codex](https://contextmode.ai/memory.md): Facts learned from your sessions reach every agent, on any machine. A changed fact closes the old one: 0 of 24 memory blocks held a stale value. - [Recall: long coding agent sessions, no compaction](https://contextmode.ai/recall.md): The model gets your recent work and an index of the rest, so a long session never compacts: 37.6% lower cost, 9 of 10 early details answered exactly. - [Instructions for Claude Code and Codex](https://contextmode.ai/instructions.md): Rules you write once in Settings, added to every Claude Code and Codex request on every machine. Unlike Memory, they change only when you edit them. - [Active Context for Claude Code and Codex](https://contextmode.ai/active-context.md): Set how much history Claude Code and Codex send to the model: 200K, 500K or 1M tokens. Older turns move to a searchable archive. - [Skills: one catalog for Claude Code and Codex](https://contextmode.ai/skills.md): Import skills from a GitHub repo once. The one that matches your message loads in any agent, on any machine, and is named in the reply. - [Search every Claude Code and Codex session](https://contextmode.ai/search.md): Every prompt, command and tool output, from every agent and machine, in one search. Archived output reads back in full, with secrets masked. - [Resume Claude Code and Codex sessions anywhere](https://contextmode.ai/session-resume.md): One command rebuilds a conversation as a native Claude Code or Codex session on any machine. The command expires after 15 minutes. ## Guides - [How to reduce Claude Code costs](https://contextmode.ai/guides/reduce-claude-code-costs.md): Where Claude Code spends tokens and how to cut them. Through Context Mode, a long Claude Code session on Opus 5.5 cost 65.5% less, $7.20 to $2.49. - [What is a coding agent gateway?](https://contextmode.ai/guides/what-is-a-coding-agent-gateway.md): A coding agent gateway sits between Claude Code or Codex and the model API. It changes what the model reads and checks tool calls, not just routes them. ## Solutions - [Solutions: spend less on agents and control them](https://contextmode.ai/solutions.md): Start from your goal or your team: cut agent spend, keep context across sessions, stop risky tool calls, and give everyone one policy. - [Audit what your coding agents ran and what was blocked](https://contextmode.ai/solutions/agent-visibility.md): An audit log of every tool call Protect blocked, with no command text, and a rule history in a hash chain. Keep the log 1 to 365 days, then export it. - [Cut coding agent cost: send the model fewer tokens](https://contextmode.ai/solutions/cut-agent-spend.md): Your agent sends the same logs and files to the model on every call. Context Mode sends fewer tokens: one long session cost 65.5% less. - [A smaller coding agent bill, and an agent that remembers](https://contextmode.ai/solutions/developers.md): Keep your agent and your model. Context Mode sends the model the failing test, not the ones that passed, and keeps your early details all day. - [Manage coding agent costs across your team](https://contextmode.ai/solutions/engineering-leaders.md): See each agent request's tokens, cost and saving, send the model less, and put the team on one pool, one budget and one bill for Context Mode. - [One policy for every coding agent in the enterprise](https://contextmode.ai/solutions/enterprise.md): One Protect policy for every engineer's agents, and no agent can loosen it. Yearly contract: our cloud, a dedicated instance or your Cloudflare account. - [Long agent sessions without a full context window](https://contextmode.ai/solutions/long-sessions.md): Your context window fills and your agent compacts. Recall archives older work word for word: no compactions, 37.6% lower cost in a paired run. - [Give every machine the same agent setup](https://contextmode.ai/solutions/platform-teams.md): For platform and DevEx teams: connect each machine with one command, check it from a script, roll it back, and hold one Protect policy on Team. - [Guardrails for coding agents with shell access](https://contextmode.ai/solutions/secure-coding-agents.md): Your agent has your terminal. Protect checks each tool call against the rules you pick before it runs, and the model reads why a call was blocked. - [Agent shell policy for security teams, enforced and audited](https://contextmode.ai/solutions/security-teams.md): One agent policy on the gateway, outside the model. Watch first, then block, with a decision log and policy history you can show an auditor. - [Stop re-explaining your project to coding agents](https://contextmode.ai/solutions/shared-context.md): Your agent forgets your project each session, machine and agent. Memory, Session resume and Search give it the current facts: 262 to 41 memory tokens. - [AI coding agents for startups: one bill, one policy](https://contextmode.ai/solutions/startups.md): One bill to the team owner and one pool of requests for the team. Each account starts with 1,000 free requests and every feature, no card. - [Agent standards that hold on every machine](https://contextmode.ai/solutions/team-standards.md): Set skills, instructions and Protect rules once on the gateway. On Team, one Protect policy covers every member, and History shows each change. ## Use cases - [Use cases: one coding agent problem per page](https://contextmode.ai/use-cases.md): Real coding agent problems, each with its fix: test output, large files, long sessions, lost context, .env reads, pushes to main and more. - [Make your coding agents follow your rules](https://contextmode.ai/use-cases/agent-rules.md): Stop pasting the same rules into each session. Write custom instructions once, 4,096 characters at most. Your connected agents use them on every machine. - [See where your coding agent spend goes](https://contextmode.ai/use-cases/agent-spend-tracking.md): See tokens, cost and saving for each agent request, by session, project and agent. A request gets a dollar figure only within 5% of the provider's count. - [Hour by hour: one agent session with no compaction](https://contextmode.ai/use-cases/all-day-session.md): Follow one workday. Recall keeps the morning's rules and test output word for word, so at hour six the agent fetches them and does not ask again. - [Analyze a large JSON file without filling the window](https://contextmode.ai/use-cases/analyze-large-files.md): Your agent writes a short script and only its answer reaches the model. A 7 MB file became 407 bytes, and data analysis cost 64% less on Haiku 4.5. - [Block destructive commands from your coding agent](https://contextmode.ai/use-cases/block-destructive-commands.md): One wrong rm -rf or terraform destroy can cost you a day. Protect checks each agent call before it runs, through sudo, sh -c and about 130 other wrappers. - [Stop your coding agent from reading .env files](https://contextmode.ai/use-cases/block-env-secrets.md): Your agent can cat .env and send your keys to the model. Protect checks each tool call and refuses the read before it runs. - [Control which sites your coding agent can reach](https://contextmode.ai/use-cases/control-agent-network.md): Your agent can send code to a paste site in a URL. Protect blocks 19 known paste and drop sites, reads nested URLs, and can refuse hosts not on your list. - [Fix a failing test without paying for the passing ones](https://contextmode.ai/use-cases/failing-test-output.md): Your coding agent runs 600 tests and 1 fails. Context Mode sends the model the failure, not the 599 passes. You pay tokens for 1.2 KB, not 17.0 KB. - [Set up a new engineer's agent on day one](https://contextmode.ai/use-cases/onboard-new-engineer.md): A new engineer's agent starts with nothing. On day one, import the team skills, paste the rules and share the facts once. Every machine then has them. - [Prompt caching: why fewer agent tokens can cost more](https://contextmode.ai/use-cases/prompt-cache.md): Cutting tokens can break the prompt cache and raise your bill. Context Mode trims once and sends the same bytes each turn, so the cache stays warm. - [Stop your coding agent from pushing to main](https://contextmode.ai/use-cases/protect-main-branch.md): Block agent pushes to main and every force push. Protect checks each git push before it runs, and branch pushes still go through. - [Resume a coding agent session on another machine](https://contextmode.ai/use-cases/resume-on-another-machine.md): Started on your laptop, now at your desktop? One command rebuilds the session there, with the latest 200 messages, and your agent's own resume opens it. - [Search your coding agent history in one place](https://contextmode.ai/use-cases/search-past-sessions.md): Fixed a bug last week but lost the session? Type one word and find the prompt, command and output from any machine. Your agent can read it back too. - [Share agent skills across your team](https://contextmode.ai/use-cases/share-skills.md): Each engineer imports the team's skill repo once. The right skill loads on any of their machines, named in the reply: 10 of 10 on a small offline test. - [One agent policy for your engineering team](https://contextmode.ai/use-cases/team-agent-policy.md): Each engineer sets their own agent permissions. Protect gives the org one policy that agents cannot loosen. Try rules in Monitor first, then block. ## Blog - [Engineering blog](https://contextmode.ai/blog.md): How Context Mode is built, what changed, and what we measured: engineering posts on the control plane between coding agents and models. - [Worker exceeded memory limit: 18 days on Cloudflare Workers](https://contextmode.ai/blog/workers-memory-limit.md): Agent sessions sent 36 MB per turn and killed 128 MB Worker isolates. The causes, the move to Rust and Wasm, and killed requests from 35.2 an hour to 0. - [One night with Cloudflare's on-demand Workers profiling](https://contextmode.ai/blog/cloudflare-on-demand-profiling.md): We profiled our live Worker and single Durable Objects with Cloudflare's new profiler, and overload errors fell from 29 in 30 minutes to 0. - [Wrong skills, noisy memory, false resumes: the fixes behind them](https://contextmode.ai/blog/why-we-moved-decisions-to-clef.md): We moved skill choice, the memory filter and the resume check to Clef decision models. Offline: the right skill 9 or 10 times in 10, not 4. - [The right skill on the right turn, or none at all](https://contextmode.ai/blog/the-right-skill-at-the-right-time.md): Skills help only when the right one loads. Context Mode asks Cloudflare Clef to pick from your catalog, or pick none: 4 of 10 right became 10 of 10. - [Agent memory that knows when a fact changed](https://contextmode.ai/blog/memory-with-two-clocks.md): Context Mode memory keeps each fact with two clocks and closes old values. In an offline eval, memory tokens per new conversation fell from 262 to 41. - [All-day agent sessions without compaction: how Recall works](https://contextmode.ai/blog/recall-all-day-sessions-without-compaction.md): Recall moves older work into an exact archive, not a summary. In a pre-registered A/B: 0 compactions, 9 of 10 early details exact, 37.6% lower cost. - [Your agent pays for the same test log on every call](https://contextmode.ai/blog/where-your-agent-tokens-go.md): Coding agents resend every tool result on every call. Context Mode folds a 17 KB test log to 1.2 KB and cut a 30-step session from $7.20 to $2.49. - [Why 39% fewer tokens cost us 149.6% more, and what we changed](https://contextmode.ai/blog/token-optimization-beyond-caching.md): We cut prompt tokens 39% and cost rose 149.6%: on Opus 5.5 a cache write costs 40 times a read. How we trim tool schemas and keep the prefix still. - [Rules your coding agent cannot rename its way around](https://contextmode.ai/blog/protect-rules-for-coding-agents.md): Protect reads what each agent tool call does, not its name, so .env reads, pushes to main and rm -rf ~ are refused. 126 of 126 production checks pass. - [How we prove Context Mode does not break your coding agent](https://contextmode.ai/blog/how-we-test-a-gateway-for-two-coding-agents.md): We test Context Mode with the real agent clients: 21 of 21 scenarios pass on each, and 496 plan-state cells per agent show 0 failures. - [What happens when your plan runs out: your agent keeps working](https://contextmode.ai/blog/what-happens-when-your-plan-runs-out.md): When your Context Mode requests run out, your agent keeps working as plain Claude Code or Codex. 496 feature and state cells per agent: 0 wrong. - [Durable Objects in production: 14 lessons from Slipstream](https://contextmode.ai/blog/durable-objects-in-production.md): What rebuilding a request path on Durable Objects taught us: idle wake from 394 ms to 113 ms, the six-call limit, an RPC trap, partial indexes. - [Slipstream: a shorter path from your agent to the model](https://contextmode.ai/blog/slipstream.md): Slipstream, the new Context Mode request path: at most 2 store calls before the model call, not 14 to 22, and an idle memory store in 113 ms, not 394 ms. ## Context Mode Engine - [Context Mode Engine: free context window plugin](https://contextmode.ai/engine.md): The free context-mode plugin. A sandbox and index on your machine keep raw tool output out of the context window, in 18 AI coding tools, no account. ## Context Mode Insight - [Context Mode Insight: AI coding agent analytics](https://contextmode.ai/insight.md): See how an engineering team works with AI coding agents, from free Context Mode Engine events, in a dashboard or through 13 MCP tools. ## Other pages - [Context Mode brand and design system](https://contextmode.ai/brand.md): The Context Mode logo, colors, type, layout, components, voice and motion, with exact values, a tokens file and logo downloads. - [About Context Mode and MKSF LTD](https://contextmode.ai/about.md): Context Mode is the control plane between coding agents and models, built by MKSF LTD in London. What we make and how we back every claim. - [Contact the Context Mode team](https://contextmode.ai/contact.md): Reach the Context Mode team by e-mail at sales@context-mode.com, on GitHub, or through the console. Our company and registered address. - [Privacy at Context Mode: your data](https://contextmode.ai/privacy.md): What data Context Mode handles when you connect Claude Code or Codex, the Engine and Insight exception, and how to reach us about your data. ## Evidence - [Launch benchmark: the full table](https://contextmode.ai/benchmarks/full.md): The workloads measured on 2026-09-29 where cost was lower, each with a published evidence file: its pairs, 95% range, verdict and evidence. - [Benchmark evidence index (JSON)](https://contextmode.ai/benchmarks/data/index.json): The launch benchmark's method, what was kept and removed, and every published evidence file with its pre-registration. - [Long session evidence index (JSON)](https://contextmode.ai/benchmarks/long-session/index.json): The long agentic coding session A/B of 2026-10-03 (Claude Code, Opus 5.5, 1M window, 4 pairs) and its amendment 4: every JSON file, as committed, test tenant ids withheld. - [Recall evidence index (JSON)](https://contextmode.ai/benchmarks/recall/index.json): Recall, 2026-10-03 and 2026-10-04: the long session A/B on a 200K window (37.6% lower cost, 9 of 10 exact answers against 4 of 10, 0 compactions against 3), the offline quality replays, the live client checks and the read-speed figures. Every JSON file, as committed, tenant ids withheld. ## Optional - [Context Mode compared with other coding agent tools](https://contextmode.ai/docs/landscape.md): Context Mode next to built-in agent features, token optimizers, LLM gateways, agent firewalls and memory tools: what each does, with sources. - [Pre-registration: Opus 5.5 short tasks (v3)](https://contextmode.ai/benchmarks/prereg/v3-opus55-short-prereg.md): The pre-registered plan for the Opus 5.5 short tasks (v3) benchmark run, committed before its first pair. - [Pre-registration: Opus 5.5 multi-agent and data analysis (v4)](https://contextmode.ai/benchmarks/prereg/v4-opus55-prereg.md): The pre-registered plan for the Opus 5.5 multi-agent and data analysis (v4) benchmark run, committed before its first pair. - [Pre-registration: Opus 5.5 test loops and data analysis (final)](https://contextmode.ai/benchmarks/prereg/final-opus55-tests-W3-minitest-W4-prereg.md): The pre-registered plan for the Opus 5.5 test loops and data analysis (final) benchmark run, committed before its first pair. - [Pre-registration: Haiku 4.5 (final)](https://contextmode.ai/benchmarks/prereg/final-haiku45-prereg.md): The pre-registered plan for the Haiku 4.5 (final) benchmark run, committed before its first pair.