feat: add Nyquist validation layer to plan-phase pipeline

Adds automated feedback architecture research to gsd-phase-researcher,
enforces it as Dimension 8 in gsd-plan-checker, and introduces
{phase}-VALIDATION.md as the per-phase validation contract.

Ensures every phase plan includes automated verify commands before
execution begins. Opt-out via workflow.nyquist_validation: false.

Closes #122 (partial), related #117

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bantuson
2026-02-20 13:46:39 +02:00
parent 3cf26d69ee
commit e0f9c738c9
9 changed files with 352 additions and 13 deletions

View File

@@ -167,6 +167,7 @@ function loadConfig(cwd) {
verifier: true,
parallelization: true,
brave_search: false,
nyquist_validation: true,
};
try {
@@ -199,6 +200,7 @@ function loadConfig(cwd) {
plan_checker: get('plan_checker', { section: 'workflow', field: 'plan_check' }) ?? defaults.plan_checker,
verifier: get('verifier', { section: 'workflow', field: 'verifier' }) ?? defaults.verifier,
parallelization,
nyquist_validation: get('nyquist_validation', { section: 'workflow', field: 'nyquist_validation' }) ?? defaults.nyquist_validation,
brave_search: get('brave_search') ?? defaults.brave_search,
};
} catch {
@@ -4319,6 +4321,7 @@ function cmdInitPlanPhase(cwd, phase, raw) {
research_enabled: config.research,
plan_checker_enabled: config.plan_checker,
commit_docs: config.commit_docs,
nyquist_validation_enabled: config.nyquist_validation,
// Phase info
phase_found: !!phaseInfo,

View File

@@ -0,0 +1,104 @@
---
phase: {N}
slug: {phase-slug}
status: draft
nyquist_compliant: false
wave_0_complete: false
created: {date}
---
# Phase {N} — Validation Strategy
> Generated by `gsd-phase-researcher` during `/gsd:plan-phase {N}`.
> Updated by `gsd-plan-checker` after plan approval.
> Governs feedback sampling during `/gsd:execute-phase {N}`.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | {pytest 7.x / jest 29.x / vitest / go test / other} |
| **Config file** | {path/to/pytest.ini or "none — Wave 0 installs"} |
| **Quick run command** | `{e.g., pytest -x --tb=short}` |
| **Full suite command** | `{e.g., pytest tests/ --tb=short}` |
| **Estimated runtime** | ~{N} seconds |
| **CI pipeline** | {.github/workflows/test.yml — exists / needs creation} |
---
## Nyquist Sampling Rate
> The minimum feedback frequency required to reliably catch errors in this phase.
- **After every task commit:** Run `{quick run command}`
- **After every plan wave:** Run `{full suite command}`
- **Before `/gsd:verify-work`:** Full suite must be green
- **Maximum acceptable task feedback latency:** {N} seconds
---
## Per-Task Verification Map
| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| {N}-01-01 | 01 | 1 | REQ-{XX} | unit | `pytest tests/test_{module}.py::test_{name} -x` | ✅ / ❌ W0 | ⬜ pending |
| {N}-01-02 | 01 | 1 | REQ-{XX} | integration | `pytest tests/test_{flow}.py -x` | ✅ / ❌ W0 | ⬜ pending |
| {N}-02-01 | 02 | 2 | REQ-{XX} | smoke | `curl -s {endpoint} \| grep {expected}` | ✅ N/A | ⬜ pending |
*Status values: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
---
## Wave 0 Requirements
> Test scaffolding committed BEFORE any implementation task. Executor runs Wave 0 first.
- [ ] `{tests/test_file.py}` — stubs for REQ-{XX}, REQ-{XX}
- [ ] `{tests/conftest.py}` — shared fixtures
- [ ] `{framework install}` — if no framework detected
*If none required: "Existing infrastructure covers all phase requirements — no Wave 0 test tasks needed."*
---
## Manual-Only Verifications
> Behaviors that genuinely cannot be automated, with justification.
> These are surfaced during `/gsd:verify-work` UAT.
| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| {behavior} | REQ-{XX} | {reason: visual, third-party auth, physical device...} | {step-by-step} |
*If none: "All phase behaviors have automated verification coverage."*
---
## Validation Sign-Off
Updated by `gsd-plan-checker` when plans are approved:
- [ ] All tasks have `<automated>` verify commands or Wave 0 dependencies
- [ ] No 3 consecutive implementation tasks without automated verify (sampling continuity)
- [ ] Wave 0 test files cover all MISSING references
- [ ] No watch-mode flags in any automated command
- [ ] Feedback latency per task: < {N}s ✅
- [ ] `nyquist_compliant: true` set in frontmatter
**Plan-checker approval:** {pending / approved on YYYY-MM-DD}
---
## Execution Tracking
Updated during `/gsd:execute-phase {N}`:
| Wave | Tasks | Tests Run | Pass | Fail | Sampling Status |
|------|-------|-----------|------|------|-----------------|
| 0 | {N} | — | — | — | scaffold |
| 1 | {N} | {command} | {N} | {N} | ✅ sampled |
| 2 | {N} | {command} | {N} | {N} | ✅ sampled |
**Phase validation complete:** {pending / YYYY-MM-DD HH:MM}

View File

@@ -5,7 +5,8 @@
"research": true,
"plan_check": true,
"verifier": true,
"auto_advance": false
"auto_advance": false,
"nyquist_validation": true
},
"planning": {
"commit_docs": true,

View File

@@ -18,7 +18,7 @@ Load all context in one call (paths only to minimize orchestrator context):
INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs init plan-phase "$PHASE")
```
Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`.
Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`.
**File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`. These are null if files don't exist.
@@ -128,6 +128,31 @@ Task(
- **`## RESEARCH COMPLETE`:** Display confirmation, continue to step 6
- **`## RESEARCH BLOCKED`:** Display blocker, offer: 1) Provide context, 2) Skip research, 3) Abort
## 5.5. Create Validation Strategy (if Nyquist enabled)
**Skip if:** `nyquist_validation_enabled` is false from INIT JSON.
After researcher completes, check if RESEARCH.md contains a Validation Architecture section:
```bash
grep -l "## Validation Architecture" "${PHASE_DIR}"/*-RESEARCH.md 2>/dev/null
```
**If found:**
1. Read validation template from `~/.claude/get-shit-done/templates/VALIDATION.md`
2. Write to `${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md`
3. Fill frontmatter: replace `{N}` with phase number, `{phase-slug}` with phase slug, `{date}` with current date
4. If `commit_docs` is true:
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.cjs commit-docs "docs(phase-${PHASE}): add validation strategy"
```
**If not found (and nyquist enabled):** Display warning:
```
⚠ Nyquist validation enabled but researcher did not produce a Validation Architecture section.
Continuing without validation strategy. Plans may fail Dimension 8 check.
```
## 6. Check Existing Plans
```bash
@@ -240,6 +265,7 @@ Checker prompt:
- {roadmap_path} (Roadmap)
- {requirements_path} (Requirements)
- {context_path} (USER DECISIONS from /gsd:discuss-phase)
- {research_path} (Technical Research — includes Validation Architecture)
</files_to_read>
**Phase requirement IDs (MUST ALL be covered):** {phase_req_ids}

View File

@@ -28,6 +28,7 @@ Parse current values (default to `true` if not present):
- `workflow.research` — spawn researcher during plan-phase
- `workflow.plan_check` — spawn plan checker during plan-phase
- `workflow.verifier` — spawn verifier during execute-phase
- `workflow.nyquist_validation` — validation architecture research during plan-phase
- `model_profile` — which model each agent uses (default: `balanced`)
- `git.branching_strategy` — branching approach (default: `"none"`)
</step>
@@ -83,6 +84,15 @@ AskUserQuestion([
{ label: "Yes", description: "Chain stages via Task() subagents (same isolation)" }
]
},
{
question: "Enable Nyquist Validation? (researches test coverage during planning)",
header: "Nyquist",
multiSelect: false,
options: [
{ label: "Yes (Recommended)", description: "Research automated test coverage during plan-phase. Adds validation requirements to plans. Blocks approval if tasks lack automated verify." },
{ label: "No", description: "Skip validation research. Good for rapid prototyping or no-test phases." }
]
},
{
question: "Git branching strategy?",
header: "Branching",
@@ -108,7 +118,8 @@ Merge new settings into existing config.json:
"research": true/false,
"plan_check": true/false,
"verifier": true/false,
"auto_advance": true/false
"auto_advance": true/false,
"nyquist_validation": true/false
},
"git": {
"branching_strategy": "none" | "phase" | "milestone"
@@ -155,7 +166,8 @@ Write `~/.gsd/defaults.json` with:
"research": <current>,
"plan_check": <current>,
"verifier": <current>,
"auto_advance": <current>
"auto_advance": <current>,
"nyquist_validation": <current>
}
}
```
@@ -176,6 +188,7 @@ Display:
| Plan Checker | {On/Off} |
| Execution Verifier | {On/Off} |
| Auto-Advance | {On/Off} |
| Nyquist Validation | {On/Off} |
| Git Branching | {None/Per Phase/Per Milestone} |
| Saved as Defaults | {Yes/No} |
@@ -193,7 +206,7 @@ Quick commands:
<success_criteria>
- [ ] Current config read
- [ ] User presented with 6 settings (profile + 4 workflow toggles + git branching)
- [ ] User presented with 7 settings (profile + 5 workflow toggles + git branching)
- [ ] Config updated with model_profile, workflow, and git sections
- [ ] User offered to save as global defaults (~/.gsd/defaults.json)
- [ ] Changes confirmed to user