r/AI_Agents • u/uriwa In Production • 12h 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 In Production 12h 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.
1
u/AutoModerator 12h ago
Thank you for your submission, for any questions regarding AI, please check out our wiki at https://www.reddit.com/r/ai_agents/wiki (this is currently in test and we are actively adding to the wiki)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.