Add Coverage Matrix and pre/post-flight blueprint verification

Closes the gap where acceptance criteria specified in draft could be lost
during architect and build phases. Adds:

- Coverage Matrix to build-site format: maps every acceptance criterion to
  its assigned task(s), making gaps visible before build starts
- Pre-flight coverage check in build: flags unassigned criteria before
  executing any tasks
- Post-flight blueprint verification: cross-references completed tasks
  against original blueprint criteria after build, adds remediation tasks
  for anything missed
- Quick mode coverage gate: lightweight but mandatory criterion check
- Criterion-level validation rules in architect command and agent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julius Brussee
2026-04-04 12:41:26 +02:00
parent 744d160009
commit 981d3f1f17
5 changed files with 66 additions and 2 deletions
+4 -2
View File
@@ -13,7 +13,7 @@
<p align="center">
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"></a>
<a href="https://docs.anthropic.com/en/docs/claude-code"><img src="https://img.shields.io/badge/Claude_Code-plugin-blueviolet" alt="Claude Code Plugin"></a>
<img src="https://img.shields.io/badge/version-2.1.0-green" alt="Version 2.1.0">
<img src="https://img.shields.io/badge/version-2.2.0-green" alt="Version 2.2.0">
</p>
<p align="center">
@@ -189,7 +189,7 @@ For existing codebases, `/bp:draft --from-code` reverse-engineers blueprints fro
/bp:architect
```
Reads all blueprints, breaks requirements into tasks, maps dependencies, and organizes everything into a **tiered build site** — a dependency graph where Tier 0 has no dependencies, Tier 1 depends only on Tier 0, and so on. This is what the build loop consumes.
Reads all blueprints, breaks requirements into tasks, maps dependencies, and organizes everything into a **tiered build site** — a dependency graph where Tier 0 has no dependencies, Tier 1 depends only on Tier 0, and so on. The build site includes a **Coverage Matrix** that maps every individual acceptance criterion to its task(s), ensuring nothing specified in the blueprints gets lost in translation. This is what the build loop consumes.
### 3. Build — run the loop
@@ -197,6 +197,8 @@ Reads all blueprints, breaks requirements into tasks, maps dependencies, and org
/bp:build
```
Before starting, a **pre-flight coverage check** validates that the build site covers all blueprint acceptance criteria — gaps are flagged before any code is written. After completion, a **post-flight blueprint verification** cross-references what was built against the original blueprints, adding remediation tasks for any criteria that slipped through.
The Ralph Loop. Each iteration:
```
+2
View File
@@ -118,11 +118,13 @@ Generate `plan-known-issues.md` with prioritized issues:
### 6. Validate Plan Completeness
Before finishing, verify:
- Every blueprint requirement has at least one plan task
- **Every ACCEPTANCE CRITERION within every requirement has at least one plan task that will validate it** — requirement-level mapping is necessary but not sufficient. Walk through each criterion one by one and confirm a task covers it. If a requirement has 5 criteria but only 3 are covered by tasks, add tasks for the remaining 2.
- Every plan task maps to a blueprint requirement (no orphan tasks)
- Dependency graph has no cycles
- [CONDITIONAL] tasks have clear trigger conditions
- [DYNAMIC] tasks have clear scoping criteria
- Test strategies cover all acceptance criteria from blueprints
- **Generate a Coverage Matrix** in the build site listing every acceptance criterion and its assigned task(s). Any criterion without a task is a GAP that must be resolved before the plan is complete.
## Task Template Rules
+18
View File
@@ -39,6 +39,7 @@ Break each requirement into one or more implementable tasks:
- Simple requirements (1-2 acceptance criteria) → 1 task
- Complex requirements (3+ acceptance criteria, multiple concerns) → multiple tasks
- Each task should be completable in one loop iteration
- When decomposing, cross-check EACH acceptance criterion in the requirement — ensure at least one task will validate it. A single task covering "R1" is insufficient if R1 has 6 acceptance criteria and the task only addresses 2 of them.
- For UI tasks: include `**Design Ref:** DESIGN.md Section {N} — {section name}` in the task description to guide the builder on which design patterns apply
Use T-numbered task IDs (T-001, T-002, ...) across all domains.
@@ -107,6 +108,21 @@ last_edited: "{CURRENT_DATE_UTC}"
| ... | | |
**Total: {n} tasks, {n} tiers**
## Coverage Matrix
Every acceptance criterion from every blueprint requirement MUST appear below with its assigned task(s). If any criterion has no task, the site is incomplete.
| Blueprint | Req | Criterion | Task(s) | Status |
|-----------|-----|-----------|---------|--------|
| blueprint-{domain}.md | R1 | {criterion text, abbreviated} | T-001 | COVERED |
| blueprint-{domain}.md | R1 | {criterion text, abbreviated} | T-001, T-002 | COVERED |
| blueprint-{domain}.md | R2 | {criterion text, abbreviated} | T-003 | COVERED |
| blueprint-{domain}.md | R2 | {criterion text, abbreviated} | — | GAP |
**Coverage: {covered}/{total} criteria ({percentage}%)**
If any row shows GAP, add tasks to cover it before proceeding.
```
If a site already exists, ask the user whether to overwrite or keep the existing one.
@@ -155,6 +171,8 @@ Run `/bp:build --peer-review` to add Codex review.
### Rules
- Every blueprint requirement MUST map to at least one task
- Every ACCEPTANCE CRITERION within every requirement MUST map to at least one task — requirement-level coverage is not sufficient. A requirement with 5 acceptance criteria needs tasks that collectively cover all 5, not just 1.
- The Coverage Matrix in the build site must show 100% COVERED status. If any row shows GAP, add tasks before finishing.
- Tasks should be small — prefer M over XL
- Dependencies must be genuine blockers, not just ordering preferences
- The site is the ONLY planning artifact — no domain plans, no file ownership
+39
View File
@@ -21,6 +21,24 @@ Before starting waves:
2. Run `"${CLAUDE_PLUGIN_ROOT}/scripts/bp-config.sh" model execution` and treat the result as `EXECUTION_MODEL`.
3. Use that exact `EXECUTION_MODEL` string in every `bp:task-builder` delegation below. Do not hard-code `opus`, `sonnet`, or `haiku` in this command.
## Pre-flight Coverage Check
Before entering the execution loop, validate that the build site covers all blueprint requirements:
1. Read the build site and all blueprint files referenced in it
2. If the build site contains a **Coverage Matrix** section, scan it for any rows with status `GAP`
3. If no Coverage Matrix exists, perform a quick manual check: for each blueprint requirement, confirm at least one task in the build site references it
4. **If gaps are found**, report them before starting:
```
⚠ COVERAGE GAPS DETECTED — {n} acceptance criteria have no assigned task:
- blueprint-{domain}.md R{n}: {criterion text}
- blueprint-{domain}.md R{n}: {criterion text}
Run `/bp:architect` to regenerate the build site with full coverage, or continue with known gaps.
```
Ask the user whether to proceed or stop. Do NOT silently continue with gaps.
5. If no gaps are found, log: `✓ Pre-flight coverage check passed — all criteria mapped to tasks.`
## If site selection is required
If the output contains `BLUEPRINT_SITE_SELECTION_REQUIRED=true`, multiple build sites/plans were found. **Ask the user which one to implement.** Then re-run with `--filter <their-choice>`.
@@ -154,6 +172,27 @@ Waves executed: {N}
Tasks completed: {done}/{total}
```
### Post-Build: Blueprint Verification
Before updating CLAUDE.md, verify that the build actually satisfies the blueprints:
1. Read all blueprint files and the build site's Coverage Matrix (if present)
2. For each blueprint requirement and its acceptance criteria, cross-reference against impl tracking:
- Is the task marked DONE in impl tracking?
- Does the task's scope actually cover this specific criterion? (A task being DONE does not mean every criterion it was supposed to cover is actually met)
3. Produce a brief coverage summary:
```
═══ Blueprint Verification ═══
Requirements: {done}/{total}
Acceptance Criteria: {verified}/{total}
Gaps: {list any unmet criteria, or "None"}
```
4. If gaps are found (criteria not covered by completed tasks):
- Log each gap with its blueprint reference
- Add the gaps as new tasks to the build site (append to the highest tier + 1)
- Report: `{n} gap(s) found — {n} remediation tasks added to build site. Run /bp:build again to address.`
5. If no gaps: proceed to CLAUDE.md hierarchy update
### Post-Build: Update CLAUDE.md Hierarchy
After BUILD COMPLETE and before the completion promise, update the context hierarchy:
+3
View File
@@ -77,6 +77,7 @@ Using the feature description + project context, directly:
- If DESIGN.md exists and the feature involves UI, reference design tokens in acceptance criteria
- Skip the visual companion, skip approach proposals
- Skip the blueprint-reviewer subagent loop — you validate inline
- Count your acceptance criteria — every one must be concrete enough that the architect phase can assign it to a task. If a criterion is vague ("works well", "good UX"), rewrite it to be testable before proceeding.
- Do a single self-check: no TODOs, no placeholders, no implementation details in requirements
### 1d: Report (brief)
@@ -114,6 +115,8 @@ Read all blueprint files just written.
- Dependencies must be genuine blockers
- For UI tasks, include `Design Ref: DESIGN.md Section {N}` if DESIGN.md exists
- Skip asking user about existing sites — overwrite if one exists
- **Coverage gate:** After generating the build site, walk through every acceptance criterion in every blueprint requirement and confirm it maps to at least one task. If any criterion is uncovered, add a task for it before proceeding. This replaces the full blueprint-reviewer loop with a single self-check pass — fast but non-negotiable.
- Include the Coverage Matrix section in the build site output (same format as the full architect path)
### 2c: Report (brief)