When AI Refactors the Code, Refactor the Decisions Too

When AI Refactors the Code, Refactor the Decisions Too

A decision log usually has a moment when it quietly stops describing the system. Nobody decides that it should. The system changes, the records stay, and a year later the log reads as confidently as ever about software that no longer exists. When we refactored our AI factory, I found out what that costs when the readers of architecture decision records are AI agents as well as people, and they take every record at its word.

Refactoring a codebase used to be slow and expensive, so it did not happen often, and the decisions behind the code had time to catch up. With AI doing the work, refactoring has become fast, cheap and, in a sense, easy. That changes what needs reviewing. It is no longer enough to review the code. We also have to review the decisions that led to the code.

When we refactored, 65 earlier decisions about how our delivery works were still claiming to govern it. This post is about what we did with them, and why I think the way you retire old decisions matters as much as the way you write new ones.

How 65 Decisions Piled Up

Our delivery pipeline grew the way most systems grow, one sensible decision at a time. Each problem we hit got a decision record, and each record was right when it was written. By the time we stopped to look, the pipeline was governed by 63 decision records and about 85,000 lines of code behind seven skills.

The cost showed up in tokens. Token use in our unattended runs exploded, and most of it went into the mechanism itself rather than the work: limits against stuck situations we had imagined but never seen, mitigations for failures in other skills, and the same content restated by several owners. So we agreed a new architecture that replaced the pipeline. If you want to know what the delivery steps are, I described them in the five steps inside our AI delivery pipeline.

The new architecture was the easy part. The harder question was what to do with the records that explained the old one.

A Stale Record Is an Instruction

A decision log is where governance is read. A person planning new work reads it to see what has been decided, and so does an agent. The difference is that an agent does not shrug at a record that looks out of date. It applies it.

We saw this happen. Our runs kept referring to old decisions that had never been explicitly overruled, and treated them as still in force. The result was a combination of old decisions and new ones, and it was not what we expected. Nothing was broken in an obvious way. The work just followed rules from two different systems at once.

That is the risk I want architects to see. In a repository where agents work every night, an outdated record is not historical clutter. It is an instruction that nobody meant to give.

Three Easy Options We Turned Down

The reasons behind most of those decisions had not gone anywhere. What had changed was the decision itself. That is why I did not want to simply let the new architecture speak for itself. We looked at three easy ways out, and each one lost something.

  • Supersede them all. One status for the whole set, and done. But it would have marked 29 decisions that still hold as no longer in force, which is false, and it would have separated their reasoning from behavior that still exists in the system.
  • Amend each one in place. Every record stays self-contained. But that is 65 edits that each repeat part of the new architecture, which breaks our rule that every topic has one owner, and the reader still has no single place to see what survived.
  • Write nothing. The new architecture document is enough on its own, so nothing has to be maintained twice. But every old record would keep claiming to govern, and a planner reading the log would plan against a pipeline that no longer runs.

Every Old Decision Gets One Fate

What we did instead was write one new architecture decision record whose main content is a table. Every earlier delivery decision got exactly one row: its disposition, where its content lives now, and who owns it. The old records changed only their status line and a link to the table. It was done in one change, the same day the new architecture was agreed.

  • Superseded: 32. The mechanism was rewritten or removed, or the decision was reversed.
  • Confirmed: 29. The decision still holds; the record stays in force and names its new owner.
  • Already superseded: 4. Retired before the refactoring.
  • Total reviewed: 65. Two more than the 63 we first counted.

The superseded group deserves a closer look, because “superseded” did not mean “thrown away”. Of the 32, only 4 were reversed and only 1 was void because its mechanism no longer exists. Another 4 were superseded as records while the decision itself carried on unchanged under a new owner. The remaining 23 were mixed: part of each decision carried forward, and part changed.

Superseded is a status. It does not mean the reasoning was wrong.

So most of what looked like retirement was really a move. The decision found a new home, and the table says where. That is what refactoring decisions means to me: restructuring the log so it matches the system again, without rewriting the history of why each decision was made.

Amend, Never Rewrite

The rule behind the table is simple to state. Whether you edit an old decision in place depends on whether it is live, not on how big the change is.

  • If it was never built, update it in place and leave no trace of the old text. Nothing depends on it, and an amendment on top of an unbuilt decision only carries a stale premise forward.
  • If it is deployed, amend it. Keep the text and add what changed, when, and why. That text is the record of why the system behaves the way it does, and rewriting it detaches the explanation from the behavior.

There is one more check I would not skip. “Accepted” only says a decision was made, not that it shipped. Before choosing, we confirm both that the work behind the decision is closed and that what the decision describes actually exists in the system. Either signal alone has misled us before.

What the Review Found That Nobody Had Written Down

Giving every decision a fate had a side effect I did not plan for. Going through all 65 one by one showed three places where neither the old records nor the new architecture said anything, and each one would have been decided by accident if we had left it.

  • Whether any kind of finding or file should still hold an unattended run for a person. We decided none does, and the risky cases get a stricter review instead.
  • Whether work a person has deferred can be picked up automatically. It cannot; it runs only when someone names it.
  • Who the reviewer acts as when an unattended run reviews its own change. The reviewer runs as the person who started the run, and its independence comes from working in a separate context, never from a different name on the account.

All three were decided before anyone built on them. That alone was worth the reading.

The Honest Limit

A table does not keep a decision alive by itself. A carried decision can still get lost between the row that says where it went and the moment its new owner rewrites that part of the system.

Our mitigation is a process, not a promise. Every rewrite lists the decisions the table carried into it, with a disposition for each one, so a reviewer can see that nothing fell through. It is something anyone can check after the fact, which is the most I would claim for any governance rule. It also fits what I wrote about moving up the abstraction ladder, where experience goes into verifying that the intent is fulfilled: the work is not done when the change lands, but when you can show that it does what was intended.

When Your Log No Longer Matches Your System

If your decision log has drifted away from the system it describes, or your agents are reading records that should have retired, I would be happy to compare notes on how we handled ours. Contact us at A-CX, and let us know what you have found.

  • Ilpo, Co-Founder and Chief AI Officer of A-CX, is a seasoned product creation executive with over 20 years of experience in innovation, strategy, and technology leadership. With a background at industry leaders like Nokia and Microsoft, Ilpo has a proven track record in product development, rapid prototyping, and operational excellence across global markets. His work emphasizes a forward-thinking approach to customer experience and organizational transformation, highlighting his expertise in driving growth and technological advancement within competitive markets.

    CAIO, Co-Founder