My coding agent crashed mid-task. How do I resume without starting over?
Do not start the task again. First see what is on disk with git status and
git diff, then reopen the same session (claude --continue,
codex resume, or Cursor's agent resume) and ask it to finish from where
it stopped. Run the tests before you trust anything. If the session will not reopen, a short note
plus the diff is enough for a fresh one, in the same agent or another. BuildGist's Inbox and its
Continue card help with both.
BuildGist is a Mac app for Claude Code, Cursor and Codex. Download for Mac.
1. See what the agent left
git status
git diff --stat
git log --oneline -5
A crash can leave a file half-written, a new file nothing imports yet, or a commit the agent made
before it stopped. Look for those three. A file that no longer parses is one sign of an edit cut
off midway. Do not run git checkout . or git reset --hard yet.
They throw away the finished part along with the broken part.
2. Reopen the session
- Claude Code:
claude --continuereopens the latest session in this folder, andclaude --resumelets you pick one. Claude Code writes the session to a local file as you work, so it is there after a crash. - Codex:
codex resumelists recent sessions, and/resumedoes the same inside Codex. - Cursor CLI:
agent resumereopens the latest chat, andagent lslists earlier ones. In the editor, the chat is in the chat history.
Then say what happened, in so many words:
The last run stopped partway (the process crashed). Check git status and git diff,
tell me which steps are complete and which file may be half-edited, then finish
from there. Do not redo finished work.
3. Roll back only the broken part
If one file is a mess, restore just that file with git restore path/to/file, or use
the agent's own checkpoints:
- Claude Code makes a checkpoint before each prompt. Press Esc twice, or type
/rewind, to restore code, conversation or both. Its documentation notes that changes made by shell commands, and changes made outside Claude Code, are not tracked by checkpoints. - Cursor keeps checkpoints locally, apart from Git. Restoring one reverts files only.
- Codex: use Git. The steps are in how to undo Codex changes.
Claude Code's options are covered in more depth in how to undo Claude Code changes.
4. Run the tests
A crashed run often did not get to the step where it ran the tests. Run them yourself before you continue. A failing test tells you where the agent stopped more reliably than its last message.
5. If the session will not reopen
Start a fresh one with a note:
Task: (what you asked for)
Done: (what the diff shows is finished)
Possibly half-done: (the file that looks cut off)
Next step: (what to do first)
Or switch agents. A crash is a natural point to move the task, and the note works in any of them.
Make the next crash cheaper
- Commit at each working step, or ask the agent to. A small commit is a restore point no tool can lose.
- Give long tasks their own branch or git worktree.
- Keep the plan in a file the agent updates as it goes, so a new session can read it.
What BuildGist does after a crash
BuildGist explains each meaningful run in plain English in its Inbox, including uncommitted work, so you can read what the run before the crash did. It records the request you typed, the files changed with line counts, and the tests that ran with their result. When you start a new chat in Claude Code, Cursor or Codex in the same project, its card offers the task you were on, if it was active in the last 12 hours. Choose Continue to start with that context, or Start fresh. The explanation is written by AI, so check it against the code and the tests.
Questions
Does Claude Code save a session if it crashes?
Claude Code writes each message to a local session file as you work, so claude --continue or claude --resume can reopen it. Check the last turn against git diff, since it may not have finished.
Should I git reset after an agent crash?
Not first. Read git status and git diff, keep the finished work, and restore only the file that is broken.
Can a different agent finish the task?
Yes. Open it in the same folder with a short note. With BuildGist, choose Continue on the card in Claude Code, Cursor or Codex.
Sources
- Claude Code checkpointing and CLI reference, checked October 25, 2026.
- Codex developer commands, checked October 25, 2026.
- Cursor CLI and Cursor agent checkpoints, checked October 25, 2026.
What you need
- A Mac with Apple silicon and macOS 12 or later.
- Claude Code, Cursor or Codex.
- A Git project. No commit, push, remote or GitHub repository is needed.
- A GitHub account, to sign in. BuildGist does not access your GitHub repositories.
Codex needs you to approve BuildGist once, in Codex. BuildGist shows the steps. Setup is in Getting started.
To explain a run, your computer sends BuildGist what that run needs, and BuildGist passes it to Anthropic. BuildGist does not keep this material. It does not send your whole repository, files the run did not change, or files named like secrets, such as .env files and keys. It keeps the explanation and short cited excerpts of changed code, at most 12 lines each. Secret masking is best-effort. Privacy has the full list.
Every account gets 7 days of BuildGist Pro free, with no card. The 7 days start at your first explanation or Continue handoff. Nobody is charged when the trial ends. After that, BuildGist Pro is $12 per month, plus any applicable tax shown at checkout. See pricing.
Try BuildGist Download for Mac
Apple silicon, macOS 12 or later. United States, 18 or older.
Related
- What did Claude Code change?
- Switch from Claude Code to Codex
- Understand code an agent wrote
- Hand off Claude Code to Cursor
- Review what Codex changed
- You’ve hit your session limit in Claude Code
- You’ve hit your usage limit in Codex
- Keep context across agents
- Review AI code before merging
- BuildGist or the git diff
- Claude Code session history
- Undo Claude Code changes
- BuildGist vs CLAUDE.md, AGENTS.md and HANDOFF.md
- Keep context from Claude Code to Cursor
- Resume an agent session in another tool
- BuildGist vs Conductor
- Codex context window full
- Undo Codex changes
- Cursor usage limit reached
- Review Cursor agent changes
- Codex session history location
- Your conversation is too long in Cursor
- One default coding agent, or two?
- Tools that summarize agent sessions
- Switch from Codex to Claude Code
- Move from Cursor to Claude Code
- Switch from GitHub Copilot to Claude Code
- Move from Windsurf to Cursor
- Switch from Gemini CLI to Claude Code
- Claude Code lost context after compacting
- What commands did the agent run?
- Turn an agent session into a PR description
- Which coding agents read AGENTS.md?
Questions: kayvanandre@gmail.com.