Continue from Claude Code or Codex
Claude Code and Codex sometimes stop before a task is done, most often when the usage limit runs out. Handoff carries that session into Atomic Agent. It saves the latest Claude Code or Codex session from your folder as a new Atomic Agent chat, with its history, and adds a message that asks the agent to pick up where it stopped.
Handoff reads the session files Claude Code and Codex keep on your computer. It does not need either tool to be running.
Run it in the folder where Claude Code or Codex was working:
atag handoff --from claude-codeatag handoff --from codexThis saves the newest session that ran in the current folder (or the newest one anywhere, if none ran here), opens the TUI on the new chat and sends the continue message right away. The chat is titled <title> (from Claude Code).
| Flag | Default | What it does |
|---|---|---|
--from claude-code|codex | required | Which tool to continue from. |
--session <id> | latest | Pick a session. A unique prefix of the id is enough. |
--list | List recent sessions instead of saving one. --limit N sets how many (default 10). | |
--note "<text>" | Add your own instruction to the continue message, as Also: <text>. | |
--context <tokens> | the local model’s context, else 32768 | Fit the history into this many tokens. 0 keeps it all. See Long sessions. |
--cwd <dir> | the session’s own folder | Working folder for the new chat. |
--source <dir> | ~/.claude or ~/.codex | Where to read sessions from. CLAUDE_CODE_STATE_DIR and CODEX_STATE_DIR also work. |
--no-open | Save the chat and print the command to open it, without starting the TUI. | |
--json | Save the chat and print the result as JSON, without opening it. |
atag and atomic-agent are the same binary, so atomic-agent handoff works too.
To open a saved chat later, the TUI takes --session <id>, and --send "<text>" sends one message once the interface is up:
atag tui --cwd ~/work/app --session <id>Open the command palette and choose Continue from Claude Code / Codex…, or go to Settings › Import and press Continue a task….
- Pick Claude Code or Codex with the switch at the top.
- Find the session that stopped. The list shows up to 15 recent sessions, with title, folder, time and number of messages.
- Press Continue.
The session opens as a new chat with its history. The continue message is placed in the message box but not sent. Choose the model you want and press Enter.
If the app is connected to an agent on another computer, the sheet asks you to run atag handoff on that computer instead.
What the agent is told
The continue message tells the agent that it is taking over a task from Claude Code (or Codex), which stopped before it was done. Tool calls that never got an answer are marked: “No result: Claude Code stopped before this call returned. Check whether it ran before relying on it.”
Long sessions on a small model
A long Claude Code session can be far larger than a local model’s context. Handoff shortens it so it fits:
- The history may take half of the target window.
- The newest steps are kept word for word.
- The older part becomes a short extract of picked lines. This is not an AI summary, and no model call is needed to make it.
- Long tool outputs in the kept part are clipped.
The target window is the context of your local model when one is set, otherwise 32,768 tokens. If you hand off to a cloud model with a large context, pass a bigger --context value, or --context 0 to keep the history as it is. The command prints how much it shortened, for example history: ~98000 → ~16000 tokens for a 32768-token window.
The desktop app always uses the default window. When it shortened the history, the confirmation says so.
Handoff or import?
Related
Get updates by email
One email when a new version comes out.