Hexagonal architecture slows coding agents 20-30%, except when swapping infrastructure

kristiyanstoyanovAI · reddit · 2026-09-20

Experiment design

The author had the same coding agent maintain two versions of one application: one with no architecture constraints (Flat), the other enforcing hexagonal/ports-and-adapters with architecture tests guarding boundaries. Features were added continuously, measuring time and token usage.

Extended results (projects grown to 12k–15k lines)

Takeaway

Overall, strong architecture made the repo harder for the agent to reason about, costing more tool calls and tokens; it only paid off when a change exploited ports-and-adapters' strength (infrastructure swap). The author asks whether we should rethink these patterns — or stop using them for smaller, less critical systems.

Full measurement report is on Zenodo (record 22806994), plus a video walkthrough. Disclosure: this is the author's own experiment; AI tools helped build the evaluator and charts, while measured changes were made by a local model.

Original post →

More from coding & agent

coding & agent channel →