Software factory TDD implementation — use when implementing a phase. Enforces red-green discipline and code security standards before committing.
For every unit of behavior:
Do not write implementation code before the failing test exists. Do not proceed past a failing test.
Read your phase spec from memory (implementation_plan, find the matching phase by name). Implement only what is in that phase. If you discover scope that should be in another phase, write a note to memory under scope_note:<phase_name> and stop — do not expand scope.
If a test fails unexpectedly (not the current TDD step), stop. Write to memory:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/memory.py" write \
--key "unexpected_failure:<phase_name>" \
--value '{"test":"<name>","error":"<message>","files_changed":["..."]}' \
--tags "failure,needs_attention"
Then surface the failure to the user. Do not continue with other tests.
Every change must be checked by the reviewer agent before committing. The reviewer checks for:
0.0.0.0 binding without intent)Do not commit a phase until the reviewer approves it.