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)
- F1–F9 (nine cumulative features): Flat 165.9 min vs Hexagonal 228.6 min
- C1–C6 (six harder independent challenges): 161.6 vs 174.2 min
- S01–S15 (fifteen cumulative features): 298.9 vs 389.5 min; Flat ended at 11,709 lines / 84 files, Hexagonal at 15,205 / 239 files
- S16 (add PostgreSQL alongside SQLite): Hexagonal wins by 45.4% (38.9 vs 71.3 min), as the change stayed entirely outside core application and domain code — but the 32.3 minutes saved didn't recover the 90.6-minute deficit from S01–S15
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.
More from coding & agent
- Google's Agent Substrate detailed: AX app layer on managed agentic compute infra — rakyll · 2026-09-21
- After 15 years of better dashboards, agents can now execute finance transactions themselves — LexSokolin · 2026-09-21
- Why sandbox-as-a-service startups are booming — and whether labs will just build it themselves — dejavucoder · 2026-09-21
- KGQALLM: open-source natural-language QA over knowledge graphs with auto SPARQL generation — adnan_hashmi · 2026-09-21
- JEV, a no-text decision model claims 200x speed and 400x cost savings, with an early port of Claude Code compaction hitting 4,575 stars in five days — gaganghotra_ · 2026-09-21
- 16x Microsoft MVP rebuilds PowerShell GridView with AI, adding live search, filters, and pipeline pass-through — dfinke · 2026-09-21