Claude Code In Action
← All lessons
Lesson 101Claude Code In Action

Steering long sessions

Summary audio

No audio recap for this lesson.

Study notes

Planning & Scoping

  • Use plan mode to have Claude research and propose a plan in read-only mode before execution
  • Read through the plan thoroughly—a detailed plan reduces execution errors
  • Iterate on the plan itself rather than hoping for the best during execution

Steering & Context Management

  • Compact command: Summarizes conversation and frees up context window, but risks losing important details
  • Add specific instructions after compact to control what gets summarized
  • Specify which parts to focus on (e. g. , "focus on API changes only")
  • Rewind: Double-tap escape on empty prompt to access checkpoint menu
  • Restore code, conversation, or both
  • Summarize from checkpoint (removes everything after it)
  • Summarize up to checkpoint (removes everything before it)

Autonomous Work

  • Goal: Set completion conditions describing what "done" looks like; Claude keeps working until evaluator confirms conditions are met
  • Use /goal clear to cancel
  • Conditions must be checkable from Claude's output (test results, type checker, etc. )
  • Loop: Runs a prompt on fixed or self-paced intervals to pull external data (CI runs, deploys) and act on state changes
  • Press escape to stop

Multi-Agent Coordination

  • Work trees: Prevent multiple Claude sessions from conflicting over the same files
  • Creates three independent file trees
  • Clean work trees auto-remove on exit
  • Use . worktreeinclude file to specify ignored files to copy into each work tree (e. g. , environment variables, local config)

Overall Strategy

  • Scope work first, then steer
  • Use goals when you can describe the end state better than the steps
  • Run parallel work in separate work trees to avoid conflicts

Takeaways

  • Use plan mode to research and propose a plan before execution, then iterate on the plan itself rather than during execution
  • Use compact command with specific instructions to summarize conversation and free context, or use rewind to restore checkpoints and remove sections of conversation
  • Set completion conditions with /goal to have Claude work autonomously until the end state is reached
  • Use /loop to run prompts on intervals to pull external data and respond to state changes
  • Use work trees to run multiple Claude sessions in parallel without file conflicts
Flashcards 9 cards
Question
click to reveal · ←/→
Answer
click to flip back
Export to Anki (.tsv) ↓
Knowledge check 1 questions