HomeVideos

Never Run claude /init

Now Playing

Never Run claude /init

Transcript

329 segments

0:00

If you're running claw code or really

0:01

any coding agent, there will be some

0:03

kind of init command. This promises to

0:05

initialize a new claw.md file or maybe

0:07

an agents.md file with codebased

0:09

documentation. I am going to recommend

0:10

that you never ever run this. And if you

0:13

find a claw.md file or an agent.mmd file

0:16

that you think has been created by an

0:17

agent, delete it. The file that this

0:19

creates will burn tokens, will distract

0:22

the agent, and will go out of date

0:23

faster than a pair on a hot day. This

0:25

paper evaluating agents.mmd are

0:27

repository level context files helpful

0:29

for coding agents. This actually put

0:31

this to the test and what they found was

0:33

we conclude that unnecessary

0:34

requirements from context files make

0:36

tasks harder and human written context

0:38

files describe only minimal

0:40

requirements. We'll get to what this

0:41

means and what you should actually use

0:42

claw.md files for in this video. If you

0:45

dig this kind of thing, then you should

0:46

check out my newsletter where I post my

0:48

new agent skills as I come up with them

0:50

and test them. And I'm also working on a

0:51

Claude code course which is going to be

0:53

an absolute banger. But let's actually

0:54

test this out and run in it inside my

0:56

work repository to see what happens. As

0:58

a bit of background, this is a fairly

1:00

large repo. It has a whole bunch of

1:02

package.json scripts, a whole bunch of

1:05

dependencies. It's a React router

1:06

application with an effect backend,

1:08

which is my favorite stack these days.

1:10

And there is currently no claw.md file

1:13

in here. But let's initialize one and

1:15

let's see what happens. We can see, by

1:16

the way, it's doing a explore step here.

1:19

And it's using sonet 4.6 for the

1:21

explore. So what this is doing is it's

1:23

calling a sub agent. I'm making that sub

1:25

agent explore the codebase and that sub

1:27

aent is going to report a summary back

1:29

to the orchestrator agent, the parent

1:30

agent. It's reading a bunch of files

1:32

here, doing a bunch of searches and just

1:33

getting an overall sense of the

1:35

codebase. Now this explore step is going

1:36

to be something that the LLM does or the

1:38

agent does every single time you do a

1:41

piece of work. It needs to explore the

1:42

codebase before it can feel confident

1:44

making changes to it. In fact, you can

1:45

think of there as being a few main tasks

1:48

that the agent does or a few main ways

1:50

that the agent uses up its context

1:51

window. The first chunk of usage is

1:53

going to be the system prompt. So,

1:55

anything that's inside the agent that it

1:57

has access to on every single request.

1:59

This would be things like, you know, MCP

2:00

servers and maybe uh any system tools

2:03

are going to be in here too. And

2:04

anything that you put in your claw.md is

2:07

going to make this bigger and bigger and

2:08

bigger. And if I just shift these up

2:10

here a little bit more, you can see

2:12

there's a little bit less available in

2:13

the context window for the other steps.

2:15

The other steps are exploration. So

2:17

exploring the codebase, understanding

2:18

what's there. Then we've got the actual

2:20

implementation, doing the thing, writing

2:23

the files. Then we've got testing,

2:25

running any feedback loops, unit tests,

2:27

any debugging goes in here, too. This

2:28

can absolutely balloon if something goes

2:30

wrong during implementation. Now, most

2:32

of these phases are fairly flexible. If

2:34

it's a very simple implementation, it

2:35

might only be very small like this. If

2:38

it doesn't need much testing, it might

2:39

be very small like this. But the thing

2:41

that's not flexible at all is going to

2:43

be the system prompt because that is

2:45

hardwired the moment that the uh agent

2:49

starts its work. So everything that you

2:51

can do to reduce this initial prompt

2:53

here to make this smaller is going to

2:55

first of all give you more space to do

2:57

your actual work, but it's also going to

2:59

reduce your costs. So for me personally,

3:01

I think of this as getting this the

3:03

lowest I can is the best possible

3:05

outcome. But when might you want to add

3:08

some information in the request that

3:09

helps the LM? Well, a common piece of

3:11

advice is if you notice something that

3:12

the AI agent is doing that you don't

3:14

like, then you put it in here. In other

3:16

words, if it tries to use the wrong

3:18

package installer or something, it uses

3:20

npm instead of pmpm, you can put it

3:22

inside claw.md and it will remember for

3:24

next time. Or if it's using a specific

3:25

pattern in React or something that you

3:27

don't like, then you can put it in

3:29

agents.mmd and it won't uh do it

3:31

anymore. So even if you're not running

3:32

claude in it, then it should like this

3:34

probably will grow over time and that is

3:37

a little bit annoying because this

3:39

little chunk here is global and that is

3:41

a killer because not all of it is going

3:43

to be relevant to every single request

3:46

that your agent makes. And so yeah, the

3:48

stuff you added in there about React is

3:49

going to be worth it there. This first

3:51

session might be like a front-end

3:53

session or something, but the next one

3:54

might be a purely API database session

3:57

where the stuff you added about React is

3:59

going to be completely useless. Even

4:00

more, you might have another session

4:01

that's just purely about documentation.

4:03

So, whenever you add something to

4:04

claw.md, you should be thinking about

4:06

all of these different use cases that

4:08

agents can have in your codebase because

4:10

anything you put into this global scope

4:12

here will affect everything you do and

4:14

cost you tokens every time you do

4:16

anything. So, with that in mind, let's

4:18

see the lovely init file that Claude

4:20

created for us. This file provides

4:21

guidance to Claude code when working

4:23

with code in this repository. Wow, what

4:25

a brilliant intro. Who is this for?

4:27

Like, what is going on here? Why would

4:29

you even print this? This is going to

4:30

cost me tokens on every single request,

4:31

Claude. It then gives us the commands.

4:34

Okay, these are unbelievably trivial to

4:37

discover. You literally just go into

4:38

package.json and they're all right

4:40

there. If you need to discover what

4:42

commands are available, you can actually

4:43

look at the source of truth, right? You

4:45

don't need this extra documentation. And

4:46

again, this is costing tokens on every

4:48

request. So, kill this. Don't like that

4:50

at all. Now, the architecture section.

4:51

Full stack React router SSR app for

4:53

managing course video publishing

4:54

workflows. React 19 with React compiler

4:56

enabled. Does it need to know this on

4:58

every single request? And how easy is it

5:01

to discover? Well, what it can do is it

5:03

can see that there's a React router

5:05

config file. So, it knows that it's in a

5:07

React router project. If it needs to

5:09

look that it's serverside rendered, it

5:10

can look in this tiny file, which might

5:12

even be less uh tokens than the actual

5:15

explanation, maybe comparable. If it

5:17

needs to, for whatever reason, know that

5:19

we're using React compiler, which it

5:21

probably shouldn't, then it goes into

5:22

v.config.ts and it can just see it

5:25

there. Right. Nice. So all of that

5:26

information is trivially discoverable uh

5:29

on its own. The only thing maybe is the

5:31

purpose of the thing. But then again the

5:34

whole project is called course video

5:36

manager. So I think I can safely delete

5:38

this too. Now we get to some stuff that

5:39

is a little maybe a bit more useful. All

5:42

backend logic uses effect for dependency

5:43

injection error handling composition

5:45

services defined with uh effect

5:47

services. And I really hate it when it

5:50

references actual files here. One thing

5:52

that makes me super nervous about this

5:54

is that this will rot really really

5:57

fast. As soon as we change any of the

5:58

implementation here, then this file is

6:00

going to go out of date and it's going

6:02

to conflict with the reality in our

6:03

codebase. Now again, this is trivially

6:05

discoverable that we're using effect

6:07

because we've got effect imports all

6:09

over the place. If we look for

6:10

effect.service, then there are eight

6:12

instances of it and they're all visible

6:14

in the file system too under DB service,

6:16

drizzle service, dump service. That's

6:18

not why not what it sounds like. repo

6:21

passer service. The file system is a

6:23

really nice way to tell claude what's

6:26

going on. And if you structure your file

6:28

system correctly, you can kind of give

6:30

it an impression of the overall

6:31

architecture which is defined in the

6:34

source of truth of your code, not in

6:36

documentation which can rot away. This

6:38

one especially key services, drizzle

6:40

services, DB function services, database

6:42

dump services. If I change the name of

6:44

any of the implementations here, I have

6:45

to go back and check this out. Tagged

6:48

errors go away again. Here I have a

6:50

video editor as part of this. So clip

6:52

operations go through a single post

6:53

endpoint API clip service. This is again

6:55

trivially discoverable from the code.

6:57

There's no reason to have this on every

6:59

single request because most of like the

7:02

actions that I take won't touch this

7:03

clip service. Again routting

7:05

configuration. I'm not going to need

7:07

this on every single request. Kill it.

7:08

Complex UI features use effect reducer.

7:11

I'm not going to use this on every

7:12

single request. And you get the idea

7:13

here. Too much is global. Too much is

7:15

going to go out of date and just rot

7:17

away. And it's just too freaking long,

7:19

man. I look at this and I think about a

7:21

key idea that I always have in the back

7:23

of my mind whenever I'm talking to LLMs,

7:25

which is that LLMs have a context

7:27

window, of course, but they also have a

7:29

budget for how many instructions they

7:31

can take on at one time. We can think of

7:33

this sentence, let's say, as an

7:35

instruction to use effect for dependency

7:37

injection, error handling, and

7:38

composition. This is another instruction

7:40

inside here. Services are defined with

7:42

this. This is another instruction. Roots

7:44

execute effect via runtime live.r run

7:46

promise. LLMs really only have a

7:48

realistic instruction budget of around

7:50

300 to 400 instructions. This increases

7:53

the kind of bigger model that you use,

7:55

but even then it only caps out at like

7:57

500. So if you're adding a bunch of

7:58

instructions into your claw.md file,

8:00

most of which are not even relevant to

8:02

the task at hand. You're just hamstring

8:04

your agent before it even gets started.

8:07

But this steering, like providing this

8:09

information to the LLM, should live

8:11

somewhere because there is useful stuff

8:13

in here that I do want to steer the LLM

8:15

towards in general. For instance, like

8:17

LLM seem really reluctant to use

8:19

reducers in their front-end logic, but I

8:21

find reducers are amazing with LLMs

8:24

because you can pull them out as a

8:25

testable unit and use that testable unit

8:28

to then drive the entire UI or at least

8:30

like reasonable size chunks of that UI.

8:33

So, I would be most likely to put this

8:35

stuff into skills that the LM can

8:37

discover, but don't burn their

8:39

instruction budget immediately. But

8:41

talking about that and talking about

8:42

skills is probably the topic for another

8:43

video. So if the steering stuff belongs

8:46

in skills and if the like uh basic setup

8:49

stuff doesn't belong here at all like

8:51

package.json script and all that kind of

8:53

thing, what should you actually put in

8:54

your claw.md? Well, the only thing I

8:56

actually have in any claw.md in my

8:59

entire setup is if I go into um memory

9:03

here and I've open the memory file here,

9:05

all I've got is a single line which is

9:09

six words saying you are on WSL on

9:12

Windows. And this is really just because

9:13

it's a kind of unintuitive setup and it

9:15

has some issues when it comes to path

9:17

resolution across the Windows Linux

9:19

divide. And I found that this single

9:21

instruction here just gives it a lot of

9:23

extra context that it needs. I've also

9:25

advocated in the past kind of using this

9:27

file to steer the agent itself. For

9:29

instance, I had this one for a while in

9:31

all interactions and commit messages be

9:32

extremely concise and sacrifice grammar

9:34

for the sake of concision. Instead, I

9:36

prefer now I think this is actually

9:38

better placed inside a skill. But even

9:40

then, I'm actually not running this yet.

9:41

I really just keep the global stuff down

9:44

to a minimum. So hopefully that makes

9:46

sense why you should never ever run

9:48

Claude in it. It's going to spill a

9:50

whole load of useless crap into your

9:51

global context where it simply won't be

9:54

relevant for most of the operations that

9:55

you will need to perform and it just

9:57

loves putting in specific patterns and

9:59

files into here which will rot away as

10:01

soon as the underlying code changes. So

10:03

either that means you need to burn

10:04

tokens to keep this up to date which

10:06

just feels crazy to me or you just

10:09

delete it. Bye-bye claude.mmd. And then

10:11

you rely on the built-in explore phase,

10:14

which every single agent should be doing

10:16

now to build up the needed context just

10:19

in time before you start the

10:20

implementation. But thanks for watching,

10:22

friends. I'll be covering this in even

10:23

more depth in my upcoming course and

10:25

I've already got some stuff on this on

10:26

the newsletter. So, thanks for watching

10:28

and what should I cover next? Let me

10:29

know if you have any questions about

10:31

LLMs, about anything around this kind of

10:33

AI coding area. And either way, thanks

10:35

for watching and I will see you very

Interactive Summary

The video strongly advises against using `init` commands for `claw.md` or `agents.md` files in AI coding agents. These files create global context that often becomes irrelevant, quickly outdated, and costly in terms of tokens and the agent's instruction budget. Instead of static documentation, the speaker recommends relying on the agent's built-in explore phase to gather context dynamically. Any essential, truly global, and unintuitive system information, such as operating environment specifics, should be kept extremely minimal in `claw.md`, while agent steering information is better placed in discoverable skills.

Suggested questions

5 ready-made prompts