Agentic Code Surgery for Brownfield Systems
Description
AI coding assistants are more helpful in greenfield development than for modifying brownfield code — large, undertested, poorly-maintained systems that make up the majority of professional programming. Left to their defaults, these assistants read a few files, guess at intent, and edit first, verify later: precisely the failure mode Michael Feathers warned against in Working Effectively with Legacy Code [1]. We propose a seven-agent workflow — Plan, Map, Break, Cover, Implement, Refactor, Finish — that forces an AI assistant to follow Feathers' discipline: characterize existing behavior with tests before touching code. Each agent has a narrow scope, an explicit exit contract, and a file-based handoff to the next, with human review at every boundary. Applied to a real brownfield codebase, this workflow produced 43 new passing tests (raising statement coverage from 0.85% to 16.78%) against zero new tests and 0.82% coverage for a regular (plan and implement) approach, and avoided all critical and major bugs the regular approach introduced.
Files
paper.pdf
Files
(202.2 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:d4d82d5912827abd70f224a32982bb2f
|
202.2 kB | Preview Download |
Additional details
Software
- Repository URL
- https://github.com/ampyard/brownfield-agentic-code-surgery
- Development Status
- Concept