@atlashub/smartstack-cli 3.39.0 → 3.41.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.
- package/.documentation/apex.html +644 -644
- package/.documentation/css/styles.css +2320 -2320
- package/.documentation/init.html +1377 -1377
- package/.documentation/js/app.js +780 -780
- package/.documentation/prd-json-v2.0.0.md +396 -396
- package/.documentation/testing-ba-e2e.md +462 -462
- package/config/default-config.json +95 -95
- package/config/mcp-defaults.json +62 -62
- package/config/settings.json +53 -53
- package/config/settings.local.example.json +16 -16
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +6 -4
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +115 -115
- package/scripts/extract-api-endpoints.ts +325 -325
- package/scripts/extract-business-rules.ts +440 -440
- package/scripts/generate-doc-with-mock-ui.ts +804 -804
- package/scripts/health-check.sh +168 -168
- package/scripts/postinstall.js +18 -18
- package/templates/agents/action.md +37 -37
- package/templates/agents/ba-reader.md +378 -378
- package/templates/agents/ba-writer.md +861 -861
- package/templates/agents/code-reviewer.md +163 -163
- package/templates/agents/db-reader.md +149 -149
- package/templates/agents/docs-context-reader.md +143 -143
- package/templates/agents/docs-sync-checker.md +122 -122
- package/templates/agents/efcore/conflicts.md +95 -84
- package/templates/agents/efcore/db-deploy.md +85 -74
- package/templates/agents/efcore/db-reset.md +96 -85
- package/templates/agents/efcore/db-seed.md +72 -61
- package/templates/agents/efcore/db-status.md +97 -86
- package/templates/agents/efcore/migration.md +197 -186
- package/templates/agents/efcore/rebase-snapshot.md +119 -108
- package/templates/agents/efcore/scan.md +103 -92
- package/templates/agents/efcore/squash.md +172 -161
- package/templates/agents/explore-codebase.md +66 -66
- package/templates/agents/explore-docs.md +98 -98
- package/templates/agents/fix-grammar.md +50 -50
- package/templates/agents/gitflow/abort.md +45 -45
- package/templates/agents/gitflow/cleanup.md +96 -96
- package/templates/agents/gitflow/commit.md +236 -236
- package/templates/agents/gitflow/exec.md +48 -48
- package/templates/agents/gitflow/finish.md +146 -146
- package/templates/agents/gitflow/init-clone.md +199 -199
- package/templates/agents/gitflow/init-detect.md +137 -137
- package/templates/agents/gitflow/init-validate.md +225 -225
- package/templates/agents/gitflow/init.md +340 -340
- package/templates/agents/gitflow/merge.md +145 -145
- package/templates/agents/gitflow/plan.md +42 -42
- package/templates/agents/gitflow/pr.md +191 -191
- package/templates/agents/gitflow/review.md +49 -49
- package/templates/agents/gitflow/start.md +147 -147
- package/templates/agents/gitflow/status.md +95 -95
- package/templates/agents/mcp-healthcheck.md +163 -163
- package/templates/agents/snipper.md +37 -37
- package/templates/agents/websearch.md +46 -46
- package/templates/hooks/appsettings-guard.sh +76 -76
- package/templates/hooks/docs-drift-check.md +96 -96
- package/templates/hooks/ef-migration-check.md +139 -139
- package/templates/hooks/hooks.json +58 -58
- package/templates/hooks/mcp-check.md +64 -64
- package/templates/hooks/ralph-mcp-logger.sh +46 -46
- package/templates/hooks/ralph-session-end.sh +69 -69
- package/templates/hooks/stop-hook.sh +177 -177
- package/templates/hooks/wsl-dotnet-cleanup.sh +24 -24
- package/templates/mcp-scaffolding/component.tsx.hbs +318 -318
- package/templates/mcp-scaffolding/controller.cs.hbs +192 -192
- package/templates/mcp-scaffolding/entity-extension.cs.hbs +239 -239
- package/templates/mcp-scaffolding/frontend/api-client.ts.hbs +116 -116
- package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -133
- package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +126 -126
- package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +261 -261
- package/templates/mcp-scaffolding/service-extension.cs.hbs +53 -53
- package/templates/mcp-scaffolding/tests/controller.test.cs.hbs +436 -436
- package/templates/mcp-scaffolding/tests/entity.test.cs.hbs +239 -239
- package/templates/mcp-scaffolding/tests/repository.test.cs.hbs +441 -441
- package/templates/mcp-scaffolding/tests/security.test.cs.hbs +442 -442
- package/templates/mcp-scaffolding/tests/service.test.cs.hbs +402 -402
- package/templates/mcp-scaffolding/tests/validator.test.cs.hbs +428 -428
- package/templates/project/DependencyInjection.Application.cs.template +25 -25
- package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -61
- package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -70
- package/templates/project/ExampleEntity.cs.template +116 -116
- package/templates/project/ExampleEntityConfiguration.cs.template +64 -64
- package/templates/project/ExampleService.cs.template +146 -146
- package/templates/project/ExtensionsDbContext.cs.template +41 -41
- package/templates/project/IExtensionsDbContext.cs.template +22 -22
- package/templates/project/Program.cs.template +47 -47
- package/templates/project/README.md +79 -79
- package/templates/project/api.ts.template +12 -12
- package/templates/project/appsettings.json.template +170 -170
- package/templates/project/claude-settings.json.template +5 -5
- package/templates/project/test-frontend/msw/handlers.ts +58 -58
- package/templates/project/test-frontend/msw/server.ts +25 -25
- package/templates/project/test-frontend/setup.ts +16 -16
- package/templates/project/test-frontend/test-utils.tsx +59 -59
- package/templates/project/test-frontend/vitest.config.ts +31 -31
- package/templates/ralph/README.md +93 -93
- package/templates/ralph/ralph.config.yaml +113 -113
- package/templates/scripts/setup-ralph-loop.sh +173 -173
- package/templates/skills/_resources/config-safety.md +61 -61
- package/templates/skills/_resources/context-digest-template.md +53 -53
- package/templates/skills/_resources/doc-context-cache.md +60 -60
- package/templates/skills/_resources/docs-manifest-schema.md +155 -155
- package/templates/skills/_resources/formatting-guide.md +124 -124
- package/templates/skills/_resources/mcp-validate-documentation-spec.md +181 -181
- package/templates/skills/_shared.md +228 -228
- package/templates/skills/admin/SKILL.md +48 -48
- package/templates/skills/ai-prompt/SKILL.md +107 -107
- package/templates/skills/ai-prompt/steps/step-00-init.md +47 -47
- package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -122
- package/templates/skills/apex/SKILL.md +168 -168
- package/templates/skills/apex/_shared.md +141 -141
- package/templates/skills/apex/references/agent-teams-protocol.md +164 -164
- package/templates/skills/apex/references/analysis-methods.md +141 -141
- package/templates/skills/apex/references/challenge-questions.md +145 -145
- package/templates/skills/apex/references/code-generation.md +412 -412
- package/templates/skills/apex/references/core-seed-data.md +1437 -1437
- package/templates/skills/apex/references/error-classification.md +144 -144
- package/templates/skills/apex/references/examine-build-validation.md +82 -82
- package/templates/skills/apex/references/execution-frontend-gates.md +177 -177
- package/templates/skills/apex/references/execution-frontend-patterns.md +105 -105
- package/templates/skills/apex/references/execution-layer1-rules.md +96 -96
- package/templates/skills/apex/references/initialization-challenge-flow.md +110 -110
- package/templates/skills/apex/references/planning-layer-mapping.md +151 -151
- package/templates/skills/apex/references/post-checks.md +1584 -1584
- package/templates/skills/apex/references/smartstack-api.md +1053 -1053
- package/templates/skills/apex/references/smartstack-frontend.md +1571 -1571
- package/templates/skills/apex/references/smartstack-layers.md +402 -402
- package/templates/skills/apex/steps/step-00-init.md +307 -307
- package/templates/skills/apex/steps/step-01-analyze.md +165 -165
- package/templates/skills/apex/steps/step-02-plan.md +144 -144
- package/templates/skills/apex/steps/step-03-execute.md +328 -328
- package/templates/skills/apex/steps/step-04-examine.md +263 -263
- package/templates/skills/apex/steps/step-05-deep-review.md +129 -129
- package/templates/skills/apex/steps/step-06-resolve.md +101 -101
- package/templates/skills/apex/steps/step-07-tests.md +238 -238
- package/templates/skills/apex/steps/step-08-run-tests.md +125 -125
- package/templates/skills/application/SKILL.md +4 -4
- package/templates/skills/application/references/application-roles-template.md +227 -227
- package/templates/skills/application/references/backend-controller-hierarchy.md +58 -58
- package/templates/skills/application/references/backend-entity-seeding.md +72 -72
- package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -83
- package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -79
- package/templates/skills/application/references/backend-verification.md +88 -88
- package/templates/skills/application/references/frontend-i18n-and-output.md +67 -67
- package/templates/skills/application/references/frontend-route-naming.md +117 -117
- package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -107
- package/templates/skills/application/references/frontend-verification.md +156 -156
- package/templates/skills/application/references/migration-checklist-troubleshooting.md +1 -1
- package/templates/skills/application/references/provider-template.md +177 -177
- package/templates/skills/application/references/roles-client-project-handling.md +55 -55
- package/templates/skills/application/references/roles-fallback-procedure.md +149 -149
- package/templates/skills/application/references/test-coverage-requirements.md +213 -213
- package/templates/skills/application/references/test-frontend.md +73 -73
- package/templates/skills/application/references/test-prerequisites.md +72 -72
- package/templates/skills/application/steps/step-05-frontend.md +176 -176
- package/templates/skills/application/steps/step-06-migration.md +193 -193
- package/templates/skills/application/steps/step-07-tests.md +356 -356
- package/templates/skills/application/steps/step-08-documentation.md +137 -137
- package/templates/skills/application/templates-backend.md +463 -463
- package/templates/skills/application/templates-frontend.md +685 -685
- package/templates/skills/application/templates-i18n.md +520 -520
- package/templates/skills/application/templates-seed.md +1096 -1096
- package/templates/skills/business-analyse/SKILL.md +327 -327
- package/templates/skills/business-analyse/_architecture.md +123 -123
- package/templates/skills/business-analyse/_elicitation.md +206 -206
- package/templates/skills/business-analyse/_module-loop.md +115 -115
- package/templates/skills/business-analyse/_shared.md +383 -383
- package/templates/skills/business-analyse/_suggestions.md +34 -34
- package/templates/skills/business-analyse/html/ba-interactive.html +4477 -4477
- package/templates/skills/business-analyse/html/build-html.js +77 -77
- package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +150 -150
- package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +227 -227
- package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +199 -199
- package/templates/skills/business-analyse/html/src/scripts/04-render-modules.js +205 -205
- package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +647 -647
- package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +195 -195
- package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +92 -92
- package/templates/skills/business-analyse/html/src/scripts/08-editing.js +135 -135
- package/templates/skills/business-analyse/html/src/scripts/09-export.js +168 -168
- package/templates/skills/business-analyse/html/src/scripts/10-comments.js +171 -171
- package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +166 -166
- package/templates/skills/business-analyse/html/src/styles/01-variables.css +38 -38
- package/templates/skills/business-analyse/html/src/styles/02-layout.css +101 -101
- package/templates/skills/business-analyse/html/src/styles/03-navigation.css +120 -120
- package/templates/skills/business-analyse/html/src/styles/04-cards.css +196 -196
- package/templates/skills/business-analyse/html/src/styles/05-modules.css +454 -454
- package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +272 -272
- package/templates/skills/business-analyse/html/src/styles/07-comments.css +184 -184
- package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +241 -241
- package/templates/skills/business-analyse/html/src/template.html +516 -516
- package/templates/skills/business-analyse/patterns/suggestion-catalog.md +546 -546
- package/templates/skills/business-analyse/questionnaire/00-application.md +160 -160
- package/templates/skills/business-analyse/questionnaire/00b-project.md +85 -85
- package/templates/skills/business-analyse/questionnaire/01-context.md +185 -185
- package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +189 -189
- package/templates/skills/business-analyse/questionnaire/03-scope.md +164 -164
- package/templates/skills/business-analyse/questionnaire/04-data.md +88 -88
- package/templates/skills/business-analyse/questionnaire/05-integrations.md +58 -58
- package/templates/skills/business-analyse/questionnaire/06-security.md +68 -68
- package/templates/skills/business-analyse/questionnaire/07-ui.md +76 -76
- package/templates/skills/business-analyse/questionnaire/08-performance.md +42 -42
- package/templates/skills/business-analyse/questionnaire/09-constraints.md +45 -45
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +43 -43
- package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +59 -59
- package/templates/skills/business-analyse/questionnaire/12-migration.md +58 -58
- package/templates/skills/business-analyse/questionnaire/13-cross-module.md +69 -69
- package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +135 -135
- package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +136 -136
- package/templates/skills/business-analyse/questionnaire.md +337 -337
- package/templates/skills/business-analyse/react/application-viewer.md +242 -242
- package/templates/skills/business-analyse/react/components.md +551 -551
- package/templates/skills/business-analyse/react/i18n-template.md +306 -306
- package/templates/skills/business-analyse/references/acceptance-criteria.md +169 -169
- package/templates/skills/business-analyse/references/agent-module-prompt.md +362 -362
- package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +557 -557
- package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -190
- package/templates/skills/business-analyse/references/cache-warming-strategy.md +566 -566
- package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -41
- package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -74
- package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +115 -115
- package/templates/skills/business-analyse/references/cadrage-shared-modules.md +68 -69
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +85 -85
- package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -297
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +107 -107
- package/templates/skills/business-analyse/references/deploy-data-build.md +180 -180
- package/templates/skills/business-analyse/references/deploy-modes.md +118 -118
- package/templates/skills/business-analyse/references/detection-strategies.md +424 -424
- package/templates/skills/business-analyse/references/entity-architecture-decision.md +218 -218
- package/templates/skills/business-analyse/references/handoff-file-templates.md +120 -120
- package/templates/skills/business-analyse/references/handoff-mappings.md +81 -81
- package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -312
- package/templates/skills/business-analyse/references/html-data-mapping.md +299 -299
- package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -65
- package/templates/skills/business-analyse/references/naming-conventions.md +243 -243
- package/templates/skills/business-analyse/references/prd-generation.md +258 -258
- package/templates/skills/business-analyse/references/review-data-mapping.md +363 -363
- package/templates/skills/business-analyse/references/robustness-checks.md +542 -542
- package/templates/skills/business-analyse/references/spec-auto-inference.md +111 -111
- package/templates/skills/business-analyse/references/team-orchestration.md +1022 -1022
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -85
- package/templates/skills/business-analyse/references/ui-resource-cards.md +259 -259
- package/templates/skills/business-analyse/references/validate-incremental-html.md +121 -121
- package/templates/skills/business-analyse/references/validation-checklist.md +347 -347
- package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +335 -335
- package/templates/skills/business-analyse/schemas/application-schema.json +453 -453
- package/templates/skills/business-analyse/schemas/feature-schema.json +53 -53
- package/templates/skills/business-analyse/schemas/project-schema.json +485 -485
- package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +201 -201
- package/templates/skills/business-analyse/schemas/sections/discovery-schema.json +82 -82
- package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +80 -80
- package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +70 -70
- package/templates/skills/business-analyse/schemas/sections/specification-schema.json +547 -547
- package/templates/skills/business-analyse/schemas/sections/validation-schema.json +93 -93
- package/templates/skills/business-analyse/schemas/shared/common-defs.json +226 -226
- package/templates/skills/business-analyse/steps/step-00-init.md +575 -576
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +767 -767
- package/templates/skills/business-analyse/steps/step-01b-applications.md +419 -419
- package/templates/skills/business-analyse/steps/step-02-decomposition.md +387 -387
- package/templates/skills/business-analyse/steps/step-03a-data.md +16 -16
- package/templates/skills/business-analyse/steps/step-03a1-setup.md +506 -506
- package/templates/skills/business-analyse/steps/step-03a2-analysis.md +252 -252
- package/templates/skills/business-analyse/steps/step-03b-ui.md +425 -425
- package/templates/skills/business-analyse/steps/step-03c-compile.md +611 -611
- package/templates/skills/business-analyse/steps/step-03d-validate.md +783 -783
- package/templates/skills/business-analyse/steps/step-04-consolidation.md +17 -17
- package/templates/skills/business-analyse/steps/step-04a-collect.md +415 -415
- package/templates/skills/business-analyse/steps/step-04b-analyze.md +163 -163
- package/templates/skills/business-analyse/steps/step-04c-decide.md +186 -186
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +840 -840
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +522 -522
- package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +703 -703
- package/templates/skills/business-analyse/steps/step-06-review.md +278 -278
- package/templates/skills/business-analyse/templates/tpl-frd.md +168 -168
- package/templates/skills/business-analyse/templates/tpl-handoff.md +186 -186
- package/templates/skills/business-analyse/templates/tpl-launch-displays.md +59 -59
- package/templates/skills/business-analyse/templates/tpl-progress.md +172 -172
- package/templates/skills/business-analyse/templates-frd.md +476 -476
- package/templates/skills/business-analyse/templates-react.md +574 -574
- package/templates/skills/cc-agent/SKILL.md +129 -129
- package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -95
- package/templates/skills/cc-agent/references/agent-frontmatter.md +213 -213
- package/templates/skills/cc-agent/references/permission-modes.md +102 -102
- package/templates/skills/cc-agent/references/tools-reference.md +144 -144
- package/templates/skills/cc-agent/steps/step-00-init.md +134 -134
- package/templates/skills/cc-agent/steps/step-01-design.md +186 -186
- package/templates/skills/cc-agent/steps/step-02-generate.md +131 -131
- package/templates/skills/cc-agent/steps/step-03-validate.md +130 -130
- package/templates/skills/cc-agent/templates/agent-categorized.md +67 -67
- package/templates/skills/cc-agent/templates/agent-standalone.md +56 -56
- package/templates/skills/cc-agent/templates/agent-with-skills.md +94 -94
- package/templates/skills/cc-audit/SKILL.md +108 -108
- package/templates/skills/cc-audit/references/agent-checklist.md +91 -91
- package/templates/skills/cc-audit/references/hook-checklist.md +110 -110
- package/templates/skills/cc-audit/references/skill-checklist.md +70 -70
- package/templates/skills/cc-audit/steps/step-00-init.md +98 -98
- package/templates/skills/cc-audit/steps/step-01-scan.md +142 -142
- package/templates/skills/cc-audit/steps/step-02-analyze.md +158 -158
- package/templates/skills/cc-audit/steps/step-03-report.md +142 -142
- package/templates/skills/cc-skill/SKILL.md +134 -134
- package/templates/skills/cc-skill/references/best-practices.md +167 -167
- package/templates/skills/cc-skill/references/frontmatter-reference.md +182 -182
- package/templates/skills/cc-skill/references/skill-patterns.md +199 -199
- package/templates/skills/cc-skill/steps/step-00-init.md +119 -119
- package/templates/skills/cc-skill/steps/step-01-design.md +199 -199
- package/templates/skills/cc-skill/steps/step-02-generate.md +145 -145
- package/templates/skills/cc-skill/steps/step-03-steps.md +151 -151
- package/templates/skills/cc-skill/steps/step-04-validate.md +124 -124
- package/templates/skills/cc-skill/templates/skill-forked.md +85 -85
- package/templates/skills/cc-skill/templates/skill-progressive.md +102 -102
- package/templates/skills/cc-skill/templates/skill-simple.md +75 -75
- package/templates/skills/cc-skill/templates/step-template.md +82 -82
- package/templates/skills/check-version/SKILL.md +196 -196
- package/templates/skills/controller/SKILL.md +162 -162
- package/templates/skills/controller/postman-templates.md +614 -614
- package/templates/skills/controller/references/controller-code-templates.md +159 -159
- package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -209
- package/templates/skills/controller/references/permission-sync-templates.md +149 -149
- package/templates/skills/controller/steps/step-00-init.md +193 -191
- package/templates/skills/controller/steps/step-01-analyze.md +146 -146
- package/templates/skills/controller/steps/step-02-plan.md +176 -176
- package/templates/skills/controller/steps/step-03-generate.md +189 -189
- package/templates/skills/controller/steps/step-04-perms.md +80 -80
- package/templates/skills/controller/steps/step-05-validate.md +107 -107
- package/templates/skills/controller/templates.md +1555 -1555
- package/templates/skills/debug/SKILL.md +70 -70
- package/templates/skills/debug/references/team-protocol.md +232 -232
- package/templates/skills/debug/steps/step-00-init.md +57 -57
- package/templates/skills/debug/steps/step-01-analyze.md +219 -219
- package/templates/skills/debug/steps/step-02-resolve.md +85 -85
- package/templates/skills/documentation/SKILL.md +132 -132
- package/templates/skills/documentation/data-schema.md +227 -227
- package/templates/skills/documentation/steps/step-00-init.md +70 -70
- package/templates/skills/documentation/steps/step-01-scan.md +113 -113
- package/templates/skills/documentation/steps/step-02-generate.md +231 -231
- package/templates/skills/documentation/steps/step-03-validate.md +251 -238
- package/templates/skills/documentation/templates.md +662 -663
- package/templates/skills/efcore/SKILL.md +168 -167
- package/templates/skills/efcore/references/both-contexts.md +32 -32
- package/templates/skills/efcore/references/database-operations.md +67 -67
- package/templates/skills/efcore/references/destructive-operations.md +38 -38
- package/templates/skills/efcore/references/reset-operations.md +81 -81
- package/templates/skills/efcore/references/seed-methods.md +86 -86
- package/templates/skills/efcore/references/shared-init-functions.md +250 -250
- package/templates/skills/efcore/references/sql-objects-injection.md +61 -61
- package/templates/skills/efcore/references/troubleshooting.md +81 -81
- package/templates/skills/efcore/references/zero-downtime-patterns.md +227 -227
- package/templates/skills/efcore/steps/db/step-deploy.md +217 -217
- package/templates/skills/efcore/steps/db/step-reset.md +186 -186
- package/templates/skills/efcore/steps/db/step-seed.md +166 -166
- package/templates/skills/efcore/steps/db/step-status.md +173 -173
- package/templates/skills/efcore/steps/migration/step-00-init.md +102 -102
- package/templates/skills/efcore/steps/migration/step-01-check.md +164 -164
- package/templates/skills/efcore/steps/migration/step-02-create.md +160 -160
- package/templates/skills/efcore/steps/migration/step-03-validate.md +168 -168
- package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +173 -173
- package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +100 -100
- package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +115 -115
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +112 -112
- package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +157 -157
- package/templates/skills/efcore/steps/shared/step-00-init.md +131 -131
- package/templates/skills/efcore/steps/squash/step-00-init.md +141 -141
- package/templates/skills/efcore/steps/squash/step-01-backup.md +120 -120
- package/templates/skills/efcore/steps/squash/step-02-fetch.md +168 -168
- package/templates/skills/efcore/steps/squash/step-03-create.md +184 -184
- package/templates/skills/efcore/steps/squash/step-04-validate.md +174 -174
- package/templates/skills/explore/SKILL.md +98 -98
- package/templates/skills/feature-full/SKILL.md +111 -111
- package/templates/skills/feature-full/steps/step-00-init.md +57 -57
- package/templates/skills/feature-full/steps/step-01-implementation.md +120 -120
- package/templates/skills/gitflow/SKILL.md +377 -377
- package/templates/skills/gitflow/_shared.md +620 -620
- package/templates/skills/gitflow/phases/abort.md +189 -189
- package/templates/skills/gitflow/phases/cleanup.md +234 -234
- package/templates/skills/gitflow/phases/status.md +192 -192
- package/templates/skills/gitflow/references/commit-message-generation.md +58 -58
- package/templates/skills/gitflow/references/commit-migration-validation.md +49 -49
- package/templates/skills/gitflow/references/finish-cleanup.md +55 -55
- package/templates/skills/gitflow/references/finish-version-bumping.md +45 -45
- package/templates/skills/gitflow/references/init-config-template.md +135 -135
- package/templates/skills/gitflow/references/init-environment-detection.md +41 -41
- package/templates/skills/gitflow/references/init-name-normalization.md +103 -103
- package/templates/skills/gitflow/references/init-questions.md +185 -185
- package/templates/skills/gitflow/references/init-structure-creation.md +75 -75
- package/templates/skills/gitflow/references/init-version-detection.md +21 -21
- package/templates/skills/gitflow/references/init-workspace-detection.md +43 -43
- package/templates/skills/gitflow/references/merge-ci-status.md +36 -36
- package/templates/skills/gitflow/references/merge-execution.md +62 -62
- package/templates/skills/gitflow/references/merge-pr-context.md +76 -76
- package/templates/skills/gitflow/references/plan-template.md +69 -69
- package/templates/skills/gitflow/references/pr-build-checks.md +60 -60
- package/templates/skills/gitflow/references/pr-generation.md +58 -58
- package/templates/skills/gitflow/references/start-branch-normalization.md +28 -28
- package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -70
- package/templates/skills/gitflow/references/start-local-config.md +113 -113
- package/templates/skills/gitflow/references/start-worktree-creation.md +50 -50
- package/templates/skills/gitflow/references/sync-push-verify.md +44 -44
- package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -38
- package/templates/skills/gitflow/steps/step-commit.md +199 -199
- package/templates/skills/gitflow/steps/step-finish.md +147 -147
- package/templates/skills/gitflow/steps/step-init.md +190 -190
- package/templates/skills/gitflow/steps/step-merge.md +85 -85
- package/templates/skills/gitflow/steps/step-plan.md +151 -151
- package/templates/skills/gitflow/steps/step-pr.md +199 -199
- package/templates/skills/gitflow/steps/step-start.md +195 -195
- package/templates/skills/gitflow/steps/step-sync.md +161 -161
- package/templates/skills/gitflow/templates/config.json +72 -72
- package/templates/skills/mcp/SKILL.md +62 -62
- package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -108
- package/templates/skills/mcp/steps/step-02-tools.md +73 -73
- package/templates/skills/notification/SKILL.md +173 -173
- package/templates/skills/quick-search/SKILL.md +99 -99
- package/templates/skills/ralph-loop/SKILL.md +234 -234
- package/templates/skills/ralph-loop/references/category-completeness.md +185 -185
- package/templates/skills/ralph-loop/references/category-rules.md +96 -96
- package/templates/skills/ralph-loop/references/compact-loop.md +300 -300
- package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -127
- package/templates/skills/ralph-loop/references/module-transition.md +151 -151
- package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -171
- package/templates/skills/ralph-loop/references/parallel-execution.md +246 -246
- package/templates/skills/ralph-loop/references/section-splitting.md +439 -439
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +256 -256
- package/templates/skills/ralph-loop/references/team-orchestration.md +547 -547
- package/templates/skills/ralph-loop/steps/step-00-init.md +150 -150
- package/templates/skills/ralph-loop/steps/step-01-task.md +174 -174
- package/templates/skills/ralph-loop/steps/step-02-execute.md +177 -177
- package/templates/skills/ralph-loop/steps/step-03-commit.md +92 -92
- package/templates/skills/ralph-loop/steps/step-04-check.md +207 -207
- package/templates/skills/ralph-loop/steps/step-05-report.md +175 -175
- package/templates/skills/refactor/SKILL.md +56 -56
- package/templates/skills/refactor/steps/step-01-discover.md +60 -60
- package/templates/skills/refactor/steps/step-02-execute.md +67 -67
- package/templates/skills/review-code/SKILL.md +95 -94
- package/templates/skills/review-code/references/clean-code-principles.md +292 -292
- package/templates/skills/review-code/references/code-quality-metrics.md +174 -174
- package/templates/skills/review-code/references/feedback-patterns.md +149 -149
- package/templates/skills/review-code/references/owasp-api-top10.md +243 -243
- package/templates/skills/review-code/references/security-checklist.md +212 -212
- package/templates/skills/review-code/steps/step-01-smartstack.md +96 -96
- package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -80
- package/templates/skills/review-code/steps/step-03-react.md +44 -44
- package/templates/skills/ui-components/SKILL.md +137 -137
- package/templates/skills/ui-components/accessibility.md +170 -170
- package/templates/skills/ui-components/patterns/dashboard-chart.md +327 -327
- package/templates/skills/ui-components/patterns/data-table.md +39 -39
- package/templates/skills/ui-components/patterns/entity-card.md +77 -77
- package/templates/skills/ui-components/patterns/grid-layout.md +91 -91
- package/templates/skills/ui-components/patterns/kanban.md +43 -43
- package/templates/skills/ui-components/responsive-guidelines.md +278 -278
- package/templates/skills/ui-components/style-guide.md +113 -113
- package/templates/skills/utils/SKILL.md +44 -44
- package/templates/skills/utils/subcommands/test-web-config.md +152 -152
- package/templates/skills/utils/subcommands/test-web.md +123 -123
- package/templates/skills/validate/SKILL.md +181 -181
- package/templates/skills/validate-feature/SKILL.md +101 -101
- package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -140
- package/templates/skills/validate-feature/references/db-validation-checks.md +180 -180
- package/templates/skills/validate-feature/steps/step-00-dependencies.md +121 -121
- package/templates/skills/validate-feature/steps/step-01-compile.md +39 -39
- package/templates/skills/validate-feature/steps/step-02-unit-tests.md +45 -45
- package/templates/skills/validate-feature/steps/step-03-integration-tests.md +53 -53
- package/templates/skills/validate-feature/steps/step-04-api-smoke.md +94 -94
- package/templates/skills/validate-feature/steps/step-05-db-validation.md +149 -149
- package/templates/skills/workflow/SKILL.md +127 -127
- package/templates/skills/workflow/steps/step-00-init.md +57 -57
- package/templates/skills/workflow/steps/step-01-implementation.md +84 -84
- package/templates/test-web/api-health.json +38 -38
- package/templates/test-web/minimal.json +19 -19
- package/templates/test-web/npm-package.json +46 -46
- package/templates/test-web/seo-check.json +54 -54
|
@@ -1,1022 +1,1022 @@
|
|
|
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
|
-
> **Execution:** Parallel by dependency layer — all modules in the same layer run simultaneously.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Multi-Application Team Structure (Project Mode)
|
|
11
|
-
|
|
12
|
-
> **Only applies when `workflow.mode === "project"`** (multiple applications in a single BA session).
|
|
13
|
-
> In single-application mode, skip this section entirely.
|
|
14
|
-
|
|
15
|
-
When the project contains multiple applications, the team structure adds an **application-level outer loop** around the existing module-level inner loop:
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
Team Lead (project level)
|
|
19
|
-
├── Application 1 (in topological order)
|
|
20
|
-
│ ├── mod-{app1-module1} (parallel per dependency layer)
|
|
21
|
-
│ ├── mod-{app1-module2}
|
|
22
|
-
│ └── consolidation-{app1}
|
|
23
|
-
├── Application 2
|
|
24
|
-
│ ├── mod-{app2-module1}
|
|
25
|
-
│ ├── mod-{app2-module2}
|
|
26
|
-
│ └── consolidation-{app2}
|
|
27
|
-
├── Cross-Application Consolidation Agent
|
|
28
|
-
└── Handoff Agent (all applications)
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**Application Loop Protocol:**
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
FOR each application in projectFeature.applicationDependencyGraph.topologicalOrder:
|
|
35
|
-
1. Load application feature.json
|
|
36
|
-
2. Read module decomposition for this application
|
|
37
|
-
3. Execute §1-§4 (team setup → module specification → review → layer completion)
|
|
38
|
-
- Team name: "ba-{projectName}-{appCode}"
|
|
39
|
-
- Agent names: "mod-{appCode}-{moduleCode}"
|
|
40
|
-
- Context passed to agents includes application-specific: context, tablePrefix, applicationRoles
|
|
41
|
-
4. After all modules in this application are specified:
|
|
42
|
-
- Run per-application consolidation (§5 — scoped to this application's modules)
|
|
43
|
-
- Mark application as "specified" in project feature.json
|
|
44
|
-
- Clean up application team
|
|
45
|
-
|
|
46
|
-
AFTER all applications specified:
|
|
47
|
-
5. Run cross-application consolidation (§5-bis)
|
|
48
|
-
6. Run unified handoff (§6 — all applications at once)
|
|
49
|
-
7. Cleanup (§7)
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Key differences from single-application mode:**
|
|
53
|
-
- Team names include application code to avoid collisions
|
|
54
|
-
- Agent prompts include application context (not just module context)
|
|
55
|
-
- Cross-application consolidation runs AFTER all per-application consolidations
|
|
56
|
-
- Handoff generates one PRD per module + one cross-application PRD
|
|
57
|
-
- The team lead tracks both `completedApplications[]` and `completedModules[]`
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## 1. Team Setup
|
|
62
|
-
|
|
63
|
-
After step-02 decomposition is complete and client has approved the module structure:
|
|
64
|
-
|
|
65
|
-
### 1a. Clean Up Old Team Data (MANDATORY)
|
|
66
|
-
|
|
67
|
-
Before creating the team, clean up any leftover data from previous sessions to prevent stale task collisions:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# Remove leftover task files from previous runs
|
|
71
|
-
rm -f ~/.claude/tasks/ba-{appName}/*.json 2>/dev/null
|
|
72
|
-
# Remove leftover team directory (TeamDelete may leave remnants)
|
|
73
|
-
rm -rf ~/.claude/teams/ba-{appName} 2>/dev/null
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
> **Why:** If a previous session used the same team name and crashed or was interrupted,
|
|
77
|
-
> leftover task files will be picked up by new agents, causing them to receive stale
|
|
78
|
-
> task_assignment notifications for wrong modules.
|
|
79
|
-
|
|
80
|
-
### 1b. Create Team and Capture Actual Name
|
|
81
|
-
|
|
82
|
-
```javascript
|
|
83
|
-
const result = TeamCreate({ team_name: "ba-{appName}", description: "BA module analysis for {appName}" });
|
|
84
|
-
// CRITICAL: TeamCreate may return a DIFFERENT name than requested!
|
|
85
|
-
// Always use the RETURNED team_name, not the requested one.
|
|
86
|
-
const actualTeamName = result.team_name;
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Store team context for the session:
|
|
90
|
-
```javascript
|
|
91
|
-
const teamContext = {
|
|
92
|
-
teamName: actualTeamName, // ← RETURNED name, NOT "ba-{appName}"
|
|
93
|
-
moduleOrder: metadata.workflow.moduleOrder,
|
|
94
|
-
dependencyLayers: dependencyGraph.layers, // ← from step-02 topological sort
|
|
95
|
-
completedModules: [],
|
|
96
|
-
completedLayers: [],
|
|
97
|
-
mode: "propose-review"
|
|
98
|
-
};
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
> **WARNING:** NEVER hardcode `"ba-{appName}"` in subsequent calls.
|
|
102
|
-
> Always use `teamContext.teamName` (the actual name returned by TeamCreate).
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## 2. Module Agent Spawn — Parallel by Dependency Layer
|
|
107
|
-
|
|
108
|
-
Process modules **layer by layer**. Within each layer, spawn ALL agents **simultaneously**.
|
|
109
|
-
|
|
110
|
-
```
|
|
111
|
-
FOR each layer in dependencyGraph.layers:
|
|
112
|
-
Execute §2a → §2b → §2c → §2d → §2e → §3 → §4
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 2a. Pre-Spawn Cross-Module Analysis
|
|
116
|
-
|
|
117
|
-
**ALWAYS executed for layers with 2+ modules.** Analyze the module definitions within this layer to identify cross-module touchpoints BEFORE spawning agents.
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
IF layer.modules.length >= 2:
|
|
121
|
-
|
|
122
|
-
ULTRATHINK: Analyze module definitions for same-layer interactions:
|
|
123
|
-
|
|
124
|
-
1. Shared entity names
|
|
125
|
-
→ Do any modules reference the same entity? (e.g., both "Products" and "Inventory"
|
|
126
|
-
might reference a "Category" entity)
|
|
127
|
-
|
|
128
|
-
2. Potential FK overlaps
|
|
129
|
-
→ Do any modules anticipate creating entities that others might reference?
|
|
130
|
-
→ E.g., Products creates "Product" entity, Orders references "Product" via FK
|
|
131
|
-
|
|
132
|
-
3. Naming conventions
|
|
133
|
-
→ Will both modules use similar attribute names? (e.g., "Code", "Name", "Status")
|
|
134
|
-
→ Agree on a consistent naming pattern
|
|
135
|
-
|
|
136
|
-
4. Shared lookup data
|
|
137
|
-
→ Do any modules reference common reference tables?
|
|
138
|
-
→ E.g., both use a "Status" enum, a "Country" lookup, a "Currency" type
|
|
139
|
-
|
|
140
|
-
5. Permission path consistency
|
|
141
|
-
→ Verify permission paths won't collide:
|
|
142
|
-
{app}.{module1}.{entity}.{action}
|
|
143
|
-
{app}.{module2}.{entity}.{action}
|
|
144
|
-
|
|
145
|
-
Build coordinationNotes for EACH module in the layer:
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**coordinationNotes template** (injected into each agent's prompt):
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
## Same-Layer Coordination Notes
|
|
152
|
-
|
|
153
|
-
You are running IN PARALLEL with: {otherModuleCodes.join(", ")}
|
|
154
|
-
|
|
155
|
-
### Known Touchpoints
|
|
156
|
-
- {otherModule} will define entity "{EntityName}" — if you need to reference it,
|
|
157
|
-
use CROSS_MODULE_QUERY to get the exact attribute structure
|
|
158
|
-
- Naming convention: use {convention} for shared concepts (e.g., "Status" enum values)
|
|
159
|
-
- Shared lookups: {list any common reference data both modules might create}
|
|
160
|
-
|
|
161
|
-
### Your Responsibilities vs Theirs
|
|
162
|
-
- You own: {your entities — list}
|
|
163
|
-
- They own: {their entities — list}
|
|
164
|
-
- Contested/shared: {entities both might create — QUERY before defining}
|
|
165
|
-
|
|
166
|
-
### Cross-Module FK Convention
|
|
167
|
-
When referencing an entity owned by a same-layer module:
|
|
168
|
-
1. Send CROSS_MODULE_QUERY to team lead asking for the entity's attribute structure
|
|
169
|
-
2. WAIT for the answer before defining your FK field
|
|
170
|
-
3. Use the exact entity name and primary key type from the answer
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
> **IF layer has only 1 module:** Skip §2a entirely. No coordination notes needed.
|
|
174
|
-
|
|
175
|
-
### 2b. Prepare Agent Context (per module)
|
|
176
|
-
|
|
177
|
-
For EACH module in the layer, gather the context the agent needs:
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
1. ba-reader.readApplicationContext({feature_id})
|
|
181
|
-
→ Extract: appName, featureId, context, language
|
|
182
|
-
|
|
183
|
-
2. Read module decomposition data from master feature.json:
|
|
184
|
-
→ modules[moduleCode]: code, name, description, featureType, entities,
|
|
185
|
-
anticipatedSections, dependencies, detailTabs, estimatedComplexity, priority
|
|
186
|
-
|
|
187
|
-
3. ba-reader.getCompletedModulesSummary({feature_id})
|
|
188
|
-
→ Compact summary of already-specified modules from COMPLETED LAYERS (max 100 lines)
|
|
189
|
-
→ Includes: entity names, FK relationships, permission paths, shared types
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### 2c. Spawn ALL Layer Agents Simultaneously
|
|
193
|
-
|
|
194
|
-
**For layers with 1 module** — single spawn (same as standard):
|
|
195
|
-
|
|
196
|
-
```javascript
|
|
197
|
-
Task({
|
|
198
|
-
subagent_type: "general-purpose",
|
|
199
|
-
team_name: teamContext.teamName,
|
|
200
|
-
name: "mod-{moduleCode}",
|
|
201
|
-
model: "opus",
|
|
202
|
-
mode: "bypassPermissions",
|
|
203
|
-
prompt: BUILD_PROMPT(references/agent-module-prompt.md, {
|
|
204
|
-
appName,
|
|
205
|
-
featureId,
|
|
206
|
-
moduleCode,
|
|
207
|
-
moduleDescription: module.description,
|
|
208
|
-
featureType: module.featureType,
|
|
209
|
-
entities: module.entities,
|
|
210
|
-
anticipatedSections: module.anticipatedSections,
|
|
211
|
-
dependencies: module.dependencies,
|
|
212
|
-
detailTabs: module.detailTabs,
|
|
213
|
-
estimatedComplexity: module.estimatedComplexity,
|
|
214
|
-
priority: module.priority,
|
|
215
|
-
completedModulesSummary,
|
|
216
|
-
coordinationNotes: "", // empty for single-module layer
|
|
217
|
-
language: metadata.language,
|
|
218
|
-
docsDir: "docs/{appName}/{moduleCode}/business-analyse/v{version}/"
|
|
219
|
-
}),
|
|
220
|
-
description: "Specify {moduleCode}"
|
|
221
|
-
});
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
**For layers with 2+ modules** — spawn ALL in a **single message** (parallel):
|
|
225
|
-
|
|
226
|
-
```javascript
|
|
227
|
-
// CRITICAL: All Task() calls MUST be in ONE message for parallel execution.
|
|
228
|
-
// Do NOT await between them — they MUST be sent together.
|
|
229
|
-
|
|
230
|
-
// Agent 1:
|
|
231
|
-
Task({
|
|
232
|
-
subagent_type: "general-purpose",
|
|
233
|
-
team_name: teamContext.teamName,
|
|
234
|
-
name: "mod-{moduleCode1}",
|
|
235
|
-
model: "opus",
|
|
236
|
-
mode: "bypassPermissions",
|
|
237
|
-
prompt: BUILD_PROMPT(references/agent-module-prompt.md, {
|
|
238
|
-
...moduleContext1,
|
|
239
|
-
coordinationNotes: coordinationNotesForModule1, // ← NEW
|
|
240
|
-
}),
|
|
241
|
-
description: "Specify {moduleCode1}"
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
// Agent 2 (IN SAME MESSAGE):
|
|
245
|
-
Task({
|
|
246
|
-
subagent_type: "general-purpose",
|
|
247
|
-
team_name: teamContext.teamName,
|
|
248
|
-
name: "mod-{moduleCode2}",
|
|
249
|
-
model: "opus",
|
|
250
|
-
mode: "bypassPermissions",
|
|
251
|
-
prompt: BUILD_PROMPT(references/agent-module-prompt.md, {
|
|
252
|
-
...moduleContext2,
|
|
253
|
-
coordinationNotes: coordinationNotesForModule2, // ← NEW
|
|
254
|
-
}),
|
|
255
|
-
description: "Specify {moduleCode2}"
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
// ... repeat for all modules in this layer
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
**BUILD_PROMPT**: Read `references/agent-module-prompt.md`, replace all `{placeholders}` with actual values (including the new `{coordinationNotes}`), and pass as the `prompt` parameter.
|
|
262
|
-
|
|
263
|
-
### 2d. Track Layer State
|
|
264
|
-
|
|
265
|
-
After spawning, initialize layer tracking:
|
|
266
|
-
|
|
267
|
-
```javascript
|
|
268
|
-
const layerState = {
|
|
269
|
-
layerIndex: L,
|
|
270
|
-
modules: layer.modules, // ["Customers", "Products"]
|
|
271
|
-
pendingProposals: [...layer.modules], // agents not yet PROPOSAL_READY
|
|
272
|
-
receivedProposals: {}, // { moduleCode: proposalSummary }
|
|
273
|
-
approvedModules: [], // modules approved by user
|
|
274
|
-
crossModuleQueries: [], // log of queries handled
|
|
275
|
-
};
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### 2e. Wait for Layer Completion — Message Handling Loop
|
|
279
|
-
|
|
280
|
-
After spawning all agents in the layer, the team lead enters a **message handling loop**.
|
|
281
|
-
Messages from teammates are delivered automatically — do NOT poll or re-spawn.
|
|
282
|
-
|
|
283
|
-
```
|
|
284
|
-
WHILE layerState.pendingProposals.length > 0:
|
|
285
|
-
|
|
286
|
-
Wait for next message from any agent in this layer.
|
|
287
|
-
|
|
288
|
-
CASE message matches "PROPOSAL_READY:{moduleCode}":
|
|
289
|
-
→ Remove moduleCode from pendingProposals
|
|
290
|
-
→ Store proposal in receivedProposals[moduleCode]
|
|
291
|
-
→ Display: "✓ Module {moduleCode} proposal received ({received}/{total})"
|
|
292
|
-
→ IF pendingProposals is now empty:
|
|
293
|
-
→ All agents in this layer have proposed
|
|
294
|
-
→ Proceed to §3 (Layer Review)
|
|
295
|
-
|
|
296
|
-
CASE message matches "CROSS_MODULE_QUERY:{targetModule}":
|
|
297
|
-
→ Handle per §2-bis (Cross-Module Coordination Protocol)
|
|
298
|
-
|
|
299
|
-
CASE message matches "CROSS_MODULE_ANSWER_RELAY:{requestingModule}":
|
|
300
|
-
→ Forward to requesting agent per §2-bis
|
|
301
|
-
|
|
302
|
-
CASE message matches "ERROR:{moduleCode}:{description}":
|
|
303
|
-
→ Handle per §8 (Error Recovery)
|
|
304
|
-
→ Remove from pendingProposals if module is skipped
|
|
305
|
-
→ IF pendingProposals is now empty → proceed to §3
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
> **This loop may take several minutes** as agents work autonomously.
|
|
309
|
-
> The team lead does nothing except handle cross-module queries during this time.
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
## 2-bis. Cross-Module Coordination Protocol (Runtime Relay)
|
|
314
|
-
|
|
315
|
-
When an agent sends `CROSS_MODULE_QUERY:{targetModule}`, the team lead routes the query based on the target module's state:
|
|
316
|
-
|
|
317
|
-
### Case 1: Target is in a COMPLETED layer
|
|
318
|
-
|
|
319
|
-
The target module's specification is already written to feature.json.
|
|
320
|
-
|
|
321
|
-
```
|
|
322
|
-
→ Read target module's entities/attributes from completedModulesSummary
|
|
323
|
-
→ Send answer directly to requesting agent:
|
|
324
|
-
|
|
325
|
-
SendMessage({
|
|
326
|
-
type: "message",
|
|
327
|
-
recipient: "mod-{requestingModule}",
|
|
328
|
-
content: "CROSS_MODULE_ANSWER:{requestingModule}\nAnswer: {entity structure from completed module data}",
|
|
329
|
-
summary: "Answer from completed {targetModule}"
|
|
330
|
-
})
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### Case 2: Target is in CURRENT layer AND has sent PROPOSAL_READY
|
|
334
|
-
|
|
335
|
-
The target agent has finished its proposal — we have its specification data.
|
|
336
|
-
|
|
337
|
-
```
|
|
338
|
-
→ Extract relevant entity/attribute info from receivedProposals[targetModule]
|
|
339
|
-
→ Send answer directly to requesting agent:
|
|
340
|
-
|
|
341
|
-
SendMessage({
|
|
342
|
-
type: "message",
|
|
343
|
-
recipient: "mod-{requestingModule}",
|
|
344
|
-
content: "CROSS_MODULE_ANSWER:{requestingModule}\nAnswer: {entity structure from proposal data}",
|
|
345
|
-
summary: "Answer from {targetModule} proposal"
|
|
346
|
-
})
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### Case 3: Target is in CURRENT layer AND still working (no PROPOSAL_READY yet)
|
|
350
|
-
|
|
351
|
-
The target agent is still specifying — relay the question.
|
|
352
|
-
|
|
353
|
-
```
|
|
354
|
-
→ Forward question to target agent:
|
|
355
|
-
|
|
356
|
-
SendMessage({
|
|
357
|
-
type: "message",
|
|
358
|
-
recipient: "mod-{targetModule}",
|
|
359
|
-
content: "CROSS_MODULE_QUERY_RELAY:{requestingModule}\nQuestion: {original question}",
|
|
360
|
-
summary: "Relay query from {requestingModule}"
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
→ Wait for target agent to respond with CROSS_MODULE_ANSWER_RELAY
|
|
364
|
-
→ Forward answer to requesting agent:
|
|
365
|
-
|
|
366
|
-
SendMessage({
|
|
367
|
-
type: "message",
|
|
368
|
-
recipient: "mod-{requestingModule}",
|
|
369
|
-
content: "CROSS_MODULE_ANSWER:{requestingModule}\nAnswer: {answer from target agent}",
|
|
370
|
-
summary: "Answer from {targetModule}"
|
|
371
|
-
})
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### Case 4: Circular query (A asks about B, B asks about A simultaneously)
|
|
375
|
-
|
|
376
|
-
Both agents are blocked waiting for each other. The team lead MUST resolve this autonomously.
|
|
377
|
-
|
|
378
|
-
```
|
|
379
|
-
→ ULTRATHINK: Based on SmartStack conventions and module descriptions,
|
|
380
|
-
make a consistent design decision for BOTH modules.
|
|
381
|
-
→ Send CROSS_MODULE_ANSWER to BOTH agents with compatible entity structures.
|
|
382
|
-
→ Log resolution in layerState.crossModuleQueries[] for later review.
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
> **Every cross-module query is logged** in `layerState.crossModuleQueries[]` for display during §3 review.
|
|
386
|
-
|
|
387
|
-
---
|
|
388
|
-
|
|
389
|
-
## 3. Layer Review — Quality-First Protocol
|
|
390
|
-
|
|
391
|
-
When ALL agents in a layer have sent PROPOSAL_READY, the team lead presents the results to the user.
|
|
392
|
-
|
|
393
|
-
### 3a. Cross-Module Interaction Analysis (layers with 2+ modules)
|
|
394
|
-
|
|
395
|
-
**ALWAYS displayed FIRST** for multi-module layers. This gives the user a bird's-eye view of how modules in this layer interact.
|
|
396
|
-
|
|
397
|
-
```
|
|
398
|
-
═══════════════════════════════════════════════════════════
|
|
399
|
-
Layer {L} — {N} modules terminés — Analyse croisée
|
|
400
|
-
═══════════════════════════════════════════════════════════
|
|
401
|
-
|
|
402
|
-
### Interactions cross-module détectées
|
|
403
|
-
|
|
404
|
-
| Module A | Module B | Type | Détail |
|
|
405
|
-
|----------|----------|------|--------|
|
|
406
|
-
| {mod1} | {mod2} | FK | {mod1}.{entity}.{field} → {mod2}.{entity} |
|
|
407
|
-
| {mod1} | {mod2} | Concept partagé | Les deux définissent "{concept}" |
|
|
408
|
-
| {mod1} | {mod2} | Lookup | {mod1} référence {mod2}.{entity} comme donnée de ref |
|
|
409
|
-
|
|
410
|
-
### Requêtes cross-module résolues pendant la spécification ({count})
|
|
411
|
-
{FOR each query in layerState.crossModuleQueries:}
|
|
412
|
-
- {requestingModule} → {targetModule}: {question summary} → {answer summary}
|
|
413
|
-
|
|
414
|
-
### Points d'attention
|
|
415
|
-
- {naming inconsistencies detected between module proposals}
|
|
416
|
-
- {potential permission path conflicts}
|
|
417
|
-
- {shared entity definition differences}
|
|
418
|
-
|
|
419
|
-
─────────────────────────────────────────────────────────
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
> **For single-module layers:** Skip §3a entirely — no cross-module analysis needed.
|
|
423
|
-
|
|
424
|
-
### 3b. Individual Module Review (ALWAYS — for quality)
|
|
425
|
-
|
|
426
|
-
Review each module's proposal individually. For multi-module layers, the user has already seen the cross-module context from §3a.
|
|
427
|
-
|
|
428
|
-
```
|
|
429
|
-
FOR each module in layer (respecting topologicalOrder within layer):
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
**Step 1:** Format and display the proposal:
|
|
433
|
-
|
|
434
|
-
```
|
|
435
|
-
═══════════════════════════════════════════════════════════
|
|
436
|
-
Proposition pour le module {moduleCode}
|
|
437
|
-
(Layer {L} — module {idx+1}/{layerTotal} — global {globalIdx+1}/{totalModules})
|
|
438
|
-
═══════════════════════════════════════════════════════════
|
|
439
|
-
|
|
440
|
-
{structured summary from agent — displayed as-is}
|
|
441
|
-
|
|
442
|
-
─────────────────────────────────────────────────────────
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
**Step 2:** Ask the user via AskUserQuestion:
|
|
446
|
-
|
|
447
|
-
```
|
|
448
|
-
Validez-vous cette spécification ?
|
|
449
|
-
Options:
|
|
450
|
-
1. "Valider" → approve as-is
|
|
451
|
-
2. "Modifier" → provide feedback for revision
|
|
452
|
-
3. "Voir détail" → team lead reads module feature.json and displays full content
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
**Step 3 — IMMEDIATELY after AskUserQuestion returns, handle the response:**
|
|
456
|
-
|
|
457
|
-
**IF user selected "Valider" (approve):**
|
|
458
|
-
```
|
|
459
|
-
SendMessage({
|
|
460
|
-
type: "message",
|
|
461
|
-
recipient: "mod-{moduleCode}",
|
|
462
|
-
content: "APPROVED:{moduleCode}",
|
|
463
|
-
summary: "{moduleCode} approved by user"
|
|
464
|
-
})
|
|
465
|
-
```
|
|
466
|
-
→ CRITICAL: You MUST send this message. Do NOT skip this step.
|
|
467
|
-
→ Then WAIT for the agent to send `MODULE_COMPLETE:{moduleCode}`.
|
|
468
|
-
→ Add moduleCode to `layerState.approvedModules`.
|
|
469
|
-
→ Continue to next module in this layer.
|
|
470
|
-
|
|
471
|
-
**IF user selected "Modifier" (revision):**
|
|
472
|
-
→ Ask user for specific feedback via AskUserQuestion
|
|
473
|
-
→ Then send:
|
|
474
|
-
```
|
|
475
|
-
SendMessage({
|
|
476
|
-
type: "message",
|
|
477
|
-
recipient: "mod-{moduleCode}",
|
|
478
|
-
content: "REVISION:{moduleCode}\n{user_feedback}",
|
|
479
|
-
summary: "{moduleCode} revision requested"
|
|
480
|
-
})
|
|
481
|
-
```
|
|
482
|
-
→ Then WAIT for the agent to send a new `PROPOSAL_READY` → re-display this module's proposal.
|
|
483
|
-
→ Other modules in the layer are NOT blocked — their proposals remain in receivedProposals.
|
|
484
|
-
|
|
485
|
-
**IF user selected "Voir détail":**
|
|
486
|
-
→ Read module feature.json via ba-reader.readSection({feature_id, section})
|
|
487
|
-
→ Display relevant sections in detail
|
|
488
|
-
→ Go back to Step 2 (re-ask the validation question)
|
|
489
|
-
|
|
490
|
-
### 3c. Revision Limits
|
|
491
|
-
|
|
492
|
-
- Max **3 revision cycles** per module
|
|
493
|
-
- After 3 rejections: team lead asks user if they want to switch to **inline interactive mode** for this module
|
|
494
|
-
- If yes: shutdown agent, team lead loads step-03a1-setup.md and executes interactively
|
|
495
|
-
- If no: mark module as "needs-review" and continue to next module
|
|
496
|
-
|
|
497
|
-
### 3d. Layer Consistency Check (layers with 2+ modules)
|
|
498
|
-
|
|
499
|
-
After ALL modules in a layer are approved, perform a final cross-module consistency verification:
|
|
500
|
-
|
|
501
|
-
```
|
|
502
|
-
IF layer.modules.length >= 2 AND all modules approved:
|
|
503
|
-
|
|
504
|
-
ULTRATHINK: Verify cross-module consistency:
|
|
505
|
-
|
|
506
|
-
1. FK references: Do FK field names match actual entity names across modules?
|
|
507
|
-
→ e.g., if Products.CategoryId references Categories.Category, names must match
|
|
508
|
-
|
|
509
|
-
2. Permission paths: Are paths consistent and non-colliding?
|
|
510
|
-
→ {app}.{module1}.{entity}.read vs {app}.{module2}.{entity}.read
|
|
511
|
-
|
|
512
|
-
3. i18n keys: Do keys follow consistent patterns? No collisions?
|
|
513
|
-
→ {module1}.labels.name vs {module2}.labels.name (OK — namespaced)
|
|
514
|
-
|
|
515
|
-
4. Seed data IDs: Are deterministic GUIDs unique across modules?
|
|
516
|
-
→ Check DeterministicGuid inputs don't collide
|
|
517
|
-
|
|
518
|
-
5. Entity attribute types: Are shared concepts typed consistently?
|
|
519
|
-
→ If both modules define "Status", is it the same enum type?
|
|
520
|
-
|
|
521
|
-
IF inconsistency found:
|
|
522
|
-
Display warning with specific issue:
|
|
523
|
-
"⚠ Incohérence détectée entre {mod1} et {mod2}: {description}"
|
|
524
|
-
|
|
525
|
-
AskUserQuestion:
|
|
526
|
-
question: "Corriger automatiquement cette incohérence ?"
|
|
527
|
-
options:
|
|
528
|
-
1. "Corriger" → send REVISION to affected agent(s) with fix instructions
|
|
529
|
-
2. "Ignorer" → proceed (will be caught in consolidation)
|
|
530
|
-
|
|
531
|
-
IF "Corriger":
|
|
532
|
-
→ Send REVISION:{moduleCode}\n{auto-fix instructions} to affected agent
|
|
533
|
-
→ Wait for new PROPOSAL_READY
|
|
534
|
-
→ Re-approve (no full re-review needed — only the fix)
|
|
535
|
-
|
|
536
|
-
IF no inconsistency found:
|
|
537
|
-
Display: "✓ Cohérence cross-module vérifiée pour le layer {L}"
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
---
|
|
541
|
-
|
|
542
|
-
## 4. Layer Completion & Agent Shutdown
|
|
543
|
-
|
|
544
|
-
After ALL modules in a layer are approved AND consistency check passed:
|
|
545
|
-
|
|
546
|
-
### 4a. Shutdown ALL Layer Agents (MANDATORY — do NOT skip)
|
|
547
|
-
|
|
548
|
-
**IMMEDIATELY** after layer is fully approved, send shutdown_request to ALL agents in this layer:
|
|
549
|
-
|
|
550
|
-
```javascript
|
|
551
|
-
// Send shutdown to ALL layer agents
|
|
552
|
-
FOR each moduleCode in layer.modules:
|
|
553
|
-
SendMessage({
|
|
554
|
-
type: "shutdown_request",
|
|
555
|
-
recipient: "mod-{moduleCode}",
|
|
556
|
-
content: "Layer complete, shutting down"
|
|
557
|
-
})
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
Wait for ALL agents to confirm shutdown (`shutdown_response approve: true`).
|
|
561
|
-
|
|
562
|
-
> **WARNING:** If you skip this step, agents will remain running indefinitely.
|
|
563
|
-
> Agents CANNOT self-terminate — they NEED shutdown_request from you.
|
|
564
|
-
|
|
565
|
-
### 4b. Update Layer Tracking
|
|
566
|
-
|
|
567
|
-
```javascript
|
|
568
|
-
FOR each moduleCode in layer.modules:
|
|
569
|
-
teamContext.completedModules.push(moduleCode);
|
|
570
|
-
ba-writer.updateModuleStatus({feature_id, moduleCode, status: "specified"});
|
|
571
|
-
|
|
572
|
-
teamContext.completedLayers.push(layerState.layerIndex);
|
|
573
|
-
|
|
574
|
-
Display:
|
|
575
|
-
"═══ Layer {L} complete — {layer.modules.length} modules specified ═══"
|
|
576
|
-
"═══ Progress: {completedModules.length}/{moduleOrder.length} modules ═══"
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
### 4c. Build Updated Context for Next Layer
|
|
580
|
-
|
|
581
|
-
Before spawning the next layer's agents, rebuild the `completedModulesSummary`:
|
|
582
|
-
|
|
583
|
-
```
|
|
584
|
-
ba-reader.getCompletedModulesSummary({feature_id})
|
|
585
|
-
→ Now includes ALL modules from completed layers
|
|
586
|
-
→ This summary is injected into next layer's agent prompts
|
|
587
|
-
→ Agents in the next layer will have full context of everything specified so far
|
|
588
|
-
```
|
|
589
|
-
|
|
590
|
-
### 4d. Next Layer or Consolidation
|
|
591
|
-
|
|
592
|
-
```
|
|
593
|
-
IF more layers remain in dependencyGraph.layers:
|
|
594
|
-
→ Go back to §2 for the next layer
|
|
595
|
-
|
|
596
|
-
IF all layers complete (all modules specified):
|
|
597
|
-
→ Proceed to §5 (Consolidation)
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
---
|
|
601
|
-
|
|
602
|
-
## 5. Consolidation Phase
|
|
603
|
-
|
|
604
|
-
After ALL modules are specified (all layers complete):
|
|
605
|
-
|
|
606
|
-
```
|
|
607
|
-
Display: "═══ All {moduleOrder.length} modules specified — Starting consolidation ═══"
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
### 5a. Spawn Consolidation Agent
|
|
611
|
-
|
|
612
|
-
```javascript
|
|
613
|
-
Task({
|
|
614
|
-
subagent_type: "general-purpose",
|
|
615
|
-
team_name: teamContext.teamName, // ← ACTUAL name from TeamCreate result
|
|
616
|
-
name: "consolidation",
|
|
617
|
-
model: "opus",
|
|
618
|
-
mode: "bypassPermissions",
|
|
619
|
-
prompt: `
|
|
620
|
-
You are a consolidation agent for business-analyse application "{appName}".
|
|
621
|
-
|
|
622
|
-
## Your Mission
|
|
623
|
-
Execute cross-module consolidation (steps 04a + 04b):
|
|
624
|
-
1. Load steps/step-04a-collect.md and execute
|
|
625
|
-
2. Load steps/step-04b-analyze.md and execute
|
|
626
|
-
|
|
627
|
-
## Context
|
|
628
|
-
- Feature ID: {featureId}
|
|
629
|
-
- Modules: {moduleOrder.join(", ")}
|
|
630
|
-
- Dependency layers: {JSON.stringify(dependencyGraph.layers)}
|
|
631
|
-
- All modules have status "specified"
|
|
632
|
-
|
|
633
|
-
## Output
|
|
634
|
-
Send CONSOLIDATION_READY with a structured report:
|
|
635
|
-
- Cross-module interactions (FK references, shared entities, event flows)
|
|
636
|
-
- Permission coherence (conflicts, overlaps, gaps)
|
|
637
|
-
- E2E user flows validated
|
|
638
|
-
- Global risks identified
|
|
639
|
-
|
|
640
|
-
## Communication
|
|
641
|
-
- CONSOLIDATION_READY:{appName}\n{report} → when analysis complete
|
|
642
|
-
- ERROR:{appName}:{description} → on blocking issue
|
|
643
|
-
`,
|
|
644
|
-
description: "Cross-module consolidation"
|
|
645
|
-
});
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
### 5b. Present Consolidation to User (04c Decision)
|
|
649
|
-
|
|
650
|
-
When CONSOLIDATION_READY received:
|
|
651
|
-
|
|
652
|
-
```
|
|
653
|
-
═══════════════════════════════════════════════════════════
|
|
654
|
-
Consolidation cross-module — {appName}
|
|
655
|
-
═══════════════════════════════════════════════════════════
|
|
656
|
-
|
|
657
|
-
{consolidation report from agent}
|
|
658
|
-
|
|
659
|
-
─────────────────────────────────────────────────────────
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
AskUserQuestion: "Approuvez-vous la consolidation ?"
|
|
663
|
-
- "Approuver" → send APPROVED to agent → agent writes consolidation to master feature.json
|
|
664
|
-
- "Réviser" → send feedback → agent adjusts
|
|
665
|
-
|
|
666
|
-
After approval → shutdown consolidation agent.
|
|
667
|
-
|
|
668
|
-
**IF `workflow.mode === "project"`:** proceed to §5-bis (cross-application consolidation).
|
|
669
|
-
**ELSE:** proceed to §6 (handoff).
|
|
670
|
-
|
|
671
|
-
---
|
|
672
|
-
|
|
673
|
-
## 5-bis. Cross-Application Consolidation (Project Mode Only)
|
|
674
|
-
|
|
675
|
-
> **Only runs when `workflow.mode === "project"` AND all applications have been consolidated.**
|
|
676
|
-
> This step validates interactions BETWEEN applications, not just between modules within one application.
|
|
677
|
-
|
|
678
|
-
```javascript
|
|
679
|
-
Task({
|
|
680
|
-
subagent_type: "general-purpose",
|
|
681
|
-
team_name: teamContext.teamName,
|
|
682
|
-
name: "cross-app-consolidation",
|
|
683
|
-
model: "opus",
|
|
684
|
-
mode: "bypassPermissions",
|
|
685
|
-
prompt: `
|
|
686
|
-
You are a cross-application consolidation agent for project "{projectName}".
|
|
687
|
-
|
|
688
|
-
## Your Mission
|
|
689
|
-
Validate interactions between ALL applications in the project:
|
|
690
|
-
|
|
691
|
-
1. Cross-application shared entities
|
|
692
|
-
→ Entity defined in App A, referenced by App B via data dependency
|
|
693
|
-
2. Cross-application permission path consistency
|
|
694
|
-
→ Each app uses its own context prefix (e.g., hr.* vs selfservice.*)
|
|
695
|
-
3. Cross-application role consistency
|
|
696
|
-
→ Same role names have compatible permission levels across apps
|
|
697
|
-
4. Cross-application navigation coherence
|
|
698
|
-
→ Applications appear in correct contexts with non-colliding routes
|
|
699
|
-
5. Cross-application seed data ordering
|
|
700
|
-
→ Foundation applications must seed first (NavigationApplication order)
|
|
701
|
-
|
|
702
|
-
## Context
|
|
703
|
-
- Project ID: {projectId}
|
|
704
|
-
- Applications: ${JSON.stringify(projectFeature.applications.map(a => ({
|
|
705
|
-
code: a.code,
|
|
706
|
-
})))}
|
|
707
|
-
- Application dependency graph: ${JSON.stringify(projectFeature.applicationDependencyGraph)}
|
|
708
|
-
|
|
709
|
-
## Output
|
|
710
|
-
Send CROSS_APP_CONSOLIDATION_READY with:
|
|
711
|
-
- Cross-application interactions found
|
|
712
|
-
- Permission path conflicts (if any)
|
|
713
|
-
- Role inconsistencies (if any)
|
|
714
|
-
- Recommended seed data order
|
|
715
|
-
`,
|
|
716
|
-
description: "Cross-app consolidation"
|
|
717
|
-
});
|
|
718
|
-
```
|
|
719
|
-
|
|
720
|
-
When CROSS_APP_CONSOLIDATION_READY received:
|
|
721
|
-
|
|
722
|
-
```
|
|
723
|
-
═══════════════════════════════════════════════════════════
|
|
724
|
-
Cross-Application Consolidation — {projectName}
|
|
725
|
-
═══════════════════════════════════════════════════════════
|
|
726
|
-
|
|
727
|
-
{cross-application consolidation report}
|
|
728
|
-
|
|
729
|
-
─────────────────────────────────────────────────────────
|
|
730
|
-
```
|
|
731
|
-
|
|
732
|
-
AskUserQuestion: "Approuvez-vous la consolidation inter-applications ?"
|
|
733
|
-
- "Approuver" → write cross-application interactions to project feature.json → proceed to §6
|
|
734
|
-
- "Réviser" → send feedback → agent adjusts
|
|
735
|
-
|
|
736
|
-
After approval → shutdown agent → proceed to §6.
|
|
737
|
-
|
|
738
|
-
---
|
|
739
|
-
|
|
740
|
-
## 6. Handoff Phase
|
|
741
|
-
|
|
742
|
-
```javascript
|
|
743
|
-
// Project mode: handoff agent processes ALL applications at once
|
|
744
|
-
// Single-app mode: handoff agent processes one application
|
|
745
|
-
const handoffContext = workflow.mode === "project"
|
|
746
|
-
? {
|
|
747
|
-
scope: "project",
|
|
748
|
-
projectId: projectId,
|
|
749
|
-
applications: projectFeature.applications.map(a => ({
|
|
750
|
-
code: a.code,
|
|
751
|
-
modules: a.modules.map(m => m.code)
|
|
752
|
-
})),
|
|
753
|
-
totalModules: projectFeature.applications.reduce((sum, a) => sum + a.modules.length, 0)
|
|
754
|
-
}
|
|
755
|
-
: {
|
|
756
|
-
scope: "application",
|
|
757
|
-
featureId: featureId,
|
|
758
|
-
modules: moduleOrder
|
|
759
|
-
};
|
|
760
|
-
|
|
761
|
-
Task({
|
|
762
|
-
subagent_type: "general-purpose",
|
|
763
|
-
team_name: teamContext.teamName, // ← ACTUAL name from TeamCreate result
|
|
764
|
-
name: "handoff",
|
|
765
|
-
model: "sonnet",
|
|
766
|
-
mode: "bypassPermissions",
|
|
767
|
-
prompt: `
|
|
768
|
-
You are a handoff agent for business-analyse ${workflow.mode === "project" ? `project "${projectName}"` : `application "${appName}"`}.
|
|
769
|
-
|
|
770
|
-
## Your Mission
|
|
771
|
-
Execute the handoff sequence (steps 05a + 05b + 05c):
|
|
772
|
-
1. Load steps/step-05a-handoff.md and execute (file mapping, BR-to-code, API summary)
|
|
773
|
-
2. Load steps/step-05b-deploy.md and execute (prd.json, ba-interactive.html, manifest)
|
|
774
|
-
3. Load steps/step-05c-ralph-readiness.md and execute (quality gate)
|
|
775
|
-
|
|
776
|
-
## Context
|
|
777
|
-
${workflow.mode === "project" ? `
|
|
778
|
-
- Project ID: ${projectId}
|
|
779
|
-
- Applications: ${JSON.stringify(handoffContext.applications)}
|
|
780
|
-
- Total modules: ${handoffContext.totalModules}
|
|
781
|
-
- Workflow mode: project
|
|
782
|
-
- All applications and modules consolidated
|
|
783
|
-
` : `
|
|
784
|
-
- Feature ID: ${featureId}
|
|
785
|
-
- Modules: ${moduleOrder.join(", ")}
|
|
786
|
-
- All modules consolidated
|
|
787
|
-
`}
|
|
788
|
-
|
|
789
|
-
## Output
|
|
790
|
-
Send HANDOFF_READY with:
|
|
791
|
-
- PRD files generated (list)
|
|
792
|
-
- HTML deployed (path)
|
|
793
|
-
- Quality gate result (PASS/FAIL with details)
|
|
794
|
-
|
|
795
|
-
## Communication
|
|
796
|
-
- HANDOFF_READY:${workflow.mode === "project" ? projectName : appName}\n{report} → when all artifacts deployed
|
|
797
|
-
- ERROR:${workflow.mode === "project" ? projectName : appName}:{description} → on blocking issue
|
|
798
|
-
`,
|
|
799
|
-
description: "Handoff & deploy"
|
|
800
|
-
});
|
|
801
|
-
```
|
|
802
|
-
|
|
803
|
-
When HANDOFF_READY received:
|
|
804
|
-
|
|
805
|
-
```
|
|
806
|
-
═══════════════════════════════════════════════════════════
|
|
807
|
-
Handoff complete — {appName}
|
|
808
|
-
═══════════════════════════════════════════════════════════
|
|
809
|
-
|
|
810
|
-
{handoff report}
|
|
811
|
-
|
|
812
|
-
─────────────────────────────────────────────────────────
|
|
813
|
-
```
|
|
814
|
-
|
|
815
|
-
Display final status to user. If quality gate PASS → ready for /ralph-loop.
|
|
816
|
-
|
|
817
|
-
---
|
|
818
|
-
|
|
819
|
-
## 7. Cleanup
|
|
820
|
-
|
|
821
|
-
After handoff complete:
|
|
822
|
-
|
|
823
|
-
```javascript
|
|
824
|
-
// Safety net: shutdown ALL remaining agents (module agents + consolidation + handoff)
|
|
825
|
-
// Module agents should already be shut down in §4a, but this catches any missed ones.
|
|
826
|
-
const allAgents = [
|
|
827
|
-
...teamContext.moduleOrder.map(m => `mod-${m}`),
|
|
828
|
-
"consolidation",
|
|
829
|
-
"handoff"
|
|
830
|
-
];
|
|
831
|
-
|
|
832
|
-
for (const agentName of allAgents) {
|
|
833
|
-
SendMessage({
|
|
834
|
-
type: "shutdown_request",
|
|
835
|
-
recipient: agentName,
|
|
836
|
-
content: "Workflow complete"
|
|
837
|
-
});
|
|
838
|
-
// Ignore errors for already-terminated agents
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
// Delete team
|
|
842
|
-
TeamDelete();
|
|
843
|
-
|
|
844
|
-
Display: "═══ Business-analyse complete — Team cleaned up ═══"
|
|
845
|
-
```
|
|
846
|
-
|
|
847
|
-
> **Note:** Sending shutdown_request to an already-terminated agent is harmless.
|
|
848
|
-
> This safety net ensures no orphan agents remain running.
|
|
849
|
-
|
|
850
|
-
---
|
|
851
|
-
|
|
852
|
-
## 8. Error Recovery
|
|
853
|
-
|
|
854
|
-
### Agent Crash in Parallel Layer
|
|
855
|
-
|
|
856
|
-
If an agent stops responding or sends ERROR while other agents in the same layer are still working:
|
|
857
|
-
|
|
858
|
-
```javascript
|
|
859
|
-
// 1. Do NOT disrupt other agents in the layer — they continue working
|
|
860
|
-
// 2. Check module status in feature.json
|
|
861
|
-
const moduleStatus = ba-reader.getModuleStatus({feature_id});
|
|
862
|
-
|
|
863
|
-
// 3. If module has partial data (status = "in-progress"):
|
|
864
|
-
// → Spawn new agent for same module (joins existing layer)
|
|
865
|
-
// → New agent detects partial state and continues
|
|
866
|
-
// → Include in prompt: "Resume specification — partial data exists in feature.json"
|
|
867
|
-
|
|
868
|
-
// 4. Track retry count per module
|
|
869
|
-
if (retryCount[moduleCode] >= 3) {
|
|
870
|
-
Display: "Agent failed 3 times for module {moduleCode}."
|
|
871
|
-
AskUserQuestion: "Fallback to inline interactive mode for this module?"
|
|
872
|
-
// If yes: remove from pendingProposals, will handle inline after layer completes
|
|
873
|
-
// If no: skip module, mark as "needs-review"
|
|
874
|
-
}
|
|
875
|
-
```
|
|
876
|
-
|
|
877
|
-
> **Key difference from sequential mode:** Other agents in the layer keep running.
|
|
878
|
-
> The crashed module is retried independently without blocking the layer.
|
|
879
|
-
|
|
880
|
-
### Context Exhaustion on Team Lead
|
|
881
|
-
|
|
882
|
-
The team lead should stay under 30% context usage. If approaching limits:
|
|
883
|
-
|
|
884
|
-
1. **Minimize presentation**: Show only entity/section counts, not full details
|
|
885
|
-
2. **Auto-approve**: If user has approved 3+ modules without changes, suggest auto-approve mode
|
|
886
|
-
3. **Skip detail view**: Don't read full feature.json into team lead context
|
|
887
|
-
|
|
888
|
-
### Resume After Session Crash
|
|
889
|
-
|
|
890
|
-
If the entire session crashes:
|
|
891
|
-
|
|
892
|
-
1. User restarts `/business-analyse`
|
|
893
|
-
2. Step-00 detects existing feature.json with `status: "decomposed"` or partial modules
|
|
894
|
-
3. Reads `metadata.workflow.completedModules` to know which modules are done
|
|
895
|
-
4. Determines which layer to resume from:
|
|
896
|
-
- Find the first layer where not all modules are in `completedModules`
|
|
897
|
-
- Modules already completed in that layer are skipped
|
|
898
|
-
5. **Cleans up old team/task data** (§1a cleanup step) before creating new team
|
|
899
|
-
6. Creates new team (§1b — captures actual team name)
|
|
900
|
-
7. Spawns agents ONLY for incomplete modules in the current layer
|
|
901
|
-
8. Continues normally (parallel within layer, sequential between layers)
|
|
902
|
-
|
|
903
|
-
---
|
|
904
|
-
|
|
905
|
-
## Task List Coordination (T10)
|
|
906
|
-
|
|
907
|
-
Create tasks for each module analysis before spawning teammates:
|
|
908
|
-
|
|
909
|
-
```javascript
|
|
910
|
-
// Create tasks for each module before spawning agents
|
|
911
|
-
for (const mod of moduleOrder) {
|
|
912
|
-
TaskCreate({
|
|
913
|
-
subject: `Specify ${mod} module`,
|
|
914
|
-
description: `Propose business specification including entities, attributes, permissions, and workflows for ${mod}`,
|
|
915
|
-
activeForm: `Analyzing ${mod}`
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
// Teammates update task status when done
|
|
920
|
-
TaskUpdate({ taskId: currentTaskId, status: 'completed' });
|
|
921
|
-
|
|
922
|
-
// Team lead checks progress
|
|
923
|
-
TaskList(); // View all tasks and their status
|
|
924
|
-
```
|
|
925
|
-
|
|
926
|
-
---
|
|
927
|
-
|
|
928
|
-
## Idle State Handling (T13)
|
|
929
|
-
|
|
930
|
-
> **IMPORTANT:** Teammates go idle after every turn — this is completely normal.
|
|
931
|
-
> Idle simply means the teammate is waiting for input. An idle notification immediately
|
|
932
|
-
> after a message does NOT mean the teammate is done or has errors.
|
|
933
|
-
> Send a message to an idle teammate to wake it up.
|
|
934
|
-
|
|
935
|
-
---
|
|
936
|
-
|
|
937
|
-
## Team Config Discovery (T14)
|
|
938
|
-
|
|
939
|
-
```javascript
|
|
940
|
-
// Teammates can discover each other via team config:
|
|
941
|
-
// ~/.claude/teams/{team-name}/config.json
|
|
942
|
-
// Contains: members[] with name, agentId, agentType
|
|
943
|
-
// Always refer to teammates by NAME, not by UUID.
|
|
944
|
-
```
|
|
945
|
-
|
|
946
|
-
---
|
|
947
|
-
|
|
948
|
-
## Decision Matrix
|
|
949
|
-
|
|
950
|
-
| Condition | Action |
|
|
951
|
-
|-----------|--------|
|
|
952
|
-
| 1 module | NO team, classic inline execution |
|
|
953
|
-
| 2+ modules (single app) | Team mode (Propose & Review) |
|
|
954
|
-
| 2+ applications (project mode) | Application loop + per-app team mode |
|
|
955
|
-
| Modules in same dependency layer | Spawn ALL in parallel (single message) |
|
|
956
|
-
| Modules in different layers | Sequential — complete layer N before spawning layer N+1 |
|
|
957
|
-
| Layer with 1 module | Standard single-agent propose-review |
|
|
958
|
-
| Layer with 2+ modules | Pre-inject coordination notes + parallel spawn + batch review |
|
|
959
|
-
| Cross-module query (completed layer) | Answer from completedModulesSummary |
|
|
960
|
-
| Cross-module query (same layer, proposed) | Answer from receivedProposals |
|
|
961
|
-
| Cross-module query (same layer, working) | Relay to target agent |
|
|
962
|
-
| Circular cross-query (A↔B) | Team lead resolves autonomously |
|
|
963
|
-
| Agent error in parallel layer | Other agents continue; retry crashed module |
|
|
964
|
-
| User rejects 3 times | Offer fallback to inline interactive |
|
|
965
|
-
| Layer consistency check fails | Auto-fix via targeted REVISION |
|
|
966
|
-
| Context > 50% on team lead | Minimize presentation, suggest auto-approve |
|
|
967
|
-
| Session crash | Resume from feature.json + completedModules state |
|
|
968
|
-
| Project mode + all app modules done | Run per-app consolidation → advance to next app |
|
|
969
|
-
| Project mode + all apps done | Run cross-app consolidation (§5-bis) → unified handoff |
|
|
970
|
-
| Project mode + app has 1 module | Inline mode for that app (no team) |
|
|
971
|
-
|
|
972
|
-
---
|
|
973
|
-
|
|
974
|
-
## Message Protocol Summary
|
|
975
|
-
|
|
976
|
-
### Standard Messages (unchanged)
|
|
977
|
-
|
|
978
|
-
| Message | Direction | Purpose |
|
|
979
|
-
|---------|-----------|---------|
|
|
980
|
-
| `PROPOSAL_READY:{moduleCode}\n{summary}` | agent → lead | Specification complete |
|
|
981
|
-
| `APPROVED:{moduleCode}` | lead → agent | User approved |
|
|
982
|
-
| `REVISION:{moduleCode}\n{feedback}` | lead → agent | User wants changes |
|
|
983
|
-
| `MODULE_COMPLETE:{moduleCode}` | agent → lead | After approval confirmed |
|
|
984
|
-
| `CONSOLIDATION_READY:{appName}\n{report}` | agent → lead | Consolidation done |
|
|
985
|
-
| `HANDOFF_READY:{appName}\n{report}` | agent → lead | Handoff done |
|
|
986
|
-
| `ERROR:{moduleCode}:{description}` | agent → lead | Blocking error |
|
|
987
|
-
| `shutdown_request` / `shutdown_response` | lead ↔ agent | Termination |
|
|
988
|
-
|
|
989
|
-
### Cross-Module Messages (NEW — for parallel execution)
|
|
990
|
-
|
|
991
|
-
| Message | Direction | Purpose |
|
|
992
|
-
|---------|-----------|---------|
|
|
993
|
-
| `CROSS_MODULE_QUERY:{targetModule}\nQuestion:{q}\nContext:{ctx}` | agent → lead | Ask about same-layer module |
|
|
994
|
-
| `CROSS_MODULE_ANSWER:{requestingModule}\nAnswer:{a}` | lead → agent | Response to query |
|
|
995
|
-
| `CROSS_MODULE_QUERY_RELAY:{requestingModule}\nQuestion:{q}` | lead → target agent | Relay query to working agent |
|
|
996
|
-
| `CROSS_MODULE_ANSWER_RELAY:{requestingModule}\nAnswer:{a}` | target agent → lead | Response to relayed query |
|
|
997
|
-
|
|
998
|
-
---
|
|
999
|
-
|
|
1000
|
-
## Token Budget Estimates
|
|
1001
|
-
|
|
1002
|
-
| Phase | Agent | Est. Context % | Notes |
|
|
1003
|
-
|-------|-------|---------------|-------|
|
|
1004
|
-
| Init + Cadrage + Decomposition | Team lead (inline) | 20-30% | Sequential, interactive |
|
|
1005
|
-
| Pre-spawn analysis (per layer) | Team lead | +1-3% per layer | Cross-module touchpoint detection |
|
|
1006
|
-
| Module specification (per module) | mod-{code} agent | 40-60% | Parallel within layer, fresh context |
|
|
1007
|
-
| Cross-module relay (per query) | Team lead | +1-2% per query | Lightweight relay |
|
|
1008
|
-
| Layer review (per layer) | Team lead | +3-5% per layer | Proposals + consistency check |
|
|
1009
|
-
| Consolidation | consolidation agent | 30-40% | Cross-module validation |
|
|
1010
|
-
| Handoff | handoff agent | 40-50% | Artifact generation |
|
|
1011
|
-
| **Total team lead** | — | **30-50%** | Same budget, more throughput |
|
|
1012
|
-
| **Total per module agent** | — | **40-60%** | Independent contexts |
|
|
1013
|
-
|
|
1014
|
-
**Key insight:** Team lead never exceeds 50% even with 10+ modules, because:
|
|
1015
|
-
- Module specifications happen in separate parallel contexts
|
|
1016
|
-
- Cross-module relay is lightweight (forward message, not re-analyze)
|
|
1017
|
-
- Layer reviews are incremental (only current layer proposals)
|
|
1018
|
-
|
|
1019
|
-
**Wall-clock time improvement:**
|
|
1020
|
-
- Layer with 3 independent modules: 1x (parallel) vs 3x (sequential) = **66% reduction**
|
|
1021
|
-
- Typical 4-module app (2 layers of 2): ~50% wall-clock reduction
|
|
1022
|
-
- Full benefit: apps with many independent foundation modules (layer 0)
|
|
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
|
+
> **Execution:** Parallel by dependency layer — all modules in the same layer run simultaneously.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Multi-Application Team Structure (Project Mode)
|
|
11
|
+
|
|
12
|
+
> **Only applies when `workflow.mode === "project"`** (multiple applications in a single BA session).
|
|
13
|
+
> In single-application mode, skip this section entirely.
|
|
14
|
+
|
|
15
|
+
When the project contains multiple applications, the team structure adds an **application-level outer loop** around the existing module-level inner loop:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Team Lead (project level)
|
|
19
|
+
├── Application 1 (in topological order)
|
|
20
|
+
│ ├── mod-{app1-module1} (parallel per dependency layer)
|
|
21
|
+
│ ├── mod-{app1-module2}
|
|
22
|
+
│ └── consolidation-{app1}
|
|
23
|
+
├── Application 2
|
|
24
|
+
│ ├── mod-{app2-module1}
|
|
25
|
+
│ ├── mod-{app2-module2}
|
|
26
|
+
│ └── consolidation-{app2}
|
|
27
|
+
├── Cross-Application Consolidation Agent
|
|
28
|
+
└── Handoff Agent (all applications)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Application Loop Protocol:**
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
FOR each application in projectFeature.applicationDependencyGraph.topologicalOrder:
|
|
35
|
+
1. Load application feature.json
|
|
36
|
+
2. Read module decomposition for this application
|
|
37
|
+
3. Execute §1-§4 (team setup → module specification → review → layer completion)
|
|
38
|
+
- Team name: "ba-{projectName}-{appCode}"
|
|
39
|
+
- Agent names: "mod-{appCode}-{moduleCode}"
|
|
40
|
+
- Context passed to agents includes application-specific: context, tablePrefix, applicationRoles
|
|
41
|
+
4. After all modules in this application are specified:
|
|
42
|
+
- Run per-application consolidation (§5 — scoped to this application's modules)
|
|
43
|
+
- Mark application as "specified" in project feature.json
|
|
44
|
+
- Clean up application team
|
|
45
|
+
|
|
46
|
+
AFTER all applications specified:
|
|
47
|
+
5. Run cross-application consolidation (§5-bis)
|
|
48
|
+
6. Run unified handoff (§6 — all applications at once)
|
|
49
|
+
7. Cleanup (§7)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Key differences from single-application mode:**
|
|
53
|
+
- Team names include application code to avoid collisions
|
|
54
|
+
- Agent prompts include application context (not just module context)
|
|
55
|
+
- Cross-application consolidation runs AFTER all per-application consolidations
|
|
56
|
+
- Handoff generates one PRD per module + one cross-application PRD
|
|
57
|
+
- The team lead tracks both `completedApplications[]` and `completedModules[]`
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 1. Team Setup
|
|
62
|
+
|
|
63
|
+
After step-02 decomposition is complete and client has approved the module structure:
|
|
64
|
+
|
|
65
|
+
### 1a. Clean Up Old Team Data (MANDATORY)
|
|
66
|
+
|
|
67
|
+
Before creating the team, clean up any leftover data from previous sessions to prevent stale task collisions:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Remove leftover task files from previous runs
|
|
71
|
+
rm -f ~/.claude/tasks/ba-{appName}/*.json 2>/dev/null
|
|
72
|
+
# Remove leftover team directory (TeamDelete may leave remnants)
|
|
73
|
+
rm -rf ~/.claude/teams/ba-{appName} 2>/dev/null
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> **Why:** If a previous session used the same team name and crashed or was interrupted,
|
|
77
|
+
> leftover task files will be picked up by new agents, causing them to receive stale
|
|
78
|
+
> task_assignment notifications for wrong modules.
|
|
79
|
+
|
|
80
|
+
### 1b. Create Team and Capture Actual Name
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
const result = TeamCreate({ team_name: "ba-{appName}", description: "BA module analysis for {appName}" });
|
|
84
|
+
// CRITICAL: TeamCreate may return a DIFFERENT name than requested!
|
|
85
|
+
// Always use the RETURNED team_name, not the requested one.
|
|
86
|
+
const actualTeamName = result.team_name;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Store team context for the session:
|
|
90
|
+
```javascript
|
|
91
|
+
const teamContext = {
|
|
92
|
+
teamName: actualTeamName, // ← RETURNED name, NOT "ba-{appName}"
|
|
93
|
+
moduleOrder: metadata.workflow.moduleOrder,
|
|
94
|
+
dependencyLayers: dependencyGraph.layers, // ← from step-02 topological sort
|
|
95
|
+
completedModules: [],
|
|
96
|
+
completedLayers: [],
|
|
97
|
+
mode: "propose-review"
|
|
98
|
+
};
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
> **WARNING:** NEVER hardcode `"ba-{appName}"` in subsequent calls.
|
|
102
|
+
> Always use `teamContext.teamName` (the actual name returned by TeamCreate).
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 2. Module Agent Spawn — Parallel by Dependency Layer
|
|
107
|
+
|
|
108
|
+
Process modules **layer by layer**. Within each layer, spawn ALL agents **simultaneously**.
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
FOR each layer in dependencyGraph.layers:
|
|
112
|
+
Execute §2a → §2b → §2c → §2d → §2e → §3 → §4
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2a. Pre-Spawn Cross-Module Analysis
|
|
116
|
+
|
|
117
|
+
**ALWAYS executed for layers with 2+ modules.** Analyze the module definitions within this layer to identify cross-module touchpoints BEFORE spawning agents.
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
IF layer.modules.length >= 2:
|
|
121
|
+
|
|
122
|
+
ULTRATHINK: Analyze module definitions for same-layer interactions:
|
|
123
|
+
|
|
124
|
+
1. Shared entity names
|
|
125
|
+
→ Do any modules reference the same entity? (e.g., both "Products" and "Inventory"
|
|
126
|
+
might reference a "Category" entity)
|
|
127
|
+
|
|
128
|
+
2. Potential FK overlaps
|
|
129
|
+
→ Do any modules anticipate creating entities that others might reference?
|
|
130
|
+
→ E.g., Products creates "Product" entity, Orders references "Product" via FK
|
|
131
|
+
|
|
132
|
+
3. Naming conventions
|
|
133
|
+
→ Will both modules use similar attribute names? (e.g., "Code", "Name", "Status")
|
|
134
|
+
→ Agree on a consistent naming pattern
|
|
135
|
+
|
|
136
|
+
4. Shared lookup data
|
|
137
|
+
→ Do any modules reference common reference tables?
|
|
138
|
+
→ E.g., both use a "Status" enum, a "Country" lookup, a "Currency" type
|
|
139
|
+
|
|
140
|
+
5. Permission path consistency
|
|
141
|
+
→ Verify permission paths won't collide:
|
|
142
|
+
{app}.{module1}.{entity}.{action}
|
|
143
|
+
{app}.{module2}.{entity}.{action}
|
|
144
|
+
|
|
145
|
+
Build coordinationNotes for EACH module in the layer:
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**coordinationNotes template** (injected into each agent's prompt):
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
## Same-Layer Coordination Notes
|
|
152
|
+
|
|
153
|
+
You are running IN PARALLEL with: {otherModuleCodes.join(", ")}
|
|
154
|
+
|
|
155
|
+
### Known Touchpoints
|
|
156
|
+
- {otherModule} will define entity "{EntityName}" — if you need to reference it,
|
|
157
|
+
use CROSS_MODULE_QUERY to get the exact attribute structure
|
|
158
|
+
- Naming convention: use {convention} for shared concepts (e.g., "Status" enum values)
|
|
159
|
+
- Shared lookups: {list any common reference data both modules might create}
|
|
160
|
+
|
|
161
|
+
### Your Responsibilities vs Theirs
|
|
162
|
+
- You own: {your entities — list}
|
|
163
|
+
- They own: {their entities — list}
|
|
164
|
+
- Contested/shared: {entities both might create — QUERY before defining}
|
|
165
|
+
|
|
166
|
+
### Cross-Module FK Convention
|
|
167
|
+
When referencing an entity owned by a same-layer module:
|
|
168
|
+
1. Send CROSS_MODULE_QUERY to team lead asking for the entity's attribute structure
|
|
169
|
+
2. WAIT for the answer before defining your FK field
|
|
170
|
+
3. Use the exact entity name and primary key type from the answer
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
> **IF layer has only 1 module:** Skip §2a entirely. No coordination notes needed.
|
|
174
|
+
|
|
175
|
+
### 2b. Prepare Agent Context (per module)
|
|
176
|
+
|
|
177
|
+
For EACH module in the layer, gather the context the agent needs:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
1. ba-reader.readApplicationContext({feature_id})
|
|
181
|
+
→ Extract: appName, featureId, context, language
|
|
182
|
+
|
|
183
|
+
2. Read module decomposition data from master feature.json:
|
|
184
|
+
→ modules[moduleCode]: code, name, description, featureType, entities,
|
|
185
|
+
anticipatedSections, dependencies, detailTabs, estimatedComplexity, priority
|
|
186
|
+
|
|
187
|
+
3. ba-reader.getCompletedModulesSummary({feature_id})
|
|
188
|
+
→ Compact summary of already-specified modules from COMPLETED LAYERS (max 100 lines)
|
|
189
|
+
→ Includes: entity names, FK relationships, permission paths, shared types
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 2c. Spawn ALL Layer Agents Simultaneously
|
|
193
|
+
|
|
194
|
+
**For layers with 1 module** — single spawn (same as standard):
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
Task({
|
|
198
|
+
subagent_type: "general-purpose",
|
|
199
|
+
team_name: teamContext.teamName,
|
|
200
|
+
name: "mod-{moduleCode}",
|
|
201
|
+
model: "opus",
|
|
202
|
+
mode: "bypassPermissions",
|
|
203
|
+
prompt: BUILD_PROMPT(references/agent-module-prompt.md, {
|
|
204
|
+
appName,
|
|
205
|
+
featureId,
|
|
206
|
+
moduleCode,
|
|
207
|
+
moduleDescription: module.description,
|
|
208
|
+
featureType: module.featureType,
|
|
209
|
+
entities: module.entities,
|
|
210
|
+
anticipatedSections: module.anticipatedSections,
|
|
211
|
+
dependencies: module.dependencies,
|
|
212
|
+
detailTabs: module.detailTabs,
|
|
213
|
+
estimatedComplexity: module.estimatedComplexity,
|
|
214
|
+
priority: module.priority,
|
|
215
|
+
completedModulesSummary,
|
|
216
|
+
coordinationNotes: "", // empty for single-module layer
|
|
217
|
+
language: metadata.language,
|
|
218
|
+
docsDir: "docs/{appName}/{moduleCode}/business-analyse/v{version}/"
|
|
219
|
+
}),
|
|
220
|
+
description: "Specify {moduleCode}"
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**For layers with 2+ modules** — spawn ALL in a **single message** (parallel):
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
// CRITICAL: All Task() calls MUST be in ONE message for parallel execution.
|
|
228
|
+
// Do NOT await between them — they MUST be sent together.
|
|
229
|
+
|
|
230
|
+
// Agent 1:
|
|
231
|
+
Task({
|
|
232
|
+
subagent_type: "general-purpose",
|
|
233
|
+
team_name: teamContext.teamName,
|
|
234
|
+
name: "mod-{moduleCode1}",
|
|
235
|
+
model: "opus",
|
|
236
|
+
mode: "bypassPermissions",
|
|
237
|
+
prompt: BUILD_PROMPT(references/agent-module-prompt.md, {
|
|
238
|
+
...moduleContext1,
|
|
239
|
+
coordinationNotes: coordinationNotesForModule1, // ← NEW
|
|
240
|
+
}),
|
|
241
|
+
description: "Specify {moduleCode1}"
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Agent 2 (IN SAME MESSAGE):
|
|
245
|
+
Task({
|
|
246
|
+
subagent_type: "general-purpose",
|
|
247
|
+
team_name: teamContext.teamName,
|
|
248
|
+
name: "mod-{moduleCode2}",
|
|
249
|
+
model: "opus",
|
|
250
|
+
mode: "bypassPermissions",
|
|
251
|
+
prompt: BUILD_PROMPT(references/agent-module-prompt.md, {
|
|
252
|
+
...moduleContext2,
|
|
253
|
+
coordinationNotes: coordinationNotesForModule2, // ← NEW
|
|
254
|
+
}),
|
|
255
|
+
description: "Specify {moduleCode2}"
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// ... repeat for all modules in this layer
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**BUILD_PROMPT**: Read `references/agent-module-prompt.md`, replace all `{placeholders}` with actual values (including the new `{coordinationNotes}`), and pass as the `prompt` parameter.
|
|
262
|
+
|
|
263
|
+
### 2d. Track Layer State
|
|
264
|
+
|
|
265
|
+
After spawning, initialize layer tracking:
|
|
266
|
+
|
|
267
|
+
```javascript
|
|
268
|
+
const layerState = {
|
|
269
|
+
layerIndex: L,
|
|
270
|
+
modules: layer.modules, // ["Customers", "Products"]
|
|
271
|
+
pendingProposals: [...layer.modules], // agents not yet PROPOSAL_READY
|
|
272
|
+
receivedProposals: {}, // { moduleCode: proposalSummary }
|
|
273
|
+
approvedModules: [], // modules approved by user
|
|
274
|
+
crossModuleQueries: [], // log of queries handled
|
|
275
|
+
};
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### 2e. Wait for Layer Completion — Message Handling Loop
|
|
279
|
+
|
|
280
|
+
After spawning all agents in the layer, the team lead enters a **message handling loop**.
|
|
281
|
+
Messages from teammates are delivered automatically — do NOT poll or re-spawn.
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
WHILE layerState.pendingProposals.length > 0:
|
|
285
|
+
|
|
286
|
+
Wait for next message from any agent in this layer.
|
|
287
|
+
|
|
288
|
+
CASE message matches "PROPOSAL_READY:{moduleCode}":
|
|
289
|
+
→ Remove moduleCode from pendingProposals
|
|
290
|
+
→ Store proposal in receivedProposals[moduleCode]
|
|
291
|
+
→ Display: "✓ Module {moduleCode} proposal received ({received}/{total})"
|
|
292
|
+
→ IF pendingProposals is now empty:
|
|
293
|
+
→ All agents in this layer have proposed
|
|
294
|
+
→ Proceed to §3 (Layer Review)
|
|
295
|
+
|
|
296
|
+
CASE message matches "CROSS_MODULE_QUERY:{targetModule}":
|
|
297
|
+
→ Handle per §2-bis (Cross-Module Coordination Protocol)
|
|
298
|
+
|
|
299
|
+
CASE message matches "CROSS_MODULE_ANSWER_RELAY:{requestingModule}":
|
|
300
|
+
→ Forward to requesting agent per §2-bis
|
|
301
|
+
|
|
302
|
+
CASE message matches "ERROR:{moduleCode}:{description}":
|
|
303
|
+
→ Handle per §8 (Error Recovery)
|
|
304
|
+
→ Remove from pendingProposals if module is skipped
|
|
305
|
+
→ IF pendingProposals is now empty → proceed to §3
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
> **This loop may take several minutes** as agents work autonomously.
|
|
309
|
+
> The team lead does nothing except handle cross-module queries during this time.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## 2-bis. Cross-Module Coordination Protocol (Runtime Relay)
|
|
314
|
+
|
|
315
|
+
When an agent sends `CROSS_MODULE_QUERY:{targetModule}`, the team lead routes the query based on the target module's state:
|
|
316
|
+
|
|
317
|
+
### Case 1: Target is in a COMPLETED layer
|
|
318
|
+
|
|
319
|
+
The target module's specification is already written to feature.json.
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
→ Read target module's entities/attributes from completedModulesSummary
|
|
323
|
+
→ Send answer directly to requesting agent:
|
|
324
|
+
|
|
325
|
+
SendMessage({
|
|
326
|
+
type: "message",
|
|
327
|
+
recipient: "mod-{requestingModule}",
|
|
328
|
+
content: "CROSS_MODULE_ANSWER:{requestingModule}\nAnswer: {entity structure from completed module data}",
|
|
329
|
+
summary: "Answer from completed {targetModule}"
|
|
330
|
+
})
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Case 2: Target is in CURRENT layer AND has sent PROPOSAL_READY
|
|
334
|
+
|
|
335
|
+
The target agent has finished its proposal — we have its specification data.
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
→ Extract relevant entity/attribute info from receivedProposals[targetModule]
|
|
339
|
+
→ Send answer directly to requesting agent:
|
|
340
|
+
|
|
341
|
+
SendMessage({
|
|
342
|
+
type: "message",
|
|
343
|
+
recipient: "mod-{requestingModule}",
|
|
344
|
+
content: "CROSS_MODULE_ANSWER:{requestingModule}\nAnswer: {entity structure from proposal data}",
|
|
345
|
+
summary: "Answer from {targetModule} proposal"
|
|
346
|
+
})
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Case 3: Target is in CURRENT layer AND still working (no PROPOSAL_READY yet)
|
|
350
|
+
|
|
351
|
+
The target agent is still specifying — relay the question.
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
→ Forward question to target agent:
|
|
355
|
+
|
|
356
|
+
SendMessage({
|
|
357
|
+
type: "message",
|
|
358
|
+
recipient: "mod-{targetModule}",
|
|
359
|
+
content: "CROSS_MODULE_QUERY_RELAY:{requestingModule}\nQuestion: {original question}",
|
|
360
|
+
summary: "Relay query from {requestingModule}"
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
→ Wait for target agent to respond with CROSS_MODULE_ANSWER_RELAY
|
|
364
|
+
→ Forward answer to requesting agent:
|
|
365
|
+
|
|
366
|
+
SendMessage({
|
|
367
|
+
type: "message",
|
|
368
|
+
recipient: "mod-{requestingModule}",
|
|
369
|
+
content: "CROSS_MODULE_ANSWER:{requestingModule}\nAnswer: {answer from target agent}",
|
|
370
|
+
summary: "Answer from {targetModule}"
|
|
371
|
+
})
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Case 4: Circular query (A asks about B, B asks about A simultaneously)
|
|
375
|
+
|
|
376
|
+
Both agents are blocked waiting for each other. The team lead MUST resolve this autonomously.
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
→ ULTRATHINK: Based on SmartStack conventions and module descriptions,
|
|
380
|
+
make a consistent design decision for BOTH modules.
|
|
381
|
+
→ Send CROSS_MODULE_ANSWER to BOTH agents with compatible entity structures.
|
|
382
|
+
→ Log resolution in layerState.crossModuleQueries[] for later review.
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
> **Every cross-module query is logged** in `layerState.crossModuleQueries[]` for display during §3 review.
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## 3. Layer Review — Quality-First Protocol
|
|
390
|
+
|
|
391
|
+
When ALL agents in a layer have sent PROPOSAL_READY, the team lead presents the results to the user.
|
|
392
|
+
|
|
393
|
+
### 3a. Cross-Module Interaction Analysis (layers with 2+ modules)
|
|
394
|
+
|
|
395
|
+
**ALWAYS displayed FIRST** for multi-module layers. This gives the user a bird's-eye view of how modules in this layer interact.
|
|
396
|
+
|
|
397
|
+
```
|
|
398
|
+
═══════════════════════════════════════════════════════════
|
|
399
|
+
Layer {L} — {N} modules terminés — Analyse croisée
|
|
400
|
+
═══════════════════════════════════════════════════════════
|
|
401
|
+
|
|
402
|
+
### Interactions cross-module détectées
|
|
403
|
+
|
|
404
|
+
| Module A | Module B | Type | Détail |
|
|
405
|
+
|----------|----------|------|--------|
|
|
406
|
+
| {mod1} | {mod2} | FK | {mod1}.{entity}.{field} → {mod2}.{entity} |
|
|
407
|
+
| {mod1} | {mod2} | Concept partagé | Les deux définissent "{concept}" |
|
|
408
|
+
| {mod1} | {mod2} | Lookup | {mod1} référence {mod2}.{entity} comme donnée de ref |
|
|
409
|
+
|
|
410
|
+
### Requêtes cross-module résolues pendant la spécification ({count})
|
|
411
|
+
{FOR each query in layerState.crossModuleQueries:}
|
|
412
|
+
- {requestingModule} → {targetModule}: {question summary} → {answer summary}
|
|
413
|
+
|
|
414
|
+
### Points d'attention
|
|
415
|
+
- {naming inconsistencies detected between module proposals}
|
|
416
|
+
- {potential permission path conflicts}
|
|
417
|
+
- {shared entity definition differences}
|
|
418
|
+
|
|
419
|
+
─────────────────────────────────────────────────────────
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
> **For single-module layers:** Skip §3a entirely — no cross-module analysis needed.
|
|
423
|
+
|
|
424
|
+
### 3b. Individual Module Review (ALWAYS — for quality)
|
|
425
|
+
|
|
426
|
+
Review each module's proposal individually. For multi-module layers, the user has already seen the cross-module context from §3a.
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
FOR each module in layer (respecting topologicalOrder within layer):
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**Step 1:** Format and display the proposal:
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
═══════════════════════════════════════════════════════════
|
|
436
|
+
Proposition pour le module {moduleCode}
|
|
437
|
+
(Layer {L} — module {idx+1}/{layerTotal} — global {globalIdx+1}/{totalModules})
|
|
438
|
+
═══════════════════════════════════════════════════════════
|
|
439
|
+
|
|
440
|
+
{structured summary from agent — displayed as-is}
|
|
441
|
+
|
|
442
|
+
─────────────────────────────────────────────────────────
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**Step 2:** Ask the user via AskUserQuestion:
|
|
446
|
+
|
|
447
|
+
```
|
|
448
|
+
Validez-vous cette spécification ?
|
|
449
|
+
Options:
|
|
450
|
+
1. "Valider" → approve as-is
|
|
451
|
+
2. "Modifier" → provide feedback for revision
|
|
452
|
+
3. "Voir détail" → team lead reads module feature.json and displays full content
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
**Step 3 — IMMEDIATELY after AskUserQuestion returns, handle the response:**
|
|
456
|
+
|
|
457
|
+
**IF user selected "Valider" (approve):**
|
|
458
|
+
```
|
|
459
|
+
SendMessage({
|
|
460
|
+
type: "message",
|
|
461
|
+
recipient: "mod-{moduleCode}",
|
|
462
|
+
content: "APPROVED:{moduleCode}",
|
|
463
|
+
summary: "{moduleCode} approved by user"
|
|
464
|
+
})
|
|
465
|
+
```
|
|
466
|
+
→ CRITICAL: You MUST send this message. Do NOT skip this step.
|
|
467
|
+
→ Then WAIT for the agent to send `MODULE_COMPLETE:{moduleCode}`.
|
|
468
|
+
→ Add moduleCode to `layerState.approvedModules`.
|
|
469
|
+
→ Continue to next module in this layer.
|
|
470
|
+
|
|
471
|
+
**IF user selected "Modifier" (revision):**
|
|
472
|
+
→ Ask user for specific feedback via AskUserQuestion
|
|
473
|
+
→ Then send:
|
|
474
|
+
```
|
|
475
|
+
SendMessage({
|
|
476
|
+
type: "message",
|
|
477
|
+
recipient: "mod-{moduleCode}",
|
|
478
|
+
content: "REVISION:{moduleCode}\n{user_feedback}",
|
|
479
|
+
summary: "{moduleCode} revision requested"
|
|
480
|
+
})
|
|
481
|
+
```
|
|
482
|
+
→ Then WAIT for the agent to send a new `PROPOSAL_READY` → re-display this module's proposal.
|
|
483
|
+
→ Other modules in the layer are NOT blocked — their proposals remain in receivedProposals.
|
|
484
|
+
|
|
485
|
+
**IF user selected "Voir détail":**
|
|
486
|
+
→ Read module feature.json via ba-reader.readSection({feature_id, section})
|
|
487
|
+
→ Display relevant sections in detail
|
|
488
|
+
→ Go back to Step 2 (re-ask the validation question)
|
|
489
|
+
|
|
490
|
+
### 3c. Revision Limits
|
|
491
|
+
|
|
492
|
+
- Max **3 revision cycles** per module
|
|
493
|
+
- After 3 rejections: team lead asks user if they want to switch to **inline interactive mode** for this module
|
|
494
|
+
- If yes: shutdown agent, team lead loads step-03a1-setup.md and executes interactively
|
|
495
|
+
- If no: mark module as "needs-review" and continue to next module
|
|
496
|
+
|
|
497
|
+
### 3d. Layer Consistency Check (layers with 2+ modules)
|
|
498
|
+
|
|
499
|
+
After ALL modules in a layer are approved, perform a final cross-module consistency verification:
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
IF layer.modules.length >= 2 AND all modules approved:
|
|
503
|
+
|
|
504
|
+
ULTRATHINK: Verify cross-module consistency:
|
|
505
|
+
|
|
506
|
+
1. FK references: Do FK field names match actual entity names across modules?
|
|
507
|
+
→ e.g., if Products.CategoryId references Categories.Category, names must match
|
|
508
|
+
|
|
509
|
+
2. Permission paths: Are paths consistent and non-colliding?
|
|
510
|
+
→ {app}.{module1}.{entity}.read vs {app}.{module2}.{entity}.read
|
|
511
|
+
|
|
512
|
+
3. i18n keys: Do keys follow consistent patterns? No collisions?
|
|
513
|
+
→ {module1}.labels.name vs {module2}.labels.name (OK — namespaced)
|
|
514
|
+
|
|
515
|
+
4. Seed data IDs: Are deterministic GUIDs unique across modules?
|
|
516
|
+
→ Check DeterministicGuid inputs don't collide
|
|
517
|
+
|
|
518
|
+
5. Entity attribute types: Are shared concepts typed consistently?
|
|
519
|
+
→ If both modules define "Status", is it the same enum type?
|
|
520
|
+
|
|
521
|
+
IF inconsistency found:
|
|
522
|
+
Display warning with specific issue:
|
|
523
|
+
"⚠ Incohérence détectée entre {mod1} et {mod2}: {description}"
|
|
524
|
+
|
|
525
|
+
AskUserQuestion:
|
|
526
|
+
question: "Corriger automatiquement cette incohérence ?"
|
|
527
|
+
options:
|
|
528
|
+
1. "Corriger" → send REVISION to affected agent(s) with fix instructions
|
|
529
|
+
2. "Ignorer" → proceed (will be caught in consolidation)
|
|
530
|
+
|
|
531
|
+
IF "Corriger":
|
|
532
|
+
→ Send REVISION:{moduleCode}\n{auto-fix instructions} to affected agent
|
|
533
|
+
→ Wait for new PROPOSAL_READY
|
|
534
|
+
→ Re-approve (no full re-review needed — only the fix)
|
|
535
|
+
|
|
536
|
+
IF no inconsistency found:
|
|
537
|
+
Display: "✓ Cohérence cross-module vérifiée pour le layer {L}"
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## 4. Layer Completion & Agent Shutdown
|
|
543
|
+
|
|
544
|
+
After ALL modules in a layer are approved AND consistency check passed:
|
|
545
|
+
|
|
546
|
+
### 4a. Shutdown ALL Layer Agents (MANDATORY — do NOT skip)
|
|
547
|
+
|
|
548
|
+
**IMMEDIATELY** after layer is fully approved, send shutdown_request to ALL agents in this layer:
|
|
549
|
+
|
|
550
|
+
```javascript
|
|
551
|
+
// Send shutdown to ALL layer agents
|
|
552
|
+
FOR each moduleCode in layer.modules:
|
|
553
|
+
SendMessage({
|
|
554
|
+
type: "shutdown_request",
|
|
555
|
+
recipient: "mod-{moduleCode}",
|
|
556
|
+
content: "Layer complete, shutting down"
|
|
557
|
+
})
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Wait for ALL agents to confirm shutdown (`shutdown_response approve: true`).
|
|
561
|
+
|
|
562
|
+
> **WARNING:** If you skip this step, agents will remain running indefinitely.
|
|
563
|
+
> Agents CANNOT self-terminate — they NEED shutdown_request from you.
|
|
564
|
+
|
|
565
|
+
### 4b. Update Layer Tracking
|
|
566
|
+
|
|
567
|
+
```javascript
|
|
568
|
+
FOR each moduleCode in layer.modules:
|
|
569
|
+
teamContext.completedModules.push(moduleCode);
|
|
570
|
+
ba-writer.updateModuleStatus({feature_id, moduleCode, status: "specified"});
|
|
571
|
+
|
|
572
|
+
teamContext.completedLayers.push(layerState.layerIndex);
|
|
573
|
+
|
|
574
|
+
Display:
|
|
575
|
+
"═══ Layer {L} complete — {layer.modules.length} modules specified ═══"
|
|
576
|
+
"═══ Progress: {completedModules.length}/{moduleOrder.length} modules ═══"
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### 4c. Build Updated Context for Next Layer
|
|
580
|
+
|
|
581
|
+
Before spawning the next layer's agents, rebuild the `completedModulesSummary`:
|
|
582
|
+
|
|
583
|
+
```
|
|
584
|
+
ba-reader.getCompletedModulesSummary({feature_id})
|
|
585
|
+
→ Now includes ALL modules from completed layers
|
|
586
|
+
→ This summary is injected into next layer's agent prompts
|
|
587
|
+
→ Agents in the next layer will have full context of everything specified so far
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### 4d. Next Layer or Consolidation
|
|
591
|
+
|
|
592
|
+
```
|
|
593
|
+
IF more layers remain in dependencyGraph.layers:
|
|
594
|
+
→ Go back to §2 for the next layer
|
|
595
|
+
|
|
596
|
+
IF all layers complete (all modules specified):
|
|
597
|
+
→ Proceed to §5 (Consolidation)
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
## 5. Consolidation Phase
|
|
603
|
+
|
|
604
|
+
After ALL modules are specified (all layers complete):
|
|
605
|
+
|
|
606
|
+
```
|
|
607
|
+
Display: "═══ All {moduleOrder.length} modules specified — Starting consolidation ═══"
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### 5a. Spawn Consolidation Agent
|
|
611
|
+
|
|
612
|
+
```javascript
|
|
613
|
+
Task({
|
|
614
|
+
subagent_type: "general-purpose",
|
|
615
|
+
team_name: teamContext.teamName, // ← ACTUAL name from TeamCreate result
|
|
616
|
+
name: "consolidation",
|
|
617
|
+
model: "opus",
|
|
618
|
+
mode: "bypassPermissions",
|
|
619
|
+
prompt: `
|
|
620
|
+
You are a consolidation agent for business-analyse application "{appName}".
|
|
621
|
+
|
|
622
|
+
## Your Mission
|
|
623
|
+
Execute cross-module consolidation (steps 04a + 04b):
|
|
624
|
+
1. Load steps/step-04a-collect.md and execute
|
|
625
|
+
2. Load steps/step-04b-analyze.md and execute
|
|
626
|
+
|
|
627
|
+
## Context
|
|
628
|
+
- Feature ID: {featureId}
|
|
629
|
+
- Modules: {moduleOrder.join(", ")}
|
|
630
|
+
- Dependency layers: {JSON.stringify(dependencyGraph.layers)}
|
|
631
|
+
- All modules have status "specified"
|
|
632
|
+
|
|
633
|
+
## Output
|
|
634
|
+
Send CONSOLIDATION_READY with a structured report:
|
|
635
|
+
- Cross-module interactions (FK references, shared entities, event flows)
|
|
636
|
+
- Permission coherence (conflicts, overlaps, gaps)
|
|
637
|
+
- E2E user flows validated
|
|
638
|
+
- Global risks identified
|
|
639
|
+
|
|
640
|
+
## Communication
|
|
641
|
+
- CONSOLIDATION_READY:{appName}\n{report} → when analysis complete
|
|
642
|
+
- ERROR:{appName}:{description} → on blocking issue
|
|
643
|
+
`,
|
|
644
|
+
description: "Cross-module consolidation"
|
|
645
|
+
});
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### 5b. Present Consolidation to User (04c Decision)
|
|
649
|
+
|
|
650
|
+
When CONSOLIDATION_READY received:
|
|
651
|
+
|
|
652
|
+
```
|
|
653
|
+
═══════════════════════════════════════════════════════════
|
|
654
|
+
Consolidation cross-module — {appName}
|
|
655
|
+
═══════════════════════════════════════════════════════════
|
|
656
|
+
|
|
657
|
+
{consolidation report from agent}
|
|
658
|
+
|
|
659
|
+
─────────────────────────────────────────────────────────
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
AskUserQuestion: "Approuvez-vous la consolidation ?"
|
|
663
|
+
- "Approuver" → send APPROVED to agent → agent writes consolidation to master feature.json
|
|
664
|
+
- "Réviser" → send feedback → agent adjusts
|
|
665
|
+
|
|
666
|
+
After approval → shutdown consolidation agent.
|
|
667
|
+
|
|
668
|
+
**IF `workflow.mode === "project"`:** proceed to §5-bis (cross-application consolidation).
|
|
669
|
+
**ELSE:** proceed to §6 (handoff).
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
673
|
+
## 5-bis. Cross-Application Consolidation (Project Mode Only)
|
|
674
|
+
|
|
675
|
+
> **Only runs when `workflow.mode === "project"` AND all applications have been consolidated.**
|
|
676
|
+
> This step validates interactions BETWEEN applications, not just between modules within one application.
|
|
677
|
+
|
|
678
|
+
```javascript
|
|
679
|
+
Task({
|
|
680
|
+
subagent_type: "general-purpose",
|
|
681
|
+
team_name: teamContext.teamName,
|
|
682
|
+
name: "cross-app-consolidation",
|
|
683
|
+
model: "opus",
|
|
684
|
+
mode: "bypassPermissions",
|
|
685
|
+
prompt: `
|
|
686
|
+
You are a cross-application consolidation agent for project "{projectName}".
|
|
687
|
+
|
|
688
|
+
## Your Mission
|
|
689
|
+
Validate interactions between ALL applications in the project:
|
|
690
|
+
|
|
691
|
+
1. Cross-application shared entities
|
|
692
|
+
→ Entity defined in App A, referenced by App B via data dependency
|
|
693
|
+
2. Cross-application permission path consistency
|
|
694
|
+
→ Each app uses its own context prefix (e.g., hr.* vs selfservice.*)
|
|
695
|
+
3. Cross-application role consistency
|
|
696
|
+
→ Same role names have compatible permission levels across apps
|
|
697
|
+
4. Cross-application navigation coherence
|
|
698
|
+
→ Applications appear in correct contexts with non-colliding routes
|
|
699
|
+
5. Cross-application seed data ordering
|
|
700
|
+
→ Foundation applications must seed first (NavigationApplication order)
|
|
701
|
+
|
|
702
|
+
## Context
|
|
703
|
+
- Project ID: {projectId}
|
|
704
|
+
- Applications: ${JSON.stringify(projectFeature.applications.map(a => ({
|
|
705
|
+
code: a.code, modules: a.modules.map(m => m.code)
|
|
706
|
+
})))}
|
|
707
|
+
- Application dependency graph: ${JSON.stringify(projectFeature.applicationDependencyGraph)}
|
|
708
|
+
|
|
709
|
+
## Output
|
|
710
|
+
Send CROSS_APP_CONSOLIDATION_READY with:
|
|
711
|
+
- Cross-application interactions found
|
|
712
|
+
- Permission path conflicts (if any)
|
|
713
|
+
- Role inconsistencies (if any)
|
|
714
|
+
- Recommended seed data order
|
|
715
|
+
`,
|
|
716
|
+
description: "Cross-app consolidation"
|
|
717
|
+
});
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
When CROSS_APP_CONSOLIDATION_READY received:
|
|
721
|
+
|
|
722
|
+
```
|
|
723
|
+
═══════════════════════════════════════════════════════════
|
|
724
|
+
Cross-Application Consolidation — {projectName}
|
|
725
|
+
═══════════════════════════════════════════════════════════
|
|
726
|
+
|
|
727
|
+
{cross-application consolidation report}
|
|
728
|
+
|
|
729
|
+
─────────────────────────────────────────────────────────
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
AskUserQuestion: "Approuvez-vous la consolidation inter-applications ?"
|
|
733
|
+
- "Approuver" → write cross-application interactions to project feature.json → proceed to §6
|
|
734
|
+
- "Réviser" → send feedback → agent adjusts
|
|
735
|
+
|
|
736
|
+
After approval → shutdown agent → proceed to §6.
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
## 6. Handoff Phase
|
|
741
|
+
|
|
742
|
+
```javascript
|
|
743
|
+
// Project mode: handoff agent processes ALL applications at once
|
|
744
|
+
// Single-app mode: handoff agent processes one application
|
|
745
|
+
const handoffContext = workflow.mode === "project"
|
|
746
|
+
? {
|
|
747
|
+
scope: "project",
|
|
748
|
+
projectId: projectId,
|
|
749
|
+
applications: projectFeature.applications.map(a => ({
|
|
750
|
+
code: a.code, featureId: a.featureJsonPath,
|
|
751
|
+
modules: a.modules.map(m => m.code)
|
|
752
|
+
})),
|
|
753
|
+
totalModules: projectFeature.applications.reduce((sum, a) => sum + a.modules.length, 0)
|
|
754
|
+
}
|
|
755
|
+
: {
|
|
756
|
+
scope: "application",
|
|
757
|
+
featureId: featureId,
|
|
758
|
+
modules: moduleOrder
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
Task({
|
|
762
|
+
subagent_type: "general-purpose",
|
|
763
|
+
team_name: teamContext.teamName, // ← ACTUAL name from TeamCreate result
|
|
764
|
+
name: "handoff",
|
|
765
|
+
model: "sonnet",
|
|
766
|
+
mode: "bypassPermissions",
|
|
767
|
+
prompt: `
|
|
768
|
+
You are a handoff agent for business-analyse ${workflow.mode === "project" ? `project "${projectName}"` : `application "${appName}"`}.
|
|
769
|
+
|
|
770
|
+
## Your Mission
|
|
771
|
+
Execute the handoff sequence (steps 05a + 05b + 05c):
|
|
772
|
+
1. Load steps/step-05a-handoff.md and execute (file mapping, BR-to-code, API summary)
|
|
773
|
+
2. Load steps/step-05b-deploy.md and execute (prd.json, ba-interactive.html, manifest)
|
|
774
|
+
3. Load steps/step-05c-ralph-readiness.md and execute (quality gate)
|
|
775
|
+
|
|
776
|
+
## Context
|
|
777
|
+
${workflow.mode === "project" ? `
|
|
778
|
+
- Project ID: ${projectId}
|
|
779
|
+
- Applications: ${JSON.stringify(handoffContext.applications)}
|
|
780
|
+
- Total modules: ${handoffContext.totalModules}
|
|
781
|
+
- Workflow mode: project
|
|
782
|
+
- All applications and modules consolidated
|
|
783
|
+
` : `
|
|
784
|
+
- Feature ID: ${featureId}
|
|
785
|
+
- Modules: ${moduleOrder.join(", ")}
|
|
786
|
+
- All modules consolidated
|
|
787
|
+
`}
|
|
788
|
+
|
|
789
|
+
## Output
|
|
790
|
+
Send HANDOFF_READY with:
|
|
791
|
+
- PRD files generated (list)
|
|
792
|
+
- HTML deployed (path)
|
|
793
|
+
- Quality gate result (PASS/FAIL with details)
|
|
794
|
+
|
|
795
|
+
## Communication
|
|
796
|
+
- HANDOFF_READY:${workflow.mode === "project" ? projectName : appName}\n{report} → when all artifacts deployed
|
|
797
|
+
- ERROR:${workflow.mode === "project" ? projectName : appName}:{description} → on blocking issue
|
|
798
|
+
`,
|
|
799
|
+
description: "Handoff & deploy"
|
|
800
|
+
});
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
When HANDOFF_READY received:
|
|
804
|
+
|
|
805
|
+
```
|
|
806
|
+
═══════════════════════════════════════════════════════════
|
|
807
|
+
Handoff complete — {appName}
|
|
808
|
+
═══════════════════════════════════════════════════════════
|
|
809
|
+
|
|
810
|
+
{handoff report}
|
|
811
|
+
|
|
812
|
+
─────────────────────────────────────────────────────────
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
Display final status to user. If quality gate PASS → ready for /ralph-loop.
|
|
816
|
+
|
|
817
|
+
---
|
|
818
|
+
|
|
819
|
+
## 7. Cleanup
|
|
820
|
+
|
|
821
|
+
After handoff complete:
|
|
822
|
+
|
|
823
|
+
```javascript
|
|
824
|
+
// Safety net: shutdown ALL remaining agents (module agents + consolidation + handoff)
|
|
825
|
+
// Module agents should already be shut down in §4a, but this catches any missed ones.
|
|
826
|
+
const allAgents = [
|
|
827
|
+
...teamContext.moduleOrder.map(m => `mod-${m}`),
|
|
828
|
+
"consolidation",
|
|
829
|
+
"handoff"
|
|
830
|
+
];
|
|
831
|
+
|
|
832
|
+
for (const agentName of allAgents) {
|
|
833
|
+
SendMessage({
|
|
834
|
+
type: "shutdown_request",
|
|
835
|
+
recipient: agentName,
|
|
836
|
+
content: "Workflow complete"
|
|
837
|
+
});
|
|
838
|
+
// Ignore errors for already-terminated agents
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// Delete team
|
|
842
|
+
TeamDelete();
|
|
843
|
+
|
|
844
|
+
Display: "═══ Business-analyse complete — Team cleaned up ═══"
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
> **Note:** Sending shutdown_request to an already-terminated agent is harmless.
|
|
848
|
+
> This safety net ensures no orphan agents remain running.
|
|
849
|
+
|
|
850
|
+
---
|
|
851
|
+
|
|
852
|
+
## 8. Error Recovery
|
|
853
|
+
|
|
854
|
+
### Agent Crash in Parallel Layer
|
|
855
|
+
|
|
856
|
+
If an agent stops responding or sends ERROR while other agents in the same layer are still working:
|
|
857
|
+
|
|
858
|
+
```javascript
|
|
859
|
+
// 1. Do NOT disrupt other agents in the layer — they continue working
|
|
860
|
+
// 2. Check module status in feature.json
|
|
861
|
+
const moduleStatus = ba-reader.getModuleStatus({feature_id});
|
|
862
|
+
|
|
863
|
+
// 3. If module has partial data (status = "in-progress"):
|
|
864
|
+
// → Spawn new agent for same module (joins existing layer)
|
|
865
|
+
// → New agent detects partial state and continues
|
|
866
|
+
// → Include in prompt: "Resume specification — partial data exists in feature.json"
|
|
867
|
+
|
|
868
|
+
// 4. Track retry count per module
|
|
869
|
+
if (retryCount[moduleCode] >= 3) {
|
|
870
|
+
Display: "Agent failed 3 times for module {moduleCode}."
|
|
871
|
+
AskUserQuestion: "Fallback to inline interactive mode for this module?"
|
|
872
|
+
// If yes: remove from pendingProposals, will handle inline after layer completes
|
|
873
|
+
// If no: skip module, mark as "needs-review"
|
|
874
|
+
}
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
> **Key difference from sequential mode:** Other agents in the layer keep running.
|
|
878
|
+
> The crashed module is retried independently without blocking the layer.
|
|
879
|
+
|
|
880
|
+
### Context Exhaustion on Team Lead
|
|
881
|
+
|
|
882
|
+
The team lead should stay under 30% context usage. If approaching limits:
|
|
883
|
+
|
|
884
|
+
1. **Minimize presentation**: Show only entity/section counts, not full details
|
|
885
|
+
2. **Auto-approve**: If user has approved 3+ modules without changes, suggest auto-approve mode
|
|
886
|
+
3. **Skip detail view**: Don't read full feature.json into team lead context
|
|
887
|
+
|
|
888
|
+
### Resume After Session Crash
|
|
889
|
+
|
|
890
|
+
If the entire session crashes:
|
|
891
|
+
|
|
892
|
+
1. User restarts `/business-analyse`
|
|
893
|
+
2. Step-00 detects existing feature.json with `status: "decomposed"` or partial modules
|
|
894
|
+
3. Reads `metadata.workflow.completedModules` to know which modules are done
|
|
895
|
+
4. Determines which layer to resume from:
|
|
896
|
+
- Find the first layer where not all modules are in `completedModules`
|
|
897
|
+
- Modules already completed in that layer are skipped
|
|
898
|
+
5. **Cleans up old team/task data** (§1a cleanup step) before creating new team
|
|
899
|
+
6. Creates new team (§1b — captures actual team name)
|
|
900
|
+
7. Spawns agents ONLY for incomplete modules in the current layer
|
|
901
|
+
8. Continues normally (parallel within layer, sequential between layers)
|
|
902
|
+
|
|
903
|
+
---
|
|
904
|
+
|
|
905
|
+
## Task List Coordination (T10)
|
|
906
|
+
|
|
907
|
+
Create tasks for each module analysis before spawning teammates:
|
|
908
|
+
|
|
909
|
+
```javascript
|
|
910
|
+
// Create tasks for each module before spawning agents
|
|
911
|
+
for (const mod of moduleOrder) {
|
|
912
|
+
TaskCreate({
|
|
913
|
+
subject: `Specify ${mod} module`,
|
|
914
|
+
description: `Propose business specification including entities, attributes, permissions, and workflows for ${mod}`,
|
|
915
|
+
activeForm: `Analyzing ${mod}`
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// Teammates update task status when done
|
|
920
|
+
TaskUpdate({ taskId: currentTaskId, status: 'completed' });
|
|
921
|
+
|
|
922
|
+
// Team lead checks progress
|
|
923
|
+
TaskList(); // View all tasks and their status
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
---
|
|
927
|
+
|
|
928
|
+
## Idle State Handling (T13)
|
|
929
|
+
|
|
930
|
+
> **IMPORTANT:** Teammates go idle after every turn — this is completely normal.
|
|
931
|
+
> Idle simply means the teammate is waiting for input. An idle notification immediately
|
|
932
|
+
> after a message does NOT mean the teammate is done or has errors.
|
|
933
|
+
> Send a message to an idle teammate to wake it up.
|
|
934
|
+
|
|
935
|
+
---
|
|
936
|
+
|
|
937
|
+
## Team Config Discovery (T14)
|
|
938
|
+
|
|
939
|
+
```javascript
|
|
940
|
+
// Teammates can discover each other via team config:
|
|
941
|
+
// ~/.claude/teams/{team-name}/config.json
|
|
942
|
+
// Contains: members[] with name, agentId, agentType
|
|
943
|
+
// Always refer to teammates by NAME, not by UUID.
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
## Decision Matrix
|
|
949
|
+
|
|
950
|
+
| Condition | Action |
|
|
951
|
+
|-----------|--------|
|
|
952
|
+
| 1 module | NO team, classic inline execution |
|
|
953
|
+
| 2+ modules (single app) | Team mode (Propose & Review) |
|
|
954
|
+
| 2+ applications (project mode) | Application loop + per-app team mode |
|
|
955
|
+
| Modules in same dependency layer | Spawn ALL in parallel (single message) |
|
|
956
|
+
| Modules in different layers | Sequential — complete layer N before spawning layer N+1 |
|
|
957
|
+
| Layer with 1 module | Standard single-agent propose-review |
|
|
958
|
+
| Layer with 2+ modules | Pre-inject coordination notes + parallel spawn + batch review |
|
|
959
|
+
| Cross-module query (completed layer) | Answer from completedModulesSummary |
|
|
960
|
+
| Cross-module query (same layer, proposed) | Answer from receivedProposals |
|
|
961
|
+
| Cross-module query (same layer, working) | Relay to target agent |
|
|
962
|
+
| Circular cross-query (A↔B) | Team lead resolves autonomously |
|
|
963
|
+
| Agent error in parallel layer | Other agents continue; retry crashed module |
|
|
964
|
+
| User rejects 3 times | Offer fallback to inline interactive |
|
|
965
|
+
| Layer consistency check fails | Auto-fix via targeted REVISION |
|
|
966
|
+
| Context > 50% on team lead | Minimize presentation, suggest auto-approve |
|
|
967
|
+
| Session crash | Resume from feature.json + completedModules state |
|
|
968
|
+
| Project mode + all app modules done | Run per-app consolidation → advance to next app |
|
|
969
|
+
| Project mode + all apps done | Run cross-app consolidation (§5-bis) → unified handoff |
|
|
970
|
+
| Project mode + app has 1 module | Inline mode for that app (no team) |
|
|
971
|
+
|
|
972
|
+
---
|
|
973
|
+
|
|
974
|
+
## Message Protocol Summary
|
|
975
|
+
|
|
976
|
+
### Standard Messages (unchanged)
|
|
977
|
+
|
|
978
|
+
| Message | Direction | Purpose |
|
|
979
|
+
|---------|-----------|---------|
|
|
980
|
+
| `PROPOSAL_READY:{moduleCode}\n{summary}` | agent → lead | Specification complete |
|
|
981
|
+
| `APPROVED:{moduleCode}` | lead → agent | User approved |
|
|
982
|
+
| `REVISION:{moduleCode}\n{feedback}` | lead → agent | User wants changes |
|
|
983
|
+
| `MODULE_COMPLETE:{moduleCode}` | agent → lead | After approval confirmed |
|
|
984
|
+
| `CONSOLIDATION_READY:{appName}\n{report}` | agent → lead | Consolidation done |
|
|
985
|
+
| `HANDOFF_READY:{appName}\n{report}` | agent → lead | Handoff done |
|
|
986
|
+
| `ERROR:{moduleCode}:{description}` | agent → lead | Blocking error |
|
|
987
|
+
| `shutdown_request` / `shutdown_response` | lead ↔ agent | Termination |
|
|
988
|
+
|
|
989
|
+
### Cross-Module Messages (NEW — for parallel execution)
|
|
990
|
+
|
|
991
|
+
| Message | Direction | Purpose |
|
|
992
|
+
|---------|-----------|---------|
|
|
993
|
+
| `CROSS_MODULE_QUERY:{targetModule}\nQuestion:{q}\nContext:{ctx}` | agent → lead | Ask about same-layer module |
|
|
994
|
+
| `CROSS_MODULE_ANSWER:{requestingModule}\nAnswer:{a}` | lead → agent | Response to query |
|
|
995
|
+
| `CROSS_MODULE_QUERY_RELAY:{requestingModule}\nQuestion:{q}` | lead → target agent | Relay query to working agent |
|
|
996
|
+
| `CROSS_MODULE_ANSWER_RELAY:{requestingModule}\nAnswer:{a}` | target agent → lead | Response to relayed query |
|
|
997
|
+
|
|
998
|
+
---
|
|
999
|
+
|
|
1000
|
+
## Token Budget Estimates
|
|
1001
|
+
|
|
1002
|
+
| Phase | Agent | Est. Context % | Notes |
|
|
1003
|
+
|-------|-------|---------------|-------|
|
|
1004
|
+
| Init + Cadrage + Decomposition | Team lead (inline) | 20-30% | Sequential, interactive |
|
|
1005
|
+
| Pre-spawn analysis (per layer) | Team lead | +1-3% per layer | Cross-module touchpoint detection |
|
|
1006
|
+
| Module specification (per module) | mod-{code} agent | 40-60% | Parallel within layer, fresh context |
|
|
1007
|
+
| Cross-module relay (per query) | Team lead | +1-2% per query | Lightweight relay |
|
|
1008
|
+
| Layer review (per layer) | Team lead | +3-5% per layer | Proposals + consistency check |
|
|
1009
|
+
| Consolidation | consolidation agent | 30-40% | Cross-module validation |
|
|
1010
|
+
| Handoff | handoff agent | 40-50% | Artifact generation |
|
|
1011
|
+
| **Total team lead** | — | **30-50%** | Same budget, more throughput |
|
|
1012
|
+
| **Total per module agent** | — | **40-60%** | Independent contexts |
|
|
1013
|
+
|
|
1014
|
+
**Key insight:** Team lead never exceeds 50% even with 10+ modules, because:
|
|
1015
|
+
- Module specifications happen in separate parallel contexts
|
|
1016
|
+
- Cross-module relay is lightweight (forward message, not re-analyze)
|
|
1017
|
+
- Layer reviews are incremental (only current layer proposals)
|
|
1018
|
+
|
|
1019
|
+
**Wall-clock time improvement:**
|
|
1020
|
+
- Layer with 3 independent modules: 1x (parallel) vs 3x (sequential) = **66% reduction**
|
|
1021
|
+
- Typical 4-module app (2 layers of 2): ~50% wall-clock reduction
|
|
1022
|
+
- Full benefit: apps with many independent foundation modules (layer 0)
|