Orchestrate the full RED-GREEN-QA pipeline with agent separation — different agents write tests, implement code, and review quality.
/creview approves a spec — this is where code gets written/cdebug), refactoring (use /crefactor), or features that don’t have an approved spec yet/ctdd is the implementation phase. The full pipeline is: /cspec → /creview → /ctdd → /cverify → /cdocs → merge. Inside /ctdd, the pipeline is: RED (write failing tests) → test audit → GREEN (implement) → /simplify → QA → mini-audit → done. Every step runs, every time.
// Tests R-001 [unit]: ...). The test agent creates structural stubs (marked STUB:TDD) but writes zero implementation logic.MA- prefix for findings to distinguish from QA findings.For features with 5+ rules, the orchestrator builds a task graph to identify independent tracks that can run RED and GREEN in parallel.
Agent: Spawning test-writing agent — reading spec (5 rules),
ARCHITECTURE.md, antipatterns...
RED complete — 2 test files, 8 test cases, all failing as expected.
Running test audit...
Test audit passed — 1 advisory (R-004 assertion could be stronger).
Spawning implementation agent...
GREEN complete — all 8 tests passing.
Running /simplify... done.
Spawning QA agent...
QA found 1 issue (0 critical, 1 high):
FINDING: QA-001
SEVERITY: BLOCKING
RULE: R-004
DESCRIPTION: Rate limit counter uses in-memory Map —
spec requires persistence across restarts
INSTANCE_FIX: Move counter to Redis
CLASS_FIX: Add integration test that restarts the server
mid-test and verifies counter survives
Starting fix round 1...
Fix round complete — all 9 tests passing. Re-running QA...
QA clean. No blocking findings.
Starting mini-audit round 1/2 — spawning 3 specialist agents
(cross-component, hostile input, resource bounds)...
Cross-component complete — found 0 findings.
Hostile input complete — found 0 findings.
Resource bounds complete — found 0 findings.
Mini-audit round 1 clean — no findings across all three lenses.
Mini-audit round 2 clean — no findings across all three lenses.
Mini-audit complete — no blocking findings.
TDD complete. Run /cverify when ready.
| Reads | Writes |
|---|---|
Approved spec (.correctless/specs/{slug}.md) |
Test files (project test directory) |
AGENT_CONTEXT.md, ARCHITECTURE.md |
Source files (implementation) |
.correctless/config/workflow-config.json |
.correctless/artifacts/qa-findings-{slug}.json |
.correctless/antipatterns.md |
.correctless/artifacts/tdd-test-edits.log |
.correctless/artifacts/checkpoint-ctdd-{slug}.json |
|
.correctless/artifacts/token-log-{slug}.json |
The RED phase test agent reads ARCHITECTURE.md entrypoints before writing integration tests. For each [integration] rule, the agent matches the rule’s scope to an entrypoint’s scope globs and writes the test through the entrypoint’s test_via pattern instead of importing internal packages directly. The agent also reads Key Patterns, Layer Conventions, and Trust Boundaries to respect layer access constraints. When no entrypoints are documented, the agent uses the best available entry point and leaves a No documented entrypoint comment for visibility.
When specs include Entry/Through/Exit integration test contracts (written by /cspec, see ABS-024), the test audit verifies that tests satisfy these contracts using tiered severity:
| Check | Type | Severity |
|---|---|---|
| Entry | Mechanical | BLOCKING — test must use the specified entrypoint |
| Through | Semi-mechanical | BLOCKING or UNCERTAIN — test must not mock prohibited components |
| Exit | Semantic | BLOCKING (definite mismatch) or ADVISORY (uncertain) |
For [integration] rules without contracts, the audit notes the gap without gating.
The test audit detects when an [integration] test imports internal packages directly instead of going through a documented entrypoint. For each entrypoint’s scope globs, the audit checks whether test imports reference paths covered by that scope. This is language-aware (Go, TypeScript/JavaScript, Python, Rust) with ADVISORY skip for unsupported languages. The check does not flag imports of the entrypoint itself — only packages within its scope. When check 10 and check 9 (contract verification) both fire on the same test, they are consolidated into a single finding. When no entrypoints are documented, the check is skipped entirely.
Same at all intensity levels for the RED → test audit → GREEN → QA pipeline with agent separation. At high/critical intensity, git commit trailers (Spec:, Rules-covered:, Phase:) are added for traceability, and the workflow transitions to a verify phase before marking done.
STUB:TDD): This is expected. The test agent creates structural stubs with STUB:TDD markers and zero-value returns. The GREEN agent replaces these with real implementations. If compilation fails before GREEN, verify the stubs have correct signatures./compact before the next phase. The checkpoint system saves progress, so you can resume after compacting..correctless/config/workflow-config.json has the correct commands.test entry and that your test runner is installed.