Each round moves through the same five stages. The loop never edits the real checkout directly.
Stage | Input | Output |
|---|---|---|
Lint | The checkout or scratch copy | A list of findings with file and line. |
Diagnose | Findings plus surrounding code | A prompt-sized bundle of context. |
Propose | The bundle | One patch from a model. |
Apply | The patch | A scratch copy with the patch applied. |
Rerun | The scratch copy | Fresh lint hits and test results. |
The rerun output feeds the accept decision. A kept patch becomes the baseline for the next round.
The transcript below is schematic and illustrative. It is not output from any real system.
schematic transcript (illustrative only, never from a real system)
loop sends: 3 lint findings, each with file, line, and rule id
model replies: 1 unified diff touching 2 lines
loop applies the diff to the scratch copy only
rerun: 1 lint hit left, suite green -> keep the patchEvery round costs lint runs plus model calls. A round budget caps the total before the loop starts.
stated example parameters: one lint run costs 2 units, one model call costs 5 units
one round = lint + model call + rerun lint = 2 + 5 + 2 = 9 units
3 rounds = 3 x 9 = 27 units
split: lint 3 x 4 = 12 units, model 3 x 5 = 15 units; 12 + 15 = 27The loop stops at the round budget, at zero hits with a green suite, or after consecutive rounds with no gain. The exact limits vary by team and setup: measure them.
It stops and reports success. There is nothing left to fix and the suite confirms the patch.
27 units. Each round is 2 + 5 + 2 = 9 units, and 3 times 9 is 27.