cfsa-antigravity 2.7.0 → 2.8.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 (50) hide show
  1. package/package.json +1 -1
  2. package/template/.agent/kit-sync.md +3 -3
  3. package/template/.agent/skills/prd-templates/references/architecture-completeness-checklist.md +28 -0
  4. package/template/.agent/skills/prd-templates/references/be-spec-classification.md +41 -0
  5. package/template/.agent/skills/prd-templates/references/bootstrap-verification-protocol.md +50 -0
  6. package/template/.agent/skills/prd-templates/references/constraint-exploration.md +41 -0
  7. package/template/.agent/skills/prd-templates/references/decision-confirmation-protocol.md +68 -0
  8. package/template/.agent/skills/prd-templates/references/decision-propagation.md +121 -0
  9. package/template/.agent/skills/prd-templates/references/domain-exhaustion-criteria.md +37 -0
  10. package/template/.agent/skills/prd-templates/references/engagement-tier-protocol.md +58 -0
  11. package/template/.agent/skills/prd-templates/references/evolution-layer-guidance.md +91 -0
  12. package/template/.agent/skills/prd-templates/references/expansion-modes.md +27 -0
  13. package/template/.agent/skills/prd-templates/references/folder-seeding-protocol.md +77 -0
  14. package/template/.agent/skills/prd-templates/references/input-classification.md +23 -0
  15. package/template/.agent/skills/prd-templates/references/map-guard-protocol.md +44 -0
  16. package/template/.agent/skills/prd-templates/references/persona-completeness-gate.md +20 -0
  17. package/template/.agent/skills/prd-templates/references/shard-boundary-analysis.md +76 -0
  18. package/template/.agent/skills/prd-templates/references/write-verification-protocol.md +57 -0
  19. package/template/.agent/workflows/create-prd-architecture.md +17 -23
  20. package/template/.agent/workflows/create-prd-compile.md +31 -22
  21. package/template/.agent/workflows/create-prd-design-system.md +18 -14
  22. package/template/.agent/workflows/create-prd-security.md +22 -24
  23. package/template/.agent/workflows/create-prd-stack.md +20 -11
  24. package/template/.agent/workflows/create-prd.md +27 -99
  25. package/template/.agent/workflows/decompose-architecture-structure.md +14 -4
  26. package/template/.agent/workflows/decompose-architecture-validate.md +29 -80
  27. package/template/.agent/workflows/decompose-architecture.md +27 -60
  28. package/template/.agent/workflows/evolve-contract.md +7 -2
  29. package/template/.agent/workflows/evolve-feature-cascade.md +34 -78
  30. package/template/.agent/workflows/evolve-feature-classify.md +22 -56
  31. package/template/.agent/workflows/ideate-discover.md +89 -100
  32. package/template/.agent/workflows/ideate-extract.md +42 -138
  33. package/template/.agent/workflows/ideate-validate.md +57 -133
  34. package/template/.agent/workflows/ideate.md +32 -19
  35. package/template/.agent/workflows/implement-slice-setup.md +15 -5
  36. package/template/.agent/workflows/implement-slice-tdd.md +21 -5
  37. package/template/.agent/workflows/plan-phase-write.md +30 -1
  38. package/template/.agent/workflows/propagate-decision-apply.md +23 -90
  39. package/template/.agent/workflows/propagate-decision-scan.md +20 -91
  40. package/template/.agent/workflows/remediate-pipeline-execute.md +6 -1
  41. package/template/.agent/workflows/validate-phase-quality.md +14 -3
  42. package/template/.agent/workflows/validate-phase-readiness.md +1 -1
  43. package/template/.agent/workflows/verify-infrastructure.md +2 -0
  44. package/template/.agent/workflows/write-architecture-spec-deepen.md +8 -2
  45. package/template/.agent/workflows/write-architecture-spec-design.md +11 -14
  46. package/template/.agent/workflows/write-be-spec-classify.md +26 -104
  47. package/template/.agent/workflows/write-be-spec-write.md +49 -3
  48. package/template/.agent/workflows/write-be-spec.md +1 -1
  49. package/template/.agent/workflows/write-fe-spec-write.md +62 -3
  50. package/template/.agent/workflows/write-fe-spec.md +1 -1
@@ -27,11 +27,12 @@ Build the decision constraints map from the ideation output, then walk through e
27
27
 
28
28
  Before any tech stack decision, read `docs/plans/ideation/meta/constraints.md` to build the **decision constraints map**.
29
29
 
30
+ - **If `meta/constraints.md` does not exist** → **STOP**: "Constraints file missing. Run `/ideate` to completion — constraint exploration is required before tech stack decisions."
31
+ - **If it exists but has no `## Project Surfaces` section** → **STOP**: "Constraints file is missing Project Surfaces. Run `/ideate-validate` to complete constraint exploration."
32
+
30
33
  Also read `docs/plans/ideation/ideation-index.md` — specifically `## Structural Classification` (authoritative surface list and project shape) and `## Engagement Tier` (gate behavior for this session).
31
34
 
32
- **Tier behavior for tech stack decisions:**
33
- - 🤖 **Auto**: Agent uses constraints + Deep Think to select best-fit option per axis. Records reasoning. Writes decisions. User reviews all stack decisions at end of shard.
34
- - 🤝 **Hybrid** / 💬 **Interactive**: Present options, wait for user confirmation per axis (current behavior).
35
+ Read the engagement tier protocol (`.agent/skills/prd-templates/references/engagement-tier-protocol.md`) — apply the tier behavior for tech stack decisions.
35
36
 
36
37
  Build the constraints map:
37
38
 
@@ -58,8 +59,10 @@ Score Fit from 1–5 based on how well the option matches the constraints map. I
58
59
  1. Ask the constraint questions for this axis
59
60
  2. Filter options based on answers
60
61
  3. Present the filtered option table with recommendation
61
- 4. **Interactive/Hybrid**: Wait for user confirmation. **Auto**: Select highest-fit option via Deep Think, write reasoning to `architecture-draft.md`, mark as `[AUTO-CONFIRMED]`.
62
- 5. Fire bootstrap with only that key: read `.agent/workflows/bootstrap-agents.md` and call with `PIPELINE_STAGE=create-prd` + the confirmed key
62
+ 4. Follow the decision confirmation protocol (`.agent/skills/prd-templates/references/decision-confirmation-protocol.md`) tier-aware.
63
+ 5. Fire bootstrap with only that key: read `.agent/workflows/bootstrap-agents.md` and call with `PIPELINE_STAGE=create-prd` + the confirmed key. **HARD GATE**: Follow the bootstrap verification protocol (`.agent/skills/prd-templates/references/bootstrap-verification-protocol.md`). If bootstrap verification fails:
64
+ - **1st failure** → retry bootstrap once with the same key
65
+ - **2nd failure** → **STOP**: tell the user which key failed verification and ask: "Retry, skip this skill provisioning, or abort?"
63
66
  6. Move to next axis
64
67
 
65
68
  > **Note on backend axis bootstrap keys**: `BACKEND_FRAMEWORK` and `API_LAYER` are distinct bootstrap keys and must each fire as a separate `/bootstrap-agents` call — do not combine them.
@@ -70,21 +73,27 @@ Score Fit from 1–5 based on how well the option matches the constraints map. I
70
73
 
71
74
  Get explicit user decisions *(Interactive/Hybrid)* or auto-select with Deep Think reasoning *(Auto)* — no "TBD" allowed. Use the brainstorming skill's approach — one decision at a time.
72
75
 
76
+ **User indecision handling**: If the user expresses uncertainty ("I don't know", "not sure", "you pick") on any decision:
77
+ - Present your recommendation with clear reasoning
78
+ - If user accepts → proceed with it
79
+ - If user remains uncertain → read `.agent/skills/resolve-ambiguity/SKILL.md` and apply its methodology to narrow the decision space
80
+ - If after ambiguity resolution the user still can't decide → lock your recommendation with a note: "[Agent-recommended, user deferred]" — this can be revisited later via `/propagate-decision`
81
+
73
82
  > **Decision recording**: For each confirmed tech stack decision, read `.agent/skills/session-continuity/protocols/06-decision-analysis.md` and follow the **Decision Effect Analysis Protocol**. Tech stack choices have high downstream impact (they constrain frameworks, skills, deployment, and testing). Record each decision to `memory/decisions.md` with upstream/downstream effects.
74
83
 
75
84
  ### Database: Persistence Map Interview
76
85
 
77
86
  Instead of a single DATABASE decision pass, use the following structured persistence map interview to identify all required stores.
78
87
 
79
- Read .agent/skills/database-schema-design/SKILL.md and follow its Persistence Map Interview methodology (Sub-steps A–E). Fire bootstrap per the skill's instructions for each confirmed store.
88
+ Read .agent/skills/database-schema-design/SKILL.md and follow its Persistence Map Interview methodology (Sub-steps A–E). Fire bootstrap per the skill's instructions for each confirmed store. **HARD GATE**: Follow the bootstrap verification protocol (`.agent/skills/prd-templates/references/bootstrap-verification-protocol.md`) after each store is confirmed.
80
89
 
81
90
  ### Design Direction
82
91
 
83
- Read `.agent/skills/design-direction/SKILL.md` and follow its interview methodology to determine the project's visual direction. After confirmation, fire bootstrap with `DESIGN_DIRECTION=[confirmed direction]`.
92
+ Read `.agent/skills/design-direction/SKILL.md` and follow its interview methodology to determine the project's visual direction. After confirmation, fire bootstrap with `DESIGN_DIRECTION=[confirmed direction]`. **HARD GATE**: Follow the bootstrap verification protocol (`.agent/skills/prd-templates/references/bootstrap-verification-protocol.md`).
84
93
 
85
94
  ### Development tooling
86
95
 
87
- Read `.agent/skills/tech-stack-catalog/references/dev-tooling-decisions.md` for the tooling axes and bootstrap keys. After the user confirms all development tooling, fire bootstrap immediately with all keys listed in that reference file.
96
+ Read `.agent/skills/tech-stack-catalog/references/dev-tooling-decisions.md` for the tooling axes and bootstrap keys. After the user confirms all development tooling, fire bootstrap immediately with all keys listed in that reference file. **HARD GATE**: Follow the bootstrap verification protocol (`.agent/skills/prd-templates/references/bootstrap-verification-protocol.md`) — verify every key.
88
97
 
89
98
  ### After each tech decision
90
99
 
@@ -94,8 +103,8 @@ Read each installed skill's SKILL.md before proceeding. Append the confirmed dec
94
103
 
95
104
  Read `.agent/workflows/bootstrap-agents.md` and call it with `PIPELINE_STAGE=create-prd` plus only the keys just decided. Bootstrap runs after **each confirmed decision**, not in a batch at the end. At the end of all tech decisions, call bootstrap once more with `ARCHITECTURE_DOC` set to the dated filename.
96
105
 
97
- ### Propose next step
106
+ ### Next step
98
107
 
99
- All tech stack decisions are locked. Next: Run `/create-prd-architecture` to design the system architecture and data strategy.
108
+ **STOP** do NOT proceed to any other workflow. The only valid next step is `/create-prd-architecture`.
100
109
 
101
- > If invoked standalone, surface via `notify_user`.
110
+ > If invoked standalone, surface via `notify_user` and wait for user confirmation.
@@ -19,13 +19,7 @@ Transform the ideation output into a production-grade architecture design docume
19
19
  **Input**: `docs/plans/ideation/ideation-index.md` (must exist and be approved)
20
20
  **Output**: `docs/plans/YYYY-MM-DD-architecture-design.md` + `docs/plans/ENGINEERING-STANDARDS.md` + `docs/plans/data-placement-strategy.md`
21
21
 
22
- > **Depth standard**: Every section of the architecture document must be specified
23
- > to the point where a developer cannot misinterpret it. If you can write a
24
- > one-paragraph section summary, it's not detailed enough. Each section should
25
- > define every field, every flow, every error case, every permission boundary.
26
- > The specificity-standards rule (`.agent/rules/specificity-standards.md`) applies to every
27
- > word of the output. One-line placeholders like `[Auth, authorization, rate limits]`
28
- > are not architecture — they are headings waiting for content.
22
+ > **Depth standard**: Every section must be specified to the point where a developer cannot misinterpret it. The specificity-standards rule (`.agent/rules/specificity-standards.md`) applies to every word of the output.
29
23
 
30
24
  ---
31
25
 
@@ -33,43 +27,30 @@ Transform the ideation output into a production-grade architecture design docume
33
27
 
34
28
  Read `docs/plans/ideation/ideation-index.md`.
35
29
 
36
- If the file doesn't exist, tell the user to run `/ideate` first. Do not proceed without approved ideation output.
30
+ If the file doesn't exist → **STOP**: tell the user to run `/ideate` first.
37
31
 
38
- Use the **Structure Map** in `ideation-index.md` to locate specific files:
39
- - Constraints + surface classification → `meta/constraints.md`
40
- - Personas `meta/personas.md`
41
- - Domain details → fractal tree under `domains/` (or `surfaces/` for multi-product). Each domain is a **folder** containing `*-index.md` (children + Role Matrix), `*-cx.md` (cross-cuts), and child feature `.md` files. Walk the tree to the depth needed.
42
- - Cross-cutting concerns → `ideation-cx.md` (global cross-surface) + per-domain `*-cx.md` files within the fractal tree
43
- - Role coverage → Role Matrix in each domain index, Role Lens in each feature file (use for RBAC planning in security shard)
32
+ **Completeness validation**: If the file exists, verify it contains these required sections:
33
+ - `## Structural Classification`
34
+ - `## Engagement Tier`
35
+ - `## MoSCoW Summary` (with at least 1 Must Have feature)
44
36
 
45
- Pay special attention to the **Project Surfaces** section in `meta/constraints.md`it determines which tech stack axes apply.
37
+ If any required section is missing **STOP**: "ideation-index.md is incomplete missing `[section]`. Run `/ideate` to complete ideation before proceeding."
46
38
 
47
- Also read `## Engagement Tier` from `ideation-index.md`. If not set during ideation, ask now:
39
+ Use the **Structure Map** in `ideation-index.md` to locate: constraints, personas, domain details (fractal tree), cross-cutting concerns, and role coverage.
48
40
 
49
- > **How involved do you want to be?**
50
- > 1. 🤖 **Auto** — I design the full architecture via Deep Think. You review the compiled output.
51
- > 2. 🤝 **Hybrid** *(recommended)* — Structural steps auto. Architecture/product decisions pause for you.
52
- > 3. 💬 **Interactive** — I pause at every step.
41
+ Pay special attention to **Project Surfaces** in `meta/constraints.md` it determines which tech stack axes apply.
53
42
 
54
- **Wait for user answer.** If an ideation tier exists, present it as default. Write to `ideation-index.md` immediately.
43
+ Read `## Engagement Tier` from `ideation-index.md`. If not set, ask the user and write immediately.
55
44
 
56
- Each shard reads the tier and adapts gates: **Auto** = all gates auto-confirm with Deep Think reasoning. **Hybrid** = structural auto, architecture/product pause. **Interactive** = all pause.
45
+ Read `.agent/skills/prd-templates/references/engagement-tier-protocol.md` — each shard reads the tier and adapts gates.
57
46
 
58
47
  ---
59
48
 
60
49
  ## 2. Load skills
61
50
 
62
- ### Bundled skills
51
+ Read each skill SKILL.md listed in the frontmatter `skills` array.
63
52
 
64
- These skills are included in the kit read each SKILL.md:
65
- 1. `.agent/skills/api-design-principles/SKILL.md` — API design principles
66
- 3. `.agent/skills/security-scanning-security-hardening/SKILL.md` — Security model
67
- 4. `.agent/skills/clean-code/SKILL.md` — Architecture principles
68
- 5. `.agent/skills/brainstorming/SKILL.md` — For collaborative decisions
69
-
70
- ### Stack-specific skill discovery
71
-
72
- Check `.agent/skills/` for relevant skills. Read `.agent/skills/find-skills/SKILL.md` for guidance on discovering community skills for your chosen stack.
53
+ Check `.agent/skills/` for stack-specific skills. Read `.agent/skills/find-skills/SKILL.md` for community skill discovery.
73
54
 
74
55
  ---
75
56
 
@@ -83,103 +64,50 @@ Check `.agent/skills/` for relevant skills. Read `.agent/skills/find-skills/SKIL
83
64
  | 3 | [`create-prd-security`](.agent/workflows/create-prd-security.md) | Security model, compliance escalation, integration points |
84
65
  | 4 | [`create-prd-compile`](.agent/workflows/create-prd-compile.md) | Development methodology, phasing, compile architecture-design.md + ENGINEERING-STANDARDS.md |
85
66
 
86
- > **Progressive working artifact**: `docs/plans/architecture-draft.md` is written incrementally by shards 1–3 (stack decisions, system architecture, data strategy, security model, integration points) and read by shard 4 (compile) to produce the final dated `architecture-design.md`.
67
+ > **Progressive working artifact**: `docs/plans/architecture-draft.md` is written incrementally by shards 1–3 and read by shard 4 to compile the final dated `architecture-design.md`.
87
68
 
88
69
  ---
89
70
 
90
71
  ## Orchestration
91
72
 
92
73
  ### Step A — Run `.agent/workflows/create-prd-stack.md`
93
-
94
- Builds the constraints map from `ideation/meta/constraints.md`, presents tech stack options per axis, gets user decisions, fires bootstrap after each confirmation.
95
-
96
74
  ### Step A.5 — Run `.agent/workflows/create-prd-design-system.md`
97
-
98
- Establishes the structural UI architecture — navigation paradigm, layout grid, page archetypes, global component inventory, motion language, data density philosophy, and global state design language. Produces `docs/plans/design-system.md` which all FE specs must consume.
99
-
100
75
  ### Step B — Run `.agent/workflows/create-prd-architecture.md`
101
-
102
- Designs system architecture (components, data flow, deployment topology, API surface) and data strategy (placement, schema, queries, migrations, PII boundaries). Creates `docs/plans/data-placement-strategy.md`.
103
-
104
76
  ### Step C — Run `.agent/workflows/create-prd-security.md`
105
-
106
- Defines the security model (auth, authorization, validation, rate limits). Escalates compliance-heavy domains to full-depth sections. Documents integration points with failure modes and fallbacks.
107
-
108
77
  ### Step D — Run `.agent/workflows/create-prd-compile.md`
109
78
 
110
- Documents development methodology and phasing strategy. Compiles `docs/plans/YYYY-MM-DD-architecture-design.md` and `docs/plans/ENGINEERING-STANDARDS.md`.
111
-
112
79
  ---
113
80
 
114
81
  ## Step E — Quality gate
115
82
 
116
83
  ### Self-check against Architecture rubric
117
84
 
118
- Read .agent/skills/pipeline-rubrics/SKILL.md and apply its Architecture rubric for the self-check.
119
-
120
- Before presenting to the user, self-check both documents against the **Architecture Rubric** (12 dimensions) from `/audit-ambiguity`:
85
+ Read `.agent/skills/pipeline-rubrics/references/architecture-rubric.md` and apply all 15 dimensions as the self-check.
121
86
 
122
- | # | Dimension | Check |
123
- |---|-----------|-------|
124
- | 1 | Tech Stack Decisiveness | Is every applicable axis decided with rationale? No TBDs? |
125
- | 2 | System Architecture | Are all components, flows, and failure modes documented? |
126
- | 3 | Data Strategy | Are placement, schema, queries, migrations, and PII boundaries defined? |
127
- | 4 | Security Model | Are auth, authz, validation, rate limits, and CSP fully specified? |
128
- | 5 | Compliance Depth | Are regulated domains (minors, payments, health) given full-depth sections? |
129
- | 6 | API Design | Are surface, versioning, conventions, errors, and pagination defined? |
130
- | 7 | Integration Robustness | Do all externals have failure + fallback plans? |
131
- | 8 | Phasing Clarity | Are phases dependency-ordered with entry/exit criteria? |
132
- | 9 | Engineering Standards | Are all thresholds concrete? No TBDs in ENGINEERING-STANDARDS.md? |
133
- | 10 | Persistence Architecture | Is the persistence map complete? Do all cross-store entities have a consistency contract (canonical ID, creation sequence, deletion cascade, read join)? |
134
- | 11 | Error Architecture | Is the global error envelope defined with all four fields? Are all five error decisions confirmed (envelope, propagation chain, unhandled exceptions, client fallback, error boundaries)? |
135
- | 12 | Attack Surface Coverage | Is the attack surface review complete? Are OWASP Top 10 (web) and API Top 10 (API) addressed with named mechanisms? Are security headers configured? Is the observability architecture documented? |
87
+ Read `.agent/skills/prd-templates/references/architecture-completeness-checklist.md` and verify all items.
136
88
 
137
- Also verify completeness:
89
+ For any dimension that scores ⚠️ or ❌ → resolve it NOW. Loop back to the relevant shard.
138
90
 
139
- - [ ] Every "Must Have" feature from `ideation-index.md` MoSCoW list has a home in the architecture
140
- - [ ] Security model addresses all compliance constraints from `ideation/meta/constraints.md`
141
- - [ ] Compliance-heavy domains have their own top-level sections (not buried as sub-bullets)
142
- - [ ] All relevant skills installed for chosen stack
143
- - [ ] Validation command in Engineering Standards matches `AGENTS.md` validation command
144
- - [ ] For multi-surface: sync strategy defined, data ownership clear, conflict resolution specified
145
- - [ ] For cross-platform: platform-specific considerations documented for each target OS
146
- - [ ] Design system document exists at docs/plans/design-system.md and all seven decision areas are filled (no placeholders)
91
+ **Remediation loop guard**: Track remediation attempts per dimension. After **3 failed attempts** on the same dimension → **STOP**: present the dimension to the user as a known gap with context on what was tried. Include it in the review presentation as an unresolved item for user decision.
147
92
 
148
- For any dimension that scores ⚠️ or ❌, resolve it NOW. Loop back to the relevant step and resolve with the user.
149
-
150
- > ❌ STOP — do not call notify_user until all dimensions score ✅.
93
+ > STOP do not call notify_user until all dimensions score and all checklist items pass.
151
94
 
152
95
  ### Depth audit
153
96
 
154
- Before presenting to the user, re-read the entire architecture document and for EACH section ask:
155
-
156
- > "Could a developer implement this without asking a single clarifying question?"
157
-
158
- If the answer is no for ANY section:
159
- 1. Identify what's missing (field types? flow steps? error cases? permission rules?)
160
- 2. Add the missing detail NOW — do not flag it, resolve it
161
- 3. Re-check the section
162
-
163
- This is the single most important step. The difference between a useful architecture document and a useless one is whether this audit is done honestly. A 2,000-word architecture doc is almost certainly too shallow for any non-trivial project.
97
+ Re-read the entire architecture document and for EACH section ask: "Could a developer implement this without asking a single clarifying question?"
164
98
 
165
- If gaps are found, loop back to the relevant step and resolve with the user.
99
+ If no identify what's missing, add the detail NOW, re-check.
166
100
 
167
- > **Note**: This is an internal self-check, not a formal audit. For a rigorous,
168
- > independent audit with evidence citations, run `/audit-ambiguity architecture` as a
169
- > separate step after this workflow completes.
101
+ > **Note**: This is an internal self-check. For a rigorous independent audit, run `/audit-ambiguity architecture` after this workflow completes.
170
102
 
171
103
  ## Step F — Request review and next steps
172
104
 
173
- Use `notify_user` to present to the user:
174
- - **Both** the architecture design document and the Engineering Standards document
175
- - Summary of the self-check results (all 12 dimensions + completeness checklist)
176
- - Any areas where you resolved gaps during the self-check
105
+ Use `notify_user` to present both documents with self-check results.
177
106
 
178
- Both documents must be approved before proceeding. Do NOT proceed to the next step until the user sends a message explicitly approving this output. Proposing next steps is not the same as receiving approval. Wait for explicit approval before continuing.
107
+ **STOP** do NOT proceed until the user explicitly approves.
179
108
 
180
- ### Proposed next steps
109
+ ### Next step
181
110
 
182
- Once approved, present the user with the appropriate next step:
111
+ **STOP** do NOT propose `/decompose-architecture` or any other pipeline workflow. The only valid next step is:
183
112
 
184
- - **Default recommendation**: Run `/audit-ambiguity architecture` — recommended for all projects, especially those with compliance constraints
185
- - **Skip condition**: Only skip `/audit-ambiguity architecture` if all 12 dimensions scored ✅ AND the project has zero compliance constraints. In that case, recommend `/decompose-architecture` directly.
113
+ - `/audit-ambiguity architecture` — unconditionally mandatory. The self-check above cannot replace an independent audit. After the audit passes, the next step is `/decompose-architecture`.
@@ -19,7 +19,10 @@ pipeline:
19
19
 
20
20
  Create directory structure, shard skeleton files, and all layer indexes.
21
21
 
22
- **Prerequisite**: Read the approved domain boundaries from `docs/plans/ia/decomposition-plan.md`. If this file does not exist, the boundaries have not been approved — tell the user to run `/decompose-architecture` Steps 3-4.5 first.
22
+ **Prerequisite**: Read the approved domain boundaries from `docs/plans/ia/decomposition-plan.md`.
23
+
24
+ - If this file does not exist → **STOP**: "Decomposition plan missing. Run `/decompose-architecture` Steps 3-4.5 first."
25
+ - If the file exists but contains no `## Domain Boundary Table` → **STOP**: "Decomposition plan is incomplete — no domain boundary table found. Run `/decompose-architecture` Step 3 to generate domain boundaries."
23
26
 
24
27
  ---
25
28
 
@@ -55,6 +58,13 @@ Read `.agent/skills/prd-templates/SKILL.md` and follow its Shard Seeding Procedu
55
58
 
56
59
  Fallback for domains not covered in the ideation domain folders is defined in the skill's Shard Seeding Procedure.
57
60
 
61
+ **Post-creation verification**: After all skeletons are created, list the `docs/plans/ia/` directory. Verify:
62
+ - Every shard in the decomposition plan has a corresponding `.md` file
63
+ - `00-infrastructure.md` exists regardless of domain decomposition
64
+ - No empty files (0 bytes)
65
+
66
+ If any skeleton is missing → create it now. Do not proceed to index creation with missing skeletons.
67
+
58
68
  ## 6. Create IA index
59
69
 
60
70
  Read `.agent/skills/prd-templates/references/decomposition-templates.md` for the **IA Index** template. Create `docs/plans/ia/index.md` using the template, populating the shards table with all shards created in Step 5.
@@ -73,8 +83,8 @@ Read `.agent/skills/prd-templates/references/decomposition-templates.md` for the
73
83
 
74
84
  For multi-surface projects, each surface's own `index.md` contains the standard three-layer table (IA/BE/FE) scoped to that surface, following the same format as the single-surface master index.
75
85
 
76
- ### Propose next step
86
+ ### Next step
77
87
 
78
- Directory structure, shard skeletons, and all layer indexes are created. Next: Run `/decompose-architecture-validate` to identify deep dive candidates, annotate shard types, validate the dependency graph, and generate the spec pipeline tracker.
88
+ **STOP** do NOT proceed to any other workflow. The only valid next step is `/decompose-architecture-validate`.
79
89
 
80
- > If this shard was invoked standalone (not from `/decompose-architecture`), surface this via `notify_user`.
90
+ > If invoked standalone, surface via `notify_user` and wait for user confirmation.
@@ -19,118 +19,67 @@ pipeline:
19
19
 
20
20
  Identify deep dive candidates, annotate shard document types, validate the dependency graph, generate the spec pipeline tracker, and request review.
21
21
 
22
- **Prerequisite**: Directory structure, shard skeletons, and layer indexes must exist (from `/decompose-architecture-structure` or equivalent). The IA index at `docs/plans/ia/index.md` and shard files must be in place.
22
+ **Prerequisite**: Directory structure, shard skeletons, and layer indexes must exist (from `/decompose-architecture-structure`).
23
23
 
24
24
  ---
25
25
 
26
26
  ## 9.5. Proactive shard load pre-check (ideation signal)
27
27
 
28
- Before identifying deep dives, read the ideation domain folders that fed each shard. The sub-area count from ideation is a **leading indicator** of shard complexity.
28
+ Read `.agent/skills/prd-templates/references/shard-boundary-analysis.md` **Shard Load Thresholds** table.
29
29
 
30
30
  For each shard skeleton:
31
- 1. Read the corresponding ideation domain folder (use the path from `ideation-index.md` Structure Map — may be under `domains/` or `surfaces/{name}/`). Read the folder's `*-index.md` for the children table.
32
- 2. Count the child feature files and sub-domain folders listed in the domain index
33
- 3. Compare against the shard load thresholds:
34
-
35
- | Ideation Sub-Areas | Pre-Check Action |
36
- |---|---|
37
- | ≤6 | ✅ No concern — proceed to skeleton validation |
38
- | 7–9 | ⚠️ **Pre-flag for split review** — note in the shard skeleton: `> ⚠️ Ideation source has [N] sub-areas — likely split candidate. Review at calibration gate.` |
39
- | ≥10 | 🚩 **Proactive split proposal** — present a split proposal to the user NOW, before the calibration gate. Use the same split format as Step 12. If the user approves, create the split shards immediately and update the decomposition plan. |
40
-
41
- > **Why proactive?** The reactive calibration gate (Step 12) catches overloaded shards, but only after skeletons are fully seeded. By reading ideation sub-area counts first, we avoid creating a massive skeleton only to immediately split it. For multi-product projects where a single surface domain (e.g., "Operations" in a desktop shop app) might have 15+ sub-areas, this saves significant rework.
31
+ 1. Read the corresponding ideation domain folder via `ideation-index.md` Structure Map
32
+ 2. Count child feature files and sub-domain folders in the domain index
33
+ 3. Compare against the load thresholds table and take the specified action
42
34
 
43
35
  ## 10. Identify deep dive candidates
44
36
 
45
- Read .agent/skills/architecture-mapping/SKILL.md and follow its methodology.
37
+ Read `.agent/skills/architecture-mapping/SKILL.md` and follow its methodology.
46
38
 
47
39
  For each shard marked "Needs Deep Dive" in the domain boundary table:
48
-
49
- 1. Create an empty deep dive skeleton at `docs/plans/ia/deep-dives/[feature-name].md`
50
- - **Naming convention**: Use kebab-case derived from the feature name (e.g., `chat-orchestration.md`, `age-verification-flow.md`, `order-state-machine.md`)
51
- 2. Add a reference to it in the parent shard's "Deep Dives Needed" section
52
- 3. Add it to the IA index deep dives column
40
+ 1. Create empty deep dive skeleton at `docs/plans/ia/deep-dives/[feature-name].md`
41
+ 2. Add reference in parent shard's "Deep Dives Needed" section
42
+ 3. Add to IA index deep dives column
53
43
 
54
44
  ## 11. Annotate expected shard types
55
45
 
56
- Based on domain boundary analysis, add a **preliminary** `Document Type`
57
- annotation to each shard skeleton. `/write-architecture-spec` confirms or reclassifies.
58
-
59
- | Classification | Expected BE Specs |
60
- |---------------|-------------------|
61
- | **Feature domain** | 1 |
62
- | **Multi-domain** | N (split along sub-feature boundaries) |
63
- | **Cross-cutting** | 1 (`00-*`) |
64
- | **Structural reference** | 0 |
65
-
66
- ```markdown
67
- > **Document Type** (preliminary): Feature domain | Multi-domain | Cross-cutting | Structural reference
68
- ```
69
-
70
- > **Note**: Classification is based on domain analysis, not shard content (which doesn't
71
- > exist yet). `/write-be-spec` uses the confirmed type to determine spec count.
46
+ Read `.agent/skills/prd-templates/references/shard-boundary-analysis.md` **Shard Document Type Classification** table. Add preliminary Document Type annotation to each shard skeleton.
72
47
 
73
48
  ## 12. Dependency graph validation
74
49
 
75
- Verify the decomposition (structural checks only content doesn't exist yet):
76
-
77
- Read .agent/skills/architecture-mapping/SKILL.md and follow its methodology for dependency graph validation.
50
+ Read `.agent/skills/architecture-mapping/SKILL.md` and follow its dependency graph validation methodology.
78
51
 
79
- - **Must Have coverage gate**: Read `docs/plans/ideation/ideation-index.md` and extract every feature listed under "Must Have" in the MoSCoW Summary. For each Must Have feature, verify it appears in at least one shard's Features section. If any Must Have feature is not covered by any shard → **STOP**: "The following Must Have features from ideation-index.md are not covered by any shard: [list]. Add them to the appropriate shards before proceeding."
52
+ Read `.agent/skills/prd-templates/references/shard-boundary-analysis.md` → **Sub-feature Count Thresholds** and **Split Proposal Format**.
80
53
 
81
- - **Shard load calibration gate**: After the Must Have coverage gate passes, count the sub-features in each shard's `## Features` section using the **bullet/named-item rule**: count every bullet point or named item under `## Features`, **excluding** group headers (lines that introduce a group of sub-features but are not themselves a concrete capability). If Step 9.5 pre-flagged any shards, they should be reviewed first. Compare against the following thresholds:
54
+ - **Must Have coverage gate**: Read `ideation-index.md` MoSCoW Summary. Every Must Have feature must appear in at least one shard. If any missing **STOP**.
82
55
 
83
- | Sub-feature Count | Action |
84
- |-------------------|--------|
85
- | **≤6** | ✅ OK — proceed |
86
- | **7–9** | ⚠️ Flag for user review — present the sub-feature list and ask: "This shard has [N] sub-features. Keep as-is, or split?" |
87
- | **≥10** | 🛑 **Hard stop** — do NOT proceed. Present a mandatory split proposal and **wait for the user to approve the split** before continuing. No shard may exit this gate with ≥10 sub-features. |
56
+ - **Shard load calibration gate**: Count sub-features in each shard using the bullet/named-item rule (defined in the analysis reference). If Step 9.5 pre-flagged shards, review first. Apply the thresholds. For ≥10, use the split proposal format from the reference.
88
57
 
89
- > **What counts as a sub-feature**: Count each bullet or named item under `## Features`. Group headers (e.g., "Content Management:") that introduce a cluster of sub-features are **not** counted — only the items beneath them. If a bullet contains sub-bullets, count each sub-bullet independently. When in doubt, ask: "Would a product manager list this as a separate line item in a release note?"
58
+ **After any split**: Update `docs/plans/ia/decomposition-plan.md` and re-run Must Have coverage gate.
90
59
 
91
- **Split proposal format:**
92
- ```
93
- Shard [NN] [domain name] has [N] sub-features (threshold: ≥10 mandatory split)
94
-
95
- Current sub-features:
96
- 1. [sub-feature]
97
- 2. [sub-feature]
98
- ...
99
-
100
- Proposed split:
101
- [NN]a — [new domain name] → file: docs/plans/ia/[NN]a-[domain].md
102
- Sub-features: 1, 3, 5
103
- [NN]b — [new domain name] → file: docs/plans/ia/[NN]b-[domain].md
104
- Sub-features: 2, 4, 6
105
-
106
- Split rationale: [why these groups are independent]
107
- ```
108
-
109
- **After any split**: Update `docs/plans/ia/decomposition-plan.md` with the revised domain boundary table and re-run the Must Have coverage gate to confirm no features were lost in the split.
60
+ **Split loop guard**: Track how many times the same shard has been split.
61
+ - **1st split** → normal. Apply the split.
62
+ - **2nd split on the same shard** → warn: "Shard `[name]` has been split twice. This may indicate the domain boundary is wrong. Present to user: re-split, or merge back and redraw the domain boundary?"
63
+ - If the total number of shards exceeds 20 → warn: "Shard count is [N]. Projects with 20+ shards are unusually large. Verify this is correct with the user."
110
64
 
65
+ Verify structural integrity:
111
66
  - [ ] No circular dependencies between shards
112
67
  - [ ] Cross-cutting shards (00-*) don't depend on feature shards
113
68
  - [ ] Every shard has a preliminary Document Type annotation
114
- - [ ] Deep dive candidates are referenced from their parent shards
115
- - [ ] BE/FE indexes exist with conventions templates (mapping tables will be populated later)
116
- - [ ] For multi-surface: shared surface shards have lower numbers than surface-specific shards that depend on them
117
- - [ ] For multi-surface: each surface has its own index.md with IA/BE/FE layer table
118
- - [ ] For multi-surface: cross-surface dependencies point to shared/ shards, not directly to another surface's shards
69
+ - [ ] Deep dive candidates are referenced from parent shards
70
+ - [ ] BE/FE indexes exist with conventions templates
71
+ - [ ] Multi-surface: shared shards have lower numbers; cross-surface deps point to shared/
119
72
 
120
73
  ## 13. Generate spec pipeline tracker
121
74
 
122
- Read `.agent/skills/session-continuity/protocols/07-spec-pipeline-generation.md` and follow the **Spec Pipeline Generation Protocol**
123
- to create `.agent/progress/spec-pipeline.md` tracking IA/BE/FE completion per shard.
75
+ Read `.agent/skills/session-continuity/protocols/07-spec-pipeline-generation.md` and follow the Spec Pipeline Generation Protocol.
124
76
 
125
77
  ## 14. Request review and propose next steps
126
78
 
127
- Use `notify_user` to present:
128
- - The full `docs/plans/ia/` directory (shard skeletons + index)
129
- - `docs/plans/be/index.md`
130
- - `docs/plans/fe/index.md`
131
- - `docs/plans/index.md`
132
- - `.agent/progress/spec-pipeline.md`
79
+ Use `notify_user` to present: IA directory, BE index, FE index, master index, spec pipeline tracker.
80
+
81
+ **STOP** — do NOT proceed until the user explicitly approves.
133
82
 
134
- The decomposition must be approved before filling in shards with `/write-architecture-spec`. Do NOT proceed to the next step until the user sends a message explicitly approving this output. Proposing next steps is not the same as receiving approval. Wait for explicit approval before continuing.
83
+ ### Next step
135
84
 
136
- **Proposed next step**: Once approved, run `/write-architecture-spec` starting with the lowest-numbered skeleton shard. Read `.agent/progress/spec-pipeline.md` to identify which shard to start with.
85
+ **STOP** — do NOT proceed to any other workflow. The only valid next step is `/write-architecture-spec` starting with the lowest-numbered shard per `.agent/progress/spec-pipeline.md`.
@@ -17,7 +17,7 @@ shards: [decompose-architecture-structure, decompose-architecture-validate]
17
17
  Break the architecture design document into domain-bounded IA shards and create the full spec layer structure.
18
18
 
19
19
  **Input**: `docs/plans/YYYY-MM-DD-architecture-design.md` (must exist and be approved)
20
- **Output**: `docs/plans/ia/`, `docs/plans/be/`, `docs/plans/fe/` directories with indexes and shard skeletons (or per-surface subdirectories for multi-surface projects)
20
+ **Output**: `docs/plans/ia/`, `docs/plans/be/`, `docs/plans/fe/` directories with indexes and shard skeletons
21
21
 
22
22
  ---
23
23
 
@@ -25,84 +25,56 @@ Break the architecture design document into domain-bounded IA shards and create
25
25
 
26
26
  Read the file at `docs/plans/*-architecture-design.md`.
27
27
 
28
- If no architecture design exists, tell the user to run `/create-prd` first. Do not proceed without an approved design.
28
+ If no architecture design exists → **STOP**: tell the user to run `/create-prd` first.
29
29
 
30
- Also check the document's `**Status**:` field. If the status is `Draft` or `Review` → **STOP**: "The architecture design is not yet approved (current status: [status]). Get explicit approval from the user and update the status to `Approved` before decomposing."
30
+ **Multi-file handling**: If the glob matches multiple files (e.g., multiple dated versions):
31
+ - Use the file with the most recent date prefix
32
+ - Warn: "Multiple architecture-design files found. Using `[filename]` (most recent). If this is wrong, specify the correct file."
31
33
 
32
- Also read `docs/plans/ideation/ideation-index.md` for the fractal domain map and structural classification. The ideation folder uses a fractal structure — read domain indexes (not flat files) to understand depth, child counts, and cross-cut density.
34
+ Check the document's `**Status**:` field.
35
+ - If `Draft` or `Review` → **STOP**: "Architecture design not yet approved. Get explicit approval first."
36
+ - If the `**Status**:` field does not exist → **STOP**: "Architecture design document has no Status field. Add `**Status**: Approved` after explicit review, or run `/create-prd` to regenerate."
33
37
 
34
- > **Design system prerequisite (web/mobile/desktop projects)**: Read `.agent/instructions/tech-stack.md` and locate the `SURFACES` value. If surfaces include `web`, `mobile`, or `desktop`, verify that `docs/plans/design-system.md` exists and is not empty.
35
- >
36
- > If it does not exist:
37
- >
38
- > ⚠️ **Warning**: FE specs for this project require a design system (`docs/plans/design-system.md`). Run `/create-prd-design-system` before writing any FE specs. You may continue with architecture decomposition now, but the design system must be completed before the FE spec writing phase.
38
+ Read `docs/plans/ideation/ideation-index.md` for the fractal domain map and structural classification.
39
+
40
+ > **Design system prerequisite (web/mobile/desktop projects)**: Read `.agent/instructions/tech-stack.md` → `SURFACES`. If surfaces include `web`, `mobile`, or `desktop`, verify `docs/plans/design-system.md` exists.
39
41
  >
40
- > This is a warning, not a hard stop architecture decomposition can proceed. API-only, CLI, and extension projects are not affected.
42
+ > If not: ⚠️ **Warning** run `/create-prd-design-system` before writing FE specs. Architecture decomposition can proceed. API-only/CLI/extension projects unaffected.
43
+
44
+ Identify **Project Type** from the architecture design header:
45
+ - **Single-surface** → standard flat structure
46
+ - **Multi-surface** → per-surface subdirectories with shared layer
41
47
 
42
- Identify the **Project Type** from the architecture design header:
43
- - **Single-surface** (web, desktop, mobile, CLI, API) → standard flat structure
44
- - **Multi-surface** (desktop + web, mobile + web, etc.) → per-surface subdirectories with shared layer
48
+ **Surface consistency check**: Compare the Project Type derived here with `## Structural Classification` in `ideation-index.md`. If they conflict (e.g., ideation says single-surface but architecture says multi-surface) → **STOP**: "Surface classification mismatch between ideation (`[ideation value]`) and architecture design (`[arch value]`). Resolve via `/propagate-decision` before decomposing."
45
49
 
46
50
  ## 2. Load brainstorming skill
47
51
 
48
- Read `.agent/skills/brainstorming/SKILL.md` — domain boundary decisions benefit from collaborative exploration.
52
+ Read `.agent/skills/brainstorming/SKILL.md`.
49
53
 
50
54
  ## 3. Identify domain boundaries
51
55
 
52
- Read .agent/skills/architecture-mapping/SKILL.md and follow its methodology.
53
-
54
- Analyze the architecture design and identify natural domain boundaries. Each boundary becomes a numbered IA shard.
55
-
56
- **Fractal tree analysis for shard boundaries:**
57
-
58
- The ideation folder uses a fractal structure. Walk the tree to inform shard granularity:
56
+ Read `.agent/skills/architecture-mapping/SKILL.md` and follow its Domain Boundary Protocol.
59
57
 
60
- | Signal | What It Means for Sharding |
61
- |--------|---------------------------|
62
- | Deep fractal tree (3+ levels) | Domain is complex enough for its own shard |
63
- | Many children (5+ features) | Consider splitting into multiple shards |
64
- | Dense CX file (5+ cross-cuts) | This domain has high coupling — keep it together in one shard, or isolate carefully |
65
- | Rich Role Matrix (3+ roles with access) | Shard needs multi-role IA spec coverage |
66
- | Hub-and-spoke shared domains | Shared domains often become `00-*` cross-cutting shards |
67
- | Leaf features marked `[EXHAUSTED]` | Most confident for shard scoping — behavior is fully defined |
58
+ Read `.agent/skills/prd-templates/references/shard-boundary-analysis.md` for fractal tree signals and standard heuristics.
68
59
 
69
- **Standard heuristics also apply:**
70
- - Features that share the same data models belong together
71
- - Features that can be developed/deployed independently are candidates for separation
72
- - Features that share the same access control model may belong together
73
- - Cross-cutting concerns (auth, API conventions, error handling) become `00-*` shards
60
+ Walk the ideation fractal tree to inform shard granularity. Build the domain inventory record, apply split trigger rules, produce the domain boundary table.
74
61
 
75
- Read `.agent/skills/architecture-mapping/SKILL.md` and follow its Domain Boundary Protocol. Build the domain inventory record, apply all three split trigger rules, and produce the domain boundary table. Present split candidates to the user before locking any boundary.
76
-
77
- > **Important**: Ideation does NOT prescribe shard boundaries. It provides the raw data (depth, features, cross-cuts, roles). This workflow makes the shard boundary decisions based on architectural analysis.
62
+ > **Important**: Ideation does NOT prescribe shard boundaries. It provides raw data. This workflow makes boundary decisions based on architectural analysis.
78
63
 
79
64
  Present the proposed domain decomposition to the user for validation.
80
65
 
81
66
  ## 4. Assign shard numbers
82
67
 
83
- Follow the numbering convention:
84
- - `00-*` — Cross-cutting/foundation concerns (may have multiple: `00-api-conventions`, `00-auth-middleware`, etc.)
85
- - `01-*` through `NN-*` — Feature domains, ordered by dependency (dependencies first)
86
-
87
- Order rule: If shard B depends on shard A, then A gets a lower number than B.
68
+ - `00-*` Cross-cutting/foundation concerns
69
+ - `01-*` through `NN-*` Feature domains, dependency-ordered (lower = fewer deps)
88
70
 
89
71
  ## 4.5. Request approval of domain boundaries
90
72
 
91
- **STOP HERE** and present the domain boundary table and shard numbering to the user for explicit approval. Use `notify_user` to present:
92
-
93
- 1. The complete domain boundary table from Step 3
94
- 2. The proposed shard numbering from Step 4
95
- 3. The dependency ordering rationale
96
- 4. Any shards marked as needing deep dives
97
-
98
- Ask:
99
- - "Does this decomposition capture every feature from the architecture design?"
100
- - "Are the domain boundaries in the right places, or should any be split/merged?"
101
- - "Is the dependency ordering correct?"
73
+ **STOP** present domain boundary table, shard numbering, dependency ordering, and deep dive candidates to the user via `notify_user`.
102
74
 
103
- **Do not proceed** to shard skeleton creation until the user explicitly approves the domain boundaries. If the user requests changes, revise Steps 3-4 and re-present.
75
+ **Do not proceed** until the user explicitly approves.
104
76
 
105
- **Write `docs/plans/ia/decomposition-plan.md` immediately after user approval of the domain list, before proceeding to skeleton creation. This is a single gate — write the plan once, then proceed to the Shard Overview.**
77
+ **Write `docs/plans/ia/decomposition-plan.md` immediately after approval**, before proceeding to skeleton creation.
106
78
 
107
79
  ---
108
80
 
@@ -118,9 +90,4 @@ Ask:
118
90
  ## Orchestration
119
91
 
120
92
  ### Step A — Run `.agent/workflows/decompose-architecture-structure.md`
121
-
122
- Creates the directory structure (with multi-surface subdirectories if needed), writes shard skeleton files, and creates the IA, BE, FE, and master index files.
123
-
124
93
  ### Step B — Run `.agent/workflows/decompose-architecture-validate.md`
125
-
126
- Identifies deep dive candidates, annotates expected shard document types, validates the dependency graph, generates the spec pipeline tracker, and requests user review.