Free template // Claude Code

Reset a stuck Claude Code session without losing the plot.

When a long session starts going in circles, fixing the same bug again or forgetting what it already tried, have Claude write a short handoff.md before you reset. The fresh session reads it and carries on, without the baggage.

_00 // WHY NOT /COMPACT

A summary can keep the mistake.

/compact summarises the conversation so you can keep going. But the summary can carry the same wrong assumptions forward, and you end up arguing with Claude over a bug it keeps reviving.

A handoff file is different: you check it, failed approaches are marked as failed, and the next session starts from a clear plan.

_01 // BEFORE YOU RESET

Paste this into Claude.

It writes handoff.md in your project root with six sections, plus two optional ones.

Before I reset this session, write a file called handoff.md in the project root so a fresh session can pick up exactly where we are. If handoff.md already exists, replace it. Keep it under one page.

Use these six sections:

1. Goal: what we're trying to achieve, in one or two sentences.
2. Where things stand: what works now and what doesn't.
3. Files involved: the exact paths that matter, with a few words on each.
4. What changed: the edits made this session, file by file, including anything reverted.
5. What failed and why: every approach that didn't work. Start each one with "FAILED: do not retry", then say what was tried and the real reason it failed. Quote the key line of the error if there was one.
6. Next step: the single next thing to do, specific enough to start on straight away.

Then add these two if they apply:

- Decisions: anything already decided or ruled out that the next session shouldn't reopen.
- Check command: the exact command that proves the work is done, and what a pass looks like.

Rules:
- Be specific: file paths, function names, exact errors and exact commands.
- In "Where things stand" and "Next step", mark each point (verified) if you confirmed it this session, or (assumed) if you didn't.
- No whole files, long logs or background that no longer matters. Short beats complete.
_02 // CHECK IT

Thirty seconds before you reset.

  • Every failed approach is marked FAILED. This matters most. If a dead end isn't marked, the next session will try it again.
  • The next step is one clear action, not a list of maybes.
  • The check command is a real command you could copy and run, not "test it".

If anything is missing or wrong, ask Claude to fix it now, while it still remembers.

_03 // RESET, THEN CONTINUE

Clear it and pick up.

Type /clear, or start a new Claude Code session in the same project folder. /clear only empties the conversation. Your files, including handoff.md, stay as they are. Then paste:

Read handoff.md, check the current files, and continue from the next step.

Before you change anything, confirm the files match what the handoff says. If they don't, tell me what's different. Don't retry anything marked FAILED. When you think you're done, run the check command and show me the output before saying it works.

When the task is finished, delete handoff.md so a later session doesn't pick up an old plan.

_04 // EXAMPLE

What a good one looks like.

# Handoff

## Goal
People with a plus sign in their email (sam+news@gmail.com)
can't confirm their newsletter signup. Clicking the
confirmation link gives a 500 error.

## Where things stand
- Signup works for every address, plus signs included (verified).
- Confirming works for plain addresses (verified).
- Confirming a plus-sign address returns 500 (verified, new test fails).
- Cause: the email is put into the link unencoded (verified, see Next step).

## Files involved
- src/api/subscribe.ts: saves the signup, builds the confirmation link
- src/api/confirm.ts: reads the email from the link, looks up the subscriber
- src/lib/validateEmail.ts: email check. Not the problem.
- tests/subscribe.test.ts: signup and confirm tests

## What changed
- tests/subscribe.test.ts: new test "confirms plus-sign addresses".
  Fails for now, as it should.
- src/lib/validateEmail.ts: regex loosened, then reverted.
  Back to the original.

## What failed and why
- FAILED: do not retry. Loosening the regex in validateEmail.ts.
  The address already passes validation. The failure is at confirm.
- FAILED: do not retry. Wrapping confirm.ts in try/catch.
  Hid the 500, but the subscriber still never got confirmed.

## Next step
In src/api/subscribe.ts (around line 42) the link is built as
/confirm?email=${email}
In a query string "+" is read as a space, so confirm.ts looks up
"sam news@gmail.com", finds no one, and crashes on the empty result.
Change it to /confirm?email=${encodeURIComponent(email)}
so "+" is sent as %2B (assumed fix, not tried yet).

## Decisions
- Keep the current confirmation-email flow and provider.
- No database schema changes.

## Check command
npm test -- subscribe
Pass = 6 of 6 tests pass, including "confirms plus-sign addresses".
Today: 5 pass, 1 fails.

Real paths, the actual cause, dead ends clearly marked, and one command that settles whether it's fixed.