This document defines a machine-readable, state-tracked workflow for AI-driven code refactoring using the Test-Driven Development (TDD) Red → Green → Refactor cycle.
It enforces:
- One branch / one PR per issue
- Strict RED/GREEN/REFACTOR phases with mandatory relevant test passing at each step
- Automatic detection and correction of violations (root-cause fixes only, no shortcuts)
- Explicitly forbidden shortcuts that mask failing tests
- Iterative cycles within a single work stream, with cycle numbers tracked
- State logging of every action, commit, test result, and violation for auditability
- PR descriptions containing a full cycle trace and state log link