AI coding agent context: how to document project decisions
By Flavio
Updated
Tagged: AI
A practical way to preserve project decisions, rejected alternatives, and unfinished questions so you and your coding agents can pick up the work later.
An agent asks why your project uses a specific database. You know you had a long conversation about it and that the choice made sense at the time, yet tracking down the reason takes way longer than it should.
Maybe it’s buried in an old chat that started with four unrelated questions before the database ever came up. You remember what you picked, just not the constraint that forced your hand. While the code tells the agent which database you’re running, it says nothing about why you picked it.
Software projects have always had this problem, and working with agents makes it show up faster because we bounce between chats while the app keeps piling up decisions. If you tend to keep several chats open at once, it also helps to keep one place for the current task.
A project should carry enough of its own history that you can step away for a while and come back without piecing together old chats.
Your future self also needs context
When people talk about agent memory, they usually focus on what the model forgets.
You forget things too. You spend a morning working out how file uploads should work, then move on to another project. A month later, a cheaper service pops up, you open the upload code, and you wonder why you didn’t just use that from the start.
A fresh agent will happily make a convincing case for switching. If the original constraint isn’t written down anywhere, the two of you can end up migrating right into a problem you already ruled out weeks ago.
You don’t need to save every dead end or half-baked guess from the chat. Keep the decision itself and the facts you’ll need to re-evaluate it later. For file uploads, a single note saying customer contracts require original files to stay in a specific region beats pages of back-and-forth about which SDK felt nicer.
Separate a decision from an investigation
In a good technical chat, half-explored ideas start sounding like final plans before you’ve agreed to anything. You look into an alternative, the agent sketches out how to build it, you ask about a downside, and then you move on to something else. When that chat gets summarized later, the option you only explored can easily get written down as the approved plan.
Label unfinished thinking clearly so that doesn’t happen. Call something a proposal while you’re still considering it, mark it accepted once you’ve agreed on it, and leave anything unresolved as an open question.
You don’t need a heavy process for this. One plain line saying “We haven’t decided whether to migrate existing files” can save you from a nasty mistake. It also gives the next session an honest starting point, so the agent can pick up the investigation without treating sample code from an earlier chat as a green light to ship it.
Keep the reason close to the project
Put code decisions right inside the repository. The notes travel with the app, keep a change history, and can link straight to the files they explain. Any agent working on the project can read them on the spot without hunting through unrelated chats.
People have been doing this for a long time. Michael Nygard wrote about architecture decision records as short documents for significant choices, covering the context, the decision, its status, and the consequences, with older records kept around after a newer one replaces them.
You don’t need a big documentation system to start. One docs/decisions.md file goes a long way. Once it gets long enough that entries are hard to find, split them into separate files under docs/decisions/. Wherever you put them, stick to the folder the project already uses for docs so you aren’t creating another knowledge store you have to remember to update.
Record what would make you reconsider
A good decision note tells you when to revisit it.
Writing “We use local storage because it’s simpler” won’t help you much later on. Maybe you needed offline access, or you didn’t want to maintain an account service. Spell out the exact requirement that drove the choice.
Take a desktop notes app as an example. A solid entry looks like this:
We store notes as local files because this release has no accounts or collaboration. Users can read their files without the app. We considered a hosted database, but it would introduce account recovery and ongoing service maintenance. Revisit this when shared editing becomes an approved requirement.
That gives a future agent something concrete to check against. Once collaboration becomes an approved feature, you have a clear reason to revisit accounts and change the architecture.
Include the rejected option so it doesn’t look like nobody ever thought of it, and include the trigger to reconsider so an old trade-off doesn’t harden into a permanent rule by accident.
Rejected alternatives deserve a fair description
Once you’ve picked an approach, it’s tempting to dismiss everything else as “too complicated” and move on.
You lose real context when you do that. A service can be great and still be the wrong fit for what you’re building right now. Maybe the framework you turned down solves problems you don’t have yet, while a manual step works fine at your current scale.
Write down the specific constraint that ruled it out. If you rejected it based on an estimate, mark it as an estimate. If you tried it and ran into a documented limit, link to that evidence.
Don’t ask an agent to invent the reasoning after the fact, either. Given the code, it’ll happily produce a story that sounds completely plausible, and plausible stories are easy to accept once the real conversation has faded from memory. If the reason is gone, write “Reason not recorded” so you know there’s still a question to answer before future work builds on a guess.
A task handoff contains different information
Keep your decision records separate from running implementation notes.
Say you’ve settled on local files for the notes app, and halfway through the build an agent updates the editor but leaves the import dialog unfinished. Those progress details belong in a task handoff covering the files changed, what was checked, and what’s still left. The decision record stays focused on why local files won. Here’s a quick example of how that looks:
When you mix the two, an old “next step” can still look active months later, and the architectural reasoning gets buried under a log of finished edits. Keep durable decisions in your docs and active work in a short task record. Once the task wraps up, close or remove its leftover items and let the accepted decision stay useful for years.
Give the agent a way to find the records
Once you’ve written a decision down, tell the agent where to look for it.
Add a short pointer in AGENTS.md that says where the decision records live and asks the agent to check relevant entries before changing that part of the codebase. Keep that pointer short. If you copy every decision into your instruction file, you end up maintaining two versions and making the instructions harder to scan.
As a project grows, add a small index grouped by area. Put your upload and retention links under a storage heading, and link to the session model under authentication. That lets an agent jump straight to what matters without loading every past discussion into every task.
File names do a lot of work here too. Call the file local-note-storage.md instead of discussion-final-v3.md, using the words someone would type when searching for that topic.
Side questions can stay in the conversation
Big decisions don’t always get their own dedicated thread. Sometimes you’re fixing a bug, you ask whether the current data model still holds up, the agent walks through a few options, and you decide to leave things as they are.
There’s no need to split that tangent off into a separate thread. Before you wrap up the session, ask whether any conclusion is worth writing down. Most side questions aren’t, though choosing to keep an unusual design because another feature depends on it usually is.
Summaries need review too
Let the agent draft the decision note for you, then read it before you commit it.
The mistakes that bite you later are usually subtle shifts in certainty. “We considered adding accounts” turns into “Accounts are planned.” “This option seems expensive” becomes “The cost is prohibitive.” “Keep it for now” gets hardened into an unconditional rule. If something is still uncertain, the note needs to keep that uncertainty intact and separate what you observed from what you expect.
Check that the downside of the chosen option made it in too. Local files save you from running an account service, yet sharing notes across devices now requires another mechanism. A record that only lists upsides reads like you’re justifying the choice after the fact.
Treat the draft as a proposed summary until you’ve signed off on it, and only let it guide future agents once it reflects what you agreed to.
Old records need an explicit status
Say the notes app adds shared editing down the road. You pick a hosted backend for shared documents while keeping personal notes local. The original local-file record still explains how the earlier architecture worked, even though it doesn’t cover the whole app anymore.
Mark the old record as superseded for that area and link directly to the new one, with the replacement explaining which requirement changed.
Don’t force whoever reads the docs next to piece together a timeline from two conflicting files. Dates help, yet an explicit status clears up ambiguity much faster. An accepted decision from last year might still apply, while a newer proposal might never have been approved. If an agent spots two records that contradict each other, it should flag the conflict before making a broad change instead of guessing which one you meant.
Some context should stay out
You can point to private context without pasting it into the repository.
If a customer contract requires a specific retention period, mention that constraint and link to the approved internal source instead of copying contract text or customer details into a public file. The same goes for credentials: write “The deployment token is in the project’s secret manager” and keep the token itself out of the file.
Skip any frustration with a product or a person too. Stick to the technical limitation you hit and what it meant for the project.
Start with one recurring decision
Pick one decision that keeps coming up in your project.
Maybe an agent keeps trying to swap out a small dependency, or you keep having to explain why your app doesn’t have an account system. Write that one down while the reason is still fresh in your head.
Once it’s written, test it by asking the agent a specific question about that choice and seeing if it finds the file on its own. If it misses it, fix the filename or make the pointer easier to spot. When it finds the file but gets the scope wrong, rewrite the paragraph that threw it off.
Doing this one choice at a time is much easier to keep up with than trying to reconstruct a project’s entire history in one sitting. Git history can help you see what changed (the Git course covers those tools if you need a refresher), though the missing reasons still have to come from whoever made the call.
Keep the habit small after that. When you finish a real design discussion, write down what you decided, what’s still open, and what would make you revisit it. Save it where the next session can find it, and read through it once before moving on.
Want me to talk about your product? You can sponsor this site.
Related posts about ai: