How to Resume Long-Running AI Coding Tasks Reliably
A coding agent can remember a conversation and still misunderstand the current project. Files may have changed, tests may have stopped halfway through, and a command may have completed after the last message. Reliable resumption starts by reconciling the saved plan with observable repository state. The goal is to continue the next justified action, with enough evidence to avoid repeating work or overwriting someone else’s changes.
AI-assisted technical guide with linked primary sources. Examples are illustrative unless stated otherwise. How these guides are made.
Separate conversation, repository, and execution state
Think of interrupted agent work as three independent recovery problems. Conversation state records requests and reasoning. Repository state records files and commits. Execution state includes running processes, queued jobs, external writes, and commands whose outcomes are uncertain. Restoring one layer does not restore the others.
Anthropic’s long-running-agent research describes progress artifacts and incremental work across sessions, and identifies premature completion and poorly documented partial work as failure modes. That supports using durable artifacts alongside model context. It does not establish that any particular checkpoint format guarantees correctness.
For a practical local workflow, keep the recovery record small enough to inspect. A transcript can preserve the discussion; a checkpoint should identify the next decision. Avoid asking a new session to infer task status from thousands of log lines before it has even checked the branch.
Write checkpoints around verifiable milestones
Create a checkpoint after a meaningful unit of work: an implementation slice, a validated failure reproduction, or a completed review. Also checkpoint before changing environments or stopping for a long break. Recording every keystroke adds noise; recording only at the end leaves the most vulnerable work undocumented.
Use a project-local file such as work-notes/task-checkpoint.md, following your repository’s conventions. Record the goal, current branch, baseline commit, affected files, completed behavior, pending behavior, validation commands and outcomes, unresolved questions, and any commands still running. State whether edits are committed. Include an owner when multiple people or agents share the project.
Separate observations from intentions. “Added the parser” is ambiguous. “Parser handles empty input in the new test; integration coverage has not run” tells the next session what is established. Store credentials elsewhere, and avoid copying private request payloads into a checkpoint that may enter version control.
A worked checkpoint for an interrupted export feature
Suppose an agent is adding CSV export to an internal dashboard and reaches a usage limit after changing the formatter. The following is an illustrative handoff format, with identifiers supplied by the actual project:
Goal: Export filtered invoices as CSV.
Branch: feature/invoice-csv
Baseline: record the actual starting commit here
Owner: export-implementation session
Completed: Formatter handles commas and empty values.
Changed: src/export/csv.ts; tests/export/csv.test.ts
Validation: Record exact command, exit status, and time.
Pending: Connect button; test active filters end to end.
Uncertain: Last browser check was interrupted before result.
Running work: Confirm whether preview server still exists.
Next action: Inspect diff, rerun focused formatter checks,
then implement filtered-row selection.
Do not change: Invoice query API or authentication flow.This checkpoint does not claim success. It directs the next session to inspect code and produce fresh evidence. If a human changes the API contract while the agent is paused, update the record before resuming. Otherwise the checkpoint becomes an authoritative-looking description of an obsolete task.
Reconcile the working directory before issuing new instructions
Start with read-only inspection. Confirm the directory, branch, recent history, staged changes, unstaged changes, and untracked files. The official Git status documentation explains how status distinguishes changes relative to the index and working tree. Include untracked files in your review; an unfinished implementation may exist entirely outside committed history.
pwd
git branch --show-current
git status --short
git log -5 --oneline
git diff
git diff --cachedThese are suggested inspection commands, not evidence that this example has been executed. Compare their output with the checkpoint. If an unfamiliar file changed, ask the owner or inspect history before modifying it. Do not “clean up” unexpected changes just to make the saved plan fit.
Check execution state separately. A local test command might still be running, while a deployment command might have submitted a remote job. For external actions, inspect the receiving system or operation identifier before retrying. Repeating an uncertain write can create duplicate tickets, releases, or other side effects.
Resume the right conversation, then refresh its assumptions
For Claude Code CLI, the official session documentation describes claude --continue for the most recent session in the current directory and claude --resume for the session picker. A saved conversation is useful background, but choose it by task identity rather than assuming the most recent session is the correct one.
claude --resumeAfter selecting the intended task, give a narrow recovery instruction: “Read the checkpoint and current diff. List contradictions, confirm the next incomplete acceptance criterion, and inspect any uncertain command outcome before changing files.” This is a proposed operating pattern, rather than a guarantee of the CLI.
If the transcript is missing, start a fresh session using the checkpoint, repository instructions, and current files. Recreating the exact previous conversation is less important than restoring the goal and evidence. If the old process is still active, resolve ownership first so two sessions do not continue the same edits.
Handle mismatches without destructive shortcuts
When the saved state and repository disagree, classify the mismatch before acting. Missing context calls for reading the relevant files. A failing test calls for diagnosis. A moved branch calls for inspecting history. Uncertain external actions call for checking the destination. These situations need different recovery steps.
The official Git reflog documentation describes local reference-update history. It can help locate a previous branch tip after references move. It does not recover arbitrary unsaved editor contents, and its records can expire. Treat it as one recovery aid rather than a substitute for commits and backups.
Avoid blanket resets, forced cleanup, or deleting worktrees as a first response. Preserve useful uncommitted changes before any deliberate rollback. Also distinguish reversible code edits from irreversible external actions: a Git revert cannot unsend an email or reverse a production data mutation.
Verify one acceptance criterion before expanding scope
Resume with a small unit of work and a clear completion check. In the CSV example, first verify formatter behavior, then connect filtered rows, then inspect the downloaded output. A green formatter test does not establish that the button exports the correct records.
Record fresh results against the current revision. If dependencies, environment variables, or service versions changed, previous validation may no longer apply. Include known verification limits in the next checkpoint, such as unavailable browser access or a missing test service. Do not silently promote an unverified step to completed status.
Before the next pause, check:
- The checkpoint identifies the actual branch and task owner.
- Completed items have evidence, while uncertain outcomes remain explicit.
- Uncommitted files and running commands are accounted for.
- The next action fits one bounded acceptance criterion.
- External writes have operation identifiers where available.
- Another session can understand the recovery record without the original transcript.
Keep recovery work visible on your Mac
Long-running tasks often stall because a developer loses track of which session needs attention. Purrvio’s Mac preview shows supported local coding sessions, with the richest detail for Claude Code and Codex. It reads local session records and processes without installing agent hooks, and can help you return to the session you intended to resume.
Purrvio provides visibility; your checkpoint and verification process still establish what work is safe to continue. Session navigation supports Ghostty and Terminal.app; direct replies require Ghostty and Automation permission. The free preview supports macOS 13 or later on Intel and Apple silicon, is locally signed, and is not Apple-notarized. Download the Purrvio Mac preview and read the installation notes before trying it.
Frequently asked questions
Is resuming a conversation enough to recover an interrupted coding task?
No. Inspect the current files, branch, running commands, and uncertain external actions. The transcript preserves discussion, while repository and execution state may have changed independently.
Should checkpoints be committed to Git?
Follow the project’s conventions. A shared, non-sensitive progress record can help a team, while personal notes may belong outside tracked files. Keep credentials and private payloads out of either format.
What should I do if the previous agent process is still running?
Establish one owner before allowing another session to edit the same work. Inspect whether the existing process is making progress or waiting, and deliberately attach, pause, or stop it using the tool’s supported controls.
Sources and further reading
Primary references checked for this guide on 10 November 2026. Documentation can change; confirm version-specific behavior before using commands in a production workflow.
- Anthropic: Effective harnesses for long-running agents
Primary research on incremental agent sessions, progress artifacts, and premature completion failure modes; workflow examples here are proposed adaptations.
- Claude Code: Manage sessions
Official CLI session persistence and resume entry points; checked for current continue and resume behavior.
- Git: git-status
Official status semantics for index, working tree, and untracked-file inspection.
- Git: git-reflog
Official description of local reference history and expiration behavior, supporting limited recovery guidance.