@atlashub/smartstack-cli 3.25.0 → 3.26.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 (25) hide show
  1. package/dist/mcp-entry.mjs +11 -5
  2. package/dist/mcp-entry.mjs.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/apex/SKILL.md +26 -5
  5. package/templates/skills/apex/_shared.md +3 -3
  6. package/templates/skills/apex/references/agent-teams-protocol.md +8 -8
  7. package/templates/skills/apex/references/challenge-questions.md +165 -0
  8. package/templates/skills/apex/{steps/step-04-validate.md → references/post-checks.md} +82 -214
  9. package/templates/skills/apex/references/smartstack-api.md +91 -14
  10. package/templates/skills/apex/references/smartstack-layers.md +16 -4
  11. package/templates/skills/apex/steps/step-00-init.md +84 -56
  12. package/templates/skills/apex/steps/step-01-analyze.md +73 -87
  13. package/templates/skills/apex/steps/step-03-execute.md +2 -2
  14. package/templates/skills/apex/steps/step-04-examine.md +198 -0
  15. package/templates/skills/apex/steps/{step-05-examine.md → step-05-deep-review.md} +6 -6
  16. package/templates/skills/apex/steps/step-06-resolve.md +2 -2
  17. package/templates/skills/business-analyse/SKILL.md +28 -0
  18. package/templates/skills/business-analyse/references/agent-module-prompt.md +255 -0
  19. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +26 -10
  20. package/templates/skills/business-analyse/references/team-orchestration.md +437 -0
  21. package/templates/skills/business-analyse/steps/step-02-decomposition.md +31 -4
  22. package/templates/skills/business-analyse/steps/step-03a1-setup.md +21 -0
  23. package/templates/skills/business-analyse/steps/step-03d-validate.md +84 -0
  24. package/templates/skills/ralph-loop/references/core-seed-data.md +45 -10
  25. package/templates/skills/ralph-loop/steps/step-02-execute.md +47 -0
@@ -0,0 +1,437 @@
1
+ # Team Orchestration — Business-Analyse Propose & Review
2
+
3
+ > **Loaded by:** step-02 when multi-module detected (`moduleOrder.length >= 2`)
4
+ > **Purpose:** Delegate module specification to autonomous agents with user review.
5
+ > **Rule:** Single module = NO team. Only create team for 2+ modules.
6
+
7
+ ---
8
+
9
+ ## 1. Team Setup
10
+
11
+ After step-02 decomposition is complete and client has approved the module structure:
12
+
13
+ ```
14
+ TeamCreate({ team_name: "ba-{appName}" })
15
+ ```
16
+
17
+ Store team context for the session:
18
+ ```javascript
19
+ const teamContext = {
20
+ teamName: "ba-{appName}",
21
+ moduleOrder: metadata.workflow.moduleOrder,
22
+ dependencyLayers: dependencyGraph.layers || null,
23
+ currentModuleIdx: 0,
24
+ completedModules: [],
25
+ mode: "propose-review"
26
+ };
27
+ ```
28
+
29
+ ---
30
+
31
+ ## 2. Module Agent Spawn — Sequential by Topological Order
32
+
33
+ For each module in `moduleOrder` (respecting dependency layers):
34
+
35
+ ### 2a. Prepare Agent Context
36
+
37
+ Before spawning, gather the context the agent needs:
38
+
39
+ ```
40
+ 1. ba-reader.readApplicationContext({feature_id})
41
+ → Extract: appName, featureId, context, language
42
+
43
+ 2. Read module decomposition data from master feature.json:
44
+ → modules[currentModuleIdx]: code, name, description, featureType, entities,
45
+ anticipatedSections, dependencies, detailTabs
46
+
47
+ 3. ba-reader.getCompletedModulesSummary({feature_id})
48
+ → Compact summary of already-specified modules (max 100 lines)
49
+ → Includes: entity names, FK relationships, permission paths, shared types
50
+ ```
51
+
52
+ ### 2b. Spawn Agent
53
+
54
+ ```javascript
55
+ Task({
56
+ subagent_type: "general-purpose",
57
+ team_name: "ba-{appName}",
58
+ name: "mod-{moduleCode}",
59
+ model: "opus",
60
+ mode: "bypassPermissions",
61
+ prompt: BUILD_PROMPT(references/agent-module-prompt.md, {
62
+ appName,
63
+ featureId,
64
+ moduleCode,
65
+ moduleDescription: module.description,
66
+ featureType: module.featureType,
67
+ entities: module.entities,
68
+ anticipatedSections: module.anticipatedSections,
69
+ dependencies: module.dependencies,
70
+ detailTabs: module.detailTabs,
71
+ completedModulesSummary,
72
+ language: metadata.language,
73
+ docsDir: "docs/business/{appName}/{moduleCode}/business-analyse/v{version}/"
74
+ }),
75
+ description: "Specify {moduleCode}"
76
+ });
77
+ ```
78
+
79
+ **BUILD_PROMPT**: Read `references/agent-module-prompt.md`, replace all `{placeholders}` with actual values, and pass as the `prompt` parameter.
80
+
81
+ ### 2c. Sequential Constraint
82
+
83
+ - Spawn ONE module agent at a time
84
+ - Wait for MODULE_COMPLETE before spawning the next
85
+ - Reason: later modules may reference entities/FKs from earlier modules
86
+ - **Future optimization**: modules in the same dependency layer with no cross-refs COULD run in parallel
87
+
88
+ ---
89
+
90
+ ## 3. Propose & Review Protocol
91
+
92
+ ### 3a. Team Lead Receives PROPOSAL_READY
93
+
94
+ After the agent finishes specifying a module, it sends:
95
+
96
+ ```
97
+ PROPOSAL_READY:{moduleCode}
98
+
99
+ ## Module: {moduleCode} — Specification Summary
100
+
101
+ ### Entities ({count})
102
+ | Entity | Attributes | Relationships |
103
+ |--------|-----------|---------------|
104
+ | ... | ... | ... |
105
+
106
+ ### Sections ({count})
107
+ | Section | Description | Resources |
108
+ |---------|-------------|-----------|
109
+ | ... | ... | ... |
110
+
111
+ ### Use Cases ({count})
112
+ - UC-{PREFIX}-001: {title}
113
+ - UC-{PREFIX}-002: {title}
114
+ - ...
115
+
116
+ ### Business Rules ({count})
117
+ - BR-{CAT}-{PREFIX}-001: {title}
118
+ - ...
119
+
120
+ ### Permissions ({count})
121
+ - {context}.{app}.{module}.{action}
122
+ - ...
123
+
124
+ ### Seed Data
125
+ - Modules: {count} | Sections: {count} | Resources: {count}
126
+ - Translations: {count} | Permissions: {count} | Role mappings: {count}
127
+
128
+ ### Wireframes
129
+ - {section}: {1-line description}
130
+ - ...
131
+ ```
132
+
133
+ ### 3b. Team Lead Presents to User
134
+
135
+ Format the proposal for user review:
136
+
137
+ ```
138
+ ═══════════════════════════════════════════════════════════
139
+ Proposition pour le module {moduleCode} ({idx+1}/{total})
140
+ ═══════════════════════════════════════════════════════════
141
+
142
+ {structured summary from agent — displayed as-is}
143
+
144
+ ─────────────────────────────────────────────────────────
145
+ ```
146
+
147
+ Then ask user via AskUserQuestion:
148
+
149
+ ```
150
+ Validez-vous cette specification ?
151
+ Options:
152
+ 1. "Valider" → approve as-is
153
+ 2. "Modifier" → provide feedback for revision
154
+ 3. "Voir detail" → team lead reads module feature.json and displays full content
155
+ ```
156
+
157
+ ### 3c. Approval Flow
158
+
159
+ **If user approves:**
160
+ ```
161
+ SendMessage({
162
+ type: "message",
163
+ recipient: "mod-{moduleCode}",
164
+ content: "APPROVED:{moduleCode}",
165
+ summary: "{moduleCode} approved by user"
166
+ })
167
+ ```
168
+ → Agent writes final status, sends MODULE_COMPLETE, and shuts down.
169
+
170
+ **If user requests modifications:**
171
+ ```
172
+ SendMessage({
173
+ type: "message",
174
+ recipient: "mod-{moduleCode}",
175
+ content: "REVISION:{moduleCode}\n{user_feedback}",
176
+ summary: "{moduleCode} revision requested"
177
+ })
178
+ ```
179
+ → Agent applies changes, re-validates, sends new PROPOSAL_READY.
180
+
181
+ **If user wants to see detail:**
182
+ → Team lead reads module feature.json via ba-reader.readSection({feature_id, section})
183
+ → Displays relevant sections in detail
184
+ → Re-asks validation question
185
+
186
+ ### 3d. Revision Limits
187
+
188
+ - Max **3 revision cycles** per module
189
+ - After 3 rejections: team lead asks user if they want to switch to **inline interactive mode** for this module
190
+ - If yes: team lead loads step-03a1-setup.md and executes interactively (classic mode)
191
+ - If no: mark module as "needs-review" and continue to next module
192
+
193
+ ---
194
+
195
+ ## 4. Module Completion & Advancement
196
+
197
+ When agent sends MODULE_COMPLETE:
198
+
199
+ ```javascript
200
+ // Update tracking
201
+ teamContext.completedModules.push(moduleCode);
202
+ teamContext.currentModuleIdx++;
203
+
204
+ // Update master feature.json
205
+ ba-writer.advanceModuleLoop({feature_id});
206
+ ba-writer.updateModuleStatus({feature_id, moduleCode, status: "specified"});
207
+
208
+ // Display progress
209
+ Display: "✓ Module {moduleCode} specified ({completedModules.length}/{moduleOrder.length})"
210
+
211
+ // Shutdown agent
212
+ SendMessage({
213
+ type: "shutdown_request",
214
+ recipient: "mod-{moduleCode}",
215
+ content: "Module complete, shutting down"
216
+ });
217
+ ```
218
+
219
+ If more modules remain → spawn next module agent (go to §2).
220
+ If all modules complete → proceed to §5 (Consolidation).
221
+
222
+ ---
223
+
224
+ ## 5. Consolidation Phase
225
+
226
+ After ALL modules are specified:
227
+
228
+ ```
229
+ Display: "═══ All modules specified — Starting consolidation ═══"
230
+ ```
231
+
232
+ ### 5a. Spawn Consolidation Agent
233
+
234
+ ```javascript
235
+ Task({
236
+ subagent_type: "general-purpose",
237
+ team_name: "ba-{appName}",
238
+ name: "consolidation",
239
+ model: "opus",
240
+ mode: "bypassPermissions",
241
+ prompt: `
242
+ You are a consolidation agent for business-analyse application "{appName}".
243
+
244
+ ## Your Mission
245
+ Execute cross-module consolidation (steps 04a + 04b):
246
+ 1. Load steps/step-04a-collect.md and execute
247
+ 2. Load steps/step-04b-analyze.md and execute
248
+
249
+ ## Context
250
+ - Feature ID: {featureId}
251
+ - Modules: {moduleOrder.join(", ")}
252
+ - All modules have status "specified"
253
+
254
+ ## Output
255
+ Send CONSOLIDATION_READY with a structured report:
256
+ - Cross-module interactions (FK references, shared entities, event flows)
257
+ - Permission coherence (conflicts, overlaps, gaps)
258
+ - E2E user flows validated
259
+ - Global risks identified
260
+
261
+ ## Communication
262
+ - CONSOLIDATION_READY:{appName}\n{report} → when analysis complete
263
+ - ERROR:{appName}:{description} → on blocking issue
264
+ `,
265
+ description: "Cross-module consolidation"
266
+ });
267
+ ```
268
+
269
+ ### 5b. Present Consolidation to User (04c Decision)
270
+
271
+ When CONSOLIDATION_READY received:
272
+
273
+ ```
274
+ ═══════════════════════════════════════════════════════════
275
+ Consolidation cross-module — {appName}
276
+ ═══════════════════════════════════════════════════════════
277
+
278
+ {consolidation report from agent}
279
+
280
+ ─────────────────────────────────────────────────────────
281
+ ```
282
+
283
+ AskUserQuestion: "Approuvez-vous la consolidation ?"
284
+ - "Approuver" → send APPROVED to agent → agent writes consolidation to master feature.json
285
+ - "Reviser" → send feedback → agent adjusts
286
+
287
+ After approval → shutdown consolidation agent → proceed to §6.
288
+
289
+ ---
290
+
291
+ ## 6. Handoff Phase
292
+
293
+ ```javascript
294
+ Task({
295
+ subagent_type: "general-purpose",
296
+ team_name: "ba-{appName}",
297
+ name: "handoff",
298
+ model: "sonnet",
299
+ mode: "bypassPermissions",
300
+ prompt: `
301
+ You are a handoff agent for business-analyse application "{appName}".
302
+
303
+ ## Your Mission
304
+ Execute the handoff sequence (steps 05a + 05b + 05c):
305
+ 1. Load steps/step-05a-handoff.md and execute (file mapping, BR-to-code, API summary)
306
+ 2. Load steps/step-05b-deploy.md and execute (prd.json, ba-interactive.html, manifest)
307
+ 3. Load steps/step-05c-ralph-readiness.md and execute (quality gate)
308
+
309
+ ## Context
310
+ - Feature ID: {featureId}
311
+ - Modules: {moduleOrder.join(", ")}
312
+ - All modules consolidated
313
+
314
+ ## Output
315
+ Send HANDOFF_READY with:
316
+ - PRD files generated (list)
317
+ - HTML deployed (path)
318
+ - Quality gate result (PASS/FAIL with details)
319
+
320
+ ## Communication
321
+ - HANDOFF_READY:{appName}\n{report} → when all artifacts deployed
322
+ - ERROR:{appName}:{description} → on blocking issue
323
+ `,
324
+ description: "Handoff & deploy"
325
+ });
326
+ ```
327
+
328
+ When HANDOFF_READY received:
329
+
330
+ ```
331
+ ═══════════════════════════════════════════════════════════
332
+ Handoff complete — {appName}
333
+ ═══════════════════════════════════════════════════════════
334
+
335
+ {handoff report}
336
+
337
+ ─────────────────────────────────────────────────────────
338
+ ```
339
+
340
+ Display final status to user. If quality gate PASS → ready for /ralph-loop.
341
+
342
+ ---
343
+
344
+ ## 7. Cleanup
345
+
346
+ After handoff complete:
347
+
348
+ ```javascript
349
+ // Shutdown any remaining agents
350
+ for (const agentName of ["consolidation", "handoff"]) {
351
+ SendMessage({
352
+ type: "shutdown_request",
353
+ recipient: agentName,
354
+ content: "Workflow complete"
355
+ });
356
+ }
357
+
358
+ // Delete team
359
+ TeamDelete();
360
+
361
+ Display: "═══ Business-analyse complete — Team cleaned up ═══"
362
+ ```
363
+
364
+ ---
365
+
366
+ ## 8. Error Recovery
367
+
368
+ ### Agent Crash
369
+
370
+ If an agent stops responding or sends ERROR:
371
+
372
+ ```javascript
373
+ // 1. Check module status in feature.json
374
+ const moduleStatus = ba-reader.getModuleStatus({feature_id});
375
+
376
+ // 2. If module has partial data (status = "in-progress"):
377
+ // → Spawn new agent for same module
378
+ // → New agent detects partial state and continues
379
+ // → Include in prompt: "Resume specification — partial data exists in feature.json"
380
+
381
+ // 3. Track retry count
382
+ if (retryCount[moduleCode] >= 3) {
383
+ Display: "Agent failed 3 times for module {moduleCode}."
384
+ AskUserQuestion: "Fallback to inline interactive mode for this module?"
385
+ // If yes: load step-03a1-setup.md inline
386
+ // If no: skip module, mark as "needs-review"
387
+ }
388
+ ```
389
+
390
+ ### Context Exhaustion on Team Lead
391
+
392
+ The team lead should stay under 30% context usage. If approaching limits:
393
+
394
+ 1. **Minimize presentation**: Show only entity/section counts, not full details
395
+ 2. **Auto-approve**: If user has approved 3+ modules without changes, suggest auto-approve mode
396
+ 3. **Skip detail view**: Don't read full feature.json into team lead context
397
+
398
+ ### Resume After Session Crash
399
+
400
+ If the entire session crashes:
401
+
402
+ 1. User restarts `/business-analyse`
403
+ 2. Step-00 detects existing feature.json with `status: "decomposed"` or partial modules
404
+ 3. Reads `metadata.workflow.completedModules` to know which modules are done
405
+ 4. Creates new team, spawns agent for next incomplete module
406
+ 5. Continues normally
407
+
408
+ ---
409
+
410
+ ## Decision Matrix
411
+
412
+ | Condition | Action |
413
+ |-----------|--------|
414
+ | 1 module | NO team, classic inline execution |
415
+ | 2+ modules | Team mode (Propose & Review) |
416
+ | Modules in same dependency layer, no cross-refs | Sequential (future: parallel) |
417
+ | Modules with dependencies | Strict topological order |
418
+ | Agent error | Respawn with same module context (max 3 retries) |
419
+ | User rejects 3 times | Offer fallback to inline interactive |
420
+ | Context > 50% on team lead | Minimize presentation, suggest auto-approve |
421
+ | Session crash | Resume from feature.json workflow state |
422
+
423
+ ---
424
+
425
+ ## Token Budget Estimates
426
+
427
+ | Phase | Agent | Estimated Context % | Duration |
428
+ |-------|-------|-------------------|----------|
429
+ | Init + Cadrage + Decomposition | Team lead (inline) | 20-30% | 5-10 min |
430
+ | Module specification (per module) | mod-{code} agent | 40-60% | 3-5 min |
431
+ | Propose & Review (per module) | Team lead relay | +2-5% per module | 1-2 min |
432
+ | Consolidation | consolidation agent | 30-40% | 2-3 min |
433
+ | Handoff | handoff agent | 40-50% | 3-5 min |
434
+ | **Total team lead** | — | **30-50%** | — |
435
+ | **Total per module agent** | — | **40-60%** | — |
436
+
437
+ **Key insight:** Team lead never exceeds 50% even with 10+ modules, because module specifications happen in separate contexts.
@@ -314,7 +314,33 @@ Create: docs/business/{app}/{module_code}/business-analyse/v1.0/
314
314
  ═══════════════════════════════════════════════════════════
315
315
  ```
316
316
 
317
- **AUTOCHAIN DO NOT STOP HERE:**
317
+ ### 9-bis. Team Mode Decision
318
+
319
+ After module registry is written and client has approved decomposition:
320
+
321
+ **IF moduleOrder.length >= 2 (TEAM MODE):**
322
+
323
+ ```
324
+ Display:
325
+ ═══════════════════════════════════════════════════════════
326
+ Multi-module détecté ({N} modules) — Activation du Mode Team
327
+ ═══════════════════════════════════════════════════════════
328
+
329
+ Chaque module sera spécifié par un agent dédié avec un contexte frais.
330
+ Vous validerez chaque proposition avant sa finalisation.
331
+
332
+ Modules : {moduleOrder.join(" → ")}
333
+ ═══════════════════════════════════════════════════════════
334
+ ```
335
+
336
+ **Load: `references/team-orchestration.md`**
337
+ → Follow the team orchestration protocol starting at §1 (Team Setup)
338
+ → DO NOT load step-03a1-setup.md — agents will load it internally
339
+ → **STOP HERE** — the team-orchestration.md takes over the workflow
340
+
341
+ **ELSE (single module — INLINE MODE):**
342
+
343
+ AUTOCHAIN — DO NOT STOP HERE:
318
344
  - Do NOT ask "shall I continue?" or "voulez-vous que je continue?"
319
345
  - Do NOT summarize what's coming next
320
346
  - Do NOT wait for user input
@@ -331,13 +357,14 @@ When `workflow.mode = "module"` or only 1 scope item identified:
331
357
  2. No dependency analysis needed
332
358
  3. **Simplified checkpoint:** Quick confirmation instead of full validation
333
359
  4. Set moduleOrder = [{single module code}]
334
- 5. Proceed to step-03
360
+ 5. Proceed to step-03 (inline, no team)
335
361
 
336
362
  ---
337
363
 
338
- ## NEXT STEP (MANDATORY — NO PAUSE)
364
+ ## NEXT STEP (conditional)
339
365
 
340
- Load: `./step-03a1-setup.md`
366
+ **If 2+ modules:** DO NOT load step-03a1. Load `references/team-orchestration.md` instead.
367
+ **If 1 module:** Load `./step-03a1-setup.md`
341
368
 
342
369
  > **FORBIDDEN:** Asking any question between decomposition summary and step-03 load.
343
370
  > The client checkpoint was at step 6. Do NOT add another one.
@@ -42,6 +42,27 @@ next_step: steps/step-03a2-analysis.md
42
42
  Dashboard modules MUST use specification.dashboards[] (it exists in the schema).
43
43
  If truly needed, use specification.extensions: {} (additionalProperties: true).
44
44
 
45
+ ## MODE DETECTION
46
+
47
+ **Check your execution context before proceeding:**
48
+
49
+ **IF you are running as a TEAM AGENT** (you received a module-specifier prompt from `references/agent-module-prompt.md`):
50
+ → You are in **AUTONOMOUS mode** (Propose & Review)
51
+ → Do NOT use `AskUserQuestion` — you PROPOSE, the team lead handles user interaction
52
+ → Replace ALL `AskUserQuestion` calls with **ULTRATHINK autonomous decisions**
53
+ → Use the decomposition data + completed module summaries to make informed choices
54
+ → After completing all steps (03a1 → 03a2 → 03b → 03c → 03d): send `PROPOSAL_READY` to team lead
55
+ → See `references/agent-module-prompt.md` for autonomous decision rules
56
+ → See `references/team-orchestration.md` § 3 for communication protocol
57
+
58
+ **IF you are running in the MAIN CONVERSATION** (classic inline mode):
59
+ → Normal interactive mode — use `AskUserQuestion` as documented below
60
+ → No `SendMessage` calls needed
61
+
62
+ **How to detect:** If your prompt contains `PROPOSE & REVIEW` or `team-lead` as recipient, you are a team agent.
63
+
64
+ ---
65
+
45
66
  ## YOUR TASK
46
67
 
47
68
  Specify one module's data model and business logic: walk through sections, define entities, business rules, and validate with client before proceeding to UI specification.
@@ -515,6 +515,90 @@ IF currentModuleIndex >= moduleOrder.length:
515
515
 
516
516
  ---
517
517
 
518
+ ## 12-bis. Agent Mode: Send Proposal to Team Lead
519
+
520
+ **IF running as TEAM AGENT (autonomous mode — detected in step-03a1 MODE DETECTION):**
521
+
522
+ After all validation checks PASS and module feature.json is written:
523
+
524
+ ### A. Build Structured Summary
525
+
526
+ Read the written module feature.json via ba-reader and build:
527
+
528
+ ```
529
+ ## Module: {moduleCode} — Specification Summary
530
+
531
+ ### Entities ({count})
532
+ | Entity | Key Attributes | Relationships |
533
+ |--------|---------------|---------------|
534
+ | {name} | {attr1} ({type}), {attr2} ({type}), ... | → {relatedEntity} (FK) |
535
+
536
+ ### Sections ({count})
537
+ | Section | Description | Resources |
538
+ |---------|-------------|-----------|
539
+ | {code} | {description} | {resource1}, {resource2}, ... |
540
+
541
+ ### Use Cases ({count})
542
+ - {UC-ID}: {title}
543
+
544
+ ### Business Rules ({count})
545
+ - {BR-ID}: {title} ({category})
546
+
547
+ ### Permissions
548
+ - {permission.path}: {roles with access}
549
+
550
+ ### Seed Data Counts
551
+ - Modules: {n} | Sections: {n} | Resources: {n}
552
+ - Translations: {n} | Permissions: {n} | Role mappings: {n} | Constants: {n}
553
+
554
+ ### Wireframes
555
+ - {section}: {1-line description of layout and key components}
556
+ ```
557
+
558
+ ### B. Send Proposal
559
+
560
+ ```
561
+ SendMessage({
562
+ type: "message",
563
+ recipient: "team-lead",
564
+ content: "PROPOSAL_READY:{moduleCode}\n\n{structured_summary}",
565
+ summary: "{moduleCode} specification ready for review"
566
+ })
567
+ ```
568
+
569
+ ### C. Wait for Response
570
+
571
+ **WAIT** for team lead to respond:
572
+
573
+ - **`APPROVED:{moduleCode}`** → Proceed to step D (Module Complete)
574
+ - **`REVISION:{moduleCode}\n{feedback}`** → Apply changes:
575
+ 1. Read the feedback
576
+ 2. Update the relevant sections in feature.json via ba-writer
577
+ 3. Re-run validation checks (section 9)
578
+ 4. Re-build summary and send new `PROPOSAL_READY`
579
+ 5. Max **3 revision cycles** — after 3, send `ERROR:{moduleCode}:Max revisions reached` and stop
580
+
581
+ ### D. Module Complete
582
+
583
+ After approval:
584
+
585
+ ```
586
+ ba-writer.updateModuleStatus({feature_id}, {moduleCode}, "specified")
587
+ ```
588
+
589
+ ```
590
+ SendMessage({
591
+ type: "message",
592
+ recipient: "team-lead",
593
+ content: "MODULE_COMPLETE:{moduleCode}",
594
+ summary: "{moduleCode} module complete"
595
+ })
596
+ ```
597
+
598
+ **STOP HERE** — do NOT loop to next module. The team lead handles module ordering and will spawn a new agent for the next module.
599
+
600
+ ---
601
+
518
602
  ## SELF-VERIFICATION (MANDATORY before loading next step)
519
603
 
520
604
  Before proceeding to step-03a (next module) or step-04 (consolidation), VERIFY: