Description
QGSD has no adversarial test-write-fix loop. After a phase or quick task executes, code is verified against its own plan but never stress-tested by an agent actively trying to break it. nf:harden fills this gap: it runs an iterative loop where an agent writes adversarial tests, runs them, fixes failures, and repeats until convergence. A --full flag gates each iteration through nf:quorum-test for multi-model consensus. nf:quick --full will automatically invoke simple hardening (max 5 loops) after verification passes.
User Story
As a QGSD operator, I want an adversarial hardening loop I can run manually or trigger from nf:quick --full, so that latent bugs are surfaced and fixed before shipping with surviving tests as proof.
Acceptance Criteria
Decomposition
- Create
commands/nf/harden.md with objective, --area and --full argument hints, and reference to workflow
- Create
~/.claude/nf/workflows/harden.md with the loop controller: convergence detection, iteration cap, structured output parsing, HARDENING.md artifact
- Define the adversarial executor prompt template: write tests that prove parts of the system are broken, list them, fix them, output
HARDENING_RESULT: {new_tests: N, fixes: N}
- Wire
--full mode: after each executor pass, call nf:quorum-test on new test files; route BLOCK to a fix executor before looping
- Add hardening invocation to
nf:quick --full post-verification step (after quorum reviews VERIFICATION.md, before task marked complete), max 5 loops
Design Notes
Two modes:
| Mode |
Inner primitive |
Max loops |
nf:harden |
nf-executor (self-contained) |
10 |
nf:harden --full |
nf-executor + nf:quorum-test gate |
10 |
via nf:quick --full |
nf:harden simple |
5 (hardcoded) |
Convergence signal: executor self-reports HARDENING_RESULT: {new_tests: N, fixes: N} — loop exits when both are 0 for 2 consecutive iterations.
Integration hierarchy:
nf:quick (default) → no hardening
nf:quick --full → nf:harden simple, max 5 loops
nf:harden → simple adversarial loop, max 10
nf:harden --full → quorum-gated adversarial loop, max 10
Size
M — Loop controller and convergence logic are novel but straightforward. Hardest part is the structured output contract and --full quorum-test wiring, which has an existing pattern to follow from quick.md's gap-fix loop. No new agent types needed.
Description
QGSD has no adversarial test-write-fix loop. After a phase or quick task executes, code is verified against its own plan but never stress-tested by an agent actively trying to break it.
nf:hardenfills this gap: it runs an iterative loop where an agent writes adversarial tests, runs them, fixes failures, and repeats until convergence. A--fullflag gates each iteration throughnf:quorum-testfor multi-model consensus.nf:quick --fullwill automatically invoke simple hardening (max 5 loops) after verification passes.User Story
As a QGSD operator, I want an adversarial hardening loop I can run manually or trigger from
nf:quick --full, so that latent bugs are surfaced and fixed before shipping with surviving tests as proof.Acceptance Criteria
nf:hardenruns up to 10 adversarial test-write-fix loops and exits early when 0 new tests and 0 fixes are reported for 2 consecutive iterationsnf:harden --area 'focus description'injects the area context into the adversarial prompt and constrains the executor to that scopenf:harden --fullgates each iteration throughnf:quorum-test; BLOCK verdict triggers a fix executor before the next loop; PASS or REVIEW-NEEDED advances the loopnf:harden(simple mode) uses a single nf-executor that self-reports structured convergence output (new_tests,fixescounts) per iterationnf:quick --fullinvokesnf:harden(simple mode, max 5 loops) after verification passes, before marking the task completeHARDENING.mdsummary is written to the quick/phase directory at loop endDecomposition
commands/nf/harden.mdwith objective,--areaand--fullargument hints, and reference to workflow~/.claude/nf/workflows/harden.mdwith the loop controller: convergence detection, iteration cap, structured output parsing,HARDENING.mdartifactHARDENING_RESULT: {new_tests: N, fixes: N}--fullmode: after each executor pass, callnf:quorum-teston new test files; route BLOCK to a fix executor before loopingnf:quick --fullpost-verification step (after quorum reviewsVERIFICATION.md, before task marked complete), max 5 loopsDesign Notes
Two modes:
nf:hardennf:harden --fullnf:quick --fullConvergence signal: executor self-reports
HARDENING_RESULT: {new_tests: N, fixes: N}— loop exits when both are 0 for 2 consecutive iterations.Integration hierarchy:
Size
M — Loop controller and convergence logic are novel but straightforward. Hardest part is the structured output contract and
--fullquorum-test wiring, which has an existing pattern to follow fromquick.md's gap-fix loop. No new agent types needed.