Gateway

Engine and Gateway: how they fit together

Context Mode Engine is complete on its own. It works on tool output, on your machine, at zero cost. Context Mode Gateway is an optional hosted service that applies the same idea to the whole conversation and to every agent you connect. You can use the Engine alone, or add the Gateway next to it.

Free · Local · Private · Forever

Context Mode Engine is source-available under the Elastic License 2.0. Free to use, for all time. It runs on your machine and keeps your data in ~/.context-mode.

Key facts

What it is
Two products with one idea: keep large text out of the model's view and let the agent read it back on demand.
Who it is for
Anyone who asks, "When does the Gateway help?" The Engine handles tool output by itself, free and local. The Gateway helps on long sessions, and you add it only if you want it.
Agents
The Engine works in ten agents: Claude Code, Codex, Gemini CLI, Qwen Code, Copilot CLI, VS Code, Kiro, ZCode, OpenCode and Pi.
Measured result
Two scopes, two units: the Engine counts bytes per tool output (median of 5 runs, benchmarks). The Gateway counts model use per session, with the raw data on its own pages.
Scope
The Engine works on tool output in each agent on your machine. The Gateway works on each request between the agent and the model API.

When does the Gateway help?

You installed Context Mode Engine. Your agent reads short replies in place of large tool output. Then you see a second name, Context Mode Gateway, and you ask when it helps. The short answer: the Engine does its work by itself, and it stays free and local. The Gateway helps when you run long sessions, and you pay for it only if you choose to add it.

One idea, two scopes

Both products follow one idea. Large text stays outside the model's view, and the agent reads back the part it needs.

Side by side

QuestionContext Mode EngineContext Mode Gateway
Where it runsOn your machine, as hooks, an MCP server and a SQLite index inside your agentHosted on Cloudflare, between your agent and the model API
What it works onTool output in the agent where you install itThe whole conversation, for every agent you connect
Where requests goFrom your agent to the model API, as beforeEvery model request passes through the hosted Gateway server on its way to Anthropic or OpenAI. Your prompts, the agent's replies and tool output go to the Gateway
What data it keepsAll of it in ~/.context-mode, one context.db per project, on your machineA store for your account on Cloudflare. It keeps: older turns and full tool output in the archive, for 30, 90 or 365 days or forever, as you choose (default 90 days); your messages and replies (first 6,000 characters of each block) and each tool call with its input, for Search, until you ask for deletion; facts for Memory, one store per account. Before storage, the Gateway masks secrets and e-mail addresses. For Memory, it sends the first 4,000 characters of each turn to Llama 3.3 70B on Cloudflare Workers AI. Details: Recall privacy, Search, Memory
How you get itFree, under the Elastic License 2.0. Install it with your agent's own commandAn optional hosted service. Connect it from an account, next to the Engine. Read about it on the contextmode.ai page for the Gateway

Use both together

The two work side by side. Keep the Engine installed in each agent: it stays free and local, and it keeps working on tool output. If you add the Gateway, it works on the requests that the agent sends to the model. Each one does its own part.

To install the Engine, use your agent's own install command on Install Context Mode Engine in your agent.

What you get

With the Engine alone, your agent reads short replies, and every byte stays on your machine. If you add the Gateway, the same idea reaches the whole conversation, for every agent you connect. Start with the Engine; add the Gateway when long sessions or several agents call for it.

Prompts to give your agent

Prompt
Explain the difference between Context Mode Engine and Context Mode Gateway in three sentences.

Get started free

Context Mode Gateway: your coding agent costs less and remembers your project. Context Mode Engine installs from your terminal.

After you sign in, the console gives you one command to connect your coding agent.

Read the docs