Recover After Reboot
Overview
Restore a pre-reboot multi-agent workspace from a reboot backup, usually ~/tmp/reboot-backup: recreate tmux layout, recover repos, relaunch agents with pane context, then remove any temporary recovery block.
Workflow
-
Read local instructions first:
- Open the workspace
AGENTS.mdor equivalent agent instruction file and follow any recovery block. - Open
~/tmp/reboot-backup/REBOOT-INSTRUCTIONS.mdif it exists. - Inspect
tmux-sessions.txt,tmux-windows.txt,tmux-panes.txt, andpane-*.txt.
- Open the workspace
-
Inventory current state before changing it:
tmux list-sessionstmux list-windows -a -F '#{session_name}:#{window_index}:#{window_name}:#{pane_current_path}'- For repo repairs, locate actual checkouts with
find <workspace-root> -path '*/.git' -type d -prune. - Do not kill an existing live session unless the recovery instructions explicitly require it.
-
Recreate missing tmux sessions/windows:
- Prefer the exact reconstruction script in
REBOOT-INSTRUCTIONS.md. - If a session already exists, skip or reconcile it; avoid duplicate names.
- Verify with
tmux list-sessions.
- Prefer the exact reconstruction script in
-
Repair repos from safest to riskiest:
- Start with
git status --short --branch,git remote -v, andgit branch --show-current. - If only
.git/indexis corrupt, try the instruction-provided index rebuild. - If objects/trees are missing, move the checkout aside as
<repo>.corrupt-YYYYMMDD-HHMMSS, fresh-clone the remote at the original path, overlay the matching*-working-tree.tar.gz, thengit add -A. - Commit recovered changes with
chore: checkpoint before OS update [auto]. - Run
git pull --rebase, thengit push. - If GitHub rejects a file over 100 MB and
git lfs versionworks,git lfs track <file>, amend, and push again. - If push fails with permission denied, create/use a writable fork, add a
forkremote, push there, and set local upstream tofork/main. Report the original upstream remains blocked.
- Start with
-
Relaunch agents:
- For each
pane-*.txt, map it tosession:window.paneand cwd usingtmux-panes.txt. - Start Codex in that pane with a prompt that tells the agent to read its captured pane file, check current git state, avoid conflicts, and resume only if the captured work is still actionable.
- Leave windows with no captured pane file as shells unless the instructions say otherwise.
- Verify with
tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index} #{pane_current_command} #{pane_current_path}'.
- For each
-
Clean the recovery marker:
- After sessions are restored, repos are pushed or fork-pushed, and agents are relaunched, remove the recovery block from the workspace
AGENTS.mdor equivalent instruction file. - Before committing, check whether that file is tracked in the relevant repo. Do not add the whole workspace
AGENTS.mdto an unrelated parent repo.
- After sessions are restored, repos are pushed or fork-pushed, and agents are relaunched, remove the recovery block from the workspace
Relaunch Prompt
Use this shape for each pane:
Post-reboot recovery relaunch. First read the captured pane context at <pane-file>; it contains the last screen from your pre-reboot session. Resume the user's latest task from that capture if it is still actionable. Start by checking current repo/git state and avoid conflicting with other relaunched agents. If the capture shows the work was complete or only a slash-command request, summarize the recovered state and wait for the user's next instruction. Do not redo unrelated work.
Validation
Before reporting done, verify:
- All expected sessions from
tmux-sessions.txtorREBOOT-INSTRUCTIONS.mdexist. - Every captured
pane-*.txthas a corresponding live Codex pane or a clearly explained exception. - Repaired repos show clean
git status --short --branchand are up to date with their writable upstream. - Any oversized recovered files are handled with LFS or explicitly left in the preserved corrupt checkout.
- The AGENTS recovery block is gone.