Skip to content

Add Claude Code and Codex CLI session restore support#558

Open
thallada wants to merge 2 commits intotmux-plugins:masterfrom
thallada:coding-agent-session-restore
Open

Add Claude Code and Codex CLI session restore support#558
thallada wants to merge 2 commits intotmux-plugins:masterfrom
thallada:coding-agent-session-restore

Conversation

@thallada
Copy link

  • Add automatic session restore for Claude Code and Codex CLI using the existing strategy pattern
  • Claude: appends --continue to the original command, preserving all CLI flags
  • Codex: restores with codex resume --last (uses a subcommand rather than a flag)
  • Both detect when a resume flag is already present and preserve the original command as-is

Add automatic save/restore for Claude Code CLI sessions using the
existing strategy pattern.

When a pane running `claude` is saved, the restore strategy appends
`--continue` to resume the most recent conversation in that working
directory. If the original command already included `--continue` or
`--resume`, it is preserved as-is so explicit session targets and
all other CLI flags are not lost.

Changes:
- Add `claude` to default_proc_list in scripts/variables.sh
- Create strategies/claude_session.sh (modeled after nvim_session.sh)
- Register the "session" strategy for claude in resurrect.tmux
- Add tests for strategy logic and wiring in
tests/test_claude_strategy.sh
- Update README.md to mention Claude Code support
Add automatic save/restore for OpenAI Codex CLI sessions using the
existing strategy pattern.

When a pane running `codex` is saved, the restore strategy replaces the
command with `codex resume --last` to resume the most recent
conversation in the working directory. Unlike Claude's `--continue`
flag, Codex uses `resume` as a subcommand, so the original command
(which may contain a prompt argument) is replaced rather than appended
to. If the original command already contains a `resume` or `fork`
subcommand, it is preserved as-is.

Changes:
- Add `codex` to default_proc_list in scripts/variables.sh
- Create strategies/codex_session.sh (modeled after claude_session.sh)
- Register the "session" strategy for codex in resurrect.tmux
- Add tests for strategy logic and wiring in
tests/test_codex_strategy.sh
- Update README.md to mention Codex CLI support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant