Documentation
Claude Code, Codex and Cursor crash recovery
When a coding-agent session dies mid-run, check the shift state, host signals, and recovery log, and learn when Nightshift resumes and when it stands down.
Updated
What happens to a long run when the session crashes?
The approved work survives on disk even when the original conversation cannot be resumed. Nightshift revives the session only when the armed shift, process evidence, and host identity support a safe continuation. Start with Status or Doctor and the shift log to see which happened.
First check what the crash left behind
From the folder containing .nightshift/, read the open boxes in punch-list.md and the latest shift-log.md entry. Ask Nightshift for Status and Doctor in the same project. If STOP, a completed shift, a deadline, or a clean close is recorded, the watchman should stand down; Start is the deliberate way to re-arm a paused contract.
# From the Nightshift workspace on macOS or Linux
ls .nightshift/STOP .nightshift/.shift-armed .nightshift/.ended 2>/dev/null
tail -40 .nightshift/shift-log.mdHow Claude Code, Codex, and Cursor recover
A recorded identity and positive failure evidence matter more than a quiet screen. The watchman runs outside the host process and advances a lease before a replacement can use tools.
- Claude Code: transcript, process, roster, clean-exit, Escape, and API-error signals guide revival. It tries the recorded conversation first, then documented fallbacks; a clean close or Escape is not treated as a crash.
- Codex: pulse, process, rollout, and SessionEnd are decisive. SessionEnd pauses recovery; a crash without it may revive. Same-conversation resume needs a recorded resumable task identity. Known non-resumable handles stand down.
- Cursor: a dead IDE-owned shift can move to a new CLI worker with the same contract. The IDE conversation ID cannot resume in the separate CLI store. Later recoveries resume that CLI worker. Cursor CLI requires project hook installation when Setup offers it.
If the old panel still shows an error
Read shift-log.md for a resume attempt and inspect the punch list and receipts. A headless Claude Code or Codex worker can append turns without refreshing an already-open panel. Reopen the recorded conversation before prompting; the process lease fences old observable tool calls. Cursor's replacement CLI worker is a different conversation, so follow the recorded attach instruction instead of treating the IDE tab as current.
What recovery cannot do: sleep, power-off, stopped containers
A powered-off or sleeping machine cannot run the local watchman; a stopped container or remote environment also stops its local processes. A live but unclassified hang is left alone to avoid duplicate workers. An upstream outage may delay every retry. If Doctor reports missing or unsafe identity, keep the open contract and restart attended rather than manufacturing a resume.
Start with a bounded prompt
This prompt names the outcome and preserves Nightshift’s review boundary. Paste it into the supported coding host from the project you want to change.
Diagnose this interrupted shift with Status and Doctor. Report the recorded host identity, process evidence, lease, and shift-log entries before proposing a restart.What this workflow does not claim
- Sleeping or powered-off machines cannot run the local watchman; uncertain liveness stands down.
- Cursor IDE-to-CLI handoff retains the contract, not the IDE conversation; Codex same-thread revival needs a resumable identity.
Evidence and sources
These links support the released behavior, public outcomes, or problem language described on this page.