Security at Context Mode
Your developers' coding agents run shell commands, read files and send code to a model. Context Mode is the gateway on that path. It blocks a destructive command before it runs, keeps each account's data in that account's own stores, and gives Standard a 99.9% monthly uptime SLA. Each fact on this page comes from the gateway's code.
Key facts
- Command control
- Protect checks each shell command, file read, web fetch and tool-server call from Claude Code and Codex before it runs. A blocked call does not reach the shell.
- Data isolation
- Each account has its own stores on Cloudflare. A request reaches the stores of its own account and no other.
- Retention
- Recall archive: 7 days on Free, 30 days on a paid plan. Usage rows: 90 days. You set how long Protect events stay, from 1 to 365 days. Imported session history has no end date.
- Encryption at rest
- Cloudflare encrypts all stored data with AES-256 in Durable Objects, R2 and Workers KV.
- Training
- The gateway has no training or fine-tuning step. Cloudflare does not use content processed by Workers AI to train AI models.
- Keys
- The gateway stores your device key as a SHA-256 hash, never the key. It reads the key's record on each request.
- Uptime
- Standard has a 99.9% monthly uptime SLA with service credits.
- Erase
- On request. This page lists each store the erase route clears.
- Contact
- security@contextmode.ai
Protect: a control on what your agents run
An agent can run git push --force, terraform destroy or rm -rf ~ during a task. Protect reads each tool call on the gateway before your terminal runs it. In Claude Code and Codex, a blocked call does not reach the shell, and the model reads why.
- It reads what a call does. Protect reads through
sudo,sh -c,xargsand 130 other wrappers. A wrapped command meets the same rule as the bare command. - The Balanced preset covers the losses you cannot undo. It blocks
git push --force, a push tomain,terraform destroy,git reset --hard,rm -rfof the home folder, and a read of.envor a credential file. You pick the preset in the console, and you add your own rules for sites, commands, scripts, files and tool servers. - One policy for the team. On Standard, the team sets the rules once. Every member's Claude Code and Codex follow them, on every machine. An agent cannot loosen the policy. An API key can only tighten it, and a change that loosens it needs a person and a reason.
- A record for your auditor. Each decision goes to a log with the rule, the tool and the program, and never the command text. You export the log as CSV or JSON Lines. Each rule change goes to a hash-chained history, and Verify record checks the chain.
- Tested in real sessions. 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. The steps are in the Protect docs. - It stays on. Core protections stay on when your requests run out.
Protect reads the call before it runs. Keep your agent's sandbox on as the second layer.
Data flow
Your coding agent sends each request to the Context Mode gateway. The gateway folds tool output, adds memory, checks tool calls against your Protect rules, and sends the request on to the model provider. The answer comes back the same way.
ANTHROPIC_BASE_URL for Claude Code, a context-mode model provider for Codex. Each request carries your device key.api.anthropic.com, api.openai.com or chatgpt.com. The credential your agent sends picks the host: an Anthropic key goes to Anthropic. Your own provider account pays the model.The gateway's own model work (what to remember, recall ranking, search vectors) runs on Cloudflare Workers AI, on the same platform as the gateway. Cloudflare does not use content processed by Workers AI to train AI models, and it processes that content only for as long as the request needs (Workers AI data usage). The gateway has no training or fine-tuning step. It forwards your requests to Anthropic or OpenAI as your own calls, and your terms with that provider apply to them.
You stay in control of the path: npx @context-mode/cli disconnect takes the gateway out, and your agents then talk to Anthropic and OpenAI directly.
Encryption in transit, encryption at rest, and keys
- Agent to gateway. Your agent reaches the gateway over HTTPS, at
https://gateway.contextmode.ai. - Gateway to model. The gateway reaches each model provider over HTTPS.
- At rest. Cloudflare encrypts all stored data at rest with AES-256. This covers every store the gateway uses: Durable Objects, R2 and Workers KV.
- Device keys. A device key is 32 random bytes. The gateway stores its SHA-256 hash, and the hash is the form it compares. The raw key is never stored and never logged.
- The key stays with us. The gateway removes the device key from the request before it forwards the request to the model provider.
- Revoke. The registry writes a revoke before it answers, and the gateway reads the key's record on each request.
What the gateway stores, where, and for how long
Each account has its own stores. Your memory store, your session store and your request counter are each a separate Cloudflare Durable Object, named by your account. Larger bodies go to Cloudflare R2 under your account's own prefix. Device keys are read from Cloudflare Workers KV.
Region. Your stores are created in Cloudflare's Eastern Europe region, close to the gateway in Frankfurt.
| Data | Where | How long |
|---|---|---|
| Recall archive, prompts and episodes | Your memory store (Durable Object). A prompt over 24 KB keeps its text in R2. | 7 days on Free, 30 days on a paid plan. A daily run deletes older rows. |
| Memory facts, skills and settings | Your memory store (Durable Object) | Until you delete them or we erase your account |
| Usage rows and insight events | Your memory store (Durable Object) | 90 days |
| Per-request savings rows and session totals | Your memory store (Durable Object) | Until we erase your account |
| Diagnostic records of oversize requests | Your memory store (Durable Object) | 7 days |
| Sessions and transcripts | Your session store (Durable Object). Imported history moves to R2. | The last 200 live turns per project and worktree; older turns become short summaries. Imported history has no end date: no timed run deletes it. |
| Protect rules and their change log | Your session store (Durable Object). The change log is append-only and hash-chained. | Until you change them or we erase your account |
| Protect events (each allow or block) | Your session store (Durable Object). Decision fields only, never the command text. | Protect events: 30 days by default. You can set 1 to 365 days. |
| Device keys and sign-out markers | The account registry. Device keys are SHA-256 hashes. The gateway reads them from Workers KV. | Until we erase your account |
Each memory fact goes through a secret redactor before the gateway stores it. Archived tool output is read back with secrets and e-mail addresses masked.
Who can read it, and how access is controlled
- You. Your device key and your console session reach your own stores only. Store names come from your account, so no request can name another account's store.
- Your team, on Standard. Each member keeps their own memory, recall, sessions and skills. The team shares three things: the request pool, the bill and the team Protect rules.
- The Context Mode owner (MKSF LTD). Admin routes need the admin key on an owner identity. A customer session that carries the key stays a customer.
- The owner's usage view shows names, on or off states, counts and times. It never shows a rule pattern, a command or a prompt.
- Sign-in. You sign in with Google or GitHub. We receive your name and e-mail address from them.
Subprocessors
| Company | What for |
|---|---|
| Cloudflare | The gateway (Workers), every store (Durable Objects, R2, KV), the gateway's own model work (Workers AI) and account email |
| Stripe | Payments, invoices and the billing portal |
| Resend | Email to your account address |
| Anthropic, OpenAI | The model providers your agent calls, on your own account |
| Google, GitHub | Sign-in only: your name and e-mail address |
Uptime: a 99.9% SLA on Standard
Standard has a 99.9% monthly uptime SLA for the gateway request path. When a month is below that level, your team gets a service credit on that month's fee.
| Monthly uptime | Service credit |
|---|---|
| Below 99.9% | 10% of that month's fee |
| Below 99.0% | 25% of that month's fee |
| Below 95.0% | 50% of that month's fee |
The team admin claims the credit by email within 30 days. Live status and history are at status.contextmode.ai.
How the gateway behaves under failure
- Protect fails closed. If your rule store does not answer, the gateway uses the last rules it read for your account, or else the default rules. It never falls back to allow everything.
- Rule changes apply at once. A rule you save applies to every request that starts after the save.
- The request counter fails open. If the counter does not answer within 150 ms, the request goes through, so a slow counter does not stop your developers. An account the gateway already knows is at its Free limit stays locked.
- Provider errors do not count. A request the model provider refuses with an error does not count against your requests.
- You keep a direct path. One command,
npx @context-mode/cli disconnect, takes the gateway out of the path. Your agents then talk to the provider directly. - Disconnect leaves a record. A developer who runs disconnect leaves the team's path and its rules. Each disconnect that reaches the gateway writes one record to the account registry: the account, the agents, the reason and the CLI version. Context Mode reads that record.
Erase on request
Write to us and we run the owner-only erase route, /__admin-erase-tenant, for your account. It needs the admin key, and the request must repeat the account id to confirm. A dry run counts the rows and deletes nothing. In order, the route erases:
- your memory store: memory, recall, prompts and the knowledge base, then every other table, including usage and savings rows;
- your session store: sessions, workspaces and transcripts;
- every topic store of your account;
- your registry rows: device keys, credential bindings, CLI events, the email log and checkouts.
The account row stays without your address: the address becomes a SHA-256 hash, the account is turned off, and the address is taken off all mail.
Report a vulnerability
Security contact: security@contextmode.ai. Write to security@contextmode.ai with the steps to reproduce and what you saw. Test only against your own account and data.
Compliance documents, questionnaire and DPA
Compliance documents and the security questionnaire: on request, through Talk to us. DPA: on request, through Talk to us. Talk to us.
Context Mode is operated by MKSF LTD, London, United Kingdom.
Choose Context Mode when …
- Your developers' agents run commands on machines that reach production, and you want one policy that every agent follows before a command runs.
- You must show an auditor what the agents tried and which rule answered, with no command text in the record.
- You want each developer's memory and sessions in that developer's own stores, with a known retention time for each kind of data.
- You need an uptime level in writing: 99.9% a month on Standard, with service credits.
Standard is one plan for the whole team: one request pool, team Protect rules and the 99.9% SLA. The price is on Pricing.