My AI agent doesn't forget code. It forgets why we made the decision

by

I've noticed a different kind of context problem while working with AI coding agents.

  • The agent can read the code.

  • It can inspect the git history.

  • It can find the files it needs.

But sometimes it still misses something important:

Why we made a particular decision in the first place.

For example:

  • Why we deliberately didn't use an abstraction

  • Why an API is handled differently in one workflow

  • Why a certain dependency is pinned

  • Why a seemingly duplicated piece of code exists

  • Why we chose a less elegant solution because of a product constraint

None of that is necessarily obvious from the code.

So I've started writing down decisions separately from implementation.

Not a huge document.

Just things like:

Decision: Keep this logic local.

Reason: The shared abstraction created problems with two existing workflows.

Or:

Decision: Don't auto-retry this request.

Reason: The operation isn't idempotent.

That small amount of context changes the next AI session quite a bit.

The agent isn't just seeing:

"Here's the code."

It's seeing:

"Here's the code, and here's why this code ended up this way."

I'm starting to think that as AI writes more of the codebase, decision history may become as important as documentation.

How are you preserving the reasoning behind architectural or product decisions in AI-assisted projects?

10 views

Add a comment

Replies

Best

ADR files plus rules is what helped me.

The ADRs are the reasoning: one numbered file per decision, Context, Decision, Consequences, under a page. The rules are the short version the agent reads every session, and each rule carries the ADR number. So the rule says what to do, and the number says where the why lives. An agent opening the file sees "the approval scale (ADR 0041)" in the first comment and doesn't have to go looking.

The part I'd underline is Consequences: what I agreed to live with. That's the bit an agent otherwise silently "fixes".

Your two examples are already ADRs. They just need a number, and that number pasted into the code.

Agent wired early placeholder directyl into production reports. Output showed confident number nobody ever measured. Took us full day to trace back. Model made temporary stub into "permanent" code without keeping context it was fake