Context Mode retweeted
Claude Code sends Anthropic Messages. Codex sends OpenAI Responses. Our gateway @contextmode runs one pipeline for both. The Worker translates a Codex turn to the Anthropic shape before the pipeline and back to Responses after it. How that works on Cloudflare:
Context Mode retweeted
The Context Mode gateway now loads at most one skill per turn and keeps it until the task ends. Clef on Workers AI picks it with one typed question. On 10 recorded turns where the old 70B judge and Clef disagreed, the 70B model was right on 4 and Clef on 10.
👀
context mode gateway roadmap for this month:
① dynamic routing
② self-hosted, on openorange by @rivet_dev
③ integrations
④ security through mcp
⑤ team velocity and team support
⑥ deltadb-style verification
⑦ self-hosted luau sandbox
⑧ goal: over 90% saving
⑨ enterprise
⑩ we will open source the gateway
@NathanFlurry openorange is how we plan to let teams run the gateway on their own servers.
how ④ ⑥ ⑦ work in the reply.
1
42
Context Mode retweeted
you can't clear the context when the context is the debug session.
claude code compacts it into a summary. early instructions can get lost.
4 steps (no bs):
① set your base url to the gateway
② passing tests fold, failures stay
③ full output archived
④ recall: it never compacts
@contextmode gateway. prove me wrong.
Context Mode retweeted
62 of 72 real agent incidents had no attacker. The agent did it alone.
That's the threat Protect is built for. Context Mode's gateway checks every Claude Code and Codex tool call against your team's policy before it runs, and logs every decision. The destroy never reaches your shell.
Turn your agent loose and try to get a drop table past it.
Your AI agent just wiped the database — and there was no hacker behind it. In 72 real incidents, 62 had no attacker at all.
That's what ROGUE-AI set out to prove. It rebuilds reported agent security incidents offline, each paired with a control that removes only the blamed cause.
Across 108 replications, 89% reproduced the reported harm. Five current GPT, Claude, Gemini and DeepSeek models repeated the same mistake in 18%–33% of runs with the cause present — and under 1% without it.
The twist: accidents with no attacker caused more harm than prompt injection did, and injection defenses can't catch them — there is no injected instruction to find. What did work was a warning after each tool output, naming the hazard and its consequence.
Does anything — or anyone — flag the risk out loud after each step your agent takes?
#AISafety #AIAgents
arxiv.org/abs/2611.26553
Context Mode retweeted
LiteLLM gives away the gateway and sells the enterprise license. PostHog gives away the code and sells the cloud.
I'm thinking about doing the same with Context Mode's gateway. Fully open source, self-host it free, pay only for SSO, audit logs and support.
Would you self-host it, or would you rather just pay and not think about it?
Context Mode retweeted
Dax is right. Selling safety behind a sales call is the worst upsell in the agent era.
So I'm thinking about open sourcing Context Mode's gateway. Self-host it free, SSO and audit logs included. Enterprise would pay for support and SLAs, not for being safe.
Tell me why this is a mistake.
Context Mode retweeted
Anthropic just shipped code mode in Claude Code. Experimental, opt-in, Claude Code only.
Context Mode's gateway already runs code mode in V8 isolates on Cloudflare Dynamic Workers. The agent writes the script, the isolate eats the raw output, and only the answer hits context. Claude Code, Codex, OpenCode or Pi, same gateway.
No flag needed. Try to break it.
contextmode.ai
Code Mode is an experimental new feature in Claude Code that can improve both speed and context efficiency when Claude needs to orchestrate multiple steps. Try it out and let us know what you think!
It enables Claude to perform multi-step tool calls by writing and running JavaScript. Rather than calling one tool at a time (e.g. Bash, Read, or Edit) and waiting to see the result before deciding what to do next, Code Mode allows Claude to write a simple script to run multiple commands in parallel, passing arguments and filtering outputs for subsequent tool calls to reduce context.
I'm excited about this work because Code Mode enables more efficient and streamlined multi-step coding flows. For example, rather than passing large amounts of raw search data into the context window or having to make a large number of sequential calls to perform the same refactoring across dozens of files, Claude can orchestrate these tasks programmatically in a single pass.
Still, you will be able to interact with Claude as normal through natural prompts. And if you ever need to see the exact JavaScript that Claude generated, you can always use Ctrl+O to expand the collapsed Code rows in the transcript viewer.
One of the most exciting practical improvements from Code Mode is its ability to perform long-running operations, like running test suites or complex builds, as background processes. When Code Mode is running in either auto or bypassPermissions mode, scripts can run in the background for up to two hours. You can continue to interact with Claude and perform other work within the same session. The /tasks command provides complete transparency and control over background scripts.
Each tool call that is generated within a script is still governed by your current deny and ask permission policies, sandbox constraints, and PreToolUse hooks. Hooks can even be defined specifically for the REPL tool to inspect the generated JavaScript before running, or redact sensitive tokens from the output before reading it into the context.
To enable Code Mode, just start your session with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude or set the environment variable in your ~/.claude/settings.json file.
Give it a try by running multi-file audits, batch edits, or any type of parallel search-and-filter operation. Code Mode is experimental and the team is actively iterating on it, so please run /feedback in your terminal to let us know what works well and where you hit any edges.
Hope it's helpful!
Context Mode retweeted
Not everything belongs in an isolate. Some scripts need your files, your shell, your machine.
Context Mode's engine runs code mode locally as a subprocess, with whatever runtime you already have. Shell, JS, TS, Python. The agent stops reading raw logs and starts asking questions of them.
Your context window was never meant to be a log file.
github.com/mksglu/context-mo…
Context Mode retweeted
Nathan's benchmark says it: V8 wins for complex, data-heavy scripts, and embedded isolates beat standalone processes.
That's exactly where Context Mode's gateway runs code mode. V8 isolates on Cloudflare Dynamic Workers. Your agent writes the script, the isolate eats the raw output, and only the answer hits context.
Bring your heaviest session and prove me wrong.
contextmode.ai
Code Mode benchmarks:
- Lua is the 🐐 for tiny scripts
- V8 the 🐐 for complex / data-heavy scripts
- QuickJS is, in fact, quick for very simple scripts
- Embedded JS isolates are better than standalone processes
- dash > bash
- LuaJIT only makes sense for complex scripts
- Lua needs many C exts to be fast (e.g. JSON parsing)
What other languages / runtimes should I bench?
~
These benchmarks are most relevant when separating the harness from the sandbox, since Code Mode is running inside the harness.
When there are hundreds of agents running on a single machine, the cost of the dynamic code execution will be a large portion of compute resources.
That said, you probably won't be able to tell a huge difference when using < 10 MB of RAM and < 50 ms time to response in practice.
~
Embedded vs Processes:
Embedded languages work as a library inside your existing process. This tends to amortize your memory & cold starts.
~
Optimizations:
There's plenty of optimizations that can be made across the board, such as:
- Prewarming VMs
- Process & VM forking
~
Sandboxing:
Per-process will require some sort of jailing / sandobxing to run securely.
Embedded languages can be risky to trust for sandboxing without extensive security review for things like Spectre & access to stdlibs.
~
Benches attached in thread. There's loads of other more experimental languages & runtime I want to bench too.
Context Mode retweeted
context mode v2.2.1 is out
a bug-fix release, like a tune-up for your agent's memory. after compaction your agent gets its saved state once, and recall leaves out notes from before that compaction
github.com/mksglu/context-mo…
Context Mode retweeted
OpenClaw cut CI usage 95.5% by caching, and @boatdotdev makes CI runs faster.
the agent inside CI is next. with @contextmode Gateway:
fixing a failing CI run: $0.0502 to $0.0420 (22.8% less)
@claude fix on a PR: $0.1113 to $0.0872 (21.6% less)
using CI on boat? DM me and your Gateway CI is free
contextmode.ai/solutions/ci
been so happy to help the openclaw guys with free CI on boat.dev
for everyone using CI on boat, huge perf improvements (via caching and specialized infra) + limits changes coming soon
Context Mode retweeted
Context Mode is like a save point for your coding agent
big tool output stays in a local index, so the window fills slower. after compaction, your agent picks up where it left off
Context Mode retweeted
You told your agent "never touch prod" last week. Today it ran terraform destroy.
Context Mode remembers the rule, brings back last week's notes, and Protect blocks the destroy with your team's policy.
contextmode.ai
Context Mode retweeted
Context Mode is a free, local, open source plugin for 11 coding agents.
The agent writes a short script, the script runs in a local sandbox, and only the answer enters the context window. The full output stays in a SQLite index on your machine, so the agent can search it later.
2.0 is a full rewrite: 9 tools, hooks on all 11 agents, one database per project, and a bench you can run yourself.
Context Mode retweeted
Stop explaining your repo to your coding agent.
It compacts mid-task and forgets the helper you wrote last week. Six months later it runs npm in a pnpm repo.
@contextmode keeps what your agent learns. Protect blocks the force push. Pro is $20 a month.
Context Mode retweeted
LiteLLM, Portkey and Helicone are great llm gateways. none of them were built for coding agents.
LiteLLM routes 100+ providers with keys and budgets.
Portkey adds fallbacks, load balancing and guardrails.
Helicone logs and traces every request.
a coding agent needs a different layer. @contextmode Gateway is built for that:
- context saving: a long Claude Code session went from $7.20 to $2.49
- Protect: 22 capabilities that check what a command actually does
- recall and memory across sessions
- resume a Claude Code or Codex session on another machine
- works with 10 agents, no fee on tokens
full comparison:
contextmode.ai/docs/landscap…
Context Mode retweeted
The model writes one ES module. Our gateway runs it in a Cloudflare Dynamic Worker with no bindings, and only the value the script returns enters the conversation. The sandbox has one way out, fetch, and each fetch goes back through the gateway. How it works:
Claude Code shipped an experimental Code Mode.
Instead of calling tools one at a time and reading each result, Claude writes a bit of JavaScript that runs the calls in parallel and hands back only the output it needs.
So the fix for chatty agents turned out to be batching, just like fixing every N+1 query I've reviewed in 10 years.
There's this one line in the docs worth reading twice: auto mode's classifier reviews the code, not each tool call.
Trying it this weekend, anyone already tested it?
code.claude.com/docs/en/code…
Context Mode retweeted
A coding agent resends its whole history on every turn. Our gateway is one Cloudflare Worker that edits that request before the model reads it. This video follows one request through it: Durable Objects, R2, Workers AI, a Dynamic Worker, and the paired benchmarks.
Context Mode retweeted
Your CI agent is not expensive because the model is smart. It is expensive because you pay for the same prompt on every pull request.
Same repo, same instructions, same job, sent again and again at full price. The bill grows with every push and nobody reads the logs.
Add two env lines to the job and route it through Context Mode Gateway. Same agent, same model, and each run costs 20% to 23% less across 5 measured CI jobs.
contextmode.ai/solutions/ci











