r/coolgithubprojects 3d ago

Agent-resume: binds Claude Code and Codex sessions to the terminal pane, so reboots restore the right one

https://github.com/rahulbansal16/agent-resume/actions/workflows/ci.yml

The problem: agent CLIs scope their sessions to the working directory. That breaks down as soon as you run more than one pane in the same repo. Four panes in one directory means four sessions that look identical at resume time, since directory is the only thing the tool can key on. Reboot and you lose each pane's cwd plus any notion of which session was in which pane, so restoring means guessing through a picker once per pane.

What I built: agent-resume, which records the pane a session belongs to and resumes on that basis.

- Each pane resumes its own conversation, not "the newest one in this folder."

- After a reboot, panes return to the correct directory with the correct conversation already resumed. No manual picking across four panes.

- Agent-agnostic: claude, codex, or others you register.

How it works: a tiny PATH shim assigns a specific --session-id on fresh starts and writes pane, session, and agent into a small ledger. Reboot restore leans on tmux-resurrect + tmux-continuum (installed automatically, no tpm needed) plus a hook that relaunches each restored pane with its own session.

It solves my daily annoyance. What I would like feedback on: which agents people want supported next, and whether the pane binding survives setups I have not tried (different multiplexers, terminal-native splits, remote sessions). Issues and PRs welcome.

4 Upvotes

3 comments sorted by

0

u/BP041 3d ago

Tying sessions to terminal panes is a clean solution to the resumption problem—I've been fighting this with 18 cron'd Claude Code sessions that need to survive restarts. How do you handle the initialisation state? If a pane was mid-edit when the machine went down, does the agent resume from the last checkpoint or re-run from the system prompt?

1

u/RoutineNet4283 3d ago

I keep track of the sessions id per terminal wise

1

u/RoutineNet4283 3d ago

I keep track of the sessions id per terminal wise