14 ms·
> Claude often ignores CLAUDE.md > The more information you have in the file that's not universally applicable to the tasks you have it working on, the more li
by nico 11mo ago
> Claude often ignores CLAUDE.md
> The more information you have in the file that's not universally applicable to the tasks you have it working on, the more likely it is that Claude will ignore your instructions in the file
Claude.md files can get pretty long, and many times Claude Code just stops following a lot of the directions specified in the file
A friend of mine tells Claude to always address him as “Mr Tinkleberry”, he says he can tell Claude is not paying attention to the instructions on Claude.md, when Claude stops calling him “Mr Tinkleberry” consistently
- stingraycharles 11mo agoThat’s hilarious and a great way to test this. What I’m surprised about is that OP didn’t mention having multiple CLAUDE.md files in each directory, specifically describing the current context / files in there. Eg if you have some database layer and want to document some critical things about that, put it in “src/persistence/CLAUDE.md” instead of the main one. Claude pulls in those files automatically whenever it tries to read a file in that directory. I find that to be a very effective technique to leverage CLAUDE.md files and be able to put a lot of content in them, but still keep them focused and avoid context bloat.
- sroussey 11mo agoUmmm… sounds like that directory should have a readme. And Claude should read readme files.
- stingraycharles 11mo agoREADMEs are written for people, CLAUDE.mds are written for coding assistants. I don’t write “CRITICAL (PRIORITY 0):” in READMEs. The benefit of CLAUDE.md files is that they’re pulled in automatically, eg if Claude wants to read “tests/foo_test.py” it will automatically pull in “tests/CLAUDE.md” (if it exists).
- adastra22 11mo agoIs this documented anywhere? This is the first I have ever heard of it.
- grumbelbart 11mo agoHere: https://www.anthropic.com/engineering/claude-code-best-practices https://www.anthropic.com/engineering/claude-code-best-pract... claude.md seems to be important enough to be their very first point in that document.
- ffsm8 11mo agoNaw man, it's the first point because in April Claude code didn't really gave anything else that somewhat worked. I tried to use that effectively, I even started a new greenfield project just to make sure to test it under ideal circumstances - and while it somewhat worked, it was always super lackluster and way more effective to explicitly add the context manually via prepared md you just reference in the prompt. I'd tell anyone to go for skills first before littering your project with these config files everywhere
- llbeansandrice 11mo agoIf AI is supposed to deliver on this magical no-lift ease of use task flexibility that everyone likes to talk about I think it should be able to work with a README instead of clogging up ALL of my directories with yet another fucking config file. Also this isn’t portable to other potential AI tools. Do I need 3+ md files in every directory?
- stingraycharles 11mo agoIt’s not delivering on magical stuff. Getting real productivity improvements out of this requires engineering and planning and it needs to be approached as such. One of the big mistakes I think is that all these tools are over-promising on the “magic” part of it. It’s not. You need to really learn how to use all these tools effectively. This is not done in days or weeks even, it takes months in the same way becoming proficient in eMacs or vim or a programming language is. Once you’ve done that, though, it can absolutely enhance productivity. Not 10x, but definitely in the area of 2x. Especially for projects / domains you’re uncomfortable with. And of course the most important thing is that you need to enjoy all this stuff as well, which I happen to do. I can totally understand the resistance as it’s a shitload of stuff you need to learn, and it may not even be relevant anymore next year.
- grayhatter 11mo ago> A friend of mine tells Claude to always address him as “Mr Tinkleberry”, he says he can tell Claude is not paying attention to the instructions on Claude.md, when Claude stops calling him “Mr Tinkleberry” consistently this is a totally normal thing that everyone does, that no one should view as a signal of a psychotic break from reality... is your friend in the room with us right now? I doubt I'll ever understand the lengths AI enjoyers will go though just to avoid any amount of independent thought...
- crystal_revenge 11mo agoI suspect you’re misjudging the friend here. This sounds more like the famous “no brown m&ms” clause in the Van Halen performance contract. As ridiculous as the request is, it being followed provides strong evidence that the rest (and more meaningful) of the requests are. Sounds like the friend understands quite well how LLMs actually work and has found a clever way to be signaled when it’s starting to go off the rails.
- davnicwil 11mo agoIt's also a common tactic for filtering inbound email. Mention that people may optionally include some word like 'orange' in the subject line to tell you they've come via some place like your blog or whatever it may be, and have read at least carefully enough to notice this. Of course ironically that trick's probably trivially broken now because of use of LLMs in spam. But the point stands, it's an old trick.
- kiernan 11mo agoCould try asking for a seahorse emoji in addition…
- mosselman 11mo agoApart from the fact that not even every human would read this and add it to the subject, this would still work. I doubt there is any spam machine out there the quickly tries to find peoples personal blog before sending them viagra mail. If you are being targeted personally, then of course all bets are off, but that would’ve been the case with or without the subject-line-trick
- jmathai 11mo agoI have a /bootstrap command that I run which instructs Claude Code to read all system and project CLAUDE.md files, skills and commands. Helps me quickly whip it back in line.
- adastra22 11mo agoIsn’t that what every new session does?
- threecheese 11mo agoThat also clears the context; a command would just append to the context.
- jmathai 11mo agoThis. I've had Claude not start sessions with all of the CLAUDE.md, skills, commands loaded and I've had it lose it mid-session.
- mrasong 11mo agoMind sharing it? (As long as it doesn’t involve anything private.)
- chickensong 11mo agoThe article explains why that's not a very good test however.
- sydd 11mo agoWhy not? It's relevant for all tasks, and just adds 1 line
- chickensong 11mo agoI guess I assumed that it's not highly relevant to the task, but I suppose it depends on interpretation. E.g. if someone tells the bus driver to smile while he drives, it's hopefully clear that actually driving the bus is more important than smiling. Having experimented with similar config, I found that Claude would adhere to the instructions somewhat reliably at the beginning and end of the conversation, but was likely to ignore during the middle where the real work is being done. Recent versions also seem to be more context-aware, and tend to start rushing to wrap up as the context is nearing compaction. These behaviors seem to support my assumption, but I have no real proof.
- dncornholio 11mo agoIt will also let the LLM process even more tokens, thus decreasing it's accuracy
- globular-toast 11mo agoIt baffles me how people can be happy working like this. "I wrap the hammer in paper so if the paper breaks I know the hammer has turned into a saw."
- fragmede 11mo agoprobably by not thinking in ridiculous analogies that don't help
- easyThrowaway 11mo agoIf you have any experience in 3D modeling, I feel it's quite closer to 3D Unwrapping than software development. You got a bitmap atlas ("context") where you have to cram as much information as possible without losing detail, and then you need to massage both your texture and the structure of your model so that your engine doesn't go mental when trying to map your informations from a 2D to a 3D space. Likewise, both operations are rarely blemish-free and your ability resides in being able to contain the intrinsic stochastic nature of the tool.
- mewpmewp2 11mo agoYou could think of it as art or creativity.
- pacifika 11mo ago> It Is Difficult to Get a Man to Understand Something When His Salary Depends Upon His Not Understanding It
- isoprophlex 11mo agoThat's smart, but I worry that that works only partially; you'll be filling up the context window with conversation turns where the LLM consistently addresses it's user as "Mr. Tinkleberry", thus reinforcing that specifc behavior encoded by CLAUDE.md. I'm not convinced that this way of addressing the user implies that it keeps attention the rest of the file.
- deleted 11mo ago[deleted]
- pmarreck 11mo agoI've found that Codex is much better at instruction-following like that, almost to a fault (for example, when I tell it to "always use TDD", it will try to use TDD even when just fixing already-valid-just-needing-expectation-updates tests!
- sesm 11mo agoWe are back to color-sorted M&Ms bowls.
- homeonthemtn 11mo agoThe green m&M's trick of AI instructions. I've used that a couple times, e.g. "Conclude your communications with "Purple fish" at the end" Claude definitely picks and chooses when purple fish will show up
- nathan_douglas 11mo agoI tell it to accomplish only half of what it thinks it can, then conclude with a haiku. That seems to help, because 1) I feel like it starts shedding discipline as it starts feeling token pressure, and 2) I feel like it is more likely to complete task n - 1 than it is to complete task n. I have no idea if this is actually true or not, or if I'm hallucinating... all I can say is that this is the impression I get.
- bryanrasmussen 11mo agoI wonder if there are any benefits, side-effects or downsides of everyone using the same fake name for Claude to call them. If a lot of people always put call me Mr. Tinkleberry in the file will it start calling people Mr. Tinkleberry even when it loses the context because so many people seem to want to be called Mr. Tinkleberry.
- seunosewa 11mo agoThen you switch to another name.
- bryanrasmussen 11mo agoyes, when you discover it. but the reason why I said just wondering was I was trying to think of unexpected ways it could effect things, that was the top one I could think of (and not really sure if it is a possibility)
- dkersten 11mo agoI used to tell it to always start every message with a specific emoji. Of the emoji wasn’t present, I knew the rules were ignored. But it’s bro reliable enough. It can send the emoji or address you correctly while still ignoring more important rules. Now I find that it’s best to have a short and tight rules file that references other files where necessary. And to refresh context often. The longer the context window gets, the more likely it is to forget rules and instructions.
- aqme28 11mo agoYou could make a hook in Claude to re-inject claude.md. For example, make it say "Mr Tinkleberry" in every response, and failing to do so re-injects the instructions.
- lubujackson 11mo agoFor whatever reason, I can't get into Claude's approach. I like how Cursor handles this, with a directory of files (even subdirectories allowed) where you can define when it should use specific documents. We are all "context engineering" now but Claude expects one big file to handle everything? Seems luke a deadend approach.
- piokoch 11mo agoThis is good for the company, chances are you will eat more tokens. I liked Aider approach, it wasn't trying to be too clever, it used files added to chat and asks if it figure out that something more is needed (like, say, settings in case of Django application). Sadly Aider is no longer maintained...
- unshavedyak 11mo agoI think their skills have the ability to dynamically pull in more data, but so far i've not tested it to much since it seems more tailored towards specific actions. Ie converting a PDF might translate nicely to the Agent pulling in the skill doc, but i'm not sure if it will translate well to it pulling in some rust_testing_patterns.md file when it writes rust tests. Eg i toyed with the idea of thinning out various CLAUDE.md files in favor of my targeted skill.md files. In doing so my hope was to have less irrelevant data in context. However the more i thought through this, the more i realized the Agent is doing "everything" i wanted to document each time. Eg i wasn't sure that creating skills/writing_documentation.md and skills/writing_tests.md would actually result in less context usage, since both of those would be in memory most of the time. My CLAUDE.md is already pretty hyper focused. So yea, anyway my point was that skills might have potential to offload irrelevant context which seems useful. Though in my case i'm not sure it would help.
- jswny 11mo agoThey have an entire feature for this: https://www.claude.com/blog/skills https://www.claude.com/blog/skills CLAUDE.md should only be for persistent reminders that are useful in 100% of your sessions Otherwise, you should use skills, especially if CLAUDE.md gets too long. Also just as a note, Claude already supports lazy loaded separate CLAUDE.md files that you place in subdirectories. It will read those if it dips into those dirs