get-shit-done/workflows/validate-phase.md
<required_reading> @~/.claude/get-shit-done/references/ui-brand.md </required_reading>
<available_agent_types> Valid GSD subagent types (use exact names — do not fall back to 'general-purpose'):
INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}")
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
AGENT_SKILLS_AUDITOR=$(gsd-sdk query agent-skills gsd-nyquist-auditor)
Parse: phase_dir, phase_number, phase_name, phase_slug, padded_phase.
AUDITOR_MODEL=$(gsd-sdk query resolve-model gsd-nyquist-auditor --raw)
NYQUIST_CFG=$(gsd-sdk query config-get workflow.nyquist_validation --raw)
If NYQUIST_CFG is false: exit with "Nyquist validation is disabled. Enable via /gsd:settings."
Display banner: GSD > VALIDATE PHASE {N}: {name}
VALIDATION_FILE=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
SUMMARY_FILES=$(ls "${PHASE_DIR}"/*-SUMMARY.md 2>/dev/null)
VALIDATION_FILE non-empty): Audit existingVALIDATION_FILE empty, SUMMARY_FILES non-empty): Reconstruct from artifactsSUMMARY_FILES empty): Exit — "Phase {N} not executed. Run /gsd:execute-phase {N} ${GSD_WS} first."Read all PLAN and SUMMARY files. Extract: task lists, requirement IDs, key-files changed, verify blocks.
Per task: { task_id, plan_id, wave, requirement_ids, has_automated_command }
State A: Parse from existing VALIDATION.md Test Infrastructure table. State B: Filesystem scan:
find . -name "pytest.ini" -o -name "jest.config.*" -o -name "vitest.config.*" -o -name "pyproject.toml" 2>/dev/null | head -10
find . \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" \) -not -path "*/node_modules/*" 2>/dev/null | head -40
Match each requirement to existing tests by filename, imports, test descriptions. Record: requirement → test_file → status.
Classify each requirement:
| Status | Criteria |
|---|---|
| COVERED | Test exists, targets behavior, runs green |
| PARTIAL | Test exists, failing or incomplete |
| MISSING | No test found |
Build: { task_id, requirement, gap_type, suggested_test_path, suggested_command }
No gaps → skip to Step 6, set nyquist_compliant: true.
Text mode (workflow.text_mode: true in config or --text flag): Set TEXT_MODE=true if --text is present in $ARGUMENTS OR text_mode from init JSON is true. When TEXT_MODE is active, replace every AskUserQuestion call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where AskUserQuestion is not available.
Call AskUserQuestion with gap table and options:
Agent(
prompt="Read ~/.claude/agents/gsd-nyquist-auditor.md for instructions.\n\n" +
"<files_to_read>{PLAN, SUMMARY, impl files, VALIDATION.md}</files_to_read>" +
"<gaps>{gap list}</gaps>" +
"<test_infrastructure>{framework, config, commands}</test_infrastructure>" +
"<constraints>Never modify impl files. Max 3 debug iterations. Escalate impl bugs.</constraints>" +
"${AGENT_SKILLS_AUDITOR}",
subagent_type="gsd-nyquist-auditor",
model="{AUDITOR_MODEL}",
description="Fill validation gaps for Phase {N}"
)
ORCHESTRATOR RULE — CODEX RUNTIME: After calling Agent() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
Handle return:
## GAPS FILLED → record tests + map updates, Step 6## PARTIAL → record resolved, move escalated to manual-only, Step 6## ESCALATE → move all to manual-only, Step 6State B (create):
~/.claude/get-shit-done/templates/VALIDATION.md${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.mdState A (update):
## Validation Audit {date}
| Metric | Count |
|--------|-------|
| Gaps found | {N} |
| Resolved | {M} |
| Escalated | {K} |
git add {test_files}
git commit -m "test(phase-${PHASE}): add Nyquist validation tests"
gsd-sdk query commit "docs(phase-${PHASE}): add/update validation strategy"
Compliant:
GSD > PHASE {N} IS NYQUIST-COMPLIANT
All requirements have automated verification.
▶ Next: /gsd:audit-milestone ${GSD_WS}
Partial:
GSD > PHASE {N} VALIDATED (PARTIAL)
{M} automated, {K} manual-only.
▶ Retry: /gsd:validate-phase {N} ${GSD_WS}
Display /clear reminder.
<success_criteria>