$ fssg build --deterministic --validate |

AI Makes the Wrong Abstraction More Expensive

Logs

AI has made writing code cheap. It has not made choosing the right boundary cheap.

In fact, I think the cost curve has moved in the opposite direction. A weak abstraction used to spread at human typing speed. An agent can now reproduce it across ten modules, add adapters around it, generate tests that freeze its shape, and document it as if the design had already been proved. The code looks more complete while the mistake becomes harder to remove.

I call this abstraction interest: every new dependency on an unproved boundary raises the future cost of changing our mind.

Completion can disguise uncertainty

A generated interface is easy to mistake for an established concept. It has a name, types, tests, examples, and polished documentation. Those are useful artifacts, but they prove consistency with the interface—not that the interface represents the right decomposition of the system.

The dangerous sequence is familiar:

  1. we see one complicated case;
  2. we ask AI to extract a reusable layer;
  3. the agent generates several consumers to demonstrate reuse;
  4. those consumers become evidence that the layer is necessary.

The argument has become circular. The abstraction created its own supporting examples.

This is one reason I do not treat generated code volume as architectural progress. Code can earn its place only by making a real obligation clearer. I wrote about that in AI Code Must Earn Its Place. The same standard applies more strongly to abstractions, because an abstraction does not merely add code. It changes the vocabulary in which later code is written.

Duplication can be evidence

Engineers are trained to remove duplication. Usually that instinct is sound. But two similar blocks are not always a refactoring request. Sometimes they are two observations that have not yet revealed which details are stable and which are accidental.

If I merge them too early, I must choose a common shape before I have enough evidence. The result often grows flags, optional fields, callbacks, and exception branches. The abstraction becomes a compact place to store uncertainty.

So I now prefer an evidence threshold:

State What I allow
One example Keep the mechanism local and name the uncertainty
Two similar examples Compare invariants and differences; do not force a shared API
Three independent examples Propose the smallest common contract
Real consumers with conflicting needs Keep separate boundaries or split the contract

This is not a universal law, and “three” is not magic. The useful idea behind the Rule of Three is restraint: repeated code is visible and reversible; a premature common model can hide differences behind a stable-looking name.

The threshold is also falsifiable. If the third case requires conditionals that refer to consumer identity, the proposed abstraction probably captures coincidence rather than a shared invariant.

My abstraction receipt

Before I let an agent modularize a mechanism, I want a small decision artifact. Not a long architecture document—just enough to expose whether the boundary has earned authority:

abstraction: EffectLedger
examples:
  - payment-capture
  - email-delivery
  - repository-push
shared_invariant: every attempted external effect has a stable identity and observed outcome
excluded_differences:
  - compensation semantics
  - provider retry policy
  - user notification
falsifier: a consumer must branch on another consumer's type
rollback: inline the adapter into each consumer and preserve fixtures

The important field is excluded_differences. Most premature abstractions describe what appears common and stay silent about what was deliberately left outside. Then the excluded details return as flags and special cases.

The falsifier matters for the same reason. It gives the abstraction a way to fail. Without it, every new mismatch is interpreted as a reason to make the shared layer more flexible.

Why IOSM ends with modularization

This is also why I keep returning to the order in IOSM: Improve, Optimize, Shrink, then Modularize.

Modularization comes after observation and reduction. First establish a baseline. Change the behavior. Measure or inspect the result. Remove what is unnecessary. Only then promote stable boundaries into modules.

That ordering is not aesthetic. It prevents the architecture from being inferred from the first generated solution. The IOSM specification makes cycles, hypotheses, evidence trails, and decision artifacts explicit; IOSM CLI carries those artifacts through controlled engineering work. Neither can guarantee a perfect abstraction. They can preserve the evidence that explains why one was introduced.

This is the practical role I want AI to play. It should generate candidate decompositions, compare them, trace consumers, and estimate migration work. It should not turn the first plausible noun into permanent architecture.

Optimize for the cost of changing your mind

I still remove duplication. I still value small interfaces and modular systems. I simply separate two questions:

  • Can AI produce a clean abstraction now?
  • Has the system produced enough evidence to justify one?

The first answer is often yes. The second is often not yet.

That gap is where abstraction interest accumulates. The solution is not to slow every change or distrust generated code. It is to keep uncertain structure local, preserve independent examples, and make promotion into a shared boundary an explicit engineering decision.

AI gives us more implementations to choose from. The advantage disappears if we commit to the first vocabulary it invents.

Sources

FACET AI CLI Terminal
facet@ai:~$