Skip to content

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:

Terminal window
atag handoff --from claude-code
atag handoff --from codex

This 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).

FlagDefaultWhat it does
--from claude-code|codexrequiredWhich tool to continue from.
--session <id>latestPick a session. A unique prefix of the id is enough.
--listList 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 32768Fit the history into this many tokens. 0 keeps it all. See Long sessions.
--cwd <dir>the session’s own folderWorking folder for the new chat.
--source <dir>~/.claude or ~/.codexWhere to read sessions from. CLAUDE_CODE_STATE_DIR and CODEX_STATE_DIR also work.
--no-openSave the chat and print the command to open it, without starting the TUI.
--jsonSave 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:

Terminal window
atag tui --cwd ~/work/app --session <id>

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?

Import brings over everything from Claude Code or Codex at once: skills, memory, MCP servers and past sessions. Handoff takes one unfinished session and sets the agent up to finish it. Use import when you move to Atomic Agent, and handoff when a task is stuck halfway.

Get updates by email

One email when a new version comes out.