HomeVideos

I was an AI skeptic. Then I tried plan mode

Now Playing

I was an AI skeptic. Then I tried plan mode

Transcript

390 segments

0:00

My interest in AI coding started when I

0:03

tried plan mode. Before I tried plan

0:04

mode, I was a total AI skeptic. I

0:06

thought there's no way that AI can write

0:08

decent code. Certainly not at the speed

0:10

that I can. There's no way that AI can

0:12

understand my codebase as well as I can.

0:14

And there's no way that AI can mimic the

0:16

instincts that I've built up over a long

0:18

career doing this stuff. And then Claude

0:19

Code released plan mode and I tried it

0:22

and I've never gone back. Every piece of

0:24

code I write now goes through this loop

0:25

where I first plan it in plan mode with

0:28

an AI. I then get the AI to execute the

0:30

plan. Basically, write the code that was

0:32

in the plan. We then test it together

0:33

either by running unit tests or by type

0:36

checking or by manual QA. Then we commit

0:38

the code and the process starts again

0:40

and we start planning the new thing. I

0:41

believe this process is completely

0:43

indispensable to getting decent outputs

0:45

from an AI. And if you drop this plan

0:47

step altogether, then you are really

0:49

hampering yourself in terms of what you

0:51

can do. Now, for folks who want to skip

0:52

to the end and get the good stuff

0:54

immediately, I've added a link below

0:56

that shares my rules for creating really

0:59

great plans in my claw.md file. We're

1:01

going to be going through some of these

1:02

and why I have them in here. But if you

1:04

want to get them right now and start

1:05

using them, then follow the link below.

1:06

And if you don't want to miss out on any

1:08

more of this stuff, then sign up to my

1:09

newsletter there, too. But let's

1:10

actually get talking about what plan

1:12

mode is. First of all, when you run claw

1:14

code or any kind of AI coding assistant

1:16

on your computer, it can do four main

1:19

things. It can write to the file system.

1:21

It can read from the file system or it

1:23

can read websites and documentation and

1:25

go and ping URLs or it can run bash

1:27

scripts on your local machine or if

1:29

you're on Windows, you know, PowerShell

1:31

or anything like that or it can use MCP

1:33

servers that are either running locally

1:34

or are remote and call tools on them to

1:37

do things and find out information. The

1:39

way the plan mode works is you

1:40

essentially disable the write

1:42

functionality. In plan mode, the AI

1:44

agent isn't allowed to write files. And

1:46

the agent has a different system prompt

1:48

telling it to do different things to

1:50

actually create a plan before making any

1:53

changes. And if it tries to make

1:54

changes, then it should actually

1:55

encounter an error. So, it's being

1:57

stopped from making changes. So, because

1:59

the agent can't do any writes to the

2:01

file system, it then goes into a mode

2:03

where it explores your codebase, looks

2:05

for all the information it might need,

2:07

and puts that into a detailed plan that

2:09

it will then go to execute on

2:11

afterwards. You can get into plan mode

2:13

really easily by just taking Claude code

2:15

and just shift tabbing until you reach

2:17

plan mode. Claude Code was the first

2:19

place that I saw plan mode. I don't know

2:21

about 9 months ago, let's say. But now

2:23

other places like Cursor and VS Code

2:25

also have plan mode. So I told you what

2:27

it is, but I haven't really told you why

2:29

this plan step here is so crucial. What

2:32

happens if you don't plan and instead go

2:34

straight into executing? Well, let's

2:36

start off with the agent first. I want

2:38

you to imagine for a second that you had

2:40

a colleague who every time they made a

2:42

commit forgot everything they'd ever

2:45

learned about the repo. How would you

2:46

make that colleague productive? Well,

2:48

probably what you tell them is to

2:50

explore the repo first before they went

2:52

and made any changes. And that's what

2:54

plan mode does here. It loads up the

2:56

LLM's context with all the relevant

2:58

info. It helps the LLM look at your code

3:00

base to see code patterns that you're

3:02

using. And not only that, it will often

3:04

use a really cheap, fast model to do

3:06

this. Claude Code often uses 4.5 Haiku

3:09

which is really cheap and really really

3:11

quick and launches it in a sub agent. So

3:14

Haiku can go and ping out loads and

3:16

loads of requests for different files

3:18

and then it sends back a summary to the

3:19

parent more expensive agent. If you had

3:21

no idea what I just said, I will explore

3:23

that in a future video. But all of this

3:24

to say that planning helps the agent.

3:27

Now if you don't do this then the

3:28

context won't be loaded with relevant

3:30

information. The LLM might make a stupid

3:32

mistake because it just doesn't have all

3:34

the information. It might use patterns

3:36

or contexts that aren't actually used in

3:38

your codebase. And so lots of the

3:39

failure modes that you might be seeing

3:41

while using these tools might be down to

3:43

the fact that you're not planning. But

3:44

let's talk about the other side of the

3:46

coin that planning actually helps the

3:48

developer. There's a great maxim from

3:50

the pragmatic programmer that says no

3:52

one ever knows what they want. When you

3:54

start planning out a new feature or a

3:55

new idea, you probably don't fully know

3:58

exactly what you want. If you're

4:00

planning a refactor, you might not fully

4:02

understand the ramifications of your

4:03

change. When you've got a UI thing to

4:05

tweak, you might have three different

4:06

options that you're considering in your

4:08

head. The way around this for most

4:09

developers is rubber ducking. Is

4:11

literally talking it out with someone

4:13

else or a rubber duck in front of you

4:14

until you figured out the best solution

4:16

by talking through it, considering all

4:18

the options. And so, an actual planning

4:20

process helps the developer by making

4:23

sure they have a strong idea of what

4:24

they want. And this process is

4:26

iterative. In other words, you loop back

4:28

and forth with the AI until you have a

4:30

plan that you feel that you can depend

4:32

on. And that process of the AI

4:34

suggesting something and you saying,

4:35

"Uh, no, not quite." By the end of that,

4:37

both you and the AI are going to have a

4:39

clearer idea of what actually needs to

4:41

be done. And then the doing of it is

4:43

really simple and you can mostly let the

4:44

AI go on autopilot. Now, if you don't do

4:46

this, then the AI is not going to know

4:49

what quite what you want. You in this

4:51

situation are like a demanding client

4:53

demanding something gets fixed, but the

4:54

AI doesn't quite know how to implement

4:57

it or the AI isn't sure how to please

5:00

you. And if you don't talk out the

5:01

requirements, you're not going to fully

5:03

know what they are. Hashing out the

5:04

requirements before you get to code is

5:06

something we've been doing for 50 years

5:08

as developers. And there's no reason why

5:10

we should stop now. So hopefully I've

5:12

convinced you that plan mode is really

5:14

useful. Let's actually walk through a

5:15

recent trace of mine so we can see it

5:17

working. I've been working on my course

5:19

video manager, which you've probably

5:20

seen a few times if you've been looking

5:21

at this channel. The first thing I did

5:23

was I entered plan mode and I described

5:25

a bug that was happening essentially in

5:27

my database. I've just moved from repos

5:30

into repo versions, but not all of the

5:32

code had been migrated yet. So,

5:34

something weird was happening when I

5:36

added a repo. I didn't type this out. I

5:38

just dictated this in. And by the way,

5:39

if you're not using a dictation tool

5:41

like Whisper Flow or Super Whisper, you

5:43

absolutely have to, but that's probably

5:44

a topic for another video. So, what it

5:46

did is it then ran an explore sub agent

5:48

to explore the codebase, understand the

5:50

current schema, and how repos are

5:52

created. Doing this, it burnt around

5:53

40,000 tokens. But bear in mind it

5:56

wasn't using opus 4.5 for this. It was

5:58

using haik coup 4.5. And then it said

6:01

now I can see the issue clearly. The

6:02

api.reos.ad.ts

6:04

create sections without a version. Let

6:05

me explore how versions are created

6:06

elsewhere. Understand that create

6:08

sections method signature. So the

6:09

explore sub agent just gave it a little

6:11

hint as to what was going wrong and then

6:13

it went and looked itself by searching

6:15

in the repo with search create repo

6:17

version. Let me check the exact schema

6:19

definition and then once it had a full

6:21

understanding it said let me write the

6:23

plan. It saves these plans on the file

6:25

system so that you can actually read

6:26

them yourselves. And in fact, you can

6:28

see in this directory I have dozens and

6:30

dozens of plans from all of my plan mode

6:32

usage. One thing it then did is it asked

6:34

me some questions. It asked, should new

6:36

repos default to v 1.0 is the initial

6:38

version name and I said yes. So in other

6:40

words, it was iterating with me towards

6:43

the solution. This was a question that I

6:45

hadn't answered in my initial like

6:47

twoline prompt and it figured out it

6:49

needed that information and it asked me

6:51

the information. In other words, I was

6:52

behaving like a crappy client, not

6:54

providing all the information up front.

6:55

And so I had a question from the

6:57

developer and I answered it. So I then

6:59

approved the plan and moved out of plan

7:02

mode into um actual pushing mode. And

7:05

from there, it was then able to actually

7:07

make the changes. Funnily enough, it

7:09

turned out that there was something that

7:10

neither of us had considered, which was

7:12

the sections still had a repo ID on them

7:15

from the previous iteration. I said,

7:17

surely they can just have a repo version

7:18

ID and then resolve any dependencies

7:20

through that. So for this I actually

7:22

kicked off plan mode again. It went and

7:24

did some more exploration here and then

7:27

it found that it was a completely

7:28

different task. So it updated the plan

7:30

file with this refactor. Further down it

7:32

then answered or I answered some more

7:34

questions and it then went and did it

7:35

and executed the code changes. So that's

7:37

what the plan mode execution loop

7:39

actually looks like. And this scales

7:41

from small changes as we saw there to

7:43

actually large scale architectural

7:45

changes. One really cool thing I've seen

7:46

people doing is taking their plans and

7:48

putting them in GitHub issues so other

7:50

people can comment on them. Kind of like

7:52

a request for comment RFC proposal where

7:54

you just put it up, people ping their

7:56

like ideas up there and then you reach a

7:58

shared solution together. It's even

7:59

great to put them on GitHub PR so that

8:01

someone reviewing your code can

8:03

understand what the plan was when you

8:05

made the code. But there's probably one

8:07

question that's coming to your head

8:08

immediately. Isn't this just like a huge

8:10

amount of reading? Like I don't want my

8:12

job to become just reading product

8:14

requirement documents all day. Well, let

8:16

me show you the single line of text that

8:18

I added to my claw.md file that has made

8:20

my plan so much easier to read. Here it

8:23

is right here. Make the plan extremely

8:25

concise. Sacrifice grammar for the sake

8:26

of concision. Now, I've talked about

8:28

this before, but this is an absolutely

8:31

key part to my workflow. This takes

8:33

plans that are like 2,000 words long and

8:35

puts them in 400 words. It gives you a

8:38

really detailed highlevel overview of

8:40

the changes and actually means you can

8:42

skip through loads of the plan really

8:44

really fast and just scan it to see if

8:46

anything looks wrong. And finally, I say

8:48

at the end of each plan, give me a list

8:49

of unresolved questions to answer if

8:51

any. This gives the agent an extra

8:53

little nudge just to ask me anything

8:55

that it's confused about or not sure

8:57

about. And it puts it in more of an

8:59

exploratory sort of slightly worried

9:01

paranoid mode, which is where I want it.

9:02

I strongly recommend you take these

9:05

literally three lines of text here, take

9:07

them, put them in your claw.md and you

9:09

will notice a massive difference in plan

9:11

mode. I could make this setup longer,

9:13

right? I could really go into detail

9:15

here, but I don't want to overforce the

9:18

LLM and this this core.md will be put

9:20

into every single session I use. So, I

9:22

find that the concision here is actually

9:25

really essential for steering the LLM

9:27

better. The fewer instructions you use

9:29

inside your claw.md, the more

9:31

instruction budget the LLM has to do

9:33

other things. But instruction budget is

9:35

probably the topic for another video, I

9:36

think. Now, there's one final thing to

9:37

cover here, which I can hear you typing

9:40

out in the comments immediately. I got

9:42

loads of these comments on my Clawude

9:44

Code video as well, which covered some

9:45

similar ground. And what you're probably

9:46

typing is, I can do this faster myself.

9:49

going through the whole plan mode then

9:52

just to get the AI ready to do the work.

9:54

I can just go into the codebase myself,

9:56

change the files and actually just do

9:58

it. And guess what? In some cases, you

10:00

are absolutely right. When you know the

10:02

codebase inside out when you know

10:04

exactly the change that needs to be

10:05

made, you go into the codebase with a

10:07

massive advantage over the LLM, which is

10:10

you have all the context already. You

10:11

don't need to send off an explore sub

10:13

agent or burn tokens to actually

10:14

understand the codebase. You know it

10:16

already. And in those cases, you should

10:18

absolutely go through and make the

10:19

change yourself. But here's the thing

10:20

you should think about, which is those

10:22

cases are going to be relatively

10:24

limited. In a large organization, you

10:26

only have so many repos that you

10:28

understand deeply. Plan mode allows you

10:30

to contribute effectively to repos you

10:32

don't know that well because you and the

10:33

LLM walk in with the same amount of

10:35

context. And plan mode allows you to

10:38

work your way through the repo, figure

10:39

out exactly what change needs to be

10:41

made, even if it's in a language that

10:43

you're not quite that familiar with. And

10:44

here's the other thing. In this

10:46

situation where you can do it faster

10:48

than the LLM, it's probably quite a

10:50

simple change. If it's a big

10:51

architectural tweak, then you probably

10:54

still want to go through the rubber duck

10:55

process. You can do that with a

10:56

colleague, of course, but then you're

10:58

taking up your colleagueu's time.

10:59

Wouldn't it be better to rubber duck

11:00

with an AI that can scan the codebase,

11:02

understand what's going on, create a

11:04

plan document, send that plan document

11:06

to your buddy and say, "I've got this

11:08

plan. What do you think?" or you might

11:09

find with the AI that actually the

11:10

requirements are more solid than you

11:12

thought and you can just get the AI to

11:14

bash it out. The final point here is

11:15

that these tools are only going to get

11:18

faster. It's an open question as to

11:19

whether the tools are going to get

11:21

smarter. I think they're going to get a

11:22

bit smarter but not a lot smarter. But

11:24

what's guaranteed is that they will get

11:26

faster. And so if your only advantage

11:28

over AI is your speed, then that

11:30

advantage will get eroded more and more

11:33

and more. And so for me, I'm using plan

11:35

mode every single time because I want to

11:37

develop familiarity with these tools. I

11:39

want to understand how they work and

11:41

what their weaknesses are because there

11:43

are weird weaknesses baked into the cake

11:45

that are not going to be removed however

11:47

long this goes on for. And the more feel

11:49

I can get for AI, I know the more secure

11:51

my career is going forward. So that's

11:53

plan mode. This loop where you plan

11:55

before you execute and test that loads

11:57

up the LLM with context and makes your

11:59

requirements clearer to yourself. If I

12:01

had one tip to give to anyone that's

12:03

doing AI coding, it is to use plan mode.

12:05

It is a phenomenal tool for working with

12:08

AI and I honestly could not live without

12:10

it. And if you want to get the most out

12:11

of plan mode, then you got to follow the

12:13

link below to get my agents.mmd file.

12:15

Thanks for following along folks. I've

12:16

been really enjoying making these AI

12:18

coding videos. I'll see you in the next

12:19

one.

Interactive Summary

The speaker, initially an AI skeptic, highlights the transformative power of "plan mode" in AI coding, particularly with Claude Code. This mode involves a loop of planning with AI, executing the plan to write code, testing, and committing. Plan mode disables the AI's write functionality, forcing it to first explore the codebase and create a detailed plan, loading its context with relevant information. This process benefits both the AI by providing necessary context and preventing errors, and the developer by clarifying requirements and acting as a "rubber ducking" partner. The speaker shares tips for optimizing plans, such as making them concise and prompting the AI to ask unresolved questions. He argues that while developers might be faster for simple, familiar changes, plan mode enables effective contributions to unknown codebases and is crucial for developing familiarity with evolving AI tools, which are guaranteed to get faster.

Suggested questions

7 ready-made prompts