cfsa-antigravity 2.1.0 → 2.2.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 (43) hide show
  1. package/package.json +1 -1
  2. package/template/.agent/instructions/example.md +21 -0
  3. package/template/.agent/skills/architecture-mapping/SKILL.md +8 -8
  4. package/template/.agent/skills/idea-extraction/SKILL.md +270 -279
  5. package/template/.agent/skills/pipeline-rubrics/references/ia-rubric.md +2 -2
  6. package/template/.agent/skills/pipeline-rubrics/references/scoring.md +1 -1
  7. package/template/.agent/skills/pipeline-rubrics/references/vision-rubric.md +2 -1
  8. package/template/.agent/skills/prd-templates/SKILL.md +11 -11
  9. package/template/.agent/skills/prd-templates/references/decomposition-templates.md +1 -1
  10. package/template/.agent/skills/prd-templates/references/engineering-standards-template.md +2 -0
  11. package/template/.agent/skills/prd-templates/references/fractal-cx-template.md +58 -0
  12. package/template/.agent/skills/prd-templates/references/fractal-feature-template.md +93 -0
  13. package/template/.agent/skills/prd-templates/references/fractal-node-index-template.md +55 -0
  14. package/template/.agent/skills/prd-templates/references/ideation-crosscut-template.md +26 -47
  15. package/template/.agent/skills/prd-templates/references/ideation-index-template.md +41 -49
  16. package/template/.agent/skills/prd-templates/references/slice-completion-gates.md +8 -0
  17. package/template/.agent/skills/prd-templates/references/vision-template.md +8 -8
  18. package/template/.agent/skills/resolve-ambiguity/SKILL.md +1 -1
  19. package/template/.agent/skills/spec-writing/SKILL.md +1 -1
  20. package/template/.agent/workflows/create-prd-architecture.md +7 -2
  21. package/template/.agent/workflows/create-prd-stack.md +1 -1
  22. package/template/.agent/workflows/create-prd.md +4 -3
  23. package/template/.agent/workflows/decompose-architecture-structure.md +2 -2
  24. package/template/.agent/workflows/decompose-architecture-validate.md +3 -3
  25. package/template/.agent/workflows/decompose-architecture.md +18 -3
  26. package/template/.agent/workflows/evolve-feature-classify.md +14 -6
  27. package/template/.agent/workflows/ideate-discover.md +71 -110
  28. package/template/.agent/workflows/ideate-extract.md +68 -104
  29. package/template/.agent/workflows/ideate-validate.md +24 -20
  30. package/template/.agent/workflows/ideate.md +7 -7
  31. package/template/.agent/workflows/implement-slice-tdd.md +25 -0
  32. package/template/.agent/workflows/remediate-pipeline-assess.md +2 -1
  33. package/template/.agent/workflows/resolve-ambiguity.md +2 -2
  34. package/template/.agent/workflows/validate-phase-quality.md +155 -0
  35. package/template/.agent/workflows/validate-phase-readiness.md +167 -0
  36. package/template/.agent/workflows/validate-phase.md +19 -154
  37. package/template/.agent/workflows/write-architecture-spec-design.md +8 -4
  38. package/template/AGENTS.md +5 -1
  39. package/template/GEMINI.md +2 -0
  40. package/template/docs/README.md +10 -10
  41. package/template/docs/kit-architecture.md +92 -25
  42. package/template/docs/plans/ideation/README.md +8 -3
  43. package/template/.agent/skills/prd-templates/references/ideation-domain-template.md +0 -61
@@ -17,7 +17,7 @@ pipeline:
17
17
 
18
18
  # Ideate — Extract
19
19
 
20
- Classify the user's input, create the `ideation/` folder structure, and load skills.
20
+ Classify the user's input, create the fractal `ideation/` folder structure, and load skills.
21
21
 
22
22
  **Prerequisite**: If invoked standalone (not from `/ideate`), verify the user has provided input — either an `@file` reference or a verbal description. If no input is provided, prompt: "What would you like to build? Describe your idea, or provide a file with `/ideate-extract @path/to/file.md`."
23
23
 
@@ -25,8 +25,7 @@ Classify the user's input, create the `ideation/` folder structure, and load ski
25
25
 
26
26
  ## 1. Input assessment
27
27
 
28
- Classify what the user has provided. This determines which mode the `idea-extraction` skill
29
- uses and how the rest of the workflow behaves.
28
+ Classify what the user has provided. This determines which mode the `idea-extraction` skill uses.
30
29
 
31
30
  | Input Type | Detection | Extraction Mode |
32
31
  |---|---|---|
@@ -38,168 +37,133 @@ uses and how the rest of the workflow behaves.
38
37
 
39
38
  **For rich inputs (Extraction mode):**
40
39
  1. Read/ingest all provided documents
41
- 2. **Proportionality check**: If the source document is over 50KB, the total ideation output (all domain files combined) must be at least 30% of the source document's line count. If it falls short, identify what was lost and recover it.
40
+ 2. **Proportionality check**: If source >50KB, total ideation output must be 30% of source line count
42
41
  3. Identify natural domain boundaries in the content
43
- 4. Present the organized inventory to the user for confirmation: "Here's what I found, organized by domain. Is anything missing or wrong?"
44
- 5. Identify gaps — domains or sub-topics not covered
45
- 6. For each gap, note it for Interview Mode treatment in `/ideate-discover`
46
- 7. Use idea-extraction skill to refine and deepen, not to re-derive what's already known
42
+ 4. Present organized inventory for user confirmation
43
+ 5. Identify gaps — note for Interview Mode in `/ideate-discover`
44
+ 6. Use idea-extraction skill to refine, not re-derive
47
45
 
48
46
  **For thin inputs (Expansion mode):**
49
- 1. Read the input and identify domain boundaries
50
- 2. For each domain area, identify depth level (surface → detailed → implementation-ready)
47
+ 1. Read input and identify domain boundaries
48
+ 2. Identify depth level per domain (surface → detailed → implementation-ready)
51
49
  3. Note shallowest domains for priority treatment in `/ideate-discover`
52
- 4. Use idea-extraction skill to deepen each one
53
50
 
54
51
  **For verbal / no input (Interview mode):**
55
52
  1. Read `.agent/skills/idea-extraction/SKILL.md` and enter Interview mode
56
53
  2. Start with: "In one sentence, what problem does this solve and for whom?"
57
- 3. **Immediately after**: Run Structural Classification (Step 1.3) — ask about audiences and surfaces before identifying domains
58
- 4. From that sentence + classification, identify the key nouns — these become initial domains
59
- 5. Proceed to folder seeding (Step 1.5) then domain exploration in `/ideate-discover`
54
+ 3. **Immediately after**: Run Structural Classification (Step 1.3)
55
+ 4. From that sentence + classification, identify initial domains
56
+ 5. Proceed to folder seeding (Step 1.5)
60
57
 
61
58
  ## 1.3. Structural Classification
62
59
 
63
60
  Read the **Structural Classification Protocol** in `.agent/skills/idea-extraction/SKILL.md`.
64
61
 
65
- This step determines the folder layout for all ideation output. It MUST run **before** any domain files are created (Step 1.5).
62
+ This step determines the folder layout. It MUST run **before** any domain folders are created (Step 1.5).
66
63
 
67
64
  **For rich/thin document input:**
68
- 1. Scan the document for surface signals:
69
- - Distinct platform names in section headings (e.g., "Consumer Web Platform", "Shop Software")
70
- - Different tech stacks per surface (e.g., "Astro for web", "Tauri for desktop")
71
- - Surface-exclusive features (e.g., "Board Viewer (desktop only)")
72
- 2. If signals detected classify as **multi-product**
73
- 3. If no signals → classify as **single-surface**
74
- 4. If ambiguous → ask the user the two classification questions before proceeding
65
+ 1. Scan for surface signals (see detection table in skill)
66
+ 2. If multi-product signals detected, scan for hub-and-spoke vs peer signals:
67
+ - One surface described as "the platform" or "the API" **hub-and-spoke**
68
+ - All surfaces access central database through one API → **hub-and-spoke**
69
+ - Surfaces described as equally independent **peer**
70
+ 3. If no multi-product signals → **single-surface**
71
+ 4. If ambiguous → ask the user the classification questions
75
72
 
76
73
  **For interview / verbal input:**
77
74
  1. After the opening problem statement, ask:
78
- - "Who are the distinct user types or audiences for this?"
75
+ - "Who are the distinct user types or audiences?"
79
76
  - "What platforms does this need to live on?" (web, mobile, desktop, API, CLI)
80
- 2. Based on the answers, classify the project shape
81
- 3. If the user's one-liner already specifies a single surface ("make me a website"), classify as **single-surface** without asking
77
+ 2. If multi-product ask: "Is there a primary platform that others depend on, or are all surfaces independent peers?"
78
+ 3. Classify the project shape
82
79
 
83
- **Record the classification** in `ideation-index.md` under `## Structural Classification`:
80
+ **Record the classification** in `ideation-index.md` under `## Structural Classification` per the super-index template.
84
81
 
85
- ```markdown
86
- ## Structural Classification
87
-
88
- - **Project Shape**: [single-surface | multi-surface-shared | multi-product]
89
- - **Surfaces**: [list of identified surfaces, e.g., "Web (Astro/React), Desktop (Rust/Tauri), Mobile (React Native)" — or "N/A" for single-surface]
90
- - **Classification Basis**: [how this was determined — "detected from document", "user interview", "inferred from one-liner"]
91
- ```
82
+ Four shapes: `single-surface`, `multi-surface-shared`, `multi-product-hub`, `multi-product-peer`.
92
83
 
93
84
  ## 1.4. Re-run check
94
85
 
95
86
  Before seeding, check whether `docs/plans/ideation/ideation-index.md` already exists.
96
87
 
97
- - If it **exists**: Present a summary of its current state (expansion mode, domain count, depth markers, cross-cut count). Ask: "An ideation folder already exists. Do you want to **continue from it** or **start fresh**?"
98
- - **Continue** → skip seeding, jump directly to Step 1.6.
99
- - **Start fresh** → archive existing folder to `docs/plans/ideation-archive-[timestamp]/`, then proceed with seeding.
88
+ - If it **exists**: Present summary (expansion mode, domain count, depth markers). Ask: "An ideation folder already exists. **Continue** or **start fresh**?"
89
+ - **Continue** → skip seeding, jump to Step 1.6
90
+ - **Start fresh** → archive to `docs/plans/ideation-archive-[timestamp]/`, then seed
100
91
  - If it **does not exist**: proceed with seeding.
101
92
 
102
- ## 1.5. Seed `ideation/` folder
93
+ ## 1.5. Seed fractal `ideation/` folder
103
94
 
104
- Read `.agent/skills/prd-templates/references/ideation-index-template.md` and the other ideation templates.
95
+ Read these templates:
96
+ - `.agent/skills/prd-templates/references/ideation-index-template.md` (super-index)
97
+ - `.agent/skills/prd-templates/references/ideation-crosscut-template.md` (global CX)
98
+ - `.agent/skills/prd-templates/references/fractal-node-index-template.md` (node index)
99
+ - `.agent/skills/prd-templates/references/fractal-cx-template.md` (node CX)
100
+ - `.agent/skills/prd-templates/references/fractal-feature-template.md` (feature file)
105
101
 
106
102
  Read `.agent/skills/technical-writer/SKILL.md` and follow its methodology.
107
103
 
108
- Read the **Structural Classification** from Step 1.3 and create the appropriate folder structure.
109
-
110
- **Single-surface layout** (project shape = `single-surface` or `multi-surface-shared`):
104
+ **Create the base structure** (all project shapes):
111
105
 
112
106
  ```
113
107
  docs/plans/ideation/
114
- ├── ideation-index.md
115
- ├── meta/
116
- │ ├── problem-statement.md
117
- ├── personas.md
118
- ├── competitive-landscape.md
119
- │ └── constraints.md
120
- ├── domains/
121
- │ └── (domain files created per identified domain)
122
- └── cross-cuts/
123
- └── cross-cut-ledger.md
108
+ ├── ideation-index.md ← super-index (from ideation-index-template)
109
+ ├── ideation-cx.md ← global cross-cuts (from ideation-crosscut-template)
110
+ └── meta/
111
+ ├── problem-statement.md
112
+ ├── personas.md
113
+ ├── competitive-landscape.md
114
+ └── constraints.md
124
115
  ```
125
116
 
126
- **Multi-product layout** (project shape = `multi-product`):
117
+ **For multi-product projects**, additionally create `surfaces/` with sub-folders per surface.
127
118
 
128
- ```
129
- docs/plans/ideation/
130
- ├── ideation-index.md
131
- ├── meta/
132
- │ ├── problem-statement.md
133
- │ ├── personas.md
134
- │ ├── competitive-landscape.md
135
- │ └── constraints.md
136
- ├── surfaces/
137
- │ ├── {surface-1-name}/
138
- │ ├── {surface-2-name}/
139
- │ └── {surface-N-name}/
140
- ├── domains/
141
- │ └── (shared/cross-cutting domain files)
142
- └── cross-cuts/
143
- └── cross-cut-ledger.md
144
- ```
119
+ **Seed domains using the Node Classification Gate** (from `idea-extraction/SKILL.md`):
145
120
 
146
- Create the surface folders based on the surfaces identified in Step 1.3.
121
+ For each domain identified in Step 1:
122
+ 1. Run the Classification Gate — determine placement:
123
+ - Single-surface → create `docs/plans/ideation/{NN}-{slug}/`
124
+ - Hub-and-spoke → surface-exclusive in `surfaces/{surface}/{NN}-{slug}/`, shared in hub surface
125
+ - Peer → surface-exclusive in `surfaces/{surface}/{NN}-{slug}/`, shared in `shared/{NN}-{slug}/`
126
+ 2. Create the domain folder with: `{slug}-index.md` + `{slug}-cx.md`
127
+ 3. For rich document inputs, parse sub-areas into feature files within each domain folder
128
+ 4. Update `ideation-index.md` structure map with paths
147
129
 
148
130
  **Seeding behavior by input type:**
149
131
 
150
- - **Rich document**: Parse by domain → create one domain file per identified domain → seed each with relevant content from source. **For multi-product projects:** place each domain file in the correct surface folder or shared `domains/` folder based on the domain placement rules in the idea-extraction skill. Preserve all detail. Add reference at top of index: `> Source: path/to/original.md`. Do not modify the original. Run the **Source → Domain Files fidelity check**: every major section of the source maps to a domain file — nothing dropped during parsing.
151
- - **Chat transcript**: Run the noise filter (read full transcript, extract decisions/ideas/rejections, discard filler, present extracted signal to user for confirmation), then create domain files with the clean structured signal. Attribute decisions: `> Decided in conversation: [decision]`.
152
- - **Thin document**: Create domain files annotated with `[SURFACE]`, `[PARTIAL]`, or `[DEEP]` depth markers per sub-area.
153
- - **Verbal / one-liner**: Create domain files with scaffolding based on the initial description. Sub-areas are `[SURFACE]` placeholders.
154
-
155
- Populate `ideation-index.md` with the domain map and document map linking to all created files.
132
+ - **Rich document**: Parse by domain → create fractal folders + feature files → seed with content. Run fidelity check: every major source section maps to a domain folder. Add `> Source: path/to/original.md` to index.
133
+ - **Chat transcript**: Noise filter extract signal seed domain folders with structured output.
134
+ - **Thin document**: Create domain folders with depth markers on feature files.
135
+ - **Verbal / one-liner**: Create domain folders with scaffolding. Feature files are `[SURFACE]`.
156
136
 
157
137
  ## 1.6. User Intent Check (ALL input types)
158
138
 
159
139
  Read `.agent/skills/brainstorming/SKILL.md` and follow its methodology.
160
140
 
161
- After seeding, present a summary of what was captured and ask how the user wants to proceed. Framing adapts to input type:
162
-
163
- - **Rich document**: "I've organized your document into the ideation folder. Here's the domain map: [domain list with depth indicators]. How would you like to proceed?"
164
- - **Chat transcript**: "I've extracted the signal from your conversation — [N] decisions, [N] feature ideas, [N] rejected directions. Here's the domain map: [list]. How would you like to proceed?"
165
- - **Thin document**: "I've seeded the ideation folder with [N] domains. I found [N] sub-areas at surface depth, [N] at partial depth, [N] implementation-ready. How would you like to proceed?"
166
- - **Verbal / one-liner**: "I've scaffolded [N] initial domains based on your description. How would you like to approach this?"
141
+ After seeding, present a summary and ask how the user wants to proceed. Present all options:
167
142
 
168
- Present all options for every input type:
169
- 1. **Full exploration** *(recommended for 3+ domains)* Recursive breadth-before-depth with Deep Think protocol domain map → breadth sweep → vertical drilling, with cross-cut detection and hypothesis generation active throughout
170
- 2. **Process as-is** — Proceed with what's captured; fill gaps via interview as they arise
143
+ 1. **Full exploration** *(recommended for 3+ domains)* — Recursive breadth-before-depth with Deep Think
144
+ 2. **Process as-is** — Proceed with what's captured; fill gaps as they arise
171
145
  3. **Expand vertically** — Drill deeper into existing features
172
146
  4. **Expand horizontally** — Add new feature domains not yet covered
173
- 5. **Explore cross-cutting concerns** — Map how existing features interact and conflict
174
- 6. **Combination** — User specifies which dimensions and order
175
- 7. **Audit ambiguity first** — Run inline check on ideation folder before deciding
176
-
177
- Recommendation logic: suggest Full if 3+ domains, vertical if 1-2 domains, Full if no domains (verbal). Always present all options. **Wait for user answer — do not assume.**
147
+ 5. **Explore cross-cutting concerns** — Map how existing features interact
148
+ 6. **Combination** — User specifies dimensions and order
149
+ 7. **Audit ambiguity first** — Run inline check before deciding
178
150
 
179
- > **Note**: Cross-cut detection is always-on regardless of mode. Even if the user picks vertical-only, maintain the cross-cut ledger and surface it at the end.
151
+ **Wait for user answer do not assume.**
180
152
 
181
153
  ## 1.7. Expansion Mode Routing
182
154
 
183
- Based on the user's choice, write the expansion mode to `ideation-index.md`:
184
-
185
- ```
186
- ## Expansion Mode
187
- - Type: [full | vertical | horizontal | cross-cutting | combination | as-is]
188
- - Targets: [list of domains/features to focus on, if applicable]
189
- - Cross-cut Detection: always-on
190
- - Deep Think Protocol: active
191
- ```
155
+ Write the expansion mode to `ideation-index.md` per the super-index template.
192
156
 
193
157
  This flag is read by `ideate-discover.md` to shape exploration behavior.
194
158
 
195
159
  ## 2. Load skills
196
160
 
197
- Read `.agent/skills/idea-extraction/SKILL.md` and follow its methodology throughout this workflow.
161
+ Read `.agent/skills/idea-extraction/SKILL.md` and follow its methodology throughout.
198
162
 
199
- Also read `.agent/skills/resolve-ambiguity/SKILL.md` — use it reactively when encountering ambiguity that can be resolved without user input (technical/factual questions). For intent/choice questions, use the decision classification rule.
163
+ Also read `.agent/skills/resolve-ambiguity/SKILL.md` — use reactively when encountering ambiguity that can be resolved without user input.
200
164
 
201
165
  ### Propose next step
202
166
 
203
- Once input is classified, folder is seeded, and skills are loaded, proceed to `/ideate-discover` to explore domains using the recursive breadth-before-depth model.
167
+ Proceed to `/ideate-discover` to explore domains using the recursive breadth-before-depth model with the fractal structure.
204
168
 
205
- > If this shard was invoked standalone (not from `/ideate`), surface this via `notify_user`. If invoked by the parent `/ideate`, this is a natural handoff — the parent orchestrates the transition.
169
+ > If invoked standalone, surface this via `notify_user`. If invoked by parent `/ideate`, this is a natural handoff.
@@ -19,7 +19,7 @@ pipeline:
19
19
 
20
20
  Explore constraints, verify domain exhaustion, and compile the vision summary.
21
21
 
22
- **Prerequisite**: If invoked standalone, verify `docs/plans/ideation/ideation-index.md` exists with domains at `[DEEP]` or `[EXHAUSTED]` level. If not, prompt the user to run `/ideate-discover` first.
22
+ **Prerequisite**: If invoked standalone, verify `docs/plans/ideation/ideation-index.md` exists with leaf nodes at `[DEEP]` or `[EXHAUSTED]` level. If not, prompt the user to run `/ideate-discover` first.
23
23
 
24
24
  ---
25
25
 
@@ -64,37 +64,41 @@ If not already explored in `/ideate-discover` Step 4, explore competitive landsc
64
64
 
65
65
  This is the final validation gate before compilation.
66
66
 
67
- ### Read the full domain map
67
+ ### Read the fractal tree
68
68
 
69
- Read `docs/plans/ideation/ideation-index.md` and review:
70
- - Every domain's status marker
71
- - Every domain file's sub-area status markers
72
- - The cross-cut ledger's pending items
69
+ Read `docs/plans/ideation/ideation-index.md` and recursively review:
70
+ - Every node's status marker (surface → domain → sub-domain → feature)
71
+ - All leaf feature files' status markers
72
+ - All CX files at every level for pending entries
73
73
 
74
74
  ### Exhaustion criteria
75
75
 
76
76
  | Check | Criteria | Action if Fail |
77
77
  |-------|----------|----------------|
78
- | All domains ≥ `[DEEP]` | Every domain in index is `[DEEP]` or `[EXHAUSTED]` | Drill remaining domains |
79
- | All Must Have features ≥ Level 2 | Every Must Have has sub-features AND edge cases explored | Deep Think + drill |
80
- | Deep Think zero hypotheses | Final Deep Think pass across ALL domains yields no new hypotheses | Present any new hypotheses, drill if confirmed |
81
- | Cross-cut ledger clean | No `pending` entries remain all are `confirmed` or `rejected` | Run synthesis questions on pending pairs |
78
+ | All leaf nodes ≥ `[DEEP]` | Every feature file in the tree is `[DEEP]` or `[EXHAUSTED]` | Drill remaining feature files |
79
+ | Status propagation correct | Parent nodes reflect their children's status | Update parent indexes |
80
+ | All Must Have features ≥ Level 2 | Every Must Have has sub-features AND edge cases AND Role Lens | Deep Think + drill |
81
+ | Deep Think zero hypotheses | Final Deep Think pass across ALL leaf nodes yields no new hypotheses | Present any new hypotheses, drill if confirmed |
82
+ | All CX files clean | No Medium/Low confidence entries remain at any level — all are High or rejected | Run synthesis questions on pending pairs |
83
+ | Role Lens complete | Every feature file has a populated Role Lens table | Fill missing Role Lens entries |
82
84
  | User confirmation | User explicitly confirms "nothing else" for each domain | Ask for each under-explored domain |
83
85
 
84
86
  ### Execute exhaustion check
85
87
 
86
- 1. Scan index for domains below `[DEEP]`. If any:
87
- - "Domain [X] is still at [status]. Should we drill deeper, or is it intentionally minimal?"
88
- - If user says "drill" → return to `/ideate-discover` for those domains
89
- - If user says "intentionally minimal" → note in domain file and proceed
88
+ 1. Walk the fractal tree. For each leaf node below `[DEEP]`:
89
+ - "Feature [X] in [domain] is still at [status]. Drill deeper or intentionally minimal?"
90
+ - If "drill" → return to `/ideate-discover`
91
+ - If "intentionally minimal" → note in feature file and proceed
90
92
 
91
- 2. Run **final Deep Think pass**: For each `[DEEP]` (not `[EXHAUSTED]`) domain, apply the four Deep Think questions one more time. Present any new hypotheses.
92
- - If new hypotheses are confirmed → drill them, update domain files
93
- - If zero hypotheses generated → mark domain as `[EXHAUSTED]`
93
+ 2. Run **final Deep Think pass**: For each `[DEEP]` leaf node, apply the four Deep Think questions. Present any new hypotheses.
94
+ - If confirmed → drill, update feature files
95
+ - If zero hypotheses → mark `[EXHAUSTED]`, propagate status upward
94
96
 
95
- 3. Check cross-cut ledger for `pending` entries. Resolve each.
97
+ 3. Walk ALL CX files at every level. Resolve any Medium/Low confidence entries.
96
98
 
97
- 4. Update `ideation-index.md` progress summary with final counts.
99
+ 4. Verify all feature files have populated Role Lens tables.
100
+
101
+ 5. Update `ideation-index.md` progress summary with final counts (total leaf nodes, exhausted count, CX entries confirmed).
98
102
 
99
103
  ---
100
104
 
@@ -162,7 +166,7 @@ Read `.agent/skills/pipeline-rubrics/references/ideation-rubric.md` before apply
162
166
  | 9 | **Domain Coverage** | Are all domains at `[DEEP]` or `[EXHAUSTED]`? |
163
167
  | 10 | **Deep Think Coverage** | Were hypotheses tracked? Are all resolved (confirmed/rejected)? |
164
168
  | 11 | **Cross-Cut Completeness** | Is the ledger clean? No pending entries? |
165
- | 12 | **Folder Structure Compliance** | Does the folder match the classified structure? (flat `domains/` for single-surface, `surfaces/` + `domains/` for multi-product) |
169
+ | 12 | **Fractal Structure Compliance** | Does every folder have an index + CX file? Do leaf nodes use the feature template? Does hub-and-spoke placement match classification? Are Role Matrix and Role Lens populated? |
166
170
 
167
171
  For any dimension that scores ⚠️ or ❌, resolve it NOW — don't present a document with known gaps. Loop back to the relevant step and work through it with the user.
168
172
 
@@ -29,7 +29,7 @@ shards: [ideate-extract, ideate-discover, ideate-validate]
29
29
  | One-liner / verbal | User describes idea in chat, no files | Interview (deep) — builds vision from scratch domain by domain |
30
30
  | Full exploration | Any input with 3+ domains | Full — Recursive breadth-before-depth with Deep Think protocol, cross-cut detection active throughout |
31
31
 
32
- **Quality guarantee**: All input types produce the **same output quality**. The ideation output that emerges from a one-liner is structurally and substantively identical to one produced from a rich document. Only the amount of interview work differs.
32
+ **Quality guarantee**: All input types produce the **same output quality** using the same fractal structure. The ideation output from a one-liner is structurally identical to one from a rich document. Every node has an index, CX file, and children. Every feature has a Role Lens. Only the amount of interview work differs.
33
33
 
34
34
  Transform a raw idea into comprehensive, structured ideation output through exhaustive recursive exploration with the Deep Think protocol.
35
35
 
@@ -46,9 +46,9 @@ Transform a raw idea into comprehensive, structured ideation output through exha
46
46
 
47
47
  | # | Shard | What It Does |
48
48
  |---|-------|-------------|
49
- | 1 | [`ideate-extract`](.agent/workflows/ideate-extract.md) | Classifies input, creates `ideation/` folder structure, seeds domain files, runs user intent check, sets expansion mode, loads skills |
50
- | 2 | [`ideate-discover`](.agent/workflows/ideate-discover.md) | Recursive breadth-before-depth domain exploration with Deep Think writes directly to domain files. Cross-cut detection + ledger active throughout. |
51
- | 3 | [`ideate-validate`](.agent/workflows/ideate-validate.md) | Constraints, metrics, competitive positioning, domain exhaustion check, vision summary compilation |
49
+ | 1 | [`ideate-extract`](.agent/workflows/ideate-extract.md) | Classifies input, determines structural classification (4 shapes), creates fractal `ideation/` folder structure using Node Classification Gate, seeds domain folders, runs user intent check, sets expansion mode, loads skills |
50
+ | 2 | [`ideate-discover`](.agent/workflows/ideate-discover.md) | Recursive breadth-before-depth exploration with Deep Think. Creates fractal nodes (folders with index + CX) and leaf feature files (with Role Lens). Hierarchical CX detection active throughout. |
51
+ | 3 | [`ideate-validate`](.agent/workflows/ideate-validate.md) | Constraints, metrics, competitive positioning, leaf-node exhaustion check, fractal structure compliance, vision summary compilation |
52
52
 
53
53
  ---
54
54
 
@@ -56,15 +56,15 @@ Transform a raw idea into comprehensive, structured ideation output through exha
56
56
 
57
57
  ### Step 1 — Run `.agent/workflows/ideate-extract.md`
58
58
 
59
- Classifies the user's input (rich doc, thin PRD, chat transcript, verbal), checks for an existing ideation folder (re-run check), creates the `docs/plans/ideation/` folder structure from the input, runs the universal user intent check to determine expansion mode, sets the expansion mode flag in `ideation-index.md`, and loads the idea-extraction and resolve-ambiguity skills.
59
+ Classifies the user's input (rich doc, thin PRD, chat transcript, verbal), determines structural classification (single-surface, multi-surface-shared, multi-product-hub, multi-product-peer), checks for existing ideation folder (re-run check), creates the fractal `docs/plans/ideation/` folder structure using the Node Classification Gate, runs user intent check to determine expansion mode, sets the expansion mode flag in `ideation-index.md`, and loads skills.
60
60
 
61
61
  ### Step 2 — Run `.agent/workflows/ideate-discover.md`
62
62
 
63
- Recursive breadth-before-depth exploration: Level 0 (global domain map) → Level 1 (domain breadth sweep) → Level 2+ (vertical drilling). Deep Think protocol active at every level. Writes directly to domain files. Cross-cut ledger accumulated continuously.
63
+ Recursive breadth-before-depth exploration: Level 0 (global domain map) → Level 1 (domain breadth sweep with Node Classification Gate) → Level 2+ (vertical drilling with Reactive Depth and Promotion Protocol). Deep Think active at every level. Writes to fractal feature files with Role Lens. Hierarchical CX files accumulated at every level.
64
64
 
65
65
  ### Step 3 — Run `.agent/workflows/ideate-validate.md`
66
66
 
67
- Explores constraints, success metrics, and competitive positioning. Runs domain exhaustion check (all domains ≥ `[DEEP]`, Deep Think yields zero hypotheses, cross-cut ledger clean). Compiles `docs/plans/vision.md` as a human-readable executive summary.
67
+ Explores constraints, success metrics, and competitive positioning. Runs leaf-node exhaustion check (all leaf features ≥ `[DEEP]`, Role Lens complete, Deep Think yields zero hypotheses, all CX files clean). Verifies fractal structure compliance. Compiles `docs/plans/vision.md` as a human-readable executive summary.
68
68
 
69
69
  ---
70
70
 
@@ -94,6 +94,31 @@ Read `.agent/skills/code-review-pro/SKILL.md` and apply its adversarial review:
94
94
 
95
95
  Run the Test Cmd to verify tests still pass.
96
96
 
97
+ ### 5.5. Query optimization check
98
+
99
+ For each database query introduced or modified in this slice:
100
+
101
+ 1. **N+1 detection**: Review all data-fetching code for loop-based queries. If a query inside a loop fetches related data that could be eagerly loaded or batched, flag as an N+1 pattern and fix using the installed ORM/DB skill's recommended approach (e.g., `include` for Prisma, `with` for Drizzle, JOIN for raw SQL, graph traversal for SurrealDB)
102
+ 2. **Index coverage**: For each new WHERE clause, ORDER BY, or JOIN condition, verify a supporting index exists in the migration/schema. If no index exists and the table is expected to exceed 10,000 rows, add one
103
+ 3. **Query plan verification** (if test DB is available): Run EXPLAIN ANALYZE (or equivalent) on queries targeting tables with >1,000 rows in seed data. Flag any sequential scan on a table expected to grow beyond 10,000 rows
104
+
105
+ If `docs/plans/ENGINEERING-STANDARDS.md` defines `### DB Query Time` budgets, annotate each new query with its expected tier in a code comment: `// DB-TIER-2: uncached read, p95 target < 50ms`
106
+
107
+ ### 5.6. Resource cleanup verification
108
+
109
+ Review all new code in this slice for resource acquisition patterns. For each resource acquired, verify matching cleanup exists:
110
+
111
+ | Resource Type | Required Cleanup | Example |
112
+ |--------------|-----------------|---------|
113
+ | DB connection/client | `disconnect()`/`close()` in `finally` | Prisma `$disconnect()`, pg `pool.end()` |
114
+ | Event listener | `removeEventListener()` or equivalent on unmount/destroy | React `useEffect` cleanup return |
115
+ | Subscription | `unsubscribe()`/`kill()` on unmount/destroy | RxJS, SurrealDB live queries, WebSocket |
116
+ | Timer (interval/timeout) | `clearInterval()`/`clearTimeout()` | Polling loops, debounce timers |
117
+ | File handle/stream | `close()`/`destroy()` | fs reads, HTTP response streams |
118
+ | Worker thread | `terminate()` | Web Workers, Node Worker Threads |
119
+
120
+ If any cleanup is missing, add it before proceeding. Run the Test Cmd after adding cleanup to verify tests still pass.
121
+
97
122
  ## 6. Validate
98
123
 
99
124
  Read `.agent/skills/verification-before-completion/SKILL.md` and apply its evidence-before-claims discipline.
@@ -71,7 +71,7 @@ Check which layers have content by verifying the presence of key files:
71
71
 
72
72
  | Layer | Key Files to Check | Has Content If… |
73
73
  |-------|-------------------|-------------------|
74
- | Ideation | `docs/plans/ideation/ideation-index.md` | File exists and domains at `[DEEP]`+ |
74
+ | Ideation | `docs/plans/ideation/ideation-index.md` | File exists, ≥1 domain folder under `domains/` (or `surfaces/`) with `*-index.md` + `*-cx.md`, and domains at `[DEEP]`+ in Structure Map |
75
75
  | Architecture | `docs/plans/*-architecture-design.md` | At least one dated file exists |
76
76
  | IA | `docs/plans/ia/index.md` | File exists with ≥1 shard listed |
77
77
  | BE | `docs/plans/be/index.md` | File exists with ≥1 spec listed |
@@ -80,6 +80,7 @@ Check which layers have content by verifying the presence of key files:
80
80
  For each layer with content, also note:
81
81
  - How many documents it contains (shards/specs count)
82
82
  - Whether any deep dive files exist (IA layer only)
83
+ - For ideation: count of domain folders, total feature files, and CX files across the fractal tree
83
84
 
84
85
  ---
85
86
 
@@ -18,7 +18,7 @@ Targeted ambiguity resolution for any pipeline document or layer. Uses the `reso
18
18
  | Invocation | Behavior |
19
19
  |---|---|
20
20
  | `/resolve-ambiguity` | Interactive — asks which document or layer to resolve |
21
- | `/resolve-ambiguity ideation` | Targets `docs/plans/ideation/ideation-index.md` + domain files |
21
+ | `/resolve-ambiguity ideation` | Targets `ideation-index.md` + `ideation-cx.md` + all fractal tree files |
22
22
  | `/resolve-ambiguity architecture` | Targets the architecture design documents |
23
23
  | `/resolve-ambiguity @path/to/spec.md` | Targets a specific file |
24
24
 
@@ -29,7 +29,7 @@ Targeted ambiguity resolution for any pipeline document or layer. Uses the `reso
29
29
  If no argument was provided, ask the user which document or layer to resolve. Accept a layer name (`vision`, `architecture`, `ia`, `be`, `fe`) or a direct `@file` path.
30
30
 
31
31
  For layer names, resolve to the canonical document(s):
32
- - `ideation` → `docs/plans/ideation/ideation-index.md` + all domain files (in `docs/plans/ideation/domains/` and `docs/plans/ideation/surfaces/*/` for multi-product projects)
32
+ - `ideation` → `docs/plans/ideation/ideation-index.md` + `ideation-cx.md` + all `*-index.md`, `*-cx.md`, and feature `.md` files recursively under `domains/` (and `surfaces/` for multi-product projects)
33
33
  - `architecture` → `docs/plans/YYYY-MM-DD-architecture-design.md` + `docs/plans/ENGINEERING-STANDARDS.md` + `docs/plans/data-placement-strategy.md`
34
34
  - `ia` → all files in `docs/plans/ia/` (excluding `index.md`)
35
35
  - `be` → all files in `docs/plans/be/` (excluding `index.md`)
@@ -0,0 +1,155 @@
1
+ ---
2
+ description: Code quality gates — tests, coverage, lint, type-check, build, CI/CD, staging deploy, migrations, spec coverage for the validate-phase workflow
3
+ parent: validate-phase
4
+ shard: quality
5
+ standalone: true
6
+ position: 1
7
+ pipeline:
8
+ position: 8.1
9
+ stage: verification
10
+ predecessors: [implement-slice]
11
+ successors: [validate-phase-readiness]
12
+ skills: [code-review-pro, deployment-procedures, testing-strategist, verification-before-completion]
13
+ calls-bootstrap: false
14
+ ---
15
+
16
+ // turbo-all
17
+
18
+ # Validate Phase — Code Quality Gates
19
+
20
+ Run all code quality checks for a completed implementation phase.
21
+
22
+ ---
23
+
24
+ ## 0. Load validation skills
25
+
26
+ Read these skills before running checks:
27
+ 1. `.agent/skills/testing-strategist/SKILL.md` — Coverage strategy and test quality
28
+ 2. `.agent/skills/code-review-pro/SKILL.md` — Review checklist for self-audit
29
+ 3. `.agent/skills/deployment-procedures/SKILL.md` — Build and release readiness
30
+
31
+ ---
32
+
33
+ ## 0.5. Parallel dispatch option
34
+
35
+ If the phase contains independent slices that don't share files, validation can run in parallel:
36
+
37
+ 1. **Identify independent slices** — slices that don't import from or export to each other
38
+ 2. **Dispatch parallel validation** — run Steps 1–5 concurrently for independent slices using the `parallel-agents` skill
39
+ 3. **Sequential for shared** — slices that share contracts or utilities must validate sequentially
40
+
41
+ This is an optimization, not a requirement. Sequential validation is always correct.
42
+
43
+ ## 1. Run test suite
44
+
45
+ Run the Test Cmd from `.agent/instructions/commands.md`. All tests must pass. Zero tolerance.
46
+
47
+ ## 2. Check coverage
48
+
49
+ Run the Test Coverage Cmd from `.agent/instructions/commands.md`.
50
+
51
+ Read `docs/plans/ENGINEERING-STANDARDS.md` and use the coverage thresholds defined in the "Test Coverage" section. If the file doesn't exist or thresholds aren't defined, fall back to these defaults:
52
+ - Statements: 80%
53
+ - Branches: 90% (critical paths: auth, payments, data mutations, permission checks), 75% (non-critical paths)
54
+ - Functions: 80%
55
+ - Lines: 80%
56
+
57
+ Critical paths are defined as: auth flows, payment processing, data mutations, and permission/authorization checks.
58
+
59
+ ## 2.5. Mutation testing (critical paths)
60
+
61
+ **Optional but recommended.** If the project's test tooling supports mutation testing (e.g., Stryker for JS/TS, mutmut for Python, cargo-mutants for Rust):
62
+
63
+ 1. Run the mutation testing tool against critical path modules only (auth, payments, data mutations, permission checks)
64
+ 2. **Required**: Mutation score ≥ 70% on critical paths — if below, the tests are passing but not actually catching bugs
65
+ 3. **Recommended**: Mutation score ≥ 50% on non-critical paths — log as a finding but don't block
66
+
67
+ If mutation testing is not available in the project's tooling, skip and note in the validation report that mutation testing was not run.
68
+
69
+ ## 3. Lint
70
+
71
+ Run the Lint Cmd from the surface stack map.
72
+
73
+ Zero lint errors. Warnings should be reviewed and addressed.
74
+
75
+ ## 4. Type check
76
+
77
+ Run the Type Check Cmd from the surface stack map.
78
+
79
+ Zero type errors. Strict mode must be enabled.
80
+
81
+ ## 5. Build
82
+
83
+ Run the Build Cmd from the surface stack map.
84
+
85
+ Build must succeed with no errors.
86
+
87
+ ---
88
+
89
+ ## 5.5. CI/CD pipeline verification
90
+
91
+ Verify the CI/CD pipeline is green for this phase's changes:
92
+
93
+ 1. Check that a CI/CD configuration file exists (e.g., `.github/workflows/`, `.gitlab-ci.yml`)
94
+ 2. Verify the pipeline has run for the latest commit in this phase
95
+ 3. Verify ALL CI/CD jobs are passing (not just the test job — include lint, type-check, build, and any deployment jobs)
96
+
97
+ **If CI/CD is red** → red path: **STOP immediately.** Do not mark this phase as complete. List the failing jobs and their error output. Fix them and re-run `/validate-phase` after fixes.
98
+
99
+ **Pass criteria**: CI/CD pipeline is green for the latest commit in this phase.
100
+
101
+ ---
102
+
103
+ ## 5.6. Staging deployment gate
104
+
105
+ 1. Deploy to staging using `.agent/skills/deployment-procedures/SKILL.md`
106
+ 2. Verify deployment succeeded (no rollback triggered, no error logs in the deployment output)
107
+ 3. Run smoke tests against the staging environment:
108
+ - Health check endpoint returns 200
109
+ - At least one authenticated route works with a valid token
110
+ - At least one protected route returns 401/403 for unauthenticated requests
111
+ 4. **If smoke tests fail** → red path: Capture the failing test output, rollback the staging deployment, and fix the issue before re-running `/validate-phase`
112
+ 5. **If deployment fails** → red path: Do not mark this phase as complete — diagnose the deployment failure, fix it, and re-run `/validate-phase`
113
+
114
+ **Pass criteria**: Staging deployment succeeds and all smoke tests pass.
115
+
116
+ ---
117
+
118
+ ## 5.6.5. Deployment strategy verification
119
+
120
+ Read the project's architecture design document (`docs/plans/*-architecture-design.md`) and look for a `## Deployment Strategy` section.
121
+
122
+ **If no deployment strategy is defined** → Log: "No deployment strategy in architecture doc. Using direct deploy." Proceed.
123
+
124
+ **If a deployment strategy is defined**:
125
+ 1. Verify the deployment in Step 5.6 followed the documented strategy (e.g., canary → verify traffic was gradually shifted; blue-green → verify old environment is still available for rollback; rolling → verify instances were replaced sequentially)
126
+ 2. If the architecture documents feature flags as the rollout mechanism → verify the new features in this phase are behind flags
127
+ 3. Verify the documented rollback trigger mechanism is configured (error rate monitoring, latency threshold alert, or manual switch — whatever the architecture specifies)
128
+
129
+ **Pass criteria**: Deployment follows the architecture-documented strategy, or no strategy is documented.
130
+
131
+ ---
132
+
133
+ ## 5.7. Migration verification
134
+
135
+ 1. Run the migration status command (e.g., `prisma migrate status`, `drizzle-kit status`, or equivalent)
136
+ 2. Verify there are no pending migrations and no failed migrations
137
+ 3. Verify the CI/CD pipeline ran migrations successfully as part of this phase's deployment
138
+ 4. Check that rollback scripts exist for each migration in this phase
139
+ 5. If migrations are pending or failed → red path: do not mark this phase as complete — run the pending migrations, verify they succeed, and re-run `/validate-phase`
140
+
141
+ **Pass criteria**: Migration status is clean. All migrations from this phase ran successfully in the CI/CD environment. Rollback scripts are present.
142
+
143
+ ---
144
+
145
+ ## 5.8. Spec coverage sweep
146
+
147
+ Read `.agent/skills/prd-templates/references/spec-coverage-sweep.md` and follow its full procedure for FE spec, BE spec, and IA shard coverage. Apply its hard-stop rule for any uncovered items.
148
+
149
+ ---
150
+
151
+ ### Propose next step
152
+
153
+ Code quality gates complete. Next: Run `.agent/workflows/validate-phase-readiness.md` for production readiness checks.
154
+
155
+ > If this shard was invoked standalone (not from `/validate-phase`), surface this via `notify_user`.