Feature request: --session-id flag to set session UUID at launch

Resolved 💬 3 comments Opened Mar 2, 2026 by sstraus Closed Mar 25, 2026

Summary

codex supports resume <uuid> to resume a specific session. However, there is no way to set the session UUID at launch time (analogous to Claude Code's --session-id <uuid>).

Use Case

I'm building TUICommander (https://github.com/stefanospin/tuicommander), a terminal orchestrator that manages multiple AI agent sessions across branches and worktrees. When the user switches branches, we persist terminal state and later restore it with the correct session.

Current workaround: After launching codex, scan ~/.codex/sessions/ for the newest JSONL file and extract the UUID from its filename. This couples us to undocumented filesystem layout.

With --session-id: We generate a UUID before launch, pass codex --session-id <uuid>, and save it. On restore: codex resume <uuid>. Clean, deterministic, no filesystem scraping.

Proposed API

codex --session-id <uuid> # Start a new session with this UUID
codex resume <uuid> # Resume that session later (already works)

This is exactly what Claude Code implements with claude --session-id <uuid> + claude --resume <uuid>.

Alternatives Considered

  • Filesystem scraping of ~/.codex/sessions/: works but undocumented, may break
  • Interactive picker via codex resume: not scriptable

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗