Skip to content
First-party CLI evidence · Updated October 9, 2026

Claude Code and Codex CLI command reference

Task-shaped references for resuming, forking, naming, backgrounding, and organizing native coding-agent sessions, checked against installed CLI help.

How this library works

These are not keyword-swapped copies. Each page starts from an exact installed string or help entry, separates similar-looking causes, gives the complete manual path, and points generic queries to the existing guide that already owns them.

Claude Code

Claude Code 2.1.286claude --fork-sessionUse claude --resume <id> --fork-session to load a saved Claude Code conversation under a new session ID. The original stays available, while new turns are written to the fork. Use claude --continue --fork-session only when the latest conversation in the current directory is definitely the source you want.Claude Code 2.1.286claude --nameRun claude --name <name> when starting a session to set the title shown in the prompt box, resume picker, and terminal title. Use a short outcome such as checkout-webhook-fix, not a generic label such as coding. The name helps retrieval; it does not change the project directory or session ID.Claude Code 2.1.286claude --bg and attachStart a background session with claude --bg and save the short ID it prints. Use claude agents to list sessions, claude logs <id> to inspect recent output, and claude attach <id> to open one in your terminal. claude stop <id> ends the process but keeps its conversation; claude rm <id> removes the background record.Existing guideclaude --continueThe existing field note owns continuing the newest Claude Code session and recovering a missing one.Existing guideclaude --resumeThe existing field note owns Claude Code resume by picker and session ID.

Codex CLI

codex-cli 0.146.0codex forkRun codex fork to choose a recorded interactive session and branch it into a new one. Use codex fork <session-id> for an explicit source, or codex fork --last for the newest session. Add a prompt to state the new direction. The source history remains unchanged; current files are still read from today's working tree.codex-cli 0.146.0codex exec resumeUse codex exec resume <session-id> "prompt" to continue a saved Codex session without the interactive UI. Use --last only when the newest recorded session is the intended one. A prompt of - reads stdin. Add --all when selecting the last session across directories, and --json when a program needs JSONL events.codex-cli 0.146.0codex archive / unarchiveRun codex archive <session> with a session UUID or name to move saved work out of the normal active list. Restore it with codex unarchive <session>. UUIDs take precedence when the value parses as one. Archiving is reversible; codex delete is a separate, permanent command and should not be used as cleanup shorthand.Existing guidecodex resumeThe existing guide owns codex resume, --last, --all, missing sessions, and local storage.

Version boundary

Commands and messages change quickly. The version named on each page is the evidence boundary, and your own CLI's --help output wins when it differs. Product limits and billing options come from the provider account, not from Crowsnest.