Learn Claude Code: Cost & Context Mastery Session Hygiene: Naming, Branching, and the Kitchen-Sink Failure

Session Hygiene: Naming, Branching, and the Kitchen-Sink Failure

Intermediate 🕐 11 min Lesson 6 of 11
What you'll learn
  • Recognize the kitchen-sink session failure pattern and restructure sessions to avoid it
  • Use /rename, /resume, and /branch to manage parallel work and return to previous sessions efficiently
  • Navigate the resume-from-summary dialog on Pro/Max plans and choose the right option for your situation

The Kitchen-Sink Failure Pattern

The most expensive session pattern is not complex tasks — it is mixed tasks. A session that starts with a bug fix, drifts into a feature discussion, then picks up a refactor, accumulates context from all three threads simultaneously. Every new turn carries the file reads, tool results, and conversation history from work that is no longer relevant. Performance degrades on each task because context from the others buries the relevant signal.

The fix is structural: one task, one session. When you finish a task, /clear and start the next one. If you need to return to the previous session, /resume brings it back exactly where you left it.

Naming Sessions So You Can Find Them

Named sessions are recoverable sessions. Give every meaningful session a name before you clear it:

/rename auth-bug-fix

Then resume it by name:

claude --resume auth-bug-fix

Or use /resume from inside any session to open the picker. You can also set the name at startup:

claude -n auth-bug-fix

Sessions you never name still get an AI-generated title based on your first prompt — short and searchable. The session picker shows these titles with timestamps and git branch context, so even unnamed sessions are usually findable.

Branching: Trying a Different Approach

When you are deep in a complex task and want to try a different approach without losing your current path, use /branch:

/branch try-streaming-approach

This copies the conversation up to that point and switches you into the copy. The original session is preserved exactly as it was. If the new approach fails, return to the original with /resume. If it succeeds, the original is still there if you need to compare.

Branching is particularly useful before a risky implementation decision: create a branch, try the approach, and you have a clean rollback if it does not work out.

The Resume-from-Summary Dialog

On Pro or Max plans, when you resume a session that has been idle for more than an hour and is over 100,000 tokens, Claude Code shows a dialog before your first message. The cache has expired by then, so the next request re-processes the full history no matter what you choose. The dialog asks how to handle subsequent requests:

Resume from summary

Runs /compact immediately. Later requests carry the summary instead of full history — cheaper per turn. Best when continuity of detail matters less than continued productivity.

Resume full session as-is

Loads the conversation unchanged. After re-caching, later requests read from cache while it stays warm. Best when you need the full context of what was explored and decided.

Don't ask me again

Resumes full session and stops showing the dialog. Use this if you always want full context and find the prompt disruptive.

The tradeoff is detail vs. per-request cost. Summary is cheaper going forward but loses the fine-grained history. Full is more expensive but preserves everything.

Practical Session Structure

The workflow that keeps sessions cheap and clean:

  1. Start a new session for each distinct task: claude -n task-name
  2. Work the task to completion
  3. Run /clear task-name to name the completed session before clearing (or just /clear if you named it earlier)
  4. Start the next task fresh
  5. Use /resume any time you need to return to a previous thread

This pattern costs almost nothing extra and prevents every kitchen-sink failure before it starts.

Key takeaways
  • The kitchen-sink session failure — mixing unrelated tasks in one long session — is the most common and most expensive pattern; one task per session is the single most impactful habit you can build.
  • /rename before /clear means every session is retrievable; /resume brings it back exactly where you left it, with full context intact.
  • /branch before risky implementation decisions gives you a free rollback — the original session is preserved, and you can return to it if the new approach fails.
  • The resume-from-summary dialog on Pro/Max plans is a tradeoff: summary is cheaper per subsequent turn but loses fine-grained history; full resume preserves everything but re-caches the full context at full price.
  • Sessions started with -n auth-bug-fix can be resumed with claude --resume auth-bug-fix from any terminal — naming them at startup is the lowest-friction way to make sessions findable.