From aaea14efd6e2099936f8bb04810b65e34649707c Mon Sep 17 00:00:00 2001 From: CyPack <57799273+CyPack@users.noreply.github.com> Date: Fri, 27 Feb 2026 19:59:21 +0100 Subject: [PATCH] feat(agents): add analysis paralysis guard, exhaustive cross-check, and task-level TDD (#736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - gsd-executor: Add block after deviation_rules. If executor makes 5+ consecutive Read/Grep/Glob calls without any Edit/Write/Bash action, it must stop and either write or report blocked. Prevents infinite analysis loops that stall execution. - gsd-plan-checker: Add exhaustive cross-check in Step 4 requirement coverage. Checker now also reads PROJECT.md requirements (not just phase goal) to verify no relevant requirement is silently dropped. Unmapped requirements become automatic blockers listed explicitly in issues. - gsd-planner: Add task-level TDD guidance alongside existing TDD Detection. For code-producing tasks in standard plans, tdd="true" + block makes test expectations explicit before implementation. Complements the existing dedicated TDD plan approach — both can coexist. Co-authored-by: CyPack Co-authored-by: Claude Sonnet 4.6 --- agents/gsd-executor.md | 10 ++++++++++ agents/gsd-plan-checker.md | 2 ++ agents/gsd-planner.md | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/agents/gsd-executor.md b/agents/gsd-executor.md index 294cc8269..19412ad8a 100644 --- a/agents/gsd-executor.md +++ b/agents/gsd-executor.md @@ -171,6 +171,16 @@ Track auto-fix attempts per task. After 3 auto-fix attempts on a single task: - Do NOT restart the build to find more issues + +**During task execution, if you make 5+ consecutive Read/Grep/Glob calls without any Edit/Write/Bash action:** + +STOP. State in one sentence why you haven't written anything yet. Then either: +1. Write code (you have enough context), or +2. Report "blocked" with the specific missing information. + +Do NOT continue reading. Analysis without action is a stuck signal. + + **Auth errors during `type="auto"` execution are gates, not failures.** diff --git a/agents/gsd-plan-checker.md b/agents/gsd-plan-checker.md index 9c4e30d4b..8f5539389 100644 --- a/agents/gsd-plan-checker.md +++ b/agents/gsd-plan-checker.md @@ -445,6 +445,8 @@ Session persists | 01 | 3 | COVERED For each requirement: find covering task(s), verify action is specific, flag gaps. +**Exhaustive cross-check:** Also read PROJECT.md requirements (not just phase goal). Verify no PROJECT.md requirement relevant to this phase is silently dropped. Any unmapped requirement is an automatic blocker — list it explicitly in issues. + ## Step 5: Validate Task Structure Use gsd-tools plan-structure verification (already run in Step 2): diff --git a/agents/gsd-planner.md b/agents/gsd-planner.md index f21290fc3..89096d69f 100644 --- a/agents/gsd-planner.md +++ b/agents/gsd-planner.md @@ -234,6 +234,26 @@ This prevents the "scavenger hunt" anti-pattern where executors explore the code **Why TDD gets own plan:** TDD requires RED→GREEN→REFACTOR cycles consuming 40-50% context. Embedding in multi-task plans degrades quality. +**Task-level TDD** (for code-producing tasks in standard plans): When a task creates or modifies production code, add `tdd="true"` and a `` block to make test expectations explicit before implementation: + +```xml + + Task: [name] + src/feature.ts, src/feature.test.ts + + - Test 1: [expected behavior] + - Test 2: [edge case] + + [Implementation after tests pass] + + npm test -- --filter=feature + + [Criteria] + +``` + +Exceptions where `tdd="true"` is not needed: `type="checkpoint:*"` tasks, configuration-only files, documentation, migration scripts, glue code wiring existing tested components, styling-only changes. + ## User Setup Detection For tasks involving external services, identify human-required configuration: