cfsa-antigravity 2.7.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/template/.agent/kit-sync.md +3 -3
  3. package/template/.agent/skills/idea-extraction/SKILL.md +61 -18
  4. package/template/.agent/skills/prd-templates/references/architecture-completeness-checklist.md +28 -0
  5. package/template/.agent/skills/prd-templates/references/be-spec-classification.md +41 -0
  6. package/template/.agent/skills/prd-templates/references/bootstrap-verification-protocol.md +50 -0
  7. package/template/.agent/skills/prd-templates/references/constraint-exploration.md +41 -0
  8. package/template/.agent/skills/prd-templates/references/decision-confirmation-protocol.md +68 -0
  9. package/template/.agent/skills/prd-templates/references/decision-propagation.md +121 -0
  10. package/template/.agent/skills/prd-templates/references/domain-exhaustion-criteria.md +37 -0
  11. package/template/.agent/skills/prd-templates/references/engagement-tier-protocol.md +58 -0
  12. package/template/.agent/skills/prd-templates/references/evolution-layer-guidance.md +91 -0
  13. package/template/.agent/skills/prd-templates/references/expansion-modes.md +27 -0
  14. package/template/.agent/skills/prd-templates/references/folder-seeding-protocol.md +77 -0
  15. package/template/.agent/skills/prd-templates/references/input-classification.md +23 -0
  16. package/template/.agent/skills/prd-templates/references/map-guard-protocol.md +44 -0
  17. package/template/.agent/skills/prd-templates/references/persona-completeness-gate.md +20 -0
  18. package/template/.agent/skills/prd-templates/references/shard-boundary-analysis.md +76 -0
  19. package/template/.agent/skills/prd-templates/references/write-verification-protocol.md +57 -0
  20. package/template/.agent/workflows/create-prd-architecture.md +17 -23
  21. package/template/.agent/workflows/create-prd-compile.md +31 -22
  22. package/template/.agent/workflows/create-prd-design-system.md +18 -14
  23. package/template/.agent/workflows/create-prd-security.md +22 -24
  24. package/template/.agent/workflows/create-prd-stack.md +20 -11
  25. package/template/.agent/workflows/create-prd.md +27 -99
  26. package/template/.agent/workflows/decompose-architecture-structure.md +14 -4
  27. package/template/.agent/workflows/decompose-architecture-validate.md +29 -80
  28. package/template/.agent/workflows/decompose-architecture.md +27 -60
  29. package/template/.agent/workflows/evolve-contract.md +7 -2
  30. package/template/.agent/workflows/evolve-feature-cascade.md +34 -78
  31. package/template/.agent/workflows/evolve-feature-classify.md +22 -56
  32. package/template/.agent/workflows/ideate-discover.md +89 -100
  33. package/template/.agent/workflows/ideate-extract.md +42 -138
  34. package/template/.agent/workflows/ideate-validate.md +57 -133
  35. package/template/.agent/workflows/ideate.md +32 -19
  36. package/template/.agent/workflows/implement-slice-setup.md +15 -5
  37. package/template/.agent/workflows/implement-slice-tdd.md +21 -5
  38. package/template/.agent/workflows/plan-phase-write.md +30 -1
  39. package/template/.agent/workflows/propagate-decision-apply.md +23 -90
  40. package/template/.agent/workflows/propagate-decision-scan.md +20 -91
  41. package/template/.agent/workflows/remediate-pipeline-execute.md +6 -1
  42. package/template/.agent/workflows/validate-phase-quality.md +14 -3
  43. package/template/.agent/workflows/validate-phase-readiness.md +1 -1
  44. package/template/.agent/workflows/verify-infrastructure.md +2 -0
  45. package/template/.agent/workflows/write-architecture-spec-deepen.md +8 -2
  46. package/template/.agent/workflows/write-architecture-spec-design.md +11 -14
  47. package/template/.agent/workflows/write-be-spec-classify.md +26 -104
  48. package/template/.agent/workflows/write-be-spec-write.md +49 -3
  49. package/template/.agent/workflows/write-be-spec.md +1 -1
  50. package/template/.agent/workflows/write-fe-spec-write.md +62 -3
  51. package/template/.agent/workflows/write-fe-spec.md +1 -1
@@ -15,121 +15,54 @@ pipeline:
15
15
 
16
16
  # Propagate Decision — Apply
17
17
 
18
- Review and apply fixes for explicit contradictions one at a time, flag implicit assumptions for `/resolve-ambiguity`, run a consistency check on changed documents, and write the propagation record.
18
+ Review and apply fixes for explicit contradictions one at a time, flag implicit assumptions, run consistency check, and write propagation record.
19
19
 
20
- > **Prerequisite**: `docs/audits/propagation-scan-[date].md` must exist. Run `/propagate-decision-scan` first if no scan report is found.
20
+ > **Prerequisite**: `docs/audits/propagation-scan-[date].md` must exist. If not → run `/propagate-decision-scan` first.
21
21
 
22
22
  ---
23
23
 
24
24
  ## 1. Explicit contradictions (one at a time)
25
25
 
26
- Read .agent/skills/resolve-ambiguity/SKILL.md and follow its methodology.
27
-
28
- For each explicit contradiction from the scan report, display:
29
-
30
- ```
31
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
32
- Contradiction 1 of X
33
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
34
- Document: docs/plans/ia/03-payments.md
35
- Section: Data Model
36
- Current: PostgreSQL array types used for tag storage
37
- Locked: MySQL (no native array type)
38
- Fix to: Replace with JSON column type per MySQL conventions
39
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
40
- [Y] Apply fix and move to next
41
- [n] Skip this item
42
- [skip] Skip entire document
43
- [stop-and-save] Save progress and stop for later resumption
44
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
- ```
46
-
47
- - **Y** — Apply the fix to the source document and move to the next contradiction
48
- - **n** — Skip this item (leave it unchanged, record as skipped)
49
- - **skip** — Skip all remaining contradictions in this document
50
- - **stop-and-save** — Save progress to the scan file (mark which items are done/skipped) and stop. The user can re-run `/propagate-decision-apply` later to resume from where they left off.
51
-
52
- > After applying a fix (`[Y]`) to a **spec document** (any file under `docs/plans/ia/`, `docs/plans/be/`, or `docs/plans/fe/`), append a row to that spec's `## Changelog` table recording: today's date, `'Decision propagation: [decision type] — [brief description of fix]'`, `/propagate-decision-apply`, and the section(s) updated. If the spec does not yet have a `## Changelog` section, add one before appending. Skip changelog updates for non-spec documents (e.g., architecture design, vision, engineering standards).
26
+ Read `.agent/skills/resolve-ambiguity/SKILL.md` for methodology.
27
+
28
+ Read `.agent/skills/prd-templates/references/decision-propagation.md` **Contradiction Display Format**.
29
+
30
+ For each explicit contradiction from the scan report: display using the format and wait for user response (Y/n/skip/stop-and-save).
31
+
32
+ After applying a fix to a spec document (`docs/plans/ia/`, `docs/plans/be/`, or `docs/plans/fe/`): append `## Changelog` row. If no `## Changelog` exists, add one from the template in `.agent/skills/prd-templates/references/be-spec-template.md`.
53
33
 
54
34
  ---
55
35
 
56
36
  ## 2. Implicit assumptions (one at a time)
57
37
 
58
- For each implicit assumption from the scan report, display:
59
-
60
- ```
61
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
62
- Assumption 1 of X
63
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
64
- Document: docs/plans/be/auth-spec.md
65
- Section: Middleware
66
- Current: "the auth provider"
67
- Issue: Does not specify Supabase Auth — could be misinterpreted
68
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
69
- [Y] Flag for /resolve-ambiguity
70
- [n] Ignore (not ambiguous enough to matter)
71
- [skip] Skip entire document
72
- [stop-and-save] Save progress and stop for later resumption
73
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
74
- ```
75
-
76
- - **Y** — Add the item to `docs/audits/propagation-ambiguity-[date].md` for later `/resolve-ambiguity` use
77
- - **n** — Ignore this item (record as ignored)
78
- - **skip** — Skip all remaining assumptions in this document
79
- - **stop-and-save** — Same behavior as Step 1
38
+ Read `.agent/skills/prd-templates/references/decision-propagation.md` **Assumption Display Format**.
39
+
40
+ For each implicit assumption: display using the format and wait for user response. Y → add to `docs/audits/propagation-ambiguity-[date].md`.
80
41
 
81
42
  ---
82
43
 
83
44
  ## 3. Consistency check on changed documents
84
45
 
85
- For every document that received at least one fix in Step 1:
46
+ For every document that received fixes:
47
+ 1. Re-read full document — verify fix applied correctly
48
+ 2. Check for remaining old-value references
49
+ 3. Check for internal contradictions introduced by fixes
50
+ 4. Check cross-references between changed documents
86
51
 
87
- 1. **Re-read the full document** — verify the fix was applied correctly
88
- 2. **Check for remaining references to old values** — the fix may have changed one section but the same old value may appear elsewhere in the document
89
- 3. **Check for internal contradictions introduced by fixes** — the fix may conflict with other content in the same document
90
- 4. **Check cross-references between changed documents** — if two documents were both fixed, verify they are now consistent with each other
91
-
92
- Report any issues found. **Do not auto-fix** — present them to the user for review. If new contradictions were introduced, add them to the scan report for a subsequent apply pass.
52
+ Report issues. **Do not auto-fix** — present to user.
93
53
 
94
54
  ---
95
55
 
96
56
  ## 4. Write propagation record
97
57
 
98
- Read .agent/skills/technical-writer/SKILL.md and follow its methodology.
99
-
100
- Write `docs/audits/propagation-[type]-[date].md` recording:
58
+ Read `.agent/skills/technical-writer/SKILL.md` for methodology.
101
59
 
102
- - **Decision type** that was propagated
103
- - **Source document** containing the locked decision
104
- - **Documents scanned** (count and list)
105
- - **Explicit contradictions found** (count)
106
- - **Fixes applied** (count and list)
107
- - **Fixes skipped** (count and list with reasons)
108
- - **Implicit assumptions flagged** (count)
109
- - **Implicit assumptions ignored** (count)
110
- - **Consistency check results** (pass/fail with details)
111
- - **Timestamp** of the propagation run
60
+ Write `docs/audits/propagation-[type]-[date].md` recording: decision type, source document, documents scanned, contradictions found/fixed/skipped, assumptions flagged/ignored, consistency results, timestamp.
112
61
 
113
62
  ---
114
63
 
115
64
  ## 5. Propose next steps
116
65
 
117
- Display the completion summary:
118
-
119
- ```
120
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
121
- Propagation Complete
122
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
123
- Fixed: X contradictions across Y documents
124
- Flagged: X implicit assumptions for /resolve-ambiguity
125
- Skipped: X items
126
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
127
-
128
- Recommended next steps:
129
- 1. Run `/resolve-ambiguity` to address the X flagged assumptions
130
- (see docs/audits/propagation-ambiguity-[date].md)
131
- 2. Run `/remediate-pipeline` to audit all layers with the corrected specs
132
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
133
- ```
134
-
135
- If no assumptions were flagged, omit recommendation 1.
66
+ Read `.agent/skills/prd-templates/references/decision-propagation.md` **Completion Summary Format** and present.
67
+
68
+ If no assumptions flagged → omit `/resolve-ambiguity` recommendation.
@@ -17,131 +17,60 @@ pipeline:
17
17
 
18
18
  Pre-scan all 6 decision types for downstream contradictions, present a selection menu, run a full scan on the selected types, and write the impact report.
19
19
 
20
- > **Prerequisite**: At least one instruction file must be filled (not `{{PLACEHOLDER}}`). If all instruction files are still template placeholders, there are no locked decisions to propagate — run `/bootstrap-agents` first.
20
+ > **Prerequisite**: At least one instruction file must be filled (not `{{PLACEHOLDER}}`). If all are still placeholders **STOP**: run `/bootstrap-agents` first.
21
21
 
22
22
  ---
23
23
 
24
24
  ## 1. Pre-scan all decision types
25
25
 
26
- Read all six decision sources and do a quick surface scan of downstream documents:
27
-
28
- | Decision Type | Source Document | Downstream Scope |
29
- |--------------|-----------------|-------------------|
30
- | **structure** | `.agent/instructions/structure.md` | All IA shards, BE specs, FE specs |
31
- | **tech-stack** | `.agent/instructions/tech-stack.md` + architecture doc | All IA shards, BE specs, FE specs |
32
- | **auth-model** | Architecture doc (auth/security section) | All BE specs with middleware, all FE specs with auth flows |
33
- | **data-placement** | `docs/plans/data-placement-strategy.md` | All IA shards with data models, all BE specs with storage |
34
- | **patterns** | `.agent/instructions/patterns.md` | All IA shards, BE specs with implementation patterns, FE specs with component patterns |
35
- | **error-architecture** | Architecture doc `## Error Architecture` section — all 5 sub-sections (`### Global Error Envelope`, `### Error Propagation Chain`, `### Unhandled Exception Strategy`, `### Client Fallback Contract`, `### Error Boundary Strategy`) — located at `docs/plans/*-architecture-design.md` | All BE specs (`docs/plans/be/`) — error envelope conformance, propagation chain rules. All FE specs (`docs/plans/fe/`) — client fallback contract per surface, error boundary placement. |
26
+ Read `.agent/skills/prd-templates/references/decision-propagation.md` **Decision Type Sources** table.
36
27
 
37
28
  For each decision type:
38
29
  1. Read the source document to extract the current locked value
39
- 2. Quick-scan downstream documents for any reference to that decision topic
40
- 3. Note the count of downstream references found (matches + mismatches — the full scan in Step 3 will determine which are conflicts)
30
+ 2. Quick-scan downstream documents for references to that decision topic
31
+ 3. Note count of downstream references found
41
32
 
42
33
  ---
43
34
 
44
35
  ## 2. Present selection menu
45
36
 
46
- Show the pre-scan findings per decision type:
47
-
48
- ```
49
- Decision propagation pre-scan:
37
+ Read `.agent/skills/prd-templates/references/decision-propagation.md` **Selection Menu Format**. Present with actual counts from Step 1.
50
38
 
51
- [1] structure structure.md inconsistencies detected in X documents
52
- [2] tech-stack — tech-stack.md — inconsistencies detected in X documents
53
- [3] auth-model — architecture doc — inconsistencies detected in X documents
54
- [4] data-placement — data-placement-strategy.md — inconsistencies detected in X documents
55
- [5] patterns — patterns.md — inconsistencies detected in X documents
56
- [6] error-architecture — architecture doc ## Error Architecture — inconsistencies detected in X documents
39
+ If `[A]` selected run full scan on all 6 types, filter to those with findings.
57
40
 
58
- [A] All with inconsistencies
59
- [Q] Quit — no propagation needed
60
- ```
41
+ If called with specific argument (e.g., `/propagate-decision structure`) → skip menu, proceed directly.
61
42
 
62
- If the user selects `[A]`, run the full scan (Step 3) on all 6 types first, then filter to only those with at least one explicit contradiction or implicit assumption.
43
+ **STOP** do not proceed until the user selects.
63
44
 
64
- If called with a specific argument (e.g., `/propagate-decision structure`), skip the menu and proceed directly with that decision type.
65
-
66
- **Do not proceed until the user selects.**
45
+ **Zero-findings shortcut**: If the pre-scan in Step 1 found zero downstream references across ALL decision types skip the menu entirely: "No downstream references found for any decision type. All pipeline documents are consistent with locked decisions. No propagation needed." Exit workflow.
67
46
 
68
47
  ---
69
48
 
70
49
  ## 3. Full scan on selected types
71
50
 
72
- For each selected decision type, scan every downstream document in the scope defined by the table in Step 1:
73
-
74
- 1. **Read the locked value** from the source document
75
- 2. **Search each downstream document** for references to the decision topic
76
- 3. **For each reference found**, record the line number and classify it as one of:
77
- - **Explicit contradiction** — The document states a value that directly conflicts with the locked decision (e.g., document says "PostgreSQL" but tech stack locks "MySQL")
78
- - **Implicit assumption** — The document references the topic but uses vague or underspecified language that neither confirms nor contradicts the locked decision (e.g., says "the database" without naming it)
79
- - **Consistent** — The document correctly uses the locked value
80
-
81
- Record all explicit contradictions and implicit assumptions with their document path, line number, current text, and the locked value they should reflect.
82
-
83
- ### error-architecture scan
84
-
85
- **Source extraction:**
86
- - Locate `docs/plans/*-architecture-design.md` using the glob (not a hardcoded path).
87
- - Read the `## Error Architecture` section and extract the locked decisions from all five sub-sections, in particular the canonical field names from `### Global Error Envelope` (e.g., `code`, `message`, `details`, `request_id`).
51
+ For each selected decision type, scan every downstream document in the scope (per Decision Type Sources table):
88
52
 
89
- **BE spec conformance** scan every file in `docs/plans/be/`:
90
- - Check whether the spec references the global error envelope by its locked name and uses the canonical field names exactly as locked in `### Global Error Envelope`.
91
- - Check whether the spec references the propagation chain rules which layer catches, logs, and surfaces errors — as defined in `### Error Propagation Chain`.
92
- - Classify findings:
93
- - **Explicit contradiction** — spec defines its own error shape with field names or structure that directly conflicts with the locked envelope.
94
- - **Implicit assumption** — spec mentions "error handling" or "error response" without naming the canonical envelope shape or field names.
95
- - **Consistent** — spec correctly names and uses the locked envelope.
53
+ 1. Read the locked value from source
54
+ 2. Search each downstream document for references
55
+ 3. Classify each reference as: **explicit contradiction** / **implicit assumption** / **consistent**
56
+ 4. Record: document path, line number, current text, locked value
96
57
 
97
- **FE spec conformance** scan every file in `docs/plans/fe/`:
98
- - Check whether the spec references the client fallback contract appropriate for its surface type, as defined in `### Client Fallback Contract`.
99
- - Check whether the spec references error boundary placement per `### Error Boundary Strategy`.
100
- - Apply the same three-way classification (explicit contradiction / implicit assumption / consistent).
101
-
102
- All findings are recorded in the standard format (document path, line number, current text, locked value) for inclusion in the impact report built in Step 4.
58
+ For **error-architecture** type: read `.agent/skills/prd-templates/references/decision-propagation.md` → **Error-Architecture Scan Procedure** and follow it.
103
59
 
104
60
  ---
105
61
 
106
62
  ## 4. Build and write impact report
107
63
 
108
- Read .agent/skills/technical-writer/SKILL.md and follow its methodology.
109
-
110
- Write `docs/audits/propagation-scan-[date].md` with:
111
-
112
- ### Explicit Contradictions
113
-
114
- | Document | Line | Current Text | Locked Value | Decision Type |
115
- |----------|------|--------------|--------------|---------------|
116
- | `src/auth/tokens.ts` | 47 | `jwt.sign(payload, secret)` | Supabase Auth (no custom JWT) | auth-model |
117
- | ... | ... | ... | ... | ... |
64
+ Read `.agent/skills/technical-writer/SKILL.md` for writing standards.
118
65
 
119
- ### Implicit Assumptions
66
+ Read `.agent/skills/prd-templates/references/decision-propagation.md` → **Impact Report Format**.
120
67
 
121
- | Document | Line | Current Text | Concern | Decision Type |
122
- |----------|------|--------------|---------|---------------|
123
- | `docs/plans/be/auth-spec.md` | 23 | "the auth provider" | Does not name the locked auth provider | auth-model |
124
- | ... | ... | ... | ... | ... |
125
-
126
- ### Summary
127
-
128
- - **Explicit contradictions**: X items across Y documents
129
- - **Implicit assumptions**: X items across Y documents
130
- - **Consistent references**: X items (no action needed)
68
+ Write `docs/audits/propagation-scan-[date].md` using the format.
131
69
 
132
70
  ---
133
71
 
134
72
  ## 5. Present summary and confirm
135
73
 
136
- Present the summary counts to the user:
137
-
138
- > **Propagation scan complete.**
139
- >
140
- > - **X explicit contradictions** found — these directly conflict with locked decisions and should be fixed
141
- > - **Y implicit assumptions** found — these are vague references that could be flagged for `/resolve-ambiguity`
142
- >
143
- > Review the full report at `docs/audits/propagation-scan-[date].md`.
144
- >
145
- > Run `/propagate-decision-apply` to review and apply fixes one at a time.
74
+ Present summary counts. Reference the full report path.
146
75
 
147
- **STOP — do not proceed to apply until the user explicitly confirms.**
76
+ **STOP** — do not proceed to apply until user confirms.
@@ -102,7 +102,12 @@ Read `.agent/skills/resolve-ambiguity/SKILL.md` for the resolution methodology.
102
102
  2. Apply approved mechanical fixes.
103
103
  3. Apply user-resolved judgment calls. Re-check if mechanical fixes changed.
104
104
 
105
- Add summary to report. If >70% of docs scored ❌ on majority of dimensions, recommend rewriting layer from scratch.
105
+ Add summary to report.
106
+
107
+ **Layer restart threshold**: If >70% of documents scored ❌ on majority of dimensions:
108
+ - Calculate the exact percentage and present: "Layer [name]: [X]% of documents scored ❌ on [Y]% of dimensions. This exceeds the 70% restart threshold."
109
+ - Present options: "(1) Restart this layer from scratch using the upstream layer as input, (2) Continue remediating document by document despite low baseline."
110
+ - **STOP** — wait for user decision before proceeding.
106
111
 
107
112
  ### Persist fix metadata
108
113
 
@@ -19,6 +19,12 @@ pipeline:
19
19
 
20
20
  Run all code quality checks for a completed implementation phase.
21
21
 
22
+ **Prerequisite**: All slices in the phase must be complete.
23
+ 1. Read `.agent/progress/phases/phase-N.md`
24
+ 2. Verify every slice shows `complete` status
25
+ 3. If any slice is not complete → **STOP**: "Phase N has incomplete slices: [list]. Complete them via `/implement-slice` before running validation."
26
+
27
+
22
28
  ---
23
29
 
24
30
  ## 0. Load validation skills
@@ -44,6 +50,11 @@ This is an optimization, not a requirement. Sequential validation is always corr
44
50
 
45
51
  Run the Test Cmd from `.agent/instructions/commands.md`. All tests must pass. Zero tolerance.
46
52
 
53
+ **Test failure early-exit**: If tests fail, do NOT proceed to steps 2-5. Instead:
54
+ 1. Capture the failing test output
55
+ 2. Identify which slice(s) the failing tests belong to
56
+ 3. **STOP**: "Validation blocked — [N] tests failing in slice(s) [names]. Fix via `/implement-slice` and re-run `/validate-phase`."
57
+
47
58
  ## 2. Check coverage
48
59
 
49
60
  Run the Test Coverage Cmd from `.agent/instructions/commands.md`.
@@ -148,8 +159,8 @@ Read `.agent/skills/prd-templates/references/spec-coverage-sweep.md` and follow
148
159
 
149
160
  ---
150
161
 
151
- ### Propose next step
162
+ ### Next step
152
163
 
153
- Code quality gates complete. Next: Run `.agent/workflows/validate-phase-readiness.md` for production readiness checks.
164
+ **STOP** do NOT proceed to any other workflow. The only valid next step is `/validate-phase-readiness`.
154
165
 
155
- > If this shard was invoked standalone (not from `/validate-phase`), surface this via `notify_user`.
166
+ > If invoked standalone, surface via `notify_user` and wait for user confirmation.
@@ -19,7 +19,7 @@ pipeline:
19
19
 
20
20
  Run all production readiness checks for a completed implementation phase.
21
21
 
22
- **Prerequisite**: Code quality gates (from `/validate-phase-quality` or equivalent) must pass first.
22
+ **Prerequisite**: Code quality gates (from `/validate-phase-quality` or equivalent) must pass first. If quality gate results do not exist or any check failed → **STOP**: run `/validate-phase-quality` first.
23
23
 
24
24
  ---
25
25
 
@@ -42,6 +42,8 @@ Read the current phase plan (e.g., `docs/plans/phases/phase-1.md`) to identify w
42
42
 
43
43
  Set the report filename now: `docs/audits/verify-infrastructure-YYYY-MM-DD-HHMM[-auth].md`.
44
44
 
45
+ **Re-run detection**: Check if a previous verification report exists for this trigger (search `docs/audits/` for `verify-infrastructure-*[-auth].md`).\n- If a previous report exists and shows `✅ PASS` → ask: \"A passing verification report already exists (`[filename]`). Re-run all checks or skip?\"\n- If a previous report exists and shows `❌ FAIL` → proceed automatically (re-verification needed).\n- If no previous report exists → proceed normally.
46
+
45
47
  ---
46
48
 
47
49
  ## 0.6. Initialize report
@@ -19,7 +19,9 @@ pipeline:
19
19
 
20
20
  Run iterative deepening passes, write the completed spec, update indexes, run the ambiguity gate, and present for review.
21
21
 
22
- **Prerequisite**: Read the shard file at `docs/plans/ia/[shard-name].md`. Sections should be filled in from the design shard (not skeleton placeholders). If sections are still skeleton placeholders, the design shard has not completed — run `/write-architecture-spec-design` first before running this shard.
22
+ **Prerequisite**: Read the shard file at `docs/plans/ia/[shard-name].md`. Sections should be filled in from the design shard (not skeleton placeholders).
23
+
24
+ **Skeleton detection**: If the file contains `<!-- TODO -->` markers, `[TBD]` placeholders, or sections with only a heading and no body text → the design shard has not completed. **STOP**: run `/write-architecture-spec-design` first.
23
25
 
24
26
  ---
25
27
 
@@ -73,6 +75,10 @@ Add any new security edge cases or access rules. Present findings to the user.
73
75
  If any pass produces significant new content, do another pass — the new content
74
76
  may reveal further edge cases. Stop when a pass produces no meaningful additions.
75
77
 
78
+ **Pass loop guard**: Track total pass count.
79
+ - Passes 4-5 → normal. Continue if producing meaningful additions.
80
+ - **After pass 5** → **STOP**: "5 deepening passes completed. Still producing new content. Present remaining gaps to user: continue deepening or accept current spec depth?"
81
+
76
82
  ## 9. Write the spec to `docs/plans/ia/[shard-name].md`
77
83
 
78
84
  Read .agent/skills/technical-writer/SKILL.md for the spec writing step.
@@ -91,7 +97,7 @@ to mark this shard's IA column as complete in `.agent/progress/spec-pipeline.md`
91
97
  ## 11.5. Bootstrap Tech Stack Skills (if applicable)
92
98
 
93
99
  If the shard you just completed is `00-architecture-design.md` (which definitively chooses the project's tech stack):
94
- Read `.agent/workflows/bootstrap-agents.md` and execute its utility instructions immediately to fill placeholders and provision skills based on the finalized tech stack.
100
+ Read `.agent/workflows/bootstrap-agents.md` and execute its utility instructions immediately to fill placeholders and provision skills based on the finalized tech stack. **HARD GATE**: Follow the bootstrap verification protocol (`.agent/skills/prd-templates/references/bootstrap-verification-protocol.md`). Confirm all tech stack placeholders are filled and all triggered skills are installed before proceeding.
95
101
 
96
102
  ## 12. Ambiguity gate
97
103
 
@@ -80,10 +80,7 @@ If the sub-feature count is **< 10**, proceed directly to Step 1c.
80
80
 
81
81
  Read `.agent/skills/brainstorming/SKILL.md` and use it to explore any remaining ambiguous sub-features — those marked `[Architecture-only]` that the user hasn't explicitly confirmed, or any sub-feature whose scope boundary (what's in, what's out) is still unclear after 1b.
82
82
 
83
- > **Authoring pattern for Steps 2–7**: After designing each section, (1) present it to the user with the targeted review questions listed below, (2) refine based on their feedback, (3) write the completed section to `docs/plans/ia/[shard-name].md` immediately do not batch writes until Step 8.
84
-
85
- > [!IMPORTANT]
86
- > **Write-as-you-go is mandatory.** Each section (Steps 2–7) must be written to `docs/plans/ia/[shard-name].md` immediately after user confirmation. If the conversation truncates, all confirmed sections must survive on disk. Never hold confirmed content in-memory waiting for a later write step.
83
+ > **Authoring pattern for Steps 2–7**: (1) Present each section with review questions, (2) follow decision confirmation protocol (`.agent/skills/prd-templates/references/decision-confirmation-protocol.md`), (3) write to `docs/plans/ia/[shard-name].md` immediately per write verification protocol (`.agent/skills/prd-templates/references/write-verification-protocol.md`). Write-as-you-go is mandatory — never batch writes.
87
84
 
88
85
  ## 2. Map all interactions
89
86
 
@@ -93,9 +90,9 @@ For each feature in the shard, document:
93
90
  - What events are emitted
94
91
  - Error states and edge cases
95
92
 
96
- **Review questions**: "Does this capture all the ways a user touches this domain?" / "Are there admin/system-initiated actions I'm missing?" / "What happens in each failure case?"
93
+ **Review questions**: "All ways a user touches this domain?" / "Admin/system-initiated actions missing?" / "What happens in each failure case?"
97
94
 
98
- Write the completed `## Interactions` section to `docs/plans/ia/[shard-name].md` immediately after user confirmation.
95
+ Write `## Interactions` to shard file immediately after confirmation. Follow write verification protocol.
99
96
 
100
97
  ## 3. Define contracts
101
98
 
@@ -107,9 +104,9 @@ For each interaction, define the contract shape:
107
104
  - Error shape (specific error codes)
108
105
  - Note: actual {{CONTRACT_LIBRARY}} schemas written in BE spec phase
109
106
 
110
- **Review questions**: "Are there fields I'm missing from these requests/responses?" / "Are these error codes specific enough?"
107
+ **Review questions**: "Fields missing from requests/responses?" / "Error codes specific enough?"
111
108
 
112
- Write the completed `## Contracts` section to `docs/plans/ia/[shard-name].md` immediately after user confirmation.
109
+ Write `## Contracts` to shard file immediately after confirmation. Follow write verification protocol.
113
110
 
114
111
  ## 4. Design data models
115
112
 
@@ -120,9 +117,9 @@ Read `.agent/skills/prd-templates/references/skill-loading-protocol.md` and load
120
117
 
121
118
  Define for each entity: tables/collections, fields, types, relationships, indexes, constraints and validation rules.
122
119
 
123
- **Review questions**: "Does this schema capture everything this domain needs to store?" / "Are the relationships and cardinalities correct?" / "Are there derived/computed fields I should account for?"
120
+ **Review questions**: "Schema captures everything?" / "Relationships and cardinalities correct?" / "Derived/computed fields to account for?"
124
121
 
125
- Write the completed `## Data Models` section to `docs/plans/ia/[shard-name].md` immediately after user confirmation.
122
+ Write `## Data Models` to shard file immediately after confirmation. Follow write verification protocol.
126
123
 
127
124
  > **Decision recording**: For non-trivial data model decisions (schema approach, denormalization trade-offs, index strategy), read `.agent/skills/session-continuity/protocols/06-decision-analysis.md` and follow the **Decision Effect Analysis Protocol**.
128
125
 
@@ -136,9 +133,9 @@ Read .agent/skills/security-scanning-security-hardening/SKILL.md and apply its a
136
133
  - Escalation paths (Guardian, Admin)
137
134
  - Admin-only operations
138
135
 
139
- **Review questions**: "Can you think of a scenario where a user should be blocked that this matrix allows?" / "Can you think of a scenario where a user should be allowed that this matrix blocks?"
136
+ **Review questions**: "Scenario where a blocked user gets through?" / "Scenario where an allowed user is blocked?"
140
137
 
141
- Write the completed `## Access Control` section to `docs/plans/ia/[shard-name].md` immediately after user confirmation.
138
+ Write `## Access Control` to shard file immediately after confirmation. Follow write verification protocol.
142
139
 
143
140
  > **Decision recording**: For access control architecture decisions (role hierarchy, ownership model, escalation paths), read `.agent/skills/session-continuity/protocols/06-decision-analysis.md` and follow the **Decision Effect Analysis Protocol**. Record to `memory/decisions.md`.
144
141
 
@@ -150,7 +147,7 @@ Read `.agent/skills/accessibility/references/ia-spec-checklist.md` and follow it
150
147
 
151
148
  **If surfaces are `api`, `cli`, or `extension` only:** Write `"Not applicable — no visual surfaces"` in the `## Accessibility` section.
152
149
 
153
- Write the completed `## Accessibility` section to `docs/plans/ia/[shard-name].md` immediately after user confirmation.
150
+ Write `## Accessibility` to shard file immediately after confirmation. Follow write verification protocol.
154
151
 
155
152
  ## 6. Design event schemas (if applicable)
156
153
 
@@ -158,7 +155,7 @@ Write the completed `## Accessibility` section to `docs/plans/ia/[shard-name].md
158
155
  - Async vs sync processing
159
156
  - Retry semantics
160
157
 
161
- Write the completed `## Event Schemas` section to `docs/plans/ia/[shard-name].md` immediately after user confirmation (if applicable).
158
+ Write `## Event Schemas` to shard file immediately after confirmation (if applicable). Follow write verification protocol.
162
159
 
163
160
  ## 7. Document edge cases
164
161