r/AgentsOfAI • u/uriwa • 3d ago
Discussion We need a benchmark for code maintainability
From human engineering experience, code maintainability matters a lot. Every team that has lived with a codebase for more than a few months has felt the compounding cost of tangled abstractions, global state, and fragile test setups.
With coding agents, that assumption is suddenly up for debate. A recent thread on X by Tom Sydney Kerckhove pushed back on the claim that unmaintainable code is not a problem when only agents are maintaining it.
The reason this argument keeps coming back is simple: LLMs can brute-force bad code. An agent can scan thousands of lines, trace side effects across poorly structured modules, and patch its way past a bug that would stall a human for hours. That problem-solving capacity hides the drag. Even when a codebase suffers from recurring bugs caused by patterns like mocking via monkey-patching, an agent often powers through the failure instead of refusing to touch the file.
Because the cost is obscured rather than obvious, intuition alone will not settle the debate. Until we prove and measure how much maintainability matters for LLMs, the doubt remains.
A Benchmark Design for Code Maintainability
Most coding benchmarks today measure greenfield generation or isolated bug fixes on existing repositories without connecting how a codebase was built to how expensive it is to change later.
Here is a two-stage benchmark design that holds the same model and harness constant across every run:
- Stage 1 — Build (v1): Give the agent a clear spec and have it implement v1 from scratch, verified against hidden tests. Measure tokens, wall-clock time, and total cost.
Stage 2 — Two independent parallel tracks branching from that exact v1 codebase (so neither track contaminates the other):
- 2a. Augment: In a fresh session of the same agent, add a v2 feature to the same codebase, verified against hidden v2 tests plus v1 regressions. Measure tokens, time, and cost.
- 2b. Fix: On a clean copy of the v1 codebase, inject a set of LLM-planted bugs (subtle logic regressions, state mismatches, broken edge cases) and have a fresh session of the same agent diagnose and fix them. Measure tokens, time, and cost.
What This Lets Us Compare
Holding the model and harness fixed turns the codebase and its underlying stack into the variable under test. You can run the exact same v1 spec, v2 feature, and bug-planting protocol across:
- Frontend frameworks (React vs. Svelte vs. Lit once the app grows past v1)
- Backend and data layers (e.g. InstantDB vs. Supabase under v2 changes and state/permission regressions)
- Languages and type systems (strict static types and compiler diagnostics vs. dynamic stacks)
- Testing practices (monkey-patched mocks vs. clean dependency injection and integration tests)
A stack that looks fast to scaffold in Stage 1 might carry a steep token and latency tax in Stage 2a and 2b, or vice versa.
Cross-Model Matrix Extension
Once the pipeline exists, you can also lift the single-model constraint and run a cross-model matrix: build v1 with Model A, then run Augment and Fix with Model B. That tests whether frontier models write code that smaller, cheaper models can safely extend and debug—or whether some models produce clever, tightly coupled code that only the same frontier model can untangle later.
Curious what stacks, failure modes, or metrics you would want included in a maintainability benchmark like this.
1
u/uriwa 3d ago
For full context: I'm working on prompt2bot (https://prompt2bot.com), a platform for hiring AI agents for various purposes, where agent-written code and automations have to stay maintainable over time.
The full essay with the benchmark diagram is on the blog here: https://prompt2bot.com/blog/benchmarking-code-maintainability
More of my work and writing is at https://uriv.me.
2
u/SensitiveChoice153 3d ago
Just use more tokens bro
1
u/AutoModerator 3d ago
Thank you for your submission! To keep our community healthy, please ensure you've followed our rules.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Distinct-Laugh-Ahaha 3d ago
Running a version of this at home, just not on code. I have a fully offline local setup (Ollama, a 9B for daily work and a 27B for slow deep passes) that I built so it can never be evicted or changed under me.
My "benchmark" is a fixed battery of 16 behavior tests. Any time I change a model's template or system prompt, I re-run the whole battery on both models and diff against the last clean baseline. That's my maintainability number: what does the next visit cost after a change.
Your cross-model matrix is my daily life. The small cheap model does most of the work, the big slow one does the deep passes. Whether the cheap one can safely build on what the expensive one made is not a hypothetical for me, it's the whole design.
One push: run more generations. V2 is kind. The cost compounds around v5 to v10, when each new session is mostly untangling the patches of the sessions before it. And real-world bugs usually come from ambiguous specs, not tidy logic errors, so a spec-confusion track might be worth adding next to the planted bugs.
Good post. This is the benchmark that actually matches how agent-built stuff lives.
1
u/Sure_Examination5084 3d ago
Kinda worried about the LLM planted bugs part, feels like the model would plant the stuff it's already good at finding
1
u/aCuria 3d ago
When the model can’t solve the problem you are kinda screwed no?
Also the token cost gets ridiculous and the models like to copy paste existing bad code everywhere
1
u/rileyrgham 2d ago
Unsurprisingly written by AI. The laziness is off the charts. 😉.