Claude Code

Verified against Claude Code · 2026-08-05

Recover a Claude Code task correctly after a compaction or restart

A session-recovery prompt that has Claude Code reconstruct exactly where a multi-step task stands from git state and any saved plan file, rather than trusting a compacted summary or its own fluent-sounding recollection of what already happened.

Claude Code4 fillable variables

The prompt

Ready to copy — highlighted parts are example details you can swap.

This session's context was compacted, resumed from a saved transcript via --continue or --resume, or otherwise interrupted partway through a task. Do not continue as though every earlier decision is still fully remembered, and do not fill a gap with a plausible-sounding guess. Reconstruct the actual current state from ground truth before writing or changing anything else.

ORIGINAL GOAL
Migrate the reports module off the legacy REST client onto the new typed API client, one file at a time, keeping every existing test green throughout.

WHERE A PRIOR PLAN MIGHT ALREADY EXIST
A PLAN.md should exist at the repo root, written at the start of this task, listing files in migration order.

HOW THIS SESSION WAS RESUMED
This session was resumed with claude --continue after an unplanned terminal restart, not through a manual compaction.

EXPECTED TEST STATE BEFORE THE INTERRUPTION
The full reports test suite was green the last time it ran before the interruption, per the PLAN.md notes.

RECONSTRUCT BEFORE DOING ANYTHING ELSE
1. Run git status and git diff to see exactly what is currently uncommitted right now. List every added, modified, and deleted file, and summarize what each specific change does in one line.
2. Run git log to see what has already been committed toward this goal, if anything, on the current branch, and how recently.
3. Read, in full, any plan, todo list, or design note that exists at the location named above.
4. Compare the current diff and commit history against the original goal stated above: state which parts are done, which are in progress, and which have not started, citing the specific file or commit that proves each of those three claims.
5. Run the actual test suite now and compare the result against The full reports test suite was green the last time it ran before the interruption, per the PLAN.md notes. above. A currently failing test where the plan says everything was green last time is new information that needs its own explanation, not something to route around silently while continuing the original task.
6. Write one paragraph stating the current understanding of exactly where this task stands, based only on what steps one through five actually show, not on an inference about what probably happened during the gap.

IF SOMETHING DOES NOT ADD UP
If the current diff contains a change that cannot be explained by the goal or the plan artifact, name it explicitly as unexplained rather than building on top of it or assuming it was intentional. If an earlier decision appears to have been made that is not written down anywhere verifiable, say plainly that the reasoning behind it is unrecoverable from available evidence, and ask — do not invent a plausible-sounding rationale to fill the gap just because one would be convenient to have.

ONLY THEN
Propose what happens next, in concrete terms, naming the very next file or command involved, and wait for explicit confirmation before resuming any edit — a proposal is not itself permission to proceed, even when it seems like the only reasonable next step.

Customize

Optional — swap in your own details for the highlighted parts above.

Why this works

Claude Code compacts a long conversation's context automatically as it nears the model's context window limit, and compaction can also be triggered manually — in both cases what carries forward into the rest of the session is a generated summary standing in for the original turns, not the turns themselves, and --continue or --resume reload a saved transcript that has the same property whenever the underlying session had already compacted. A summary is lossy by construction: it reliably keeps the stated goal and the obvious file changes, and just as reliably drops the specific reasoning behind a judgment call, such as why one of two viable approaches was chosen, because that reasoning lived in a sentence of discussion rather than in a diff. This prompt's core mechanic is refusing to trust the compacted summary or the model's own fluent-sounding recollection, and instead re-deriving task state from git status, git diff, and git log — sources that cannot be silently rewritten by a summarization pass, the same principle behind verifying a claim against its primary source rather than trusting someone's paraphrase of it. Explicitly allowing 'the reasoning is unrecoverable, ask' as a valid output is the load-bearing part: a model motivated to appear continuous and competent will otherwise fabricate a plausible justification for a decision it cannot actually verify, and a fabricated rationale that later gets built on top of is far more expensive to unwind than an honest gap flagged immediately after a restart. Re-running the test suite rather than trusting the summary's account of test state closes the same gap one level lower: a compacted summary might faithfully report 'tests were passing' as of the last real turn it summarized, but that turn is not now, and treating a stale true fact as a current one is exactly the kind of small, compounding error that a session recovering from a real interruption cannot afford to inherit silently.

What you get back

git status shows 2 modified files with uncommitted changes and one new, uncommitted file. git log shows one prior commit toward this goal, so one of five planned files is done and merged into this branch's history. PLAN.md at the repo root lists five files in order; based on git state, file one is complete, files two and three are in progress with uncommitted changes, files four and five are not started. One thing does not add up: a test file has a modification not explained by the plan or the related source diff — flagging this rather than assuming it was intentional. Proposed next step: finish the in-progress files, resolve the unexplained test change, run the full suite, then commit before starting file four. Waiting for confirmation.

Verified against

Claude Code Sonnet 4.6 · 2026-08-05

Changelog

  • 2026-08-05 — Initial publish, verified against Claude Code session compaction and --continue (Sonnet 4.6).

Building this for real?

This is a free starting point. If you'd rather have custom software built and running for your business, that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
All Claude Code prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY