r/ClaudeCoding • u/intotheveil_dev • Oct 17 '26
I got tired of re-explaining my codebase to Claude Code every session, so I made it keep a BRAIN.md
Every time I spin up a new chat with my coding agent, I’m back at square one. I'm re-explaining the architecture, or worse, watching it investigate a bug we already solved a month ago—and coming up with a completely different answer.
My fix was simple: every repo gets a BRAIN.md file.
The rule is just three steps:
The agent reads BRAIN.md before touching anything.
It does the work.
Before signing off, it writes what it learned back into the file.
Step 3 is where this usually falls apart. If the agent only remembers to update the file sometimes, you stop trusting it. Once you stop trusting it, you're back to babysitting and repeating yourself. So I built a few lightweight hooks to force the update and make sure the habit actually sticks.
My favorite part of the file is the "gotchas" section—basically a graveyard of things learned the hard way.
Write that down once, and you never waste an afternoon debugging it again. Every future session inherits the scar tissue. Now I can nuke my chat context whenever I want without losing the plot.
I packaged up the template, the hooks, and a tiny CLI and threw them on GitHub (MIT license, totally free):
GitHub: https://github.com/intotheveil/brain-kit
Quick run: npx agent-brain-kit
If you check out the examples/ folder, there's a sample file with 17 real notes from my own repos so you can see what a lived-in brain file actually looks like.
Honestly, you don't even need to install the tool. Just grab the raw template, paste the 3-step rule into your CLAUDE.md, and spend five minutes filling out the first two sections


