ccx 如何在 Claude Code 與 Codex 之間交接工作並同步上下文
How I hand a Claude Code session to Codex (and back) without re-explaining anything
Aaron W 介紹其開源工具 ccx,可在 Claude Code 與 Codex 桌面應用程式之間雙向同步工作上下文,讓任務交接時無須重新説明。同步內容包括所有用戶訊息與回覆、精簡後的工具呼叫及輸出、最新任務清單、未完成步驟狀態、圖片快取副本的路徑,以及 git status。
When Claude Code hits its 5-hour limit mid-task, you can wait for the reset, pay for API tokens, or move the task to another agent. I use both Claude Code and Codex, so the third option is the obvious one. The hard part isn't switching apps. It's the handoff: the other agent knows nothing about the task.
The problem with switching
I switch for two reasons:
- One side runs out. Claude Code has a 5-hour window and a weekly cap, and so does Codex.
- Cross-checking. When one model loops on a bug, the other often solves it in one pass.
Either way, the new side starts cold. You re-explain what the project is, where you were, which approaches you already ruled out, and what's broken now. Pasting the transcript doesn't work well either: tool calls and their output run to tens of thousands of words.
Then you switch back, and Claude doesn't know what Codex changed.
What I built: ccx
ccx links a Claude Code session with a Codex thread and keeps them in sync both ways, inside both desktop apps. It's open source (MIT) and runs entirely on your Mac.
- Claude hits its limit.
- Click ⇄ in the menu bar, pick the project and session.
- Codex picks up the task with the full context.
When Codex runs out too, open the same Claude conversation and send anything ("continue"). Codex's progress comes in. Switch as many times as you like.
What gets carried over
- Every user message and reply
- Condensed tool calls and their output
- The latest task list (Claude's todos or Codex's plan)
- Whether the other side stopped mid-step
- Pasted images, as the path of the app's own cached copy
git status
The code is already on your disk. All of this arrives as context for the model, not as new chat bubbles.
How it works
-
Claude side: reads the session JSONL files under
~/.claude/projects/. -
Codex side: goes only through Codex's own app-server API (
thread/list,thread/read, session import). It never parses Codex's internal files. -
Pairing: a Claude session A and a Codex thread T form a pair in
~/.ccx/pairs.json, and each side keeps a cursor of how much the other has received. -
Delivery: when you send a message in A, a
UserPromptSubmithook appends T's new progress to that message and moves the cursor. Nothing is delivered twice, and the hook never blocks a prompt. If something was condensed away, the model can page through it with aread_sessiontool.
Each update is usually a few thousand tokens. Clicking again with nothing new does nothing.
A heads-up before you run out
v0.0.32 adds a usage heads-up. When either side's 5-hour window passes 90%, and again when it's used up, the menu bar notifies you once and offers that side's newest session to continue in the other app.
- Codex: read from its app-server's
account/rateLimits/read. Built in. - Claude: Claude Code keeps no local signal before the limit, so ccx also reads CodexBar, Claude Code Usage Monitor or ccusage when one of them is installed, through their documented output only.
FAQ
Does it bypass usage limits? No. You use your own Claude and ChatGPT/Codex plans, each within its own limits. ccx only moves the task between them.
Is anything uploaded? No. Sync is local. ccx reaches GitHub only to install and check for updates.
Windows, Linux, standalone CLIs? Not yet. macOS 13+ with the Claude and/or Codex desktop app.
Install
Paste this into Claude Code or Codex and it installs itself:
Install ccx for me: run `curl -fsSL https://raw.githubusercontent.com/aaronwong1999/ccx/main/install.sh | sh` (it needs network access and writes to my home folder), then run `~/.local/bin/ccx doctor` and tell me the result.
Feedback is welcome in Issues or on X (@aaron0x10).
來源:DEV Community · dev.to