An AI coding agent starts every session knowing nothing about your project. It has no idea why you picked one library over another, or that a certain file is generated and must not be touched. It certainly doesn't know that the team argued for a week about a naming rule and finally settled it.
So it guesses. The annoying part is that it guesses well. The code compiles, the tests pass, and three weeks later you find out that the agent quietly did the one thing you had decided never to do.
For a while my fix was to explain the project again in every prompt. That's the same as saying "I don't have time to put gasoline in my car." Eventually you run out of gas.
In October 2026 we packaged a proper fix as a skill for Claude Code. We call it the Agentic Code Setup, and we install it in our projects now.
What it is
It's a small working system that lives inside one repository. Everything is in that repo. There's no shared rules folder somewhere else, and no separate documentation repo that nobody opens.
If you clone the project, you have the rules.
There are three parts: rules that the agent always loads, a ledger of what the project already decided, and two commands, /plan and /build, that make the agent use that ledger.
The rules file
AGENTS.md holds the rules. What the repo is, the stack, the commands, the layout, how a release works, when something counts as done. We keep it under about 150 lines. An agent reads a short file with more care than a long one, and honestly so do people.
CLAUDE.md has a single line in it: @AGENTS.md. One source, so the two can't drift apart.
Then there's CONTEXT.md, the project vocabulary. Somewhere between five and twenty terms, each with a definition and an Avoid line listing the synonyms we ban.
You might laugh at a vocabulary file. I wrote in 2015 that naming is the most difficult part of CSS, and it turns out the same is true here. In one of our projects "apply" is for configuration and "deploy" is for code. An agent that mixes them up writes a commit message, a doc and a function name that all mean the wrong thing.
The ledger
The ledger sits in docs/agents/. Every entry gets an ID that never changes.
| File | ID | What it holds |
|---|---|---|
DECISIONS.md |
D- | Constraints. The rule, the reason, the rejected alternatives, the evidence. |
PATTERNS.md |
PATTERN- | How things are built here. Status is approved or candidate. |
CONTRACTS.md |
C- | Interfaces that cross a boundary: provided, consumed, external. |
OPEN-QUESTIONS.md |
Q- | Unknowns. Work that depends on one is out of scope until a person answers. |
ARCHITECTURE.md |
Parts, data flow, state, build and deploy. | |
REJECTED.md |
Proposals we turned down. Never proposed again without new evidence. |
We never delete an old entry. It moves to a superseded file, because the old code is still around and somebody will ask why it looks like that.
There's also a small script, ledger-lint.py, that checks the IDs, the required fields and the links. A ledger that nobody checks goes stale as fast as any other document. Ask me how I know.
Plan first, then build
/plan <what> produces a plan and stops. /build builds from an approved plan, and nothing gets built from a plan nobody approved. Behind the commands there's a planner agent that can only read, and a builder agent that builds one part and reports back in a fixed format.
Projects with a user interface get a bit more: a design document with the real token tables, a registry of screens and components, and screenshots in light and dark. The rule we wrote for those is short.
A screen nobody looked at is not done.
The one question
Before every change, the agent has to ask itself one thing:
Does this change something already approved?
If the answer is no, the work is additive. The agent does it and reports afterwards. If the answer is yes, it writes a proposal and waits for a person. That single question got rid of most of the surprises we used to find in code review.
A few more lines from the rules file do a lot of work:
Build only from
approvedentries. Unanswered means out of scope: record a Q-, never invent a value, a requirement or a behaviour.
The code wins over any document. When they disagree, say so and fix the document.
History is not a template.
The last one needs a word. An agent reads your git history far more carefully than you do. It will find a workaround from two years ago and copy it as if it were house style. When I look at some of our old code I can't help giggling. What on earth were we thinking? The agent doesn't giggle. It copies.
Existing projects
A new project starts with an empty ledger and that's fine. An existing project is the hard case, because the knowledge is all there but it's spread over the code, old pull requests and people's heads.
For those, the setup runs what we call a backfill. Read-only agents go through the repository and look at its structure, its contracts, its rules, its history and its documents. A rule that the code follows consistently becomes an approved entry, with file and line as evidence. Something they see only once becomes a candidate. Something nobody can explain becomes an open question.
A person only gets to see the clashes. The docs say one thing and the code does another. Or the code does the same thing in two different ways. Those open in a temporary review page on your machine, one clash per card, with the sources side by side and a recommendation. You answer with the keyboard.
On the first project we tried this, the backfill recorded 57 entries without bothering anyone and raised 15 clashes. We decided all 15 the same day. Fifteen decisions is a coffee. If it had asked us about all 72, we would never have found the time.
When the answer to a clash is "the code is wrong", the agent writes a suggested fix. It never changes the code on its own.
Addons
The base setup has no tickets, no pull requests and no reviews. A repository with one developer doesn't need them. Teams can switch on three addons, and the setup asks about each of them every time it runs.
The team addon is the strict one: no ticket, no code. It brings product owner, test author and reviewer agents, and tests get written first and have to fail for the right reason. The ClickUp addon has CI comment on the ticket and publish the ledger as a ClickUp Doc. The Slack addon posts when a pull request is ready and when a release goes out.
Anything that talks to the outside world starts as a dry run. Somebody has to flip a switch on purpose before it goes live.
A normal day now
A task used to start with a long prompt that explained the project again. Now it starts like this:
/plan add CSV export to the reports screen
The plan comes back with a table called Knowledge used. Each row is a ledger entry the plan depends on, what it says, and why it applies here. We go through the rows and mark them: confirm, wrong, outdated.
I think that table is the most useful thing in the whole system. A plan that stands on a wrong rule is wrong, even if every step in it looks reasonable. Reading ten rows takes me a minute. Finding the same wrong assumption later in a diff takes a lot longer, and by then I'm annoyed.
After that we approve the plan, change it, or drop it. Then /build.
What we learned
Short rules beat long ones. Every line you add to the always-loaded file makes the others a little weaker.
Write the reason next to the rule. An agent follows a rule with a reason much better than a bare order, and a new colleague does too. That was the part I didn't expect: the ledger turned into the onboarding document we never got around to writing.
Unknowns need a place to live. Before we had an open questions file, an unknown simply became a guess.
We keep changing the skill as we install it in more repositories. Five releases went out in the first month, and most of them came out of something that broke in a real project. So please don't copy this blindly. See if it fits how you work, then test the hell out of it on a real project with real code.
If you want this in your own codebase, talk to us. The short version, one tip at a time, is in Today I Learned.