@@ -165,13 +165,16 @@ After generation, verify:
165165- [ ] Install script includes new command files
166166- [ ] Hooks are in `install/hooks/` if they need distribution
167167
168- # # Parallel Execution Integration
168+ # # STEP 0: Parallel Execution Check (MANDATORY)
169169
170- **IMPORTANT**: Before generating artifacts, check for parallelization opportunities.
170+ > **STOP! Complete this check BEFORE writing ANY files.**
171+ >
172+ > You MUST analyze the generation plan for parallelization opportunities and ask the user
173+ > for approval BEFORE generating artifacts. This is not optional.
171174
172- # ## Parallelization Check
175+ # ## Parallelization Analysis
173176
174- When the generation plan includes **3+ independent artifact groups **, invoke the parallel execution system :
177+ When the generation plan includes **3+ files across different modules/directories **, you MUST :
175178
1761791. **Analyze Artifact Groups**
177180 - Code files (can be generated in parallel across modules)
@@ -254,21 +257,44 @@ User runs: /m4-generate payment-retry --option=C
254257
255258## Execution Instructions
256259
260+ ### Phase 1: Planning (BEFORE any file writes)
261+
2572621. Read manifold from `.manifold/<feature>.yaml`
2582632. Read anchoring from `.manifold/<feature>.anchor.yaml`
2592643. Select solution option (from `--option` or prompt user)
260- 4. **CHECK PROJECT PATTERNS** - Examine existing structure before placing files
261- 5. **PARALLELIZATION CHECK** - Analyze artifacts for parallel generation opportunity
262- - If ≥3 independent artifact groups detected
263- - Run auto-suggester analysis
264- - Prompt user: "Parallel generation detected (Xfiles, Yx speedup). Enable? [Y/N]"
265- - If approved, use `/parallel` command with artifact tasks
266- 6. For each artifact type:
265+ 4. **BUILD ARTIFACT LIST** - List ALL files that will be generated
266+ 5. **⚠️ MANDATORY PARALLELIZATION CHECK** (See "STEP 0" above)
267+ - Count the artifact groups (code, tests, docs, ops)
268+ - If ≥3 files across different directories:
269+ ```
270+ 🔀 PARALLEL GENERATION OPPORTUNITY
271+
272+ I've identified [N] artifacts that could be generated in parallel:
273+
274+ Group 1 - [Type]: [file1, file2, ...]
275+ Group 2 - [Type]: [file1, file2, ...]
276+ Group 3 - [Type]: [file1, file2, ...]
277+
278+ Estimated speedup: ~Xx faster
279+
280+ Would you like to enable parallel generation? [Y/N]
281+ ```
282+ - **WAIT for user response before proceeding**
283+ - If Y: Use `/parallel` command with generation tasks
284+ - If N: Continue with sequential generation
285+
286+ ### Phase 2: Generation (AFTER user approval)
287+
288+ 6. **CHECK PROJECT PATTERNS** - Examine existing structure before placing files
289+ 7. For each artifact type:
267290 - Generate artifact with constraint traceability
268291 - Add comments linking to constraint IDs: `// Satisfies: B1, T2`
269292 - **Place in correct directory per Artifact Placement Rules**
270- 7. Create all files in appropriate directories
271- 8. **Update install script** if adding new distributable commands
272- 9. **Update manifold YAML** with generation tracking (artifacts, coverage)
273- 10. Set phase to GENERATED
274- 11. Display summary with constraint coverage
293+ 8. Create all files in appropriate directories
294+ 9. **Update install script** if adding new distributable commands
295+
296+ ### Phase 3: Finalization
297+
298+ 10. **Update manifold YAML** with generation tracking (artifacts, coverage)
299+ 11. Set phase to GENERATED
300+ 12. Display summary with constraint coverage
0 commit comments