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
@@ -0,0 +1,167 @@
1
+ ---
2
+ description: Production readiness gates — API docs, accessibility, performance, security, dependency audit, results for the validate-phase workflow
3
+ parent: validate-phase
4
+ shard: readiness
5
+ standalone: true
6
+ position: 2
7
+ pipeline:
8
+ position: 8.2
9
+ stage: verification
10
+ predecessors: [validate-phase-quality]
11
+ successors: [update-architecture-map]
12
+ skills: [adversarial-review, security-scanning-security-hardening, verification-before-completion]
13
+ calls-bootstrap: false
14
+ ---
15
+
16
+ // turbo-all
17
+
18
+ # Validate Phase — Production Readiness Gates
19
+
20
+ Run all production readiness checks for a completed implementation phase.
21
+
22
+ **Prerequisite**: Code quality gates (from `/validate-phase-quality` or equivalent) must pass first.
23
+
24
+ ---
25
+
26
+ ## 5.9. API documentation sync (surfaces with API endpoints)
27
+
28
+ Read the surface stack map from `.agent/instructions/tech-stack.md`. **Skip this step** if the project has no API surface and no BE endpoints exposed to external consumers.
29
+
30
+ 1. Read `docs/plans/ENGINEERING-STANDARDS.md` → `## Code Quality` → `Required documentation` field
31
+ 2. If API documentation is required or the project exposes public API endpoints:
32
+ - Verify an OpenAPI spec file exists (e.g., `openapi.yaml`, `openapi.json`, or a generated equivalent)
33
+ - If the project uses a schema-first or code-first generation approach (documented in architecture-design.md), verify the generation tool produces output matching the implemented endpoints
34
+ - For each new endpoint in this phase, verify it appears in the OpenAPI spec with:
35
+ - Request body schema matching the {{CONTRACT_LIBRARY}} contract
36
+ - Response schema matching the contract
37
+ - All error codes documented
38
+ - Run OpenAPI linter if configured (e.g., the tool named in ENGINEERING-STANDARDS.md or the project's `lint` scripts)
39
+ 3. If API documentation is not required and no public API surface exists → skip
40
+
41
+ **Pass criteria**: OpenAPI spec exists and is in sync with implemented contracts for this phase's endpoints, or API documentation is not applicable.
42
+
43
+ ---
44
+
45
+ ## 6. Accessibility audit (if UI changes)
46
+
47
+ Audit all new UI components in this phase for WCAG 2.1 AA compliance using the Accessibility skill(s) from the cross-cutting section.
48
+
49
+ ## 7. Performance check
50
+
51
+ ### 7a. Performance budget verification (mandatory when budgets are defined)
52
+
53
+ Read `docs/plans/ENGINEERING-STANDARDS.md` section `## Performance Budgets`.
54
+
55
+ **If the section does not exist or contains only unfilled template placeholders** → Log: "No performance budgets defined in ENGINEERING-STANDARDS.md — skipping budget verification." Proceed to 7b.
56
+
57
+ **If budgets are defined**, read the `### CI Enforcement` table. For each row where the enforcement tool is named:
58
+
59
+ 1. Check if the named enforcement tool is installed/available in the project
60
+ 2. **If tool is available** → run it against the staging deployment (from Step 5.6) using the thresholds in the corresponding budget table:
61
+ - **Web Vitals** (LCP, INP, CLS) → run against staging URLs, one per page type defined in the budget
62
+ - **JS Bundle Size** → measure build output against per-page-type caps
63
+ - **API Response Time** → run the named load test tool with a baseline scenario against staging endpoints
64
+ - **DB Query Time** → run EXPLAIN ANALYZE (or equivalent) on critical queries and verify against tier thresholds
65
+ - **Desktop/Mobile/CLI metrics** → run the named platform profiler against the built artifact
66
+ 3. **If tool is not available** → log which tool is missing and recommend installation, but do not block
67
+
68
+ **Verdict per budget row**:
69
+ - `Fail` classification in CI Enforcement table AND threshold exceeded → **STOP.** Mark step 7a as `❌`. The phase cannot pass until budgets are met.
70
+ - `Warn` classification AND threshold exceeded → Log as a finding, do not block.
71
+ - Tool not available → Log as a finding, do not block, recommend installation.
72
+
73
+ **Pass criteria**: All `Fail`-classified budgets pass their thresholds. All `Warn`-classified findings are logged.
74
+
75
+ ### 7b. Deep performance audit (optional)
76
+
77
+ Check if the `performance-optimization` skill is installed (look for `.agent/skills/performance-optimization/SKILL.md`).
78
+
79
+ **If installed**:
80
+ 1. Read `.agent/skills/performance-optimization/SKILL.md`
81
+ 2. Run the skill's audit protocol against the phase's changed pages/routes/endpoints
82
+ 3. Compare results to the targets in `docs/plans/ENGINEERING-STANDARDS.md` (response time budgets, bundle sizes, memory limits, or other surface-appropriate metrics)
83
+ 4. Report any metrics that exceed the defined thresholds
84
+
85
+ **If not installed**:
86
+ - Manually verify that no obviously expensive operations were added (large synchronous imports, unoptimized assets, missing lazy loading, N+1 queries, unbounded loops)
87
+ - If performance is critical for this project, recommend installing the skill via `find-skills`
88
+
89
+ ## 8. Security review
90
+
91
+ Read .agent/skills/adversarial-review/SKILL.md and follow its structured methodology for generating attack scenarios, abuse cases, and race conditions against the phase's changes. Produce spec-level gap items for any identified risks. Feed these into the defense-in-depth audit below.
92
+
93
+ Read .agent/skills/security-scanning-security-hardening/SKILL.md and run its full defense-in-depth audit protocol against the phase's changes (new endpoints, new data flows, new auth checks). Report findings with severity levels. Block the phase if any Critical or High severity issues are found.
94
+
95
+ **Supplemental security checks (conditional)**: After the core audit completes, read the Security skill(s) from the cross-cutting section of the surface stack map. For each listed skill directory name, read `.agent/skills/[skill]/SKILL.md` and run its audit protocol as a supplement to the core audit.
96
+
97
+ Report any additional findings from supplemental audits with the same severity classification.
98
+
99
+ **Surface-conditional DAST scan (if applicable)**: Read `docs/plans/ENGINEERING-STANDARDS.md` → `## Security` → `Security testing tool` field. If a DAST or security scanning tool is defined:
100
+ 1. Run it against the staging deployment from Step 5.6
101
+ 2. Report findings with severity levels consistent with the core audit
102
+ 3. Block the phase if any Critical or High severity findings are discovered
103
+
104
+ If no security testing tool is defined in ENGINEERING-STANDARDS → skip and log: "No DAST/security testing tool configured."
105
+
106
+ ## 8.5. Dependency audit
107
+
108
+ ### Core audit (mandatory — no skill required)
109
+
110
+ Run the package manager's built-in vulnerability audit tool. Use the appropriate command for the project's language/package manager:
111
+
112
+ | Package Manager | Audit Command |
113
+ |----------------|---------------|
114
+ | npm | `npm audit --audit-level=high` |
115
+ | pnpm | `pnpm audit --audit-level=high` |
116
+ | yarn | `yarn npm audit --severity high` |
117
+ | pip | `pip-audit` or `safety check` |
118
+ | cargo | `cargo audit` |
119
+ | go | `govulncheck ./...` |
120
+ | bundler | `bundle audit check` |
121
+ | composer | `composer audit` |
122
+
123
+ If the project uses a package manager not listed above, check its documentation for a built-in vulnerability audit command.
124
+
125
+ **If any HIGH or CRITICAL vulnerabilities are found in production dependencies** → **STOP.** Mark step 8.5 as `❌`. List affected packages and recommended fixes (upgrade version, patch, or replace).
126
+
127
+ **If only LOW or MODERATE vulnerabilities are found** → Log as findings, do not block.
128
+
129
+ **If the audit tool is not available** (e.g., language has no built-in audit) → Log: "No built-in dependency audit available for [language]. Recommend installing a dependency auditing tool." Do not block.
130
+
131
+ ### Supplemental audit (conditional)
132
+
133
+ If the `dependency-auditing` skill is installed (`.agent/skills/dependency-auditing/SKILL.md`):
134
+ 1. Read the skill and run its full audit protocol (Snyk, Socket.dev, SBOM generation, lockfile integrity)
135
+ 2. Report any additional findings with severity levels
136
+
137
+ **Pass criteria**: Zero HIGH/CRITICAL vulnerabilities in production dependencies.
138
+
139
+ ## 9. Document results
140
+
141
+ **Note on report file**: `docs/audits/phase-N-validation.md` is written progressively. Step 5.8 creates the file and appends the `## Spec Coverage` section. Step 9 appends all remaining sections. Do not recreate or overwrite the file in Step 9 — append only.
142
+
143
+ - Test results and coverage
144
+ - Lint and type-check status
145
+ - Build status
146
+ - Accessibility findings
147
+ - Performance budget results (7a) and deep audit findings (7b)
148
+ - Security review findings (including DAST results if applicable)
149
+ - Dependency audit results
150
+ - API documentation sync status (if applicable)
151
+ - Deployment strategy compliance (if applicable)
152
+ - CI/CD pipeline status
153
+ - Staging deployment result
154
+ - Migration verification status
155
+ - Pass/fail verdict
156
+
157
+ ## 10. Present results and next steps
158
+
159
+ Read .agent/skills/verification-before-completion/SKILL.md and follow its methodology.
160
+
161
+ Use `notify_user` to present the validation report.
162
+
163
+ ### Proposed next steps
164
+
165
+ - **If all checks pass**: "Phase N validation complete. Next: Run `/update-architecture-map` to ensure the project's living architecture document is up-to-date."
166
+ - **If any checks fail**: "Fix the failures listed in the validation report and re-run `/validate-phase` for Phase N."
167
+ - **If new requirements were discovered during validation** (scope gaps, missing features, behavioral corrections): Use `/evolve-feature` to add them at the correct entry point layer. Do not attempt to add them directly to specs — evolution must go through the classify → cascade flow to maintain layer consistency.
@@ -8,6 +8,7 @@ pipeline:
8
8
  loop: true # one validate per phase
9
9
  skills: [adversarial-review, code-review-pro, deployment-procedures, security-scanning-security-hardening, testing-strategist, verification-before-completion]
10
10
  calls-bootstrap: false
11
+ shards: [validate-phase-quality, validate-phase-readiness]
11
12
  ---
12
13
 
13
14
  // turbo-all
@@ -16,172 +17,36 @@ pipeline:
16
17
 
17
18
  Comprehensive validation of a completed implementation phase.
18
19
 
19
- ---
20
-
21
- ## 0. Load validation skills
22
-
23
- Read these skills before running checks:
24
- 1. `.agent/skills/testing-strategist/SKILL.md` — Coverage strategy and test quality
25
- 2. `.agent/skills/code-review-pro/SKILL.md` — Review checklist for self-audit
26
- 3. `.agent/skills/deployment-procedures/SKILL.md` — Build and release readiness
20
+ **Input**: A completed phase with all slices implemented
21
+ **Output**: Validation report with pass/fail verdict
27
22
 
28
23
  ---
29
24
 
30
- ## 0.5. Parallel dispatch option
31
-
32
- If the phase contains independent slices that don't share files, validation can run in parallel:
33
-
34
- 1. **Identify independent slices** — slices that don't import from or export to each other
35
- 2. **Dispatch parallel validation** — run Steps 1–5 concurrently for independent slices using the `parallel-agents` skill
36
- 3. **Sequential for shared** — slices that share contracts or utilities must validate sequentially
37
-
38
- This is an optimization, not a requirement. Sequential validation is always correct.
39
-
40
- ## 1. Run test suite
41
-
42
- Run the Test Cmd from `.agent/instructions/commands.md`. All tests must pass. Zero tolerance.
43
-
44
- ## 2. Check coverage
45
-
46
- Run the Test Coverage Cmd from `.agent/instructions/commands.md`.
47
-
48
- 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:
49
- - Statements: 80%
50
- - Branches: 90% (critical paths: auth, payments, data mutations, permission checks), 75% (non-critical paths)
51
- - Functions: 80%
52
- - Lines: 80%
53
-
54
- Critical paths are defined as: auth flows, payment processing, data mutations, and permission/authorization checks.
55
-
56
- ## 2.5. Mutation testing (critical paths)
57
-
58
- **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):
25
+ ## Shard Overview
59
26
 
60
- 1. Run the mutation testing tool against critical path modules only (auth, payments, data mutations, permission checks)
61
- 2. **Required**: Mutation score ≥ 70% on critical paths — if below, the tests are passing but not actually catching bugs
62
- 3. **Recommended**: Mutation score 50% on non-critical paths log as a finding but don't block
63
-
64
- If mutation testing is not available in the project's tooling, skip and note in the validation report that mutation testing was not run.
65
-
66
- ## 3. Lint
67
-
68
- Run the Lint Cmd from the surface stack map.
69
-
70
- Zero lint errors. Warnings should be reviewed and addressed.
71
-
72
- ## 4. Type check
73
-
74
- Run the Type Check Cmd from the surface stack map.
75
-
76
- Zero type errors. Strict mode must be enabled.
77
-
78
- ## 5. Build
79
-
80
- Run the Build Cmd from the surface stack map.
81
-
82
- Build must succeed with no errors.
27
+ | # | Shard | What It Does |
28
+ |---|-------|-------------|
29
+ | 1 | [`validate-phase-quality`](.agent/workflows/validate-phase-quality.md) | Code quality gates: tests, coverage, mutation testing, lint, type-check, build, CI/CD, staging deploy, deployment strategy, migrations, spec coverage |
30
+ | 2 | [`validate-phase-readiness`](.agent/workflows/validate-phase-readiness.md) | Production readiness gates: API doc sync, accessibility, performance budgets, security review, DAST, dependency audit, results documentation, next steps |
83
31
 
84
32
  ---
85
33
 
86
- ## 5.5. CI/CD pipeline verification
34
+ ## Orchestration
87
35
 
88
- Verify the CI/CD pipeline is green for this phase's changes:
36
+ ### Step A Run `.agent/workflows/validate-phase-quality.md`
89
37
 
90
- 1. Check that a CI/CD configuration file exists (e.g., `.github/workflows/`, `.gitlab-ci.yml`)
91
- 2. Verify the pipeline has run for the latest commit in this phase
92
- 3. Verify ALL CI/CD jobs are passing (not just the test job — include lint, type-check, build, and any deployment jobs)
38
+ Loads validation skills, runs all code quality checks (tests, coverage, mutation testing, lint, type-check, build), verifies CI/CD pipeline, deploys to staging, verifies deployment strategy compliance, checks migrations, and runs the spec coverage sweep.
93
39
 
94
- **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.
40
+ ### Step B Run `.agent/workflows/validate-phase-readiness.md`
95
41
 
96
- **Pass criteria**: CI/CD pipeline is green for the latest commit in this phase.
42
+ Runs production readiness checks: API documentation sync, accessibility audit, performance budget enforcement, deep performance audit, security review (including surface-conditional DAST), dependency supply chain audit. Documents all results and presents the validation report with next steps.
97
43
 
98
44
  ---
99
45
 
100
- ## 5.6. Staging deployment gate
101
-
102
- 1. Deploy to staging using `.agent/skills/deployment-procedures/SKILL.md`
103
- 2. Verify deployment succeeded (no rollback triggered, no error logs in the deployment output)
104
- 3. Run smoke tests against the staging environment:
105
- - Health check endpoint returns 200
106
- - At least one authenticated route works with a valid token
107
- - At least one protected route returns 401/403 for unauthenticated requests
108
- 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`
109
- 5. **If deployment fails** → red path: Do not mark this phase as complete — diagnose the deployment failure, fix it, and re-run `/validate-phase`
110
-
111
- **Pass criteria**: Staging deployment succeeds and all smoke tests pass.
112
-
113
- ---
114
-
115
- ## 5.7. Migration verification
116
-
117
- 1. Run the migration status command (e.g., `prisma migrate status`, `drizzle-kit status`, or equivalent)
118
- 2. Verify there are no pending migrations and no failed migrations
119
- 3. Verify the CI/CD pipeline ran migrations successfully as part of this phase's deployment
120
- 4. Check that rollback scripts exist for each migration in this phase
121
- 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`
122
-
123
- **Pass criteria**: Migration status is clean. All migrations from this phase ran successfully in the CI/CD environment. Rollback scripts are present.
124
-
125
- ---
126
-
127
- ## 5.8. Spec coverage sweep
128
-
129
- 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.
130
-
131
- ---
132
-
133
- ## 6. Accessibility audit (if UI changes)
134
-
135
- Audit all new UI components in this phase for WCAG 2.1 AA compliance using the Accessibility skill(s) from the cross-cutting section.
136
-
137
- ## 7. Performance check
138
-
139
- Check if the `performance-optimization` skill is installed (look for `.agent/skills/performance-optimization/SKILL.md`).
140
-
141
- **If installed**:
142
- 1. Read `.agent/skills/performance-optimization/SKILL.md`
143
- 2. Run the skill's audit protocol against the phase's changed pages/routes/endpoints
144
- 3. Compare results to the targets in `docs/plans/ENGINEERING-STANDARDS.md` (response time budgets, bundle sizes, memory limits, or other surface-appropriate metrics)
145
- 4. Report any metrics that exceed the defined thresholds
146
-
147
- **If not installed**:
148
- - Note: "No performance optimization skill installed. Skipping automated performance audit."
149
- - Manually verify that no obviously expensive operations were added (large synchronous imports, unoptimized assets, missing lazy loading, N+1 queries, unbounded loops)
150
- - If performance is critical for this project, recommend installing the skill via `find-skills`
151
-
152
- ## 8. Security review
153
-
154
- Read .agent/skills/adversarial-review/SKILL.md and follow its structured methodology for generating attack scenarios, abuse cases, and race conditions against the phase's changes. Produce spec-level gap items for any identified risks. Feed these into the defense-in-depth audit below.
155
-
156
- Read .agent/skills/security-scanning-security-hardening/SKILL.md and run its full defense-in-depth audit protocol against the phase's changes (new endpoints, new data flows, new auth checks). Report findings with severity levels. Block the phase if any Critical or High severity issues are found.
157
-
158
- **Supplemental security checks (conditional)**: After the core audit completes, read the Security skill(s) from the cross-cutting section of the surface stack map. For each listed skill directory name, read `.agent/skills/[skill]/SKILL.md` and run its audit protocol as a supplement to the core audit.
159
-
160
- Report any additional findings from supplemental audits with the same severity classification.
161
-
162
- ## 9. Document results
163
-
164
- **Note on report file**: `docs/audits/phase-N-validation.md` is written progressively. Step 5.8 creates the file and appends the `## Spec Coverage` section. Step 9 appends all remaining sections. Do not recreate or overwrite the file in Step 9 — append only.
165
-
166
- - Test results and coverage
167
- - Lint and type-check status
168
- - Build status
169
- - Accessibility findings
170
- - Performance findings
171
- - Security review findings
172
- - CI/CD pipeline status
173
- - Staging deployment result
174
- - Migration verification status
175
- - Pass/fail verdict
176
-
177
- ## 10. Present results and next steps
178
-
179
- Read .agent/skills/verification-before-completion/SKILL.md and follow its methodology.
180
-
181
- Use `notify_user` to present the validation report.
182
-
183
- ### Proposed next steps
46
+ ## Quality Gate
184
47
 
185
- - **If all checks pass**: "Phase N validation complete. Next: Run `/update-architecture-map` to ensure the project's living architecture document is up-to-date."
186
- - **If any checks fail**: "Fix the failures listed in the validation report and re-run `/validate-phase` for Phase N."
187
- - **If new requirements were discovered during validation** (scope gaps, missing features, behavioral corrections): Use `/evolve-feature` to add them at the correct entry point layer. Do not attempt to add them directly to specs — evolution must go through the classify → cascade flow to maintain layer consistency.
48
+ You may not call `notify_user` until:
49
+ - [ ] All code quality checks pass (Shard 1)
50
+ - [ ] All production readiness checks pass (Shard 2)
51
+ - [ ] Validation report written to `docs/audits/phase-N-validation.md`
52
+ - [ ] Pass/fail verdict determined
@@ -46,9 +46,13 @@ Before loading skills, check whether the shard file at `docs/plans/ia/[shard-nam
46
46
 
47
47
  ### 1a. Read the authoritative sources
48
48
 
49
- Read the following files and build a **reconciliation table** comparing what each source says about this shard's features. Use the `ideation-index.md` Domain Documents table to find the correct domain file path (may be in `domains/` or `surfaces/{name}/` for multi-product projects). The ideation domain file is the **primary source of truth** for sub-features — the architecture design is secondary context.
49
+ Read the following files and build a **reconciliation table** comparing what each source says about this shard's features. Use the `ideation-index.md` Structure Map to find the correct domain folder path (may be under `domains/` or `surfaces/{name}/` for multi-product projects). The ideation domain's feature files are the **primary source of truth** for sub-features — the architecture design is secondary context.
50
50
 
51
- 1. The relevant ideation domain file for this shard (path from `ideation-index.md` Domain Documents table)
51
+ 1. The relevant ideation domain folder for this shard (path from `ideation-index.md` Structure Map):
52
+ - Read the domain's `*-index.md` for the children table and Role Matrix
53
+ - Read each child **feature `.md` file** for sub-feature details (Role Lens, behavior, edge cases)
54
+ - Read the domain's `*-cx.md` for cross-domain interactions relevant to this shard
55
+ - If the domain has sub-domain folders, recurse into them and aggregate all descendant feature files
52
56
  2. The shard's `## Features` section (from `/decompose-architecture-structure`)
53
57
  3. `docs/plans/ideation/ideation-index.md` — Must Have features for this domain
54
58
 
@@ -61,8 +65,8 @@ Present the reconciled `## Features` list to the user, including a count of newl
61
65
  > **Reconciled features for [Shard NN — Domain Name]:**
62
66
  > [bullet list of all sub-features, with `[Architecture-only]` markers]
63
67
  >
64
- > **[N] sub-features added from ideation domain file** that were missing from the shard skeleton.
65
- > **[M] sub-features marked `[Architecture-only]`** — not found in ideation domain file, added during decomposition.
68
+ > **[N] sub-features added from ideation domain tree** that were missing from the shard skeleton.
69
+ > **[M] sub-features marked `[Architecture-only]`** — not found in ideation domain tree, added during decomposition.
66
70
  >
67
71
  > "Does this feature list match your intent for this domain? Any sub-features to add, remove, or re-scope?"
68
72
 
@@ -76,12 +76,16 @@ Once a stage is locked, downstream stages may not contradict it. To change a loc
76
76
  | ↳ | `/evolve-feature-classify` | Feature description | Classified change + new content at entry point | Evolution |
77
77
  | ↳ | `/evolve-feature-cascade` | Classified change + entry point | Layer-by-layer additions + implementation impact | Evolution |
78
78
  | 8 | `/plan-phase` | Architecture + specs | Dependency-ordered TDD slices | Planning |
79
+ | ↳ | `/plan-phase-preflight` | Approved specs | Phase gate + completeness audit + consistency check | Planning |
80
+ | ↳ | `/plan-phase-write` | Preflight pass | Slices + acceptance criteria + progress files | Planning |
79
81
  | 9 | `/implement-slice` | Slice acceptance criteria | Working code via Red→Green→Refactor | Implementation |
80
82
  | ↳ | `/implement-slice-setup` | Slice from phase plan | Progress check + skills + contracts + parallel mode | Implementation |
81
83
  | ↳ | `/implement-slice-tdd` | Contract + tests | Red→Green→Refactor + validation + progress tracking | Implementation |
82
84
  | 9.5 | `/verify-infrastructure` | Implemented infra or auth slice | Operational verification report | Verification |
83
85
  | 10 | `/validate-phase` | Completed phase | Full validation gate | Verification |
84
- | 11 | `/evolve-contract` | Changed Zod schema | Safe schema migration | Maintenance |
86
+ | | `/validate-phase-quality` | Completed phase | Code quality gates — tests, coverage, lint, type-check, build, CI/CD, staging, migrations, spec coverage | Verification |
87
+ | ↳ | `/validate-phase-readiness` | Quality gates passed | Production readiness gates — API docs, accessibility, performance, security, dependency audit, results | Verification |
88
+ | 11 | `/evolve-contract` | Changed `{{CONTRACT_LIBRARY}}` schema | Safe schema migration | Maintenance |
85
89
 
86
90
  > **Note**: Rows marked with ↳ are independently-invocable sub-workflows (shards)
87
91
  > of their parent command. The parent orchestrates them in sequence, but each shard
@@ -83,6 +83,8 @@ Once a stage is locked, downstream stages may not contradict it. To change a loc
83
83
  | ↳ | `/implement-slice-tdd` | Contract + tests | Red→Green→Refactor + validation + progress tracking | Implementation |
84
84
  | 7.5 | `/verify-infrastructure` | Implemented infra or auth slice | Operational verification report | Verification |
85
85
  | 10 | `/validate-phase` | Completed phase | Full validation gate | Verification |
86
+ | ↳ | `/validate-phase-quality` | Completed phase | Code quality gates — tests, coverage, lint, type-check, build, CI/CD, staging, migrations, spec coverage | Verification |
87
+ | ↳ | `/validate-phase-readiness` | Quality gates passed | Production readiness gates — API docs, accessibility, performance, security, dependency audit, results | Verification |
86
88
  | 11 | `/evolve-contract` | Changed `{{CONTRACT_LIBRARY}}` schema | Safe schema migration | Maintenance |
87
89
 
88
90
 
@@ -35,19 +35,19 @@ The pipeline is a linear sequence of commands. Each step tells you what to run n
35
35
  You describe your idea (or point to a document with @file).
36
36
  The pipeline explores your idea using recursive breadth-before-depth:
37
37
  - Level 0: Maps all domains in your product
38
- - Level 1: Sweeps sub-areas within each domain
38
+ - Level 1: Sweeps each domain for sub-areas (Classification Gate: sub-domain folder or feature file?)
39
39
  - Level 2+: Drills vertically until each domain is exhausted
40
40
  At every level, a Deep Think protocol generates hypotheses based on
41
41
  domain knowledge — "Based on this industry, I'd expect X. Is that relevant?"
42
- Cross-cutting concerns are tracked continuously in a dedicated ledger.
43
- Each domain gets its own file the moment it's discovered (shard-as-you-go).
44
-
45
- Output: docs/plans/ideation/ folder:
46
- ideation-index.md ← pipeline key file (domain map, MoSCoW, coverage)
47
- domains/*.md one file per domain
48
- meta/*.md problem, personas, constraints, competitive landscape
49
- cross-cuts/ cross-cut ledger
50
- docs/plans/vision.md ← human-readable executive summary (not a pipeline input)
42
+ Cross-cutting concerns are tracked at the level where they occur (CX files).
43
+ Each domain gets its own folder the moment it's discovered (fractal-as-you-go).
44
+
45
+ Output: docs/plans/ideation/ folder (fractal tree):
46
+ ideation-index.md ← pipeline key file (structure map, MoSCoW, coverage)
47
+ ideation-cx.md global cross-cuts
48
+ domains/*/ domain folders (index + CX + feature files)
49
+ meta/*.md problem, personas, constraints, competitive landscape
50
+ docs/plans/vision.md ← human-readable executive summary (not a pipeline input)
51
51
 
52
52
  Step 2: /audit-ambiguity ideation ── MANDATORY ──
53
53
  Scores the ideation folder against a 12-dimension rubric.
@@ -32,36 +32,87 @@ The intelligence of the kit lives entirely within the `.agent/` directory.
32
32
 
33
33
  ## 2. Ideation Architecture
34
34
 
35
- The ideation layer is the pipeline's first output and the source of truth for all downstream specification work. It replaces the former monolithic `vision.md` approach with a sharded folder structure that scales with project complexity.
35
+ The ideation layer is the pipeline's first output and the source of truth for all downstream specification work. It uses a **fractal folder structure** — every node (surface, domain, sub-domain) is a folder containing an index file, a cross-cut (CX) file, and its children. Leaf nodes are `.md` feature files. This pattern is universal regardless of project complexity.
36
36
 
37
37
  ### Pipeline Key File
38
38
 
39
- `docs/plans/ideation/ideation-index.md` is the **pipeline key file** — the primary entry point for all downstream workflows. When `/create-prd`, `/decompose-architecture`, or any specification workflow needs to understand the product, it reads `ideation-index.md` first, then follows links to relevant domain files for detail.
39
+ `docs/plans/ideation/ideation-index.md` is the **pipeline key file** — the primary entry point for all downstream workflows. When `/create-prd`, `/decompose-architecture`, or any specification workflow needs to understand the product, it reads `ideation-index.md` first, then follows links into the fractal tree.
40
40
 
41
41
  `docs/plans/vision.md` still exists but is a **human-readable executive summary** only — a sales pitch compiled from the ideation folder. No downstream workflow reads it as a data source.
42
42
 
43
- ### Folder Structure
43
+ ### Structural Classification (4 Project Shapes)
44
+
45
+ During `/ideate-extract`, every project is classified into one of four shapes that governs folder layout:
46
+
47
+ | Shape | When | Folder Pattern |
48
+ |-------|------|----------------|
49
+ | `single-surface` | One surface (e.g., web app only) | Flat `domains/` at top level |
50
+ | `multi-surface-shared` | Multiple surfaces sharing the same backend (e.g., web + mobile) | Flat `domains/` with surface annotations in feature files |
51
+ | `multi-product-hub` | One primary surface owns most logic; others consume it | Primary surface's folder owns shared domains; others reference them |
52
+ | `multi-product-peer` | Independent products with shared infrastructure | `shared/` folder for shared domains; surface folders for exclusive domains |
53
+
54
+ ### Fractal Folder Structure
44
55
 
45
56
  ```text
46
57
  docs/plans/ideation/
47
- ├── ideation-index.md # Pipeline key file domain map, MoSCoW summary, coverage
48
- ├── domains/ # One file per product domain
49
- ├── user-management.md
50
- │ ├── billing.md
51
- └── ...
58
+ ├── ideation-index.md # Super-index shape, structure map, MoSCoW, progress
59
+ ├── ideation-cx.md # Global CX cross-surface interactions (if multi-product)
60
+ ├── domains/ # Top-level domains (single/multi-surface-shared)
61
+ │ ├── 01-user-management/ # Each domain is a FOLDER, not a file
62
+ │ ├── user-management-index.md # Children table, Role Matrix, decisions
63
+ │ │ ├── user-management-cx.md # Cross-cuts between this domain's children
64
+ │ │ ├── 01-registration.md # Leaf feature file (Role Lens, behavior, edge cases)
65
+ │ │ ├── 02-authentication/ # Sub-domain (promoted from feature if complex)
66
+ │ │ │ ├── authentication-index.md
67
+ │ │ │ ├── authentication-cx.md
68
+ │ │ │ ├── 01-login.md
69
+ │ │ │ └── 02-password-reset.md
70
+ │ │ └── 03-roles.md
71
+ │ └── 02-billing/
72
+ │ ├── billing-index.md
73
+ │ ├── billing-cx.md
74
+ │ └── ...
52
75
  ├── meta/ # Structured metadata
53
76
  │ ├── problem-statement.md
54
77
  │ ├── personas.md
55
78
  │ ├── constraints.md
56
79
  │ └── competitive-landscape.md
57
- └── cross-cuts/ # Cross-cutting concern tracking
58
- └── cross-cut-ledger.md
80
+ └── [surfaces/] # Only for multi-product-hub or multi-product-peer
81
+ ├── web/
82
+ │ ├── web-index.md
83
+ │ ├── web-cx.md
84
+ │ └── 01-dashboard/...
85
+ └── mobile/
86
+ ├── mobile-index.md
87
+ ├── mobile-cx.md
88
+ └── 01-notifications/...
59
89
  ```
60
90
 
61
91
  **Key properties:**
62
- - **Shard-as-you-go**: Domain files are created the moment a domain is identified during exploration, not batched after all exploration is complete
63
- - **Living documents**: Domain files and the index are updated in place as exploration deepens they are never dated (see Dated File Convention below)
64
- - **Downstream consumers**: `/create-prd` reads `ideation-index.md` + `meta/constraints.md`; `/decompose-architecture` reads `ideation-index.md` + domain files; specification workflows reference domain files for sub-feature detail
92
+ - **Fractal pattern**: Every folder has an index + CX file. Every leaf is a feature `.md` file. This is universal no exceptions.
93
+ - **Reactive depth**: Folders are created during exploration when complexity is discovered, not pre-scaffolded. A feature file can be promoted to a sub-domain folder if it reveals internal complexity.
94
+ - **Numbering**: Children are numbered `{NN}-{slug}` within their parent. Paths are expressed as dot-separated (e.g., `01.02.03` = domain 01, sub-domain 02, feature 03).
95
+ - **Soft depth limit**: 4 levels recommended. Level 5 triggers a user prompt to confirm structured complexity isn't runaway nesting.
96
+
97
+ ### Role Integration
98
+
99
+ Roles (personas) are defined once in `meta/personas.md` and then referenced at every level of the tree:
100
+
101
+ | Location | What | Purpose |
102
+ |----------|------|---------|
103
+ | `meta/personas.md` | Full persona definitions (6 fields each) | Single source of truth |
104
+ | Node index files | **Role Matrix** — which personas access which children | Structural overview of role coverage |
105
+ | Feature files | **Role Lens** — per-persona behavior details | Downstream input for IA/BE/FE multitenancy specs |
106
+
107
+ ### Node Classification Gate
108
+
109
+ Before creating any new node (domain, sub-domain, or feature), the agent runs a classification gate:
110
+
111
+ 1. **What is it?** — Domain (top-level concept), sub-domain (2+ interacting capabilities), or feature (single capability)
112
+ 2. **Where does it go?** — Surface-exclusive, hub-owned, shared, or top-level (depends on project shape)
113
+ 3. **Does it already exist?** — Check for duplicates before creating
114
+
115
+ This prevents incorrect domain placement — the primary failure mode of the old flat structure.
65
116
 
66
117
  ### Exploration Model
67
118
 
@@ -69,20 +120,20 @@ The `/ideate` workflow uses **recursive breadth-before-depth exploration**:
69
120
 
70
121
  | Level | Scope | What happens |
71
122
  |---|---|---|
72
- | **Level 0** | Global domain map | Identify all top-level domains in the product. Each gets a file in `domains/`. |
73
- | **Level 1** | Sub-area sweep per domain | For each domain, identify all sub-areas. Mark each with a depth status marker. |
74
- | **Level 2+** | Vertical drilling | Drill into each sub-area until no new information emerges. Recursion: new domains discovered during drilling loop back to Level 0. |
123
+ | **Level 0** | Global domain map | Identify all top-level domains. Run Classification Gate for each. Create domain folders. |
124
+ | **Level 1** | Domain breadth sweep | For each domain, identify sub-areas. Classification Gate: sub-domain folder or feature file? Update Role Matrix. |
125
+ | **Level 2+** | Vertical drilling | Drill each child. Fill feature files (Role Lens, behavior, edge cases). Promote features to sub-domains if complex. |
75
126
 
76
- Each domain file tracks its sub-areas with status markers:
127
+ Each node tracks its status:
77
128
 
78
129
  | Marker | Meaning |
79
130
  |---|---|
80
131
  | `[SURFACE]` | Identified but unexplored |
81
- | `[BREADTH]` | Sub-areas listed, not detailed |
132
+ | `[BREADTH]` | Children listed, not detailed |
82
133
  | `[DEEP]` | Core logic, edge cases, interactions documented |
83
134
  | `[EXHAUSTED]` | Deep Think yielded nothing new — domain complete |
84
135
 
85
- A domain reaches `[EXHAUSTED]` only when the Deep Think protocol generates no new hypotheses.
136
+ Status propagates upward: a node is `[EXHAUSTED]` only when ALL its children are `[EXHAUSTED]`.
86
137
 
87
138
  ### Deep Think Protocol
88
139
 
@@ -90,14 +141,30 @@ At every exploration level, the agent actively generates hypotheses:
90
141
 
91
142
  > *"Based on [industry knowledge / domain patterns / cross-domain interaction], I'd expect [feature/concern/edge case]. Is that relevant to your product?"*
92
143
 
93
- Hypotheses are tracked in domain files with resolution status (confirmed/rejected/deferred). This prevents shallow exploration — the agent doesn't just record what the user says, it actively probes for what the user hasn't mentioned yet.
144
+ Hypotheses are tracked in feature files with resolution status (confirmed/rejected/deferred). This prevents shallow exploration — the agent doesn't just record what the user says, it actively probes for what the user hasn't mentioned yet.
145
+
146
+ ### Hierarchical Cross-Cuts
147
+
148
+ Cross-cutting concerns are tracked **at the level where they occur**, not in a single flat ledger:
149
+
150
+ | CX File Location | What It Tracks |
151
+ |-----------------|----------------|
152
+ | `ideation-cx.md` (global) | Cross-surface interactions (multi-product only) |
153
+ | `{surface}-cx.md` | Cross-domain interactions within a surface |
154
+ | `{domain}-cx.md` | Cross-sub-domain interactions within a domain |
155
+ | `{sub-domain}-cx.md` | Cross-feature interactions within a sub-domain |
156
+
157
+ Each CX entry includes which nodes interact, confidence level, 5 synthesis questions (trigger, data, flow, failure, scope), role scoping, and rejected pairs with reasoning.
158
+
159
+ ### Downstream Consumption
94
160
 
95
- ### Cross-Cut Ledger
161
+ | Consumer | What It Reads |
162
+ |----------|--------------|
163
+ | `/create-prd` | `ideation-index.md` + `meta/constraints.md` |
164
+ | `/decompose-architecture` | `ideation-index.md` + domain indexes (walks fractal tree for shard boundary signals: depth, child count, CX density, Role Matrix) |
165
+ | Spec workflows | Domain indexes + feature files for sub-feature detail |
96
166
 
97
- Cross-cutting concerns (security, notifications, analytics, error handling, etc.) are tracked continuously in `cross-cuts/cross-cut-ledger.md` as they're discovered at any level, not batched into a separate pass. Each entry includes:
98
- - Which domains are involved
99
- - Confidence level (increases as exploration deepens)
100
- - Resolution status
167
+ > **Important**: Ideation does NOT prescribe shard boundaries. `/decompose-architecture` reads the fractal tree and makes architectural decisions about where to draw shard lines.
101
168
 
102
169
  ---
103
170