A Claude Code session has stopped helping when you spend more effort correcting its assumptions than testing its changes. But a difficult bug alone is not a reason to restart. Use this walkthrough to distinguish a productive investigation from a conversation that needs a clean start.
1. Check whether the task has actually changed
Write the current objective in one sentence. Compare it with the objective that opened the session. Fixing authentication middleware and then adding invoice exports are separate tasks, even if they share a repository.
Anthropic recommends starting a new session when starting a new task. Treat completion boundaries as natural reset points rather than carrying every investigation into the next feature. ([claude.com](https://claude.com/resources/articles/using-claude-code-session-management-and-1m-context?f80ce999_page=14&utm_source=openai))
Restart trigger: you would give a new teammate a different brief, with different files, constraints, and acceptance criteria.
2. Look for repeated assumptions, not just failed tests
Before restarting, make one precise correction: name the mistaken assumption, provide contrary evidence, and request a revised hypothesis before another edit.
For example: “The request reaches the handler, so routing is not the failure. Inspect how the handler reads the session cookie. Do not change route registration.”
If the next proposal returns to route registration without new evidence, consider restarting. My practical rule is to reset when corrections stop changing the investigation—not whenever the first patch fails.
Anthropic notes that irrelevant conversation, file contents, and commands can distract Claude, and recommends clearing context between tasks. ([anthropic.com](https://www.anthropic.com/engineering/claude-code-best-practices?trk=feed_main-feed-card_feed-article-content&utm_source=openai))
3. Choose compaction only when the direction remains sound
Use /compact when the objective and reasoning remain useful but the conversation contains too much accumulated detail. It summarizes the history so you can continue. Use /clear when you want a fresh conversation rather than a compressed version of the existing one. ([support.claude.com](https://support.claude.com/en/articles/14552983-models-usage-and-limits-in-claude-code?utm_source=openai))
A focused compaction request might be: “Preserve the cookie contract, failing test, and confirmed findings; discard exploratory routing discussion.”
For a fresh start, write your own brief instead. This is especially useful when you want to separate verified facts from the previous session’s explanations. Do not ask a summary to decide which disputed claims are true.
4. Save evidence before clearing the conversation
Create a short handoff note in the repository. Review it yourself before trusting it. Include:
- Goal: the observable behavior you need.
- Evidence: the failing command and relevant error output.
- Working state: changed files and what remains unverified.
- Constraints: interfaces or behavior that must stay unchanged.
- Rejected approaches: what failed and the evidence against it.
Keep guesses explicitly labeled as guesses. Anthropic’s guidance for fresh-context workflows recommends using filesystem artifacts, progress notes, and verification tools to reconstruct the task. Your handoff should support that reconstruction, not reproduce the entire conversation. ([platform.claude.com](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices?trk=article-ssr-frontend-pulse_little-text-block&utm_source=openai))
5. Separate conversation cleanup from code cleanup
Before clearing, inspect git status and git diff. Decide which changes are worth keeping. Preserve work through your normal checkpoint process, and avoid broad cleanup commands that could discard unrelated edits.
/clear removes conversation history while project files and project memory remain available. It is not a code rollback. A new conversation therefore needs an accurate account of the working tree it inherits. ([support.claude.com](https://support.claude.com/en/articles/14552983-models-usage-and-limits-in-claude-code?utm_source=openai))
6. Restart with one bounded verification task
Give the new conversation a narrow opening instruction: “Read the handoff note and inspect the current diff. Reproduce the cookie test failure. Report your hypothesis before editing. Keep the public API unchanged.”
Then request one patch and the relevant test result. Judge the restart by whether the investigation now follows evidence, not whether the first answer sounds more confident.
Check loaded context with /context if the supposedly fresh conversation still feels cluttered; Anthropic recommends inspecting it in a fresh session to identify unnecessary context. ([claude.com](https://claude.com/blog/maximizing-the-value-of-your-claude-code-sessions?utm_source=openai))
7. Keep relay access separate from session hygiene
If you use SwiftRelay with Claude Code, apply the same restart checklist. SwiftRelay provides pay-as-you-go, per-token access, but access configuration is separate from deciding which task history belongs in your next conversation.
Sign up for SwiftRelay to try your workflow with the small gift credit available to new accounts. Keep the debugging rule simple: continue while evidence accumulates; restart when inherited assumptions keep obstructing the next useful test.