Specification Debt in the Age of AI Coding Agents

Magnifying glass over the fine print of a billing statement, with 'past due' highlighted.

TL;DR Every enterprise application holds business rules that live only in its code, a problem a recent ByteCode.News article calls specification debt. AI coding agents can change that code quickly, but they often miss the rules it enforces. In CoreStory's research, leading models got both the requested change and the hidden rule right in only 5 of 115 attempts on the six hardest tasks. The answer is to recover the specification first, trace each rule back to the code that enforces it, and give that context to engineers, business stakeholders and AI agents before anything changes.

Every mature enterprise application contains requirements that no one remembers writing: customer-specific exceptions, regulatory calculations, unusual transaction logic, and rules tied to legacy contracts.

Each rule met a real business need. Together, they capture years, sometimes decades, of decisions about how the business operates.

A recent ByteCode.News article, Accreted Specifications, describes how requirements build up over the life of an application. Over time, it gets harder to tell why they were added.

The author calls this specification debt, and it becomes a risk once AI agents start changing software that people can only partly explain.

Specification debt is different from technical debt

Technical debt typically describes the cost of implementation decisions that make software harder to maintain. Specification debt is the loss of knowledge about what the software is supposed to do. Analysis can tell you what the code does, but it rarely tells you why the code exists in the first place.

A poorly structured function can be refactored. But how can you confidently change a business-critical application without fully understanding which behaviors need to be preserved?

Consider an enterprise billing application that has accumulated requirements over two decades:

  • Customers on older contracts retain specific pricing arrangements
  • Certain jurisdictions require different tax or rounding calculations
  • Credits must be applied in a particular order to comply with contractual obligations
  • Some transactions require exceptions based on their originating system

These requirements may be distributed across multiple programs, configuration files, database procedures, and integration points. Some may have never even appeared in a formal requirements document.

The code works and the business depends on it, yet the underlying requirements are only partially documented.

That's what makes enterprise software so hard to change. One wrong edit can break a 15-year-old customer contract, and nobody will notice until the invoices go out.

AI makes specification debt more consequential

AI coding agents can work through a codebase faster than any engineer, but they only know what the code tells them.

For example, if you ask one to simplify the billing calculation, it might collapse the “redundant” branches, pass every test, and remove a rule your largest customer depends on.

That's because a branch that looks redundant may encode a contractual obligation. A hardcoded date may correspond to a regulatory change. An unusual sequence of operations may protect against a financial discrepancy.

In our own research at CoreStory, we evaluated leading AI models on code changes that depended on unstated business rules. Our scorecard highlights six tasks the models struggled with. Across those tasks, the models got both the requested change and the underlying business rule right in 5 of 115 attempts.

Leading AI models got both the requested change and the hidden business rule right in just 5 of 115 attempts. In the other 110, they got the change, the rule, or both wrong.

The faster we can change software, the more important it becomes to understand what must not change.

Recover the specification before changing the implementation

Start by tracing how the application behaves across the system. A summary of one file or function can miss a business rule that depends on several parts working together.

A useful specification recovery process should establish four things:

1. What the system actually does. Identify business rules, decision logic, workflows, dependencies, data transformations, and exceptions across the codebase.

2. Where that behavior originates. Connect recovered rules to the source code, conditions, and execution paths that provide evidence for them.

3. What depends on that behavior. Understand which downstream processes, integrations, and consumers could be affected if a particular rule changes.

4. Which behavior the business intends to preserve. Give domain experts the evidence they need to distinguish valid requirements from defects, obsolete exceptions, and unintended behavior.

As the Accreted Specifications article argues, the goal is to separate the promises a system makes from the behavior it shows by accident.

The code shows what happens today. Domain experts can say which behavior the business still needs.

Preserving every conditional can carry old bugs forward. Removing an unusual branch can break a rule a customer still relies on.

From implicit business rules to explicit contracts

Consider a similar pricing rule in a payment system. The processing fee varies by the customer’s contract date, transaction type, and region.

An AI summary might call this a conditional fee calculation. A recovered specification spells out when the rule applies and how to verify it.

Business rule: Qualifying legacy contracts retain their original processing fee arrangement.

Conditions: The contract predates the revised pricing policy and the transaction meets the applicable eligibility criteria.

Dependencies: Contract metadata, transaction classification, regional pricing configuration, and downstream billing reconciliation.

Source evidence: The specific application logic that selects the pricing arrangement.

Verification: Representative transactions demonstrating the expected behavior for both legacy and current contracts, including boundary conditions.

Business review: Confirmation that the legacy arrangement remains an active contractual obligation.

The team can confirm whether the fee rule still applies before changing the code that enforces it.

An AI coding agent can use the same specification to see what its changes need to preserve.

Business context should be part of the development lifecycle

Specification recovery is often associated with legacy modernization, where teams need to understand an existing application before replacing or restructuring it.

But the problem isn't limited to mainframes. A three-year-old microservice can pick up the same kind of hidden rules. A sales team signs a customer with an unusual discount, an engineer adds a check for that account, and a year later nobody on the team remembers why it's there.

That's why recovery can't be a one-time project. Once the legacy fee rule from the billing example is written down and linked to the code that enforces it, the next engineer who opens that code can see it, a reviewer can check a pull request against it, and an AI coding agent can read it before proposing a change. Without that link, the knowledge fades again with the next round of turnover.

Making institutional knowledge accessible

At CoreStory, we start by asking what the business relies on the code to do.

We trace each business rule and its dependencies back to the code that enforces it. In the billing example, an engineer or an AI agent can see that the old pricing branch supports active contracts before touching it, and the finance team can review the same evidence to confirm whether those contracts still need it.

Software will continue to evolve and requirements will continue to accumulate. But the implementation doesn't have to remain the only place where those requirements exist.

In an era when AI can generate code faster than ever, recovering and preserving business intent may be one of the most important investments an enterprise can make.

Explore the CoreStory V3 benchmarks.

CoreStory
CoreStory Editorial Team