@atlashub/smartstack-cli 4.18.0 → 4.19.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 (160) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +318 -415
  4. package/templates/agents/docs-context-reader.md +3 -3
  5. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -0
  6. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +126 -0
  7. package/templates/skills/apex/SKILL.md +29 -16
  8. package/templates/skills/apex/_shared.md +62 -9
  9. package/templates/skills/apex/references/analysis-methods.md +8 -6
  10. package/templates/skills/apex/references/challenge-questions.md +5 -5
  11. package/templates/skills/apex/references/core-seed-data.md +68 -45
  12. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +26 -21
  13. package/templates/skills/apex/references/parallel-execution.md +156 -0
  14. package/templates/skills/apex/references/person-extension-pattern.md +12 -12
  15. package/templates/skills/apex/references/post-checks.md +1748 -1726
  16. package/templates/skills/apex/references/smartstack-api.md +63 -57
  17. package/templates/skills/apex/references/smartstack-frontend-compliance.md +594 -0
  18. package/templates/skills/apex/references/smartstack-frontend.md +1246 -1842
  19. package/templates/skills/apex/references/smartstack-layers.md +98 -145
  20. package/templates/skills/apex/steps/step-00-init.md +30 -6
  21. package/templates/skills/apex/steps/step-01-analyze.md +27 -23
  22. package/templates/skills/apex/steps/step-02-plan.md +12 -12
  23. package/templates/skills/apex/steps/step-03-execute.md +198 -143
  24. package/templates/skills/apex/steps/step-04-examine.md +24 -93
  25. package/templates/skills/apex/steps/step-05-deep-review.md +16 -16
  26. package/templates/skills/apex/steps/step-06-resolve.md +9 -9
  27. package/templates/skills/apex/steps/step-07-tests.md +3 -1
  28. package/templates/skills/apex/steps/step-08-run-tests.md +1 -1
  29. package/templates/skills/business-analyse/SKILL.md +182 -301
  30. package/templates/skills/business-analyse/_shared.md +119 -336
  31. package/templates/skills/business-analyse/html/ba-interactive.html +703 -82
  32. package/templates/skills/business-analyse/html/build-html.js +41 -3
  33. package/templates/skills/business-analyse/html/src/partials/cadrage-context.html +34 -0
  34. package/templates/skills/business-analyse/html/src/partials/cadrage-risks.html +48 -0
  35. package/templates/skills/business-analyse/html/src/partials/cadrage-scope.html +49 -0
  36. package/templates/skills/business-analyse/html/src/partials/cadrage-stakeholders.html +55 -0
  37. package/templates/skills/business-analyse/html/src/partials/cadrage-success.html +34 -0
  38. package/templates/skills/business-analyse/html/src/partials/consol-datamodel.html +8 -0
  39. package/templates/skills/business-analyse/html/src/partials/consol-flows.html +29 -0
  40. package/templates/skills/business-analyse/html/src/partials/consol-interactions.html +8 -0
  41. package/templates/skills/business-analyse/html/src/partials/consol-permissions.html +8 -0
  42. package/templates/skills/business-analyse/html/src/partials/decomp-dependencies.html +38 -0
  43. package/templates/skills/business-analyse/html/src/partials/decomp-modules.html +51 -0
  44. package/templates/skills/business-analyse/html/src/partials/handoff-summary.html +24 -0
  45. package/templates/skills/business-analyse/html/src/partials/module-spec-container.html +4 -0
  46. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +17 -1
  47. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +31 -5
  48. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +100 -63
  49. package/templates/skills/business-analyse/html/src/scripts/06-render-mockups.js +372 -0
  50. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  51. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  52. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  53. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +142 -0
  54. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +94 -0
  55. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +150 -0
  56. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  57. package/templates/skills/business-analyse/questionnaire.md +23 -280
  58. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  59. package/templates/skills/business-analyse/react/components.md +4 -4
  60. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  61. package/templates/skills/business-analyse/react/schema.md +14 -14
  62. package/templates/skills/business-analyse/references/acceptance-criteria.md +21 -21
  63. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  64. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  65. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +5 -5
  66. package/templates/skills/business-analyse/references/deploy-data-build.md +12 -11
  67. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  68. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  69. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  70. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  71. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  72. package/templates/skills/business-analyse/references/robustness-checks.md +36 -36
  73. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  74. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  75. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  76. package/templates/skills/business-analyse/references/validation-checklist.md +3 -3
  77. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  78. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  79. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  80. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  81. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  82. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  83. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  84. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  85. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -4
  87. package/templates/skills/business-analyse/steps/step-00-init.md +68 -77
  88. package/templates/skills/business-analyse/steps/step-01-cadrage.md +54 -180
  89. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  90. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  91. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  92. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  93. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  94. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  95. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  96. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  97. package/templates/skills/business-analyse/templates-react.md +2 -2
  98. package/templates/skills/derive-prd/SKILL.md +92 -0
  99. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  100. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  101. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  102. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  103. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  104. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -263
  105. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  106. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  107. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  108. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  109. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  110. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  111. package/templates/skills/ralph-loop/SKILL.md +2 -1
  112. package/templates/skills/ralph-loop/references/init-resume-recovery.md +1 -1
  113. package/templates/skills/ralph-loop/steps/step-01-task.md +2 -2
  114. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  115. package/templates/skills/business-analyse/_architecture.md +0 -124
  116. package/templates/skills/business-analyse/_elicitation.md +0 -206
  117. package/templates/skills/business-analyse/_module-loop.md +0 -115
  118. package/templates/skills/business-analyse/_rules.md +0 -142
  119. package/templates/skills/business-analyse/_suggestions.md +0 -34
  120. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  121. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  122. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  123. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  124. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  125. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  126. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  127. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  128. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  129. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  130. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -58
  131. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  132. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  133. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  134. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  135. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  136. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -366
  137. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  138. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  139. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  140. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  141. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  142. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  143. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  144. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1093
  145. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  146. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  147. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  148. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  149. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -486
  150. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -300
  151. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -405
  152. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -516
  153. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -691
  154. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  155. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  156. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  157. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  158. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -937
  159. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  160. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -17,17 +17,17 @@ Api → Application, Infrastructure
17
17
  Web → Application (via API clients)
18
18
  ```
19
19
 
20
- ### FORBIDDEN Patterns
21
-
22
- | Layer | FORBIDDEN import | Why |
23
- |-------|-----------------|-----|
24
- | Domain | Application, Infrastructure, Api | Domain is the core, depends on nothing |
25
- | Application | Infrastructure, Api | Application defines interfaces, Infrastructure implements them |
26
- | Controller | DbContext (direct injection) | Controllers use Application services, not database directly |
27
- | Controller | IRepository (direct injection) | Controllers use Application services, not repositories |
28
- | Domain | EF Core attributes (`[Table]`, `[Column]`, `[Index]`) | Domain must be persistence-ignorant; use `IEntityTypeConfiguration<T>` in Infrastructure |
29
- | Domain | `using Microsoft.EntityFrameworkCore` | Infrastructure concern leaking into Domain |
30
- | API response | Domain entity (e.g., `ActionResult<Employee>`) | Return DTOs (`EmployeeResponseDto`), never Domain entities |
20
+ ### Forbidden Patterns
21
+
22
+ | Layer | Do not | Why |
23
+ |-------|--------|-----|
24
+ | Domain | import Application, Infrastructure, Api | Domain is the core, depends on nothing |
25
+ | Application | import Infrastructure, Api | Application defines interfaces, Infrastructure implements them |
26
+ | Controller | inject DbContext directly | Controllers use Application services, not database directly |
27
+ | Controller | inject IRepository directly | Controllers use Application services, not repositories |
28
+ | Domain | use EF Core attributes (`[Table]`, `[Column]`, `[Index]`) | Domain must be persistence-ignorant; use `IEntityTypeConfiguration<T>` in Infrastructure |
29
+ | Domain | use `using Microsoft.EntityFrameworkCore` | Infrastructure concern leaking into Domain |
30
+ | API response | return Domain entity (e.g., `ActionResult<Employee>`) | Return DTOs (`EmployeeResponseDto`), never Domain entities |
31
31
 
32
32
  ### Enforcement
33
33
 
@@ -50,10 +50,10 @@ Web → Application (via API clients)
50
50
 
51
51
  **Rules:**
52
52
  - Inherit `BaseEntity`, choose tenant interface based on data isolation requirements:
53
- - **`ITenantEntity`** (strict mode, default): User can only access their tenant's data. Implement `Guid TenantId { get; set; }`. Service MUST filter by `_currentTenant.TenantId` with guard clause.
54
- - **`IOptionalTenantEntity`** (optional mode): Cross-tenant data (shared lookup tables, public content). Implement `Guid? TenantId { get; set; }`. Service MAY accept null TenantId. EF global filter handles both shared (null) and tenant-scoped (TenantId == current) rows automatically.
55
- - **`IScopedTenantEntity`** (scoped mode): Data scoped by Scope + TenantId combination. Validate both match current context in service layer.
56
- - **No tenant interface** (none mode): Cross-tenant system data (no isolation). No TenantId property, no filtering needed.
53
+ - `ITenantEntity` (strict mode, default): User can only access their tenant's data. Implement `Guid TenantId { get; set; }`. Service must filter by `_currentTenant.TenantId` with guard clause.
54
+ - `IOptionalTenantEntity` (optional mode): Cross-tenant data (shared lookup tables, public content). Implement `Guid? TenantId { get; set; }`. Service may accept null TenantId. EF global filter handles both shared (null) and tenant-scoped (TenantId == current) rows automatically.
55
+ - `IScopedTenantEntity` (scoped mode): Data scoped by Scope + TenantId combination. Validate both match current context in service layer.
56
+ - No tenant interface (none mode): Cross-tenant system data (no isolation). No TenantId property, no filtering needed.
57
57
  - Also implement `IAuditableEntity` for CreatedBy/UpdatedBy tracking
58
58
  - See `references/smartstack-api.md` for exact BaseEntity API (Id, CreatedAt, UpdatedAt only)
59
59
  - No Code/IsDeleted/RowVersion in BaseEntity — add business properties yourself
@@ -61,8 +61,8 @@ Web → Application (via API clients)
61
61
  - Value objects for composite values
62
62
  - **Person Extension Pattern:** If entity has `personRoleConfig` (from PRD or feature.json):
63
63
  - Load `references/person-extension-pattern.md` for full patterns
64
- - **Mandatory** (`userLinkMode: 'mandatory'`): `Guid UserId` (non-nullable), ZERO person fields (`FirstName`, `LastName`, `Email`), unique index `(TenantId, UserId)`
65
- - **Optional** (`userLinkMode: 'optional'`): `Guid? UserId` (nullable), own person fields + computed `Display*` properties, filtered unique index `(TenantId, UserId) WHERE UserId IS NOT NULL`
64
+ - Mandatory variant (`userLinkMode: 'mandatory'`): `Guid UserId` (non-nullable), ZERO person fields (`FirstName`, `LastName`, `Email`), unique index `(TenantId, UserId)`
65
+ - Optional variant (`userLinkMode: 'optional'`): `Guid? UserId` (nullable), own person fields + computed `Display*` properties, filtered unique index `(TenantId, UserId) WHERE UserId IS NOT NULL`
66
66
  - EF Config: `builder.Ignore()` on computed `Display*` properties (optional variant only)
67
67
 
68
68
  ---
@@ -70,11 +70,11 @@ Web → Application (via API clients)
70
70
  ## Layer 0 — Infrastructure: EF Core (sequential)
71
71
 
72
72
  **Configs:** `Infrastructure/Persistence/Configurations/{App}/{Module}/`
73
- **Migrations:** `Infrastructure/Persistence/Migrations/` (NEVER subdirectories)
73
+ **Migrations:** `Infrastructure/Persistence/Migrations/` (not in subdirectories)
74
74
 
75
75
  | Action | Tool |
76
76
  |--------|------|
77
- | Create config | MCP `scaffold_extension` (type: configuration) |
77
+ | Create config | Manual: `IEntityTypeConfiguration<T>` per `smartstack-api.md` patterns |
78
78
  | Create migration | MCP `suggest_migration` → `dotnet ef migrations add` |
79
79
  | Validate | MCP `check_migrations` |
80
80
 
@@ -86,9 +86,9 @@ Web → Application (via API clients)
86
86
  - Migration name ALWAYS from MCP `suggest_migration`
87
87
  - Migration flag: `-o Persistence/Migrations`
88
88
 
89
- **BLOCKING:** `dotnet build --no-restore` MUST pass after migration.
89
+ Build requirement: `dotnet build --no-restore` must pass after migration.
90
90
 
91
- > **CRITICAL — Migration must cover ALL entities (POST-CHECK 36, 40):**
91
+ > **Migration must cover ALL entities (POST-CHECK C38, C42):**
92
92
  > Create/update migration AFTER ALL entities and EF configs are registered in DbContext.
93
93
  > Verify with `dotnet ef migrations has-pending-model-changes` — must report NO pending changes.
94
94
  > If entities are added incrementally across modules, create a NEW migration for each batch.
@@ -100,7 +100,7 @@ Web → Application (via API clients)
100
100
  **Folder:** `Infrastructure/Persistence/Seeding/Data/{ModulePascal}/`
101
101
 
102
102
  > **Detailed templates:** See `references/core-seed-data.md` for complete C# code templates.
103
- > Navigation hierarchy: Application → Module → Section → Resource (ALL levels need seed data).
103
+ > Navigation hierarchy: Application → Module → Section → Resource (all levels need seed data).
104
104
 
105
105
  | Action | Tool |
106
106
  |--------|------|
@@ -121,7 +121,7 @@ Web → Application (via API clients)
121
121
  5. **NavigationResourceSeedData.cs** — Resource-level navigation (if resources defined)
122
122
  6. **Permissions.cs** — Static permission constants: `public static class {Module} { public const string Read = "..."; }`. Referenced by `[RequirePermission(Permissions.{Module}.Read)]`.
123
123
  7. **PermissionsSeedData.cs** — MCP `generate_permissions` first, fallback template
124
- 8. **RolesSeedData.cs** — Code-based role mapping: Admin=wildcard(*), Manager=CRU, Contributor=CR, Viewer=R. **NEVER use deterministic GUIDs for roles** — look up by Code at runtime.
124
+ 8. **RolesSeedData.cs** — Code-based role mapping: Admin=wildcard(*), Manager=CRU, Contributor=CR, Viewer=R. Do not use deterministic GUIDs for roles — look up by Code at runtime.
125
125
 
126
126
  **Infrastructure (created ONCE per application):**
127
127
  9. **{App}SeedDataProvider.cs** — Implements IClientSeedDataProvider
@@ -133,17 +133,13 @@ Web → Application (via API clients)
133
133
 
134
134
  ### GUID Generation Rule
135
135
 
136
- ```csharp
137
- // ALWAYS use Guid.NewGuid() for ALL seed data IDs
138
- // Avoids conflicts between projects/tenants/environments
139
- // Idempotence is handled by Code-based lookups at runtime
140
- public static readonly Guid ModuleId = Guid.NewGuid();
141
- ```
136
+ All seed data IDs MUST use `Guid.NewGuid()` — NEVER deterministic/sequential/fixed GUIDs.
137
+ > See `references/core-seed-data.md` section 1b for the complete GUID rule and template.
142
138
 
143
- ### Route Convention (CRITICAL — Full Paths Required)
139
+ ### Route Convention (Full Paths Required)
144
140
 
145
141
  > **Routes stored in DB drive the platform menu AND application-tracking.**
146
- > Short routes (e.g., `humanresources`) cause **400 Bad Request** on every page navigation.
142
+ > Short routes (e.g., `humanresources`) cause errors on every page navigation.
147
143
 
148
144
  **Route format: `/{app-kebab}/{module-kebab}/{section-kebab}`**
149
145
 
@@ -178,21 +174,21 @@ var sectionRoute = $"{moduleRoute}/{ToKebabCase(sectionCode)}";
178
174
  // → "/human-resources/employees/departments"
179
175
  ```
180
176
 
181
- **ROUTE SPECIAL CASES (list and detail sections):**
177
+ **Route special cases (list and detail sections):**
182
178
  > `list` and `detail` are view modes of the module, NOT functional sub-areas.
183
179
  > - `list` section route = module route (e.g., `/human-resources/employees`) — NO `/list` suffix
184
180
  > - `detail` section route = module route + `/:id` (e.g., `/human-resources/employees/:id`) — NOT `/detail/:id`
185
- > - FORBIDDEN: `/employees/list`, `/employees/detail/:id`
181
+ > - Do not use: `/employees/list`, `/employees/detail/:id`
186
182
  > - Other sections (dashboard, approve, import) = module route + `/{section-kebab}` (normal)
187
183
 
188
- **FORBIDDEN:**
189
- - Deterministic/sequential/fixed GUIDs ALWAYS use `Guid.NewGuid()`
190
- - Missing translations (must have fr, en, it, de)
191
- - Empty seed classes with no seeding logic
192
- - PascalCase in route URLs always kebab-case
193
- - Missing NavigationApplicationSeedData menu invisible
194
- - **Short routes without `/` prefix** `"humanresources"` must be `"/human-resources"`
195
- - **Routes without parent hierarchy** `"employees"` must be `"/human-resources/employees"`
184
+ **Do not:**
185
+ - Use deterministic/sequential/fixed GUIDs always use `Guid.NewGuid()`
186
+ - Skip translations (must have fr, en, it, de)
187
+ - Create empty seed classes with no seeding logic
188
+ - Use PascalCase in route URLs always kebab-case
189
+ - Omit NavigationApplicationSeedData menu becomes invisible
190
+ - Use short routes without `/` prefix `"humanresources"` must be `"/human-resources"`
191
+ - Create routes without parent hierarchy `"employees"` must be `"/human-resources/employees"`
196
192
 
197
193
  ---
198
194
 
@@ -211,24 +207,24 @@ var sectionRoute = $"{moduleRoute}/{ToKebabCase(sectionCode)}";
211
207
 
212
208
  **Rules:**
213
209
  - **Tenant injection depends on entity tenant mode** (see entity rules below):
214
- - **strict mode (default):** Inject `ICurrentTenantService` + guard clause: `var tenantId = _currentTenant.TenantId ?? throw new TenantContextRequiredException();` (mandatory, returns 400)
215
- - **optional mode:** Inject `ICurrentTenantService`, no guard: `var tenantId = _currentTenant.TenantId;` (nullable). EF global filter handles shared+tenant data.
216
- - **scoped mode:** Inject `ICurrentTenantService`, validate Scope + TenantId consistency. Tenant scope requires TenantId.
217
- - **none mode:** No `ICurrentTenantService` injection needed (cross-tenant data, no filtering)
218
- - **ALL services MUST inject `ICurrentUserService`** for audit trails
219
- - **ALL services MUST inject `ILogger<T>`** for production diagnostics
210
+ - strict mode (default): Inject `ICurrentTenantService` + guard clause: `var tenantId = _currentTenant.TenantId ?? throw new TenantContextRequiredException();` (returns 400 if missing)
211
+ - optional mode: Inject `ICurrentTenantService`, no guard: `var tenantId = _currentTenant.TenantId;` (nullable). EF global filter handles shared+tenant data.
212
+ - scoped mode: Inject `ICurrentTenantService`, validate Scope + TenantId consistency. Tenant scope requires TenantId.
213
+ - none mode: No `ICurrentTenantService` injection needed (cross-tenant data, no filtering)
214
+ - All services must inject `ICurrentUserService` for audit trails
215
+ - All services must inject `ILogger<T>` for production diagnostics
220
216
  - CQRS with MediatR
221
- - FluentValidation for all commands — **MUST register validators via DI:**
217
+ - FluentValidation for all commands — must register validators via DI:
222
218
  `services.AddValidatorsFromAssemblyContaining<Create{Entity}DtoValidator>();`
223
- Without DI registration, `[FromBody]` DTOs are never validated (POST-CHECK 38)
224
- - **Date fields in DTOs MUST use `DateOnly`**, not `string` (POST-CHECK 39). See `smartstack-api.md` DTO Type Mapping.
219
+ Without DI registration, `[FromBody]` DTOs are never validated (POST-CHECK C40)
220
+ - Date fields in DTOs must use `DateOnly`, not `string` (POST-CHECK C41). See `smartstack-api.md` DTO Type Mapping.
225
221
  - DTOs separate from domain entities
226
222
  - Service interfaces in Application, implementations in Infrastructure
227
- - **FORBIDDEN:** `tenantId: Guid.Empty`, `TenantId!.Value`, queries without TenantId filter, `ICurrentUser` (does not exist — use `ICurrentUserService` + `ICurrentTenantService`), `string` type for date fields
223
+ - Do not use: `tenantId: Guid.Empty`, `TenantId!.Value`, queries without TenantId filter, `ICurrentUser` (does not exist — use `ICurrentUserService` + `ICurrentTenantService`), `string` type for date fields
228
224
  - **Person Extension services:** If entity has `personRoleConfig`:
229
- - `Include(x => x.User)` on ALL queries (mandatory)
225
+ - `Include(x => x.User)` on all queries (required)
230
226
  - Inject `ICoreDbContext` for User existence checks
231
- - Mandatory: search on `User.FirstName`, `User.LastName`, `User.Email`
227
+ - Required: search on `User.FirstName`, `User.LastName`, `User.Email`
232
228
  - Optional: search fallback `User.FirstName ?? x.FirstName`
233
229
  - CreateAsync: verify User exists + no duplicate `(TenantId, UserId)`
234
230
  - ResponseDto: include `Display*` fields resolved from User join
@@ -246,25 +242,25 @@ var sectionRoute = $"{moduleRoute}/{ToKebabCase(sectionCode)}";
246
242
  | Validate | MCP `validate_security` |
247
243
 
248
244
  **Rules:**
249
- - `[RequirePermission(Permissions.{Module}.{Action})]` on EVERY endpoint
250
- - **NavRoute minimum 2 segments** (application.module):
245
+ - `[RequirePermission(Permissions.{Module}.{Action})]` on every endpoint
246
+ - NavRoute minimum 2 segments (application.module):
251
247
  - `[NavRoute("human-resources.employees")]` (CORRECT — module-level, 2 segments)
252
248
  - `[NavRoute("human-resources.employees.departments")]` (CORRECT — section-level, 3 segments)
253
249
  - `[NavRoute("administration.ai", Suffix = "prompts")]` (CORRECT — sub-resource with Suffix)
254
- - **NavRoute values MUST use kebab-case for ALL multi-word segments:**
250
+ - NavRoute values must use kebab-case for all multi-word segments:
255
251
  - `[NavRoute("human-resources.employees")]` (CORRECT)
256
252
  - `[NavRoute("humanresources.employees")]` (WRONG — missing hyphens)
257
253
  - `[NavRoute("project-management.projects")]` (CORRECT)
258
254
  - `[NavRoute("projectmanagement.projects")]` (WRONG)
259
- - Permission paths MUST use kebab-case matching NavRoute codes (e.g., `human-resources.employees.read`)
260
- - FORBIDDEN: concatenated segments like `humanresources` — must be `human-resources`
261
- - POST-CHECK 32 detects non-kebab-case NavRoute values. POST-CHECK 33 detects non-kebab-case permissions
262
- - **FORBIDDEN:** `[Route("api/...")]` alongside `[NavRoute]` — causes 404s (POST-CHECK 41)
263
- - `[NavRoute]` is the ONLY route attribute needed — resolves routes from DB at startup
264
- - NEVER use `[Authorize]` without specific permission
255
+ - Permission paths must use kebab-case matching NavRoute codes (e.g., `human-resources.employees.read`)
256
+ - Do not use concatenated segments like `humanresources` — must be `human-resources`
257
+ - POST-CHECK C34 detects non-kebab-case NavRoute values. POST-CHECK C35 detects non-kebab-case permissions
258
+ - Do not combine `[Route("api/...")]` with `[NavRoute]` — causes 404s (POST-CHECK C43)
259
+ - `[NavRoute]` is the only route attribute needed — resolves routes from DB at startup
260
+ - Do not use `[Authorize]` without specific permission
265
261
  - Swagger XML documentation
266
262
  - Return DTOs, never domain entities
267
- - **Person Extension DTOs:** ResponseDto MUST include `Display*` fields (`DisplayFirstName`, `DisplayLastName`, `DisplayEmail`) resolved from User join. Mandatory CreateDto: `Guid UserId` only. Optional CreateDto: `Guid? UserId` + person fields.
263
+ - **Person Extension DTOs:** ResponseDto must include `Display*` fields (`DisplayFirstName`, `DisplayLastName`, `DisplayEmail`) resolved from User join. Required CreateDto: `Guid UserId` only. Optional CreateDto: `Guid? UserId` + person fields.
268
264
 
269
265
  ---
270
266
 
@@ -284,19 +280,9 @@ var sectionRoute = $"{moduleRoute}/{ToKebabCase(sectionCode)}";
284
280
 
285
281
  **Layout mapping:** Configured per application in the routing configuration.
286
282
 
287
- ### Lazy Loading (MANDATORY)
283
+ ### Lazy Loading (Required)
288
284
 
289
- ALL page components MUST be lazy-loaded using `React.lazy()`:
290
-
291
- ```tsx
292
- const EmployeesPage = lazy(() =>
293
- import('@/pages/HumanResources/Employees/EmployeesPage')
294
- .then(m => ({ default: m.EmployeesPage }))
295
- );
296
-
297
- // Route element — ALWAYS wrap with Suspense
298
- element: <Suspense fallback={<PageLoader />}><EmployeesPage /></Suspense>
299
- ```
285
+ > See `references/smartstack-frontend.md` section 1 for complete patterns (React.lazy + Suspense + named export wrapping).
300
286
 
301
287
  ### Page Structure Pattern
302
288
 
@@ -315,19 +301,9 @@ const [loading, setLoading] = useState(true);
315
301
 
316
302
  ### Components & CSS
317
303
 
318
- **Components:** DataTable, EntityCard, EntityLookup (NEVER raw HTML `<table>`)
319
- **CSS:** Variables ONLY — hardcoded Tailwind colors are **BLOCKING** in POST-CHECK 9:
320
-
321
- | Instead of | Use |
322
- |-----------|-----|
323
- | `bg-white` | `bg-[var(--bg-card)]` |
324
- | `bg-gray-50` | `bg-[var(--bg-primary)]` |
325
- | `text-gray-900` | `text-[var(--text-primary)]` |
326
- | `text-gray-500` | `text-[var(--text-secondary)]` |
327
- | `border-gray-200` | `border-[var(--border-color)]` |
328
- | `bg-blue-600` | `bg-[var(--color-accent-500)]` |
329
- | `hover:bg-blue-700` | `hover:bg-[var(--color-accent-600)]` |
330
- | `text-red-500` | `text-[var(--error-text)]` |
304
+ **Components:** DataTable, EntityCard, EntityLookup (do not use raw HTML `<table>`)
305
+ **CSS:** Variables only — hardcoded Tailwind colors cause failures in POST-CHECK C9.
306
+ > See `references/smartstack-frontend.md` section 4 for the full CSS variable mapping table.
331
307
 
332
308
  **Loader:** `Loader2` from `lucide-react` for spinners, `PageLoader` for Suspense fallback
333
309
 
@@ -345,48 +321,25 @@ If the module defines `{sections}`, generate frontend routes for EACH section as
345
321
 
346
322
  Section pages live in `src/pages/{AppPascal}/{Module}/{Section}/`.
347
323
 
348
- ### FK Fields in Forms (CRITICAL)
349
-
350
- Any entity property that is a FK Guid (e.g., `EmployeeId`, `DepartmentId`) MUST use the `EntityLookup` component NEVER a `<select>` dropdown, NEVER a `<input type="text">`. Users cannot type GUIDs manually, and `<select>` fails at scale (no search, loads all options).
351
-
352
- ```tsx
353
- // CORRECT — EntityLookup for FK field (ONLY acceptable pattern)
354
- <EntityLookup
355
- apiEndpoint="/api/human-resources/employees"
356
- value={formData.employeeId}
357
- onChange={(id) => handleChange('employeeId', id)}
358
- label={t('module:form.employee', 'Employee')}
359
- mapOption={(item) => ({ id: item.id, label: item.name, sublabel: item.code })}
360
- required
361
- />
362
-
363
- // WRONG plain text input for FK GUID
364
- <input type="text" value={formData.employeeId} placeholder="Enter employee ID" />
365
-
366
- // WRONG <select> dropdown for FK field (even with API-loaded options)
367
- <select value={formData.departmentId} onChange={(e) => setFormData({...formData, departmentId: e.target.value})}>
368
- <option value="">Select...</option>
369
- {departments.map(d => <option key={d.id} value={d.id}>{d.name}</option>)}
370
- </select>
371
- ```
372
-
373
- **Backend requirement:** Each target entity's GetAll endpoint MUST accept `?search=` parameter. See `smartstack-api.md` Service Pattern.
374
-
375
- See `references/smartstack-frontend.md` section 6 for the full `EntityLookup` component definition and usage patterns.
376
-
377
- **FORBIDDEN:**
378
- - `src/pages/{Module}/` (flat, missing App)
379
- - `import axios` → use `@/services/api/apiClient`
380
- - `<table>` → use DataTable
381
- - `<input type="text">` for FK Guid fields → use `EntityLookup`
382
- - `<select>` for FK Guid fields → use `EntityLookup` (even with API-loaded options)
383
- - Placeholder "Enter ID" or "Enter GUID" → use `EntityLookup`
384
- - Hardcoded Tailwind colors (`bg-white`, `text-gray-900`) → use CSS variables
385
- - Static page imports in route files → use `React.lazy()`
386
- - `<Suspense>` without `fallback` prop
387
- - Only fr/en → MUST have 4 languages
388
- - `t('key')` without namespace prefix → use `t('ns:key', 'fallback')`
389
- - Hardcoded user-facing strings in JSX → use `t()`
324
+ ### FK Fields in Forms
325
+
326
+ FK Guid fields (e.g., `EmployeeId`) must use `EntityLookup` — do not use `<select>` or `<input>`.
327
+ Backend: GetAll endpoint must accept `?search=` parameter.
328
+ > See `references/smartstack-frontend.md` section 6 for the full EntityLookup component, code examples, and usage patterns.
329
+
330
+ **Do not:**
331
+ - Use `src/pages/{Module}/` structure (flat, missing App)
332
+ - Import axios directly — use `@/services/api/apiClient`
333
+ - Use raw `<table>` element — use DataTable
334
+ - Use `<input type="text">` for FK Guid fields — use `EntityLookup`
335
+ - Use `<select>` for FK Guid fields use `EntityLookup` (even with API-loaded options)
336
+ - Add placeholders like "Enter ID" or "Enter GUID" — use `EntityLookup`
337
+ - Hardcode Tailwind colors (`bg-white`, `text-gray-900`) — use CSS variables
338
+ - Import pages statically in route files — use `React.lazy()`
339
+ - Create `<Suspense>` without `fallback` prop
340
+ - Support only fr/en must have 4 languages
341
+ - Use `t('key')` without namespace prefix — use `t('ns:key', 'fallback')`
342
+ - Hardcode user-facing strings in JSX use `t()`
390
343
 
391
344
  ---
392
345
 
@@ -416,14 +369,14 @@ t('{module}:actions.create', 'Create entity') // ALWAYS with namespace prefix
416
369
  | Action | Tool |
417
370
  |--------|------|
418
371
  | Generate doc-data.ts + page wrapper | `/documentation` skill (type: user) |
419
- | Verify DocToggleButton in pages | POST-CHECK 24 |
372
+ | Verify DocToggleButton in pages | POST-CHECK C26 |
420
373
 
421
374
  **Output files:**
422
375
  - `src/pages/docs/business/{app}/{module}/doc-data.ts` — data-driven documentation
423
376
  - `src/pages/docs/business/{app}/{module}/index.tsx` — page wrapper using `DocRenderer`
424
377
  - `src/i18n/locales/fr/docs-{app}-{module}.json` — French doc translations
425
378
 
426
- **DocToggleButton (MANDATORY):** Every list/detail page must include `DocToggleButton` in its header.
379
+ **DocToggleButton (Required):** Every list/detail page must include `DocToggleButton` in its header.
427
380
  See `references/smartstack-frontend.md` section 7 for the component pattern.
428
381
 
429
382
  ---
@@ -438,7 +391,7 @@ See `references/smartstack-frontend.md` section 7 for the component pattern.
438
391
 
439
392
  **Rules:**
440
393
  - Business test data for development/demo environments
441
- - ALL DevData entities MUST include `TenantId`
394
+ - All DevData entities must include `TenantId`
442
395
  - DevData depends on seed data (navigation, permissions) being in place
443
396
  - Optional — skip if no meaningful test data needed
444
397
 
@@ -504,27 +457,27 @@ For EACH file in the plan, specify HOW it will be created/modified:
504
457
 
505
458
  ---
506
459
 
507
- ## Parallelization Strategy (Agent Teams)
460
+ ## Parallelization Strategy (Agent tool)
508
461
 
509
- > **Cross-layer parallelism is FORBIDDEN.** Layers execute sequentially: 0 → 1 → 2 → 3 → 4.
510
- > Agent teams are used **within** a layer to parallelize multi-entity work.
462
+ > **Do not parallelize across layers.** Layers execute sequentially: 0 → 1 → 2 → 3 → 4.
463
+ > The Agent tool is used **within** a layer to parallelize multi-entity work.
511
464
 
512
465
  If NOT economy_mode AND a layer has multiple entities to process:
513
466
 
514
- **Create agent teams WITHIN the layer to parallelize multi-entity work.**
467
+ **Launch parallel Agent subagents WITHIN the layer for multi-entity work.**
515
468
 
516
- - **Layer 2 (Backend):** If multiple entities, spawn entity-specific teammates (each handles service + controller for one entity)
517
- - **Layer 3 (Frontend):** If multiple entities, spawn entity-specific teammates (each handles pages + i18n for one entity)
469
+ - **Layer 2 (Backend):** If multiple entities, launch one Snipper agent per entity (each handles service + controller for one entity)
470
+ - **Layer 3 (Frontend):** If multiple entities, launch one Snipper agent per entity (each handles pages + i18n for one entity)
518
471
 
519
472
  | Condition | Action |
520
473
  |-----------|--------|
521
- | economy_mode = true | NO teams, all sequential |
522
- | Single entity | NO teams, agent principal handles all layers |
523
- | Multiple entities, Layer 2 | Teams: one teammate per entity (service + controller) |
524
- | Multiple entities, Layer 3 | Teams: one teammate per entity (pages + i18n) |
525
- | Analysis phase (step-01) | Teams: scan-backend + scan-frontend + scan-context |
474
+ | economy_mode = true | NO parallel agents, all sequential |
475
+ | Single entity | NO parallel agents, agent principal handles all layers |
476
+ | Multiple entities, Layer 2 | Parallel: one Snipper agent per entity (service + controller) |
477
+ | Multiple entities, Layer 3 | Parallel: one Snipper agent per entity (pages + i18n) |
478
+ | Analysis phase (step-01) | Parallel: 2-3 Explore agents (backend + frontend + context) |
526
479
 
527
- See `references/agent-teams-protocol.md` for team creation, teammate spawning, task coordination, and shutdown.
480
+ See `references/parallel-execution.md` for agent launch patterns, task coordination, and decision matrix.
528
481
 
529
482
  ---
530
483
 
@@ -206,7 +206,7 @@ These values are propagated to:
206
206
 
207
207
  ---
208
208
 
209
- ## 5e. Scope Complexity Guard (BLOCKING)
209
+ ## 5e. Scope Complexity Guard
210
210
 
211
211
  > **Root cause (test-apex-007):** `/apex` was invoked with 3 applications and 7 entities.
212
212
  > The model's context window saturated, causing: incomplete migrations, lost conventions,
@@ -234,21 +234,32 @@ IF delegate_mode (-d flag):
234
234
  → SKIP guard (ralph-loop already handles scope per module)
235
235
 
236
236
  ELSE IF app_count > 1:
237
- BLOCKING: "Multiple applications detected ({app_count} apps, {entity_count} entities).
237
+ Warning: "Multiple applications detected ({app_count} apps, {entity_count} entities).
238
238
  /apex handles 1 module at a time. For multi-module projects, use:
239
239
  - /ralph-loop (automated: reads PRD, generates all modules sequentially)
240
240
  - Multiple /apex calls (manual: one /apex per module)
241
241
 
242
- To override this guard, split your request:
242
+ To proceed, split your request:
243
243
  /apex -e add HR employee management
244
244
  /apex -e add CRM client management
245
245
  /apex -e add Project management"
246
246
 
247
+ ELSE IF entity_count > 6:
248
+ → BLOCKING: "Too many entities ({entity_count}) for a single /apex invocation.
249
+ Context window saturation causes: incomplete migrations, lost conventions,
250
+ missing pages, unregistered i18n, forgotten DI registrations.
251
+ Maximum: 6 entities without delegate mode (-d).
252
+
253
+ Solutions:
254
+ /ralph-loop (automated multi-module orchestration)
255
+ /apex -d {prd_path} (delegate mode, called per module by ralph-loop)
256
+ Split manually: /apex add {first 3-4 entities} → then /apex add {remaining}"
257
+ → STOP execution
258
+
247
259
  ELSE IF scope_score > 8:
248
260
  → WARNING: "Large scope detected ({entity_count} entities, {section_count} sections).
249
261
  /apex works best with ≤ 4 entities per invocation.
250
- Consider splitting into smaller iterations.
251
- Proceeding, but expect higher risk of omissions."
262
+ Consider splitting into smaller iterations."
252
263
 
253
264
  AskUserQuestion:
254
265
  header: "Scope"
@@ -294,7 +305,20 @@ needs_notification = {module_complexity} in ["crud-workflow","complex"] OR task
294
305
 
295
306
  ```
296
307
  IF resume_mode:
297
- Read .claude/output/apex/ → find latest task restore state from 00-context.md → SKIP to next step
308
+ Read .claude/output/apex/ → find latest task directory (by timestamp)
309
+
310
+ IF state.json exists:
311
+ → Read state.json for precise layer-level resume:
312
+ completed_layers, completed_entities, files_created, build_gates, commits
313
+ → Resume step-03 at NEXT uncompleted layer (skip completed layers entirely)
314
+ → Re-derive remaining state variables from existing files + git log
315
+
316
+ ELSE IF 00-context.md exists:
317
+ → Restore state from 00-context.md (step-00 output only)
318
+ → Re-derive post-step-00 state from git history + existing files
319
+
320
+ ELSE:
321
+ → Full re-derive from git history + existing files (slowest path)
298
322
  ```
299
323
 
300
324
  ---
@@ -14,7 +14,7 @@ next_step: steps/step-02-plan.md
14
14
 
15
15
  - **ALWAYS** read `references/smartstack-api.md` — BaseEntity API, entity/config/controller patterns
16
16
  > **CONTEXT NOTE:** This file stays in context and is reused by step-03. Do NOT re-read it there.
17
- - If NOT `{economy_mode}`: read `references/agent-teams-protocol.md`
17
+ - If NOT `{economy_mode}`: read `references/parallel-execution.md`
18
18
 
19
19
  ---
20
20
 
@@ -58,15 +58,21 @@ IF delegate_mode:
58
58
  4. Read feature.json for wireframes/componentMapping if {feature_path} exists:
59
59
  → enriches frontend generation in step-03
60
60
 
61
- 5. Perform LIGHTWEIGHT code exploration (verification only):
62
- - Glob("**/Domain/Entities/**/{module_code}/**/*.cs") what already exists?
63
- - Glob("**/Infrastructure/Persistence/Seeding/Data/**/*SeedData*.cs") → existing seed data?
64
- - Glob("src/pages/**/{module_code}/**/*.tsx") → existing pages?
65
- Only to determine create vs modify vs skip (NOT deep analysis)
61
+ 5. Perform LIGHTWEIGHT code exploration (verification only — ONLY entities from PRD tasks):
62
+ For each entity_name in entities[]:
63
+ - Glob("**/Domain/Entities/**/{entity_name}.cs") → exists? (create vs modify)
64
+ - Glob("**/Infrastructure/Persistence/Configurations/**/{entity_name}Configuration.cs") → exists?
65
+ - Glob("**/Application/Services/**/*{entity_name}*Service.cs") exists?
66
+ - Glob("**/Api/Controllers/**/*{entity_name}*Controller.cs") → exists?
67
+ Module-level checks (once):
68
+ - Glob("**/Infrastructure/Persistence/Seeding/Data/{module_code}/**/*SeedData*.cs") → existing seed data?
69
+ - Glob("src/pages/**/{module_code}/**/*.tsx") → existing pages?
70
+ Do NOT scan the full codebase — only verify files relevant to PRD tasks.
71
+ Result: mark each PRD task as "create" (file missing) or "modify" (file exists).
66
72
 
67
73
  6. Gap Analysis: Mark all PRD tasks as "create" unless existing code found
68
74
 
69
- SKIP: Full Agent Teams exploration (section 2), challenge question follow-up
75
+ SKIP: Full Agent tool parallel exploration (section 2), challenge question follow-up
70
76
  Jump to section 5 (Gap Analysis summary) → section 7 (Analysis Summary)
71
77
  ```
72
78
 
@@ -105,28 +111,26 @@ MCP:
105
111
  - mcp__smartstack__analyze_extension_points → React extension points
106
112
  ```
107
113
 
108
- ### If NOT economy_mode: Agent Teams
114
+ ### If NOT economy_mode: Parallel Agent Exploration
109
115
 
110
- > **Protocol:** See `references/agent-teams-protocol.md`
116
+ > **Protocol:** See `references/parallel-execution.md`
111
117
 
112
- ```
113
- TeamCreate("apex-analyze", description: "Scan SmartStack project for existing code")
114
-
115
- Spawn 3 teammates (subagent_type: "Explore", model: "sonnet"):
118
+ Launch 2-3 Explore agents in parallel (single message):
116
119
 
117
- 1. scan-backend:
118
- "Scan backend for module {module_code}: entities, EF configs, services,
119
- DTOs, validators, controllers in Domain/ + Infrastructure/ + Application/ + Api/"
120
+ ```
121
+ Agent(subagent_type='Explore', model='sonnet',
122
+ prompt='Scan backend for module {module_code}: entities, EF configs, services,
123
+ DTOs, validators, controllers in Domain/ + Infrastructure/ + Application/ + Api/')
120
124
 
121
- 2. scan-frontend:
122
- "Scan frontend for module {module_code}: pages, components, hooks,
123
- i18n files, route definitions in src/pages/ + src/components/ + src/locales/"
125
+ Agent(subagent_type='Explore', model='sonnet',
126
+ prompt='Scan frontend for module {module_code}: pages, components, hooks,
127
+ i18n files, route definitions in src/pages/ + src/components/ + src/locales/')
124
128
 
125
- 3. scan-context:
126
- "Read context artifacts for module {module_code}: .ralph/prd-{module_code}.json,
127
- docs/business/**/feature.json → extract sections, entities, rules, permissions, ACs"
129
+ Agent(subagent_type='Explore', model='sonnet',
130
+ prompt='Read context artifacts for module {module_code}: .ralph/prd-{module_code}.json,
131
+ docs/business/**/feature.json → extract sections, entities, rules, permissions, ACs')
128
132
 
129
- Wait for all 3 aggregate results shutdownTeamDelete("apex-analyze")
133
+ # All 3 launched in a single messageagent principal aggregates results
130
134
  ```
131
135
 
132
136
  ---
@@ -61,26 +61,26 @@ IF delegate_mode:
61
61
  > - Skill/MCP assignment table (per file, per layer)
62
62
  > - Layer 0/1/2/3/4 file lists with tools (see "Planning Template" section)
63
63
  > - FK field guidance (EntityLookup + backend ?search= parameter)
64
- > - Parallelization strategy (Agent Teams within Layer 2/3 for multi-entity)
64
+ > - Parallelization strategy (Agent tool within Layer 2/3 for multi-entity)
65
65
  > - Delegate mode fast path (PRD task mapping to layers)
66
66
 
67
67
  ```
68
68
  Layer 0: SEQUENTIAL (agent principal)
69
69
  → domain + infra + migration
70
- → dotnet build --no-restore (BLOCKING)
70
+ → dotnet build --no-restore (must pass)
71
71
 
72
72
  Layer 1: SEQUENTIAL (agent principal)
73
73
  → seed data (navigation, permissions, roles)
74
- → dotnet build (BLOCKING)
74
+ → dotnet build (must pass)
75
75
 
76
- Layer 2: PARALLEL WITHIN LAYER (Agent Teams if multi-entity)
76
+ Layer 2: PARALLEL WITHIN LAYER (Agent tool if multi-entity)
77
77
  → services + controllers
78
- → dotnet build (BLOCKING)
78
+ → dotnet build (must pass)
79
79
  → backend tests inline (scaffold + run + fix max 3)
80
80
 
81
- Layer 3: PARALLEL WITHIN LAYER (Agent Teams if multi-entity)
81
+ Layer 3: PARALLEL WITHIN LAYER (Agent tool if multi-entity)
82
82
  → pages + i18n + documentation
83
- → compliance gate (BLOCKING)
83
+ → compliance gate (must pass)
84
84
  → frontend tests inline (scaffold + run + fix max 3)
85
85
 
86
86
  Layer 4: OPTIONAL (agent principal)
@@ -105,7 +105,7 @@ Verify the plan respects dependencies:
105
105
  - Backend tests AFTER services + controllers (inline in Layer 2)
106
106
  - Frontend AFTER API controllers (API contract needed)
107
107
  - Frontend tests AFTER pages created (inline in Layer 3)
108
- - Build gate between EVERY layer (BLOCKING): Layer 0 → 1 → 2 → 3 → 4
108
+ - Build gate between EVERY layer (must pass): Layer 0 → 1 → 2 → 3 → 4
109
109
  ```
110
110
 
111
111
  ---
@@ -155,7 +155,7 @@ Write to `{output_dir}/02-plan.md` with the complete plan.
155
155
 
156
156
  ---
157
157
 
158
- ## 8. Create Task List (MANDATORY)
158
+ ## 8. Create Task List
159
159
 
160
160
  > **Visibility:** TaskCreate generates the grouped progress UI with checkboxes.
161
161
  > This makes APEX execution trackable and predictable for the user.
@@ -207,7 +207,7 @@ TaskCreate(subject: "APEX Progress",
207
207
  TaskCreate(subject: "Layer 0: Domain + Infrastructure",
208
208
  description: "Entities: {entity1} ({tenantMode}), {entity2} ({tenantMode}).
209
209
  Files: Domain/Entities/*.cs, Infrastructure/Persistence/Configs/*.cs, Migration.
210
- Tools: MCP scaffold_extension (type: entity, configuration). MCP suggest_migration.
210
+ Tools: MCP scaffold_extension (type: entity). EF config: manual per smartstack-api.md. MCP suggest_migration.
211
211
  Gate: dotnet build --no-restore. ACs: {relevant ACs}.",
212
212
  activeForm: "Creating domain entities",
213
213
  metadata: { layer: 0, entities: [...], tools: ["scaffold_extension", "suggest_migration"], build_gate: "pending", files_created: [] })
@@ -271,7 +271,7 @@ Gate: dotnet build.",
271
271
 
272
272
  # Post-execution
273
273
  TaskCreate(subject: "eXamine: Validation + POST-CHECKs",
274
- description: "MCP validate_conventions, build, 50 POST-CHECKs, acceptance criteria.
274
+ description: "MCP validate_conventions, build, POST-CHECKs (see post-checks.md), acceptance criteria.
275
275
  Tools: MCP validate_conventions, validate_security, validate_frontend_routes.",
276
276
  activeForm: "Validating conventions",
277
277
  metadata: { tools: ["validate_conventions", "validate_security", "validate_frontend_routes"] })
@@ -279,7 +279,7 @@ Tools: MCP validate_conventions, validate_security, validate_frontend_routes.",
279
279
 
280
280
  ### Economy Mode
281
281
 
282
- IF economy_mode: Create the SAME tasks (for visibility), but no Agent Teams — agent principal executes sequentially.
282
+ IF economy_mode: Create the SAME tasks (for visibility), but no parallel agents — agent principal executes sequentially.
283
283
 
284
284
  ### Delegate Mode
285
285