**Steering Claude Code Through Hours-Long Sessions: Plan Mode, Compact, Rewind, Goals — Transcript & Summary | SozAI**
Source: https://sozai.app/transcript/steering-claude-code-hours-long-sessions/

Learn how to effectively steer Claude through long coding sessions using plan mode, compact, rewind, goals, loops, and work trees.

## Key Takeaways

- Scoping and planning work before execution is critical for long sessions.
- Compact and rewind commands help manage context and correct course efficiently.
- Goal and loop modes enable more autonomous and continuous task completion.
- Work trees prevent conflicts in multi-agent coding environments.
- Proper steering techniques reduce the need for babysitting Claude during long runs.

## What the video covers

- Running long tasks with Claude, such as refactoring or feature implementation, requires careful steering and planning.
- First, scope the work using plan mode where Claude researches and provides a detailed plan before execution.
- Iterate over the plan to reduce execution hiccups rather than hoping for the best.
- Use the compact command to summarize and condense conversation context, freeing up Claude's context window while guiding the summary.
- Rewind allows reverting to checkpoints created by user prompts to correct course without complicated prompting.
- Goal mode sets completion conditions that Claude works towards until a fast evaluator confirms they are met, enabling more autonomous operation.
- Loop runs prompts on intervals to monitor external states like CI runs and acts on changes, with an option to stop via escape.
- Work trees prevent conflicts when multiple Claude sessions work on the same repository by isolating file trees and managing ignored files.
- Effective long session management involves scoping work first, steering with compaction and rewind, setting clear goals, and using parallel work trees.
- Following these methods allows trusting Claude to run long coding sessions without constant supervision.

## Chapters

1. 00:00 Introduction to Long Tasks with Claude
2. 00:14 Two Important Habits for Long Sessions
3. 00:28 Planning and Iterating the Work Plan
4. 00:50 Using Compact to Manage Context
5. 01:16 Rewind for Course Correction
6. 01:52 Goal and Loop Modes for Autonomous Work
7. 02:51 Work Trees for Multi-Agent Collaboration
8. 03:27 Summary and Best Practices for Steering Claude

Answers

## Questions about this video

What is the purpose of plan mode when working with Claude?

Plan mode allows Claude to research and create a detailed plan in read-only mode before starting execution, reducing errors and improving efficiency.

How does the compact command help during long Claude sessions?

The compact command summarizes the conversation and creates a new context while deleting old messages, freeing up Claude's context window and allowing focused steering.

What are work trees and why are they important?

Work trees create independent file trees for multiple Claude sessions working on the same repository, preventing conflicts and ensuring safe parallel development.

## Full Transcript — Download SRT & Markdown

00:02

Speaker A

You can prompt Claude and watch it finish a quick task, but running a long one is much harder.

00:07

Speaker A

Refactoring across a dozen files or implementing a new feature can take hours, and if you are steering Claude in the right direction, it can potentially take longer.

00:14

Speaker A

But there are many ways to help Claude during these long sessions. There are two important habits.

00:21

Speaker A

The first is to scope the work before Claude starts. So if you use plan mode, Claude will do the research in read-only mode and hand you a plan.

00:28

Speaker A

Once the plan has been provided, actually read through it. The more thorough the plan, the less likely that you're going to have hiccups when Claude executes.

00:35

Speaker A

And when it comes to revising the plan, just ask Claude to add it where you want.

00:39

Speaker A

It's much faster to iterate over a plan than it is to simply hope for the best.

00:44

Speaker A

The second habit is to steer Claude in the right direction. And here are some ways that you can do that.

00:50

Speaker A

Compact summarizes your conversation and uses that as a new context while deleting the old, freeing up your context window.

00:57

Speaker A

However, there is a risk that something important will be removed, causing Claude to drift in the wrong direction.

01:02

Speaker A

So when you do the compact command, add in the changes you want. And adding instructions after the command tells Claude how to summarize.

01:08

Speaker A

So if you were done debugging a while ago but want to just focus on those API changes, well, here you can do that.

01:16

Speaker A

When Claude goes down the wrong path, you don't have to prompt your way out of it.

01:20

Speaker A

Rewind brings you to the last checkpoint. To open it, double tap escape on an empty prompt and you'll get the rewind menu.

01:26

Speaker A

Every user prompt creates a checkpoint that you can revert back to with different options.

01:31

Speaker A

One, you can restore the code, conversation, or both. To summarize from here, we'll summarize everything after the checkpoint.

01:38

Speaker A

Great if you had a side conversation and just want to free up some space.

01:42

Speaker A

And summarize up to here, we'll summarize everything before the checkpoint. So this is great if you want to summarize a long setup phase, but keep the implementation parts.

01:52

Speaker A

When we talk about steering, we assume that you are hands-on. If you want something a little bit more autonomous, there is the goal and loop.

02:00

Speaker A

Goal sets a completion condition. You describe what done looks like and Claude keeps working across turns until a fast evaluator confirms that those conditions have been met.

02:09

Speaker A

Instead of just stopping the first time it thinks it's finished. So for example, I could do slash goal, all tests in source billing pass, and the type checker report zero errors.

02:18

Speaker A

Doing slash goal clear will cancel it. And one constraint here is that the evaluator only reads the transcript, so the condition has to be checkable from the output that Claude produces,

02:28

Speaker A

like the test results that it ran. Loop runs a prompt on an interval between turns, fixed or self-paced.

02:33

Speaker A

Use it to pull something external like a CI run or a deploy and act when the state changes.

02:38

Speaker A

You can press escape to stop it. So our steering metaphor assumes one steering wheel in one car.

02:45

Speaker A

But when we're working with multiple agents on the same code base, we don't want to have two steering wheels in one car.

02:51

Speaker A

Well, that's just unsafe. This is where work trees come in. It prevents two or more cloud sessions from fighting over files in a repository.

02:58

Speaker A

This prevents conflicts by having three independent file trees. On exit, a clean work tree is auto removed.

03:04

Speaker A

A .worktree include file at the repo root lists get ignored files to copy into each work tree, which is useful for an environment variable file or a local configuration that you need but don't want to commit into the version control.

03:24

Speaker A

When it comes to handling long cloud code sessions, scope your work first and then steer.

03:27

Speaker A

Direct your compaction so the summary keeps what matters. Use the rewind menu to course correct.

03:32

Speaker A

Set a goal when you can describe done better than you can describe the steps and run parallel work and work trees.

03:37

Speaker A

Do that and you can trust a long run without babysitting it.

Topics: Claude AI long coding sessions plan mode compact command rewind feature goal mode loop mode work trees AI code assistant software development


---
This is the markdown twin of https://sozai.app/transcript/steering-claude-code-hours-long-sessions/ — the same content, without the markup.
Published by SozAI (https://sozai.app). Reuse and quotation are allowed with attribution and a link back.
Machine-readable index: https://sozai.app/llms.txt · data API: https://sozai.app/api/
