One gateway for 7 coding agents: Pi, OpenCode, T3 Code
Thank you to the teams who build these apps: Anthropic for Claude Code and Claude Desktop, OpenAI for Codex and the ChatGPT desktop app, pingdotgg for T3 Code, the OpenCode team, and earendil-works for Pi. Thank you also to the community that asked for each one. Today Context Mode connects 7 apps: Claude Code, Claude Desktop, Codex, Codex Desktop, T3 Code, OpenCode and Pi. You install each app the way its makers say. Then one command, npx @context-mode/cli, connects the ones you pick. One console shows all of them, and one memory store serves all of them. You keep your app, your model and your own key or login.
TL;DR
- 7 apps, one command:
npx @context-mode/clisigns you in, lists the 7 apps (found ones checked), writes each config, checks each one, and printsReady. - Native install first: install each app with its makers' own command, then run the Context Mode command. The table below has both.
- One app at a time:
npx @context-mode/cli setup --agent <id>, withclaude,claude-desktop,codex,codex-desktop,t3code,opencodeorpi. - What you get in each app: Saving, Memory, Skills, Instructions, Recall, Search and Active Context, on every request. We measure them on Claude Code (and some on Codex) only.
- Protect is enforced on Claude Code and Codex. On Pi it is recorded only. On the other apps it is not verified yet.
- Setup asks first: it shows the diff, asks first, makes a backup, and never writes your API key. Undo with
npx @context-mode/cli disconnect --agent <id>.
Which coding agents work with Context Mode?
This post answers one question: which coding agents can use one gateway, and how do you connect them? Until now, Context Mode connected Claude Code and Codex. Now it connects 7 apps:
- In the terminal: Claude Code, Codex, OpenCode and Pi.
- On the desktop: Claude Desktop, Codex Desktop (the ChatGPT app) and T3 Code.
Context Mode is a gateway between your coding agent and the model provider, Anthropic or OpenAI. Each app keeps its own login, its own model and its own config file. Setup changes only its own keys: the address the app sends requests to, the device-key header, and a few app settings it names in the diff. There is no plugin, no wrapper and no fork.
Pick your app: install, connect, restart
Pick an app to see its makers' install step, then the Context Mode command, then what to keep in mind. Claude Code and Codex share one tab.
# install Claude Code / Codex the way their makers' docs say (see the table below) # then use them with their own logins: $ npx @context-mode/cli setup --agent claude $ npx @context-mode/cli setup --agent codex # or both at once: $ npx @context-mode/cli setup --agent all
Claude Code: quit it and run claude again. Codex: start a new session. A shell-only OPENAI_API_KEY is not sent; Codex sends only the key in its own login.
# Claude Desktop's own way: Help → Troubleshooting → Enable Developer Mode,
# then Developer → Configure Third-Party Inference… → Connection → Apply Changes
# or let the CLI write the same entry (named contextmode):
$ npx @context-mode/cli setup --agent claude-desktopQuit with Cmd+Q, not only close the window, then open it again. Which login the Chat tab may use: not verified.
# the ChatGPT app reads the Codex CLI's ~/.codex/config.toml
# sign in to Codex the usual way, then:
$ npx @context-mode/cli setup --agent codex-desktopOne write covers the Codex CLI and the app. Quit with Cmd+Q and open it again. If a [profiles.*] picks another provider, that profile wins while it is active, and setup names it.
$ brew install --cask t3-code
# or the CLI/server: curl -fsSL https://t3.codes/install.sh | sh
# Settings → Providers: keep CODEX_HOME at ~/.codex, no Shadow home path
$ npx @context-mode/cli setup --agent t3codeIt prints the T3 Code step first, then writes the Claude Code file and the Codex file, once each. Quit T3 Code fully and open it again.
$ curl -fsSL https://opencode.ai/install | bash # or: npm install -g opencode-ai, or: brew install anomalyco/tap/opencode $ opencode auth login # pick Anthropic, add your API key $ npx @context-mode/cli setup --agent opencode
Needs your own Anthropic API key. Quit OpenCode and run it again. Verified on opencode-ai 1.19.4; OpenCode 2.x is not verified.
$ npm install -g @earendil-works/pi-coding-agent
# or: curl -fsSL https://pi.dev/install.sh | sh
# in Pi, /login with your Anthropic or OpenAI API key
$ npx @context-mode/cli setup --agent piNeeds your own API key. A Claude subscription (Pro/Max) cannot be used in Pi: this is Anthropic's rule. Use an Anthropic API key, or turn on extra usage at claude.ai/settings/usage. If Pi is signed in with a subscription, setup leaves Anthropic alone, says so, and sets only OpenAI. Quit Pi and run it again.
How to install each app, then connect it
Order matters for us: the app's own install first, then Context Mode. Every command below is the one its makers or our CLI give. Context Mode needs Node 20.12 or later.
| App | Native install | Context Mode command | What you need |
|---|---|---|---|
| Claude Code | Anthropic's install (macOS, Linux, WSL): curl -fsSL https://claude.ai/install.sh | bash (setup page). Its settings reference names the keys setup writes. | npx @context-mode/cli setup --agent claude | A Claude login (subscription or API key). Restart Claude Code. |
| Claude Desktop | Download it from claude.com/download. Then Help → Troubleshooting → Enable Developer Mode, then Developer → Configure Third-Party Inference… → Connection → Apply Changes (in-app configuration) | npx @context-mode/cli setup --agent claude-desktop | Quit with Cmd+Q and open it again. |
| Codex | OpenAI's install: npm install -g @openai/codex or brew install --cask codex (Codex README). Its config reference names the provider table setup writes. | npx @context-mode/cli setup --agent codex | A Codex login: ChatGPT, or an API key stored with codex login. Start a new session. |
| Codex Desktop | The ChatGPT app with Codex. Download it from OpenAI's ChatGPT desktop app page. It reads ~/.codex/config.toml. | npx @context-mode/cli setup --agent codex-desktop | Same login as Codex. Quit with Cmd+Q and open it again. |
| T3 Code | brew install --cask t3-code, or curl -fsSL https://t3.codes/install.sh | sh. Windows: winget install T3Tools.T3Code (install docs) | npx @context-mode/cli setup --agent t3code | The Claude Code and/or Codex you have, with their logins. Quit T3 Code fully and open it again. |
| OpenCode | curl -fsSL https://opencode.ai/install | bash, or npm install -g opencode-ai, or brew install anomalyco/tap/opencode (docs) | npx @context-mode/cli setup --agent opencode | Your own Anthropic API key, with opencode auth login or ANTHROPIC_API_KEY. |
| Pi | npm install -g @earendil-works/pi-coding-agent, or curl -fsSL https://pi.dev/install.sh | sh (earendil-works/pi) | npx @context-mode/cli setup --agent pi | Your own Anthropic or OpenAI API key, with Pi's /login or ANTHROPIC_API_KEY / OPENAI_API_KEY. |
Two gaps, said plainly. This post gives no install command for Claude Code or Codex, and no download link for Claude Desktop or the ChatGPT app: use the ones their makers give. Windows users of T3 Code can also run scoop install extras/t3code or irm https://t3.codes/install.ps1 | iex.
How to connect all your coding agents in one command
Run the CLI with no arguments. It signs you in when this terminal has no device key yet. Then it lists the 7 apps, with the ones it finds here checked. Space toggles an app, Enter confirms, Ctrl+C stops with nothing written.
$ npx @context-mode/cli
# signs you in in the browser if this terminal has no device key
Which apps should use context-mode? (space to toggle, enter to confirm)
# the 7 apps, each marked found or not found; found ones checked
Claude Code connected (workspace …)
Codex connected (workspace …)
OpenCode connected (workspace …)
Pi connected (workspace …)
Console: https://console.contextmode.ai
Ready
Next:
1. Restart your agents:
Claude Code: quit it and run `claude` again (a running session keeps the old settings).
Codex: start a new session (`codex`).
OpenCode: quit it and run `opencode` again (it reads its config at start).
Pi: quit it and run `pi` again (it reads models.json at start).
2. Ask it anything. Now and then a line that starts with "⚡ context-mode" shows under the answer.
3. Check it worked: your request shows on https://console.contextmode.ai within a minute.
Not there, or an error in the agent? Run: npx @context-mode/cli doctor
The CLI's after-setup text still says "⚡ context-mode". The line itself now starts with "⏺ contextmode ·". Before it prints Ready, the CLI sends each app one check request through the gateway (marked x-cm-dry-run: 1). The gateway answers it itself, so it costs nothing and is not counted. If a check fails, the CLI says that app will not go through Context Mode yet.
One detail: --agent all covers Claude Code and Codex only. T3 Code, OpenCode and Pi come from the list above, or from --agent t3code, --agent opencode and --agent pi.
Check, fix and undo
$ npx @context-mode/cli status
Gateway: https://gateway.contextmode.ai
Console: https://console.contextmode.ai
# who is signed in, the workspace, this device, then one line per agent
$ npx @context-mode/cli doctor
# checks the gateway answers, the device key is valid, and each installed agent is set up
$ npx @context-mode/cli disconnect --agent pi
# removes what setup wrote; the file goes back as it was, backup first
What you get in each app
The gateway does not switch features on or off by app name. Each of the 7 apps sends a known client fingerprint, so each one gets Saving, Memory, Skills, Instructions, Recall, Search and Active Context on every request. Protect and Session resume differ by app (see the matrix). Pick a feature to see one example.
You, in Claude Code: "run the tests and fix the failing one" # the test run prints every result # the model gets the failing test, its error and the summary line # the passed results stay out of the context
Large tool output (logs, fetched pages, big files) stays out of the model's context. Works on every request in all 7 apps. Measured on Claude Code: see the benchmarks.
Monday, in Claude Code: "We use pnpm in this repo, not npm." Thursday, in Pi, same folder: "Add the date library." pnpm add ...
One memory store serves all your apps. Facts about you, your code and your task are kept for any app. Facts about how one app behaves stay with that app. Not measured live across apps yet.
You, in T3 Code: "use release-notes for this sprint" # the release-notes skill loads for this turn
Import skills once, for example from GitHub. They run from the gateway, so you install nothing on each machine. When a request fits a skill, it loads by itself.
// Console: Settings → Instructions
Keep answers short.
Never touch code or technical terms.Write your rules once in the console. Every request from each connected app carries them, on every machine.
You, in Claude Desktop, late in a long session: "what did we decide about the quota check this morning?" # the agent reads the decision back from the archive
Long history goes to the archive, not lost. The agent reads older work back when it needs it. Measured on Claude Code; works on every request elsewhere.
$ git push origin main
# Claude Code, Codex: blocked by your rule
# Pi: recorded in Activity; blocking not verified
# Claude Desktop, Codex Desktop, T3 Code, OpenCode: not verified yetProtect is enforced on Claude Code and Codex. Do not count on it to stop a command in the other apps yet.
The honest matrix
"Yes" means the gateway applies it to every request from that app. "Measured" means we ran the proof on that app. We give no saving number for an app we did not measure.
| App | Saving, Skills, Instructions, Recall | Memory | Protect | Session resume |
|---|---|---|---|---|
| Claude Code | Yes; Saving and Recall measured | Yes | Enforced | Yes |
| Claude Desktop | Yes | Yes, stored as Claude Code; Chat tab scope not verified | Not verified | No |
| Codex | Yes; Saving measured in part | Yes | Enforced | Yes |
| Codex Desktop | Yes | Yes, stored as Codex | Not verified | Not verified |
| T3 Code | Yes | Yes, stored as Claude Code or Codex | Not verified | No |
| OpenCode | Yes | Yes, stored as OpenCode | Not verified | No |
| Pi | Yes | Yes, stored as Pi | Recorded only | No |
Read more: Saving, Memory, Skills, Instructions, Recall, Active Context, Search, Protect and Session resume.
One memory across Claude Code, Codex, OpenCode and Pi
Most people use more than one agent. Without a shared store, each one starts from zero, and you say "use pnpm" seven times. With Context Mode, a rule you give Claude Code on Monday comes back in Pi on Thursday, in the same project. This works by design: facts about you and your code are not tied to one app. We have not yet measured it live across apps.
Facts about you, your code and your task are stored for any app. Skill facts and facts about how one app behaves are stored with the app that captured them (claude-code, codex, opencode or pi), because a skill in one app can mean nothing in another.
Is setup safe for my config files?
Setup edits files you care about, so it follows the same rules for every app:
- It shows the diff and asks first. Key names only, never a value.
- It makes a backup:
<file>.cm-setup-bak-<timestamp>, then writes the new file in one step. - It changes only its own keys. Comments and every other setting stay. If the file does not parse, it writes nothing.
- It never writes or prints your API key. Your app sends its own key or login, and the gateway passes it on.
- The device key (
cmdk_…) lives in~/.context-mode/credentials.jsonwith mode 0600. The gateway strips it before the request goes to Anthropic or OpenAI.
$ npx @context-mode/cli setup --agent opencode --dry-run # show the changes, write nothing
$ npx @context-mode/cli setup --agent opencode --check # exit 0 when configured, 2 when not
$ npx @context-mode/cli setup --agent opencode --yes # write without asking
Say this plainly
- Benchmarks come from Claude Code (and some from Codex). We do not extend them to the other apps.
- Protect is enforced on Claude Code and Codex. On Pi it is recorded only. On Claude Desktop, Codex Desktop, T3 Code and OpenCode it is not verified yet.
- OpenCode and Pi need your own API key. OpenCode has had no Claude sign-in since 1.3.0. A Claude subscription (Pro/Max) cannot be used in Pi: this is Anthropic's rule, not ours. Use an Anthropic API key, or turn on extra usage at claude.ai/settings/usage. If Pi is signed in with a subscription, setup leaves Anthropic alone, says so, and sets only OpenAI.
- The "⏺ contextmode" line shows in Claude Code, Codex and Codex Desktop. OpenCode shows it only in
opencode run, and Pi only inpi -p. Claude Desktop, T3 Code, the OpenCode TUI and desktop app, and the Pi interactive screen are not verified. - Claude Desktop: quit with Cmd+Q, not only close the window. Which login its Chat tab may use is not verified.
- Codex Desktop: a
[profiles.*]that picks another provider wins while it is active; setup names it. - T3 Code: its Claude Code turns show as Claude Code in the console. A Shadow home path is not verified.
- OpenCode 2.x is not verified. Session resume works on Claude Code and Codex only.
Read the post for your app
- Claude Desktop: third-party mode in one command.
- The ChatGPT desktop app: one config file for the Codex CLI and the app.
- Pi: memory and skills for an open agent.
- T3 Code: one command for both of its agents.
Start now
Install your apps their own way, then run one command. Open the Console to see every app in one workspace.
npx @context-mode/cli
- Console: console.contextmode.ai (start free)
- CLI:
npx @context-mode/cli - Docs: Quick start and the CLI
Context Mode is under the Elastic License 2.0 (ELv2).