v1 · Archived

This page is v1, the original pilot: one author, one matched pair, unblinded. It found no gap in task completion between clean and sloppy code. v2, a later blinded replication with three independent pairs, found a real gap (clean 28/36 rounds passed vs. sloppy 12/36). Read v2, the current results, and how the method changed →

v1 · Archived Pilot

What does maintainability mean when AI maintains the code?

I built clean and deliberately degraded versions of the same small program, then gave both versions twelve maintenance tasks. Both passed every hidden test. This paper reports that result, the differences that appeared in the source code, and the larger study needed to find out whether those differences eventually cost an AI maintainer time or accuracy.

Study typePilot
SystemOne Python task manager
Current scope12 maintenance rounds

Research framing

Research question

Research question

When an AI agent modifies a codebase, do names, documentation, types, module boundaries, and tests affect whether it makes the right change? How does the answer change when the repository grows or the ticket leaves room for interpretation?

Provisional thesis

Different parts of “clean code” may matter under different conditions.

In this pilot, names and docstrings did not change whether a task passed. Types, shared helpers, and duplicated logic changed the shape of the source, but the pilot did not show that they changed maintenance cost. Human reviewers may still face costs that the task grader could not see.

Pilot result

Both versions passed every test.

The clean and degraded files produced the same tested behavior even though their complexity, duplication, types, documentation, and coding conventions differed.

Limit

One small program cannot answer the general question.

We still need to test larger repositories, incomplete tickets, fresh agent sessions, different models, and human review.

The claim above remains provisional. The later studies turn its separate parts into testable predictions.

Pilot study

One program, two variants, twelve rounds

Both variants began as the same deliberately buggy task-manager library of about 50 lines and received the same maintenance tasks in the same order.

Clean

Typed dataclasses, descriptive names, validation helpers, docstrings, and shared access patterns.

Degraded

Dictionaries, one-letter names, no types or docstrings, redundant boolean comparisons, and repeated raw-data access.

The system under test

By round 12, both variants supported priorities, due dates, tags, subtasks, notes, search, archiving, bulk operations, and recurring tasks. Their public method names matched, while their return representations differed.

tm = TaskManager()
task = tm.add_task("Ship the working paper", priority="high", tags=["writing"])
tm.add_subtask(task.id, "Draft outline")
tm.complete_task(task.id)      # blocked until the subtask is complete
tm.complete_subtask(task.id, 1)
tm.complete_task(task.id)

Protocol

Treatment

Clean versus deliberately degraded source code.

Maintenance

The same twelve tasks, applied sequentially to both variants.

Behavioral grader

A hidden pytest suite written from each task specification before either variant was changed.

Structural measures

Complexity, maintainability index, duplication, code churn, and selected anti-pattern counts.

Important limitation: I wrote both variants, interpreted every task, and performed the maintenance. The whole program fit in context, every ticket specified the required behavior, and the grader hid the interface difference between dataclasses and dictionaries. The pilot is useful for designing the next experiment, but it cannot support a general causal claim.

Measurement

What the pilot measured

Passing tests is necessary but insufficient. A program can remain behaviorally correct while becoming harder to change, inspect, or recover. The pilot therefore records both task outcomes and structural proxies, using the product-quality categories in ISO/IEC 25010:2023 as a reference.

Task outcome

Did each change pass?

Hidden tests passed, regressions introduced, and edits needed to reach a passing state.

Source measurements

How did the files differ?

Cyclomatic complexity, Radon maintainability index, duplication, code churn, and selected anti-patterns.

Outside this pilot

What did the pilot miss?

The pilot did not record misunderstood requirements, files the agent failed to find, elapsed time, or the accuracy of human review.

The structural metrics are not a composite “cleanliness score.” Each is reported separately, and none directly measures whether a change was safe or understandable.

Results

Equal task completion, different structure

Both variants passed 60/60 hidden tests with zero recorded regressions across twelve rounds.

RoundTaskClean editsDegraded editsRegressions
1Bug fix11none
2Priority levels11none
3Due dates11none
4Title validation11none
5Tags11none
6Typed not-found errors11none
7Subtasks23none
8Task notes21none
9Bulk operations11none
10Search11none
11Archiving32none
12Recurring tasks43none
Checkpoint interpretation

The degraded variant remained about 1.26–1.27 times as complex as clean, but the ratio did not widen. Duplication appeared in the degraded variant after bulk operations were introduced. The edit-count proxy favored degraded code by 11 edits to 13, contrary to the prediction. Because edit count reflects tool-call granularity rather than cost, later studies must use tokens, elapsed time, changed lines, and repair cycles.

Round-by-round structural trend

RoundClean LOCClean CCClean dup%Degraded LOCDegraded CCDegraded dup%

Interpretation

What the result means—and what it does not

Result

The two versions completed the same tasks.

Under a complete specification and hidden tests, both small variants reached the same behavioral outcomes.

Source code

The files did not evolve in the same way.

Complexity and duplication distinguished the variants, although the experiment did not show that these differences caused maintenance cost.

Limit

We do not know whether those differences become costly.

The study did not vary scale, ambiguity, context availability, maintainer independence, model choice, or human oversight.

That is the pilot finding: the tests reported no difference while the source measurements did. The next study asks whether those source differences affect an agent when the work is larger, less specified, or spread across more files.

Research program

Studies that follow this pilot

The next papers are separated by the study they report. One tests AI maintenance; another tests human review.

01
Current paper

Pilot study

Record the result, identify weak measurements, and specify what the next experiment must change.

02
Confirmatory study

When does code quality matter to AI maintainers?

Separate readability from structure, vary scale and specification quality, and test pre-registered maintenance hypotheses.

03
Governance study

Human review and audit

Test whether reviewers can explain matched changes, identify risks, and decide when to escalate.

04
Synthesis

Code quality in AI-first organizations

Integrate technical maintenance and organizational oversight once both have direct evidence.

Hypotheses across the research program

H1

Bounded-task equivalence. When a ticket specifies every required behavior, the tests cover those behaviors, and the relevant code fits in context, clean and degraded variants will be equivalent on task success within a pre-registered margin.

H2

Structural-debt interaction. When a change crosses more dependencies, follows an incomplete ticket, or builds on a longer edit history, degraded code will produce more failures, regressions, and repair work.

H3

Readability interaction. Descriptive names and documentation will matter more when the agent must infer intent than when the ticket specifies the behavior.

H4

Governance cost. Human reviewers will take longer and make more errors when auditing degraded code, even where AI task completion remains equivalent.

H5

Model sensitivity. Outcomes on degraded code will vary more across models and agent configurations than outcomes on clean code.

The next study must separate readability from structure

The pilot changed names, documentation, types, data representation, duplication, and helper structure at the same time. The next study must vary readable names and documentation separately from properties enforced by types, contracts, or shared interfaces.

ConditionHuman readabilityStructural constraintsPurpose
CleanHighHighReference condition
Readable / weakHighLowIsolate readability
Terse / structuredLowHighIsolate types, contracts, and shared interfaces
DegradedLowLowCombined treatment

Experiments needed next

  1. Freeze the confirmatory design.Specify hypotheses, primary outcomes, equivalence margins, stopping rules, and the analysis plan before collecting new confirmatory data.
  2. Finish the pilot sequence.Rounds 13–18 can improve the longitudinal record, but they should not carry the main causal claim.
  3. Build matched factorial variants.Create conditions that separate readability from structural constraints without changing intended behavior.
  4. Run independent replications.Use multiple codebases, task orders, fresh agent sessions, model configurations, and blinded graders.
  5. Test the conditions most likely to change the result.Vary ticket completeness, dependency depth, available context, and prior edit history.
  6. Measure outcomes directly.Record correctness, regressions, requirements errors, tokens, elapsed time, repair cycles, changed files, and unnecessary edits.

Mixed Workforce connection

Maintainable by machines, governable by humans?

The Mixed Workforce Company argues that a company remains accountable for work it delegates to AI. This project examines one practical consequence: code may be easy for an agent to change and still be difficult for a person to inspect.

AI maintenance

Can an AI agent make the change?

Measure correctness, regressions, repair cost, retrieval, and performance across code conditions.

Human oversight

Can people understand and control the change?

Measure audit accuracy, review time, confidence, explanation quality, and escalation decisions.

Proposition for the governance study

Readable code may matter less when an agent makes a routine change, yet still matter when a reviewer must approve that change or investigate a failure.

This pilot does not test that proposition. Paper 3 requires a separate human-participant study with matched diffs, blinded reviewers, counterbalanced ordering, and pre-registered scoring criteria.

Reproducibility materials

The two implementations, side by side

The repository contains both round-12 variants, the 60-test grading suite, per-round snapshots, metric logs, the pilot report, and the protocol for later studies.

Glossary

Terms used in this report