TL;DR
- Fabien Sanglard, the programmer known for game engine architecture deep-dives, published his agent.md after tiring of repeating the same code-style corrections to his AI coding agent every session.
- His rules are specific review corrections: extract magic numbers into constants, use early returns to reduce indentation, keep function names under 30 characters, use enums instead of booleans for parameters, and treat any change in member visibility as needing approval.
- He is open about the limit, since context dilution means the model attends less to instructions buried in a long session, and his fixes are blunt: a new session per feature, or telling the agent to reload agent.md when quality drops.
- The exercise is to review your last five sessions, find corrections you made more than once, and write them into whatever instruction file your harness loads.
In plain English
Coding agents such as Claude Code, Cursor and Antigravity read an instruction file at startup, named CLAUDE.md, agent.md, gemini.md or whatever the tool expects, and treat its contents as standing rules for the session. Sanglard’s file is about 40 lines, with roughly 15 doing most of the work. The rules read as transcripts of real corrections, including “Don’t touch blocks of code unrelated to the feature you implement” and an instruction to write a failing test first when the prompt says a bug is being fixed. One line, “program to levels of abstraction”, compresses an architectural principle: lower-level mechanics go into a driver layer while calling code deals in domain concepts.
Context dilution is the documented effect where a model pays less attention to material sitting in the middle of a long context window, so rules loaded at the start fade as the session grows. Specificity is what makes the surviving rules usable: a character count on function names gives the agent something to check, where an instruction to write clean code gives it nothing.
Fabien Sanglard — the programmer behind fabiensanglard.net, known for deep-dives into game engine architecture — published his agent.md this week. The premise is familiar: he was repeating the same code-style corrections to his AI coding agent session after session, so he wrote them down in the file the harness loads at startup.
The trick itself is obvious. What he chose to put in the file is worth reading.
His rules are specific code-review corrections: extract magic numbers into constants, reduce indentation with early returns, keep function names under 30 characters, use enums instead of booleans for function parameters, treat any change in member visibility as a design decision that needs explicit approval. One rule — “program to levels of abstraction” — is a full architectural principle compressed into a sentence: lower-level mechanics get encapsulated in a driver layer, calling code works with domain concepts.
Every line clearly came from a real session where the AI did the wrong thing and Sanglard got tired of correcting it. “Don’t touch blocks of code unrelated to the feature you implement.” “If the prompt indicates a bug is being fixed, don’t write the fix right away. First write the test. Observe it failing. Then write the fix.”
He’s also honest about the limits. Context dilution — the documented phenomenon where models pay less attention to instructions in the middle of a long context — means the model stops following these rules as the session gets longer. His workarounds are blunt: start a new session per feature, or explicitly tell the agent to reload agent.md when quality drops. No magic. Just awareness of where the tool breaks down.
The people getting real, repeatable value from AI coding tools aren’t the ones with the cleverest prompts. They noticed what they kept repeating, wrote it down, and put it where the tool loads it automatically. Sanglard’s file is 40 lines. About 15 of them do most of the work. And they only work because each one is specific enough to be actionable — “keep function names short” with a character count, not “write clean code.”
If you use Claude Code, Cursor, Antigravity, or any agent with an instruction file, the exercise is worth doing even if you throw away everything Sanglard wrote: sit with your last five sessions, find the corrections you made more than once, and write them down. The file is CLAUDE.md, agent.md, gemini.md, or whatever your harness calls it. Call it whatever your tool expects. The point is writing the corrections down.