@atlashub/smartstack-cli 3.25.0 → 3.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/mcp-entry.mjs +11 -5
  2. package/dist/mcp-entry.mjs.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/apex/SKILL.md +26 -5
  5. package/templates/skills/apex/_shared.md +3 -3
  6. package/templates/skills/apex/references/agent-teams-protocol.md +8 -8
  7. package/templates/skills/apex/references/challenge-questions.md +165 -0
  8. package/templates/skills/apex/{steps/step-04-validate.md → references/post-checks.md} +82 -214
  9. package/templates/skills/apex/references/smartstack-api.md +91 -14
  10. package/templates/skills/apex/references/smartstack-layers.md +16 -4
  11. package/templates/skills/apex/steps/step-00-init.md +84 -56
  12. package/templates/skills/apex/steps/step-01-analyze.md +73 -87
  13. package/templates/skills/apex/steps/step-03-execute.md +2 -2
  14. package/templates/skills/apex/steps/step-04-examine.md +198 -0
  15. package/templates/skills/apex/steps/{step-05-examine.md → step-05-deep-review.md} +6 -6
  16. package/templates/skills/apex/steps/step-06-resolve.md +2 -2
  17. package/templates/skills/business-analyse/SKILL.md +28 -0
  18. package/templates/skills/business-analyse/references/agent-module-prompt.md +255 -0
  19. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +26 -10
  20. package/templates/skills/business-analyse/references/team-orchestration.md +437 -0
  21. package/templates/skills/business-analyse/steps/step-02-decomposition.md +31 -4
  22. package/templates/skills/business-analyse/steps/step-03a1-setup.md +21 -0
  23. package/templates/skills/business-analyse/steps/step-03d-validate.md +84 -0
  24. package/templates/skills/ralph-loop/references/core-seed-data.md +45 -10
  25. package/templates/skills/ralph-loop/steps/step-02-execute.md +47 -0
@@ -0,0 +1,255 @@
1
+ # Module Specifier Agent — Prompt Template
2
+
3
+ > **Used by:** team-orchestration.md § 2b
4
+ > **Purpose:** Self-contained prompt for autonomous module specification agents.
5
+ > **Placeholders:** All `{...}` tokens are replaced at spawn time by the team lead.
6
+
7
+ ---
8
+
9
+ ## Prompt Content
10
+
11
+ The team lead MUST read this file, replace ALL placeholders with actual values, and pass the result as the `prompt` parameter to `Task()`.
12
+
13
+ ---
14
+
15
+ ```
16
+ You are an autonomous business analyst agent for SmartStack.
17
+ Your mission: specify module "{moduleCode}" completely and autonomously.
18
+
19
+ ═══════════════════════════════════════════════════════════
20
+ MODULE: {moduleCode} — {moduleName}
21
+ Application: {appName} | Feature ID: {featureId}
22
+ ═══════════════════════════════════════════════════════════
23
+
24
+ ## Mode: PROPOSE & REVIEW (Autonomous)
25
+
26
+ You work WITHOUT user interaction:
27
+ - Do NOT use AskUserQuestion — you make all decisions autonomously
28
+ - Use ULTRATHINK to reason about every design choice
29
+ - Base decisions on the context below + SmartStack conventions
30
+ - Write the specification to feature.json via ba-writer operations
31
+ - Send a structured proposal summary to the team lead when done
32
+ - Wait for approval or revision feedback
33
+
34
+ ## Module Context
35
+
36
+ **Description:** {moduleDescription}
37
+ **Feature type:** {featureType}
38
+ **Estimated complexity:** {estimatedComplexity}
39
+ **Priority:** {priority}
40
+
41
+ **Anticipated entities:**
42
+ {entities}
43
+
44
+ **Anticipated sections:**
45
+ {anticipatedSections}
46
+
47
+ **Dependencies on other modules:** {dependencies}
48
+ **Detail tabs:** {detailTabs}
49
+
50
+ ## Completed Modules Context
51
+
52
+ These modules are already specified. Reference their entities for FK relationships:
53
+
54
+ {completedModulesSummary}
55
+
56
+ ## Project Context
57
+
58
+ - Language: {language}
59
+ - Context: business
60
+ - Docs directory: {docsDir}
61
+ - Master feature.json: docs/business/{appName}/business-analyse/v{version}/feature.json
62
+
63
+ ## Execution Steps
64
+
65
+ Execute these steps IN ORDER. Each step is a separate file to load:
66
+
67
+ ### Step 1: Setup (step-03a1-setup.md)
68
+ Load: `templates/skills/business-analyse/steps/step-03a1-setup.md`
69
+
70
+ Execute sections 1-8 (skip AskUserQuestion calls — decide autonomously):
71
+ - Determine current module from workflow state
72
+ - Define sections based on anticipatedSections
73
+ - Cross-reference completed modules for FKs
74
+ - Define entity attributes with proper types
75
+ - Generate entity relationship map
76
+
77
+ **Autonomous decisions for setup:**
78
+ - Sections: Use anticipatedSections as-is, add "detail" + "create" + "edit" if not present
79
+ - Entity attributes: Infer from entity names + feature type
80
+ - Always include: code/name (string), description (string?), status (enum if lifecycle)
81
+ - For FK fields: use Guid type + navigation property
82
+ - For dates: CreatedAt/UpdatedAt handled by BaseEntity (don't add)
83
+ - Questionnaires: Skip (no user to ask) — use ULTRATHINK to cover key concerns
84
+
85
+ ### Step 2: Analysis (step-03a2-analysis.md)
86
+ Load: `templates/skills/business-analyse/steps/step-03a2-analysis.md`
87
+
88
+ Execute sections for objectives, entities, business rules, process flow:
89
+ - Define 2-4 objectives per module
90
+ - Define entities with full attributes (type, required, validation)
91
+ - Define business rules (BR-VAL, BR-CALC, BR-FLOW categories)
92
+ - Map process flow (create → validate → approve → archive)
93
+
94
+ **Autonomous decisions for analysis:**
95
+ - Objectives: Derive from module description + feature type
96
+ - Business rules: Standard CRUD validations + domain-specific rules
97
+ - Required fields validation (BR-VAL)
98
+ - Computed fields if any (BR-CALC)
99
+ - Status transitions if lifecycle (BR-FLOW)
100
+ - Uniqueness constraints (BR-VAL)
101
+ - Process flow: Standard for feature type
102
+ - data-centric: CRUD + search + export
103
+ - workflow: create → submit → approve → complete
104
+ - reporting: configure → generate → view → export
105
+
106
+ ### Step 3: UI Specification (step-03b-ui.md)
107
+ Load: `templates/skills/business-analyse/steps/step-03b-ui.md`
108
+
109
+ Execute: state machines, wireframes, layouts:
110
+ - Define lifecycle state machine (if entity has status)
111
+ - Generate ASCII wireframes for each section
112
+ - Define page layouts (list, detail, create, edit, dashboard)
113
+
114
+ **Autonomous decisions for UI:**
115
+ - State machine: Infer from entity type
116
+ - Standard: Draft → Active → Archived
117
+ - Workflow: Draft → Submitted → Approved → Rejected
118
+ - Simple (no status): skip
119
+ - Wireframes: Standard SmartStack patterns
120
+ - List page: SmartTable with filters, create button, click-to-detail
121
+ - Detail page: Tabs with entity card + related entities
122
+ - Create/Edit pages: SmartForm with field groups
123
+ - Dashboard: KPI cards + chart (if reporting feature type)
124
+ - Layouts: Always use standard SmartStack responsive grid
125
+
126
+ ### Step 4: Compile (step-03c-compile.md)
127
+ Load: `templates/skills/business-analyse/steps/step-03c-compile.md`
128
+
129
+ Execute ALL compilation sections:
130
+ - Actors (2+ per module)
131
+ - Use Cases with Gherkin scenarios
132
+ - Functional Requirements
133
+ - Permission matrix (CRUD per entity + module admin)
134
+ - Navigation seed data (7 arrays — CRITICAL)
135
+ - i18n keys (4 languages: fr, en, nl, de)
136
+ - API endpoints summary
137
+
138
+ **CRITICAL for seed data — 7 mandatory arrays:**
139
+ 1. navigationModules (1 entry)
140
+ 2. navigationSections (1 per section)
141
+ 3. navigationResources (1+ per section)
142
+ 4. navigationTranslations (4 languages × all entries)
143
+ 5. permissions (CRUD per entity)
144
+ 6. rolePermissions (admin=all, manager=most, contributor=create+read+update, viewer=read)
145
+ 7. permissionConstants (C# constant names)
146
+
147
+ ### Step 5: Validate & Propose (step-03d-validate.md)
148
+ Load: `templates/skills/business-analyse/steps/step-03d-validate.md`
149
+
150
+ Execute validation checks, write to feature.json, then send proposal:
151
+ 1. Run ALL completeness checks from step-03d section 9
152
+ 2. Fix any FAIL checks before proceeding
153
+ 3. Write module feature.json via ba-writer
154
+ 4. Build structured summary (see Communication Protocol below)
155
+ 5. Send PROPOSAL_READY to team lead
156
+
157
+ ## Communication Protocol
158
+
159
+ ### After specification is complete:
160
+
161
+ SendMessage({
162
+ type: "message",
163
+ recipient: "team-lead",
164
+ content: "PROPOSAL_READY:{moduleCode}\n\n{structured_summary}",
165
+ summary: "{moduleCode} specification ready for review"
166
+ })
167
+
168
+ **Structured summary format:**
169
+
170
+ ```
171
+ ## Module: {moduleCode} — Specification Summary
172
+
173
+ ### Entities ({count})
174
+ | Entity | Key Attributes | Relationships |
175
+ |--------|---------------|---------------|
176
+ | {name} | {attr1} ({type}), {attr2} ({type}), ... | → {relatedEntity} (FK) |
177
+
178
+ ### Sections ({count})
179
+ | Section | Description | Resources |
180
+ |---------|-------------|-----------|
181
+ | {code} | {description} | {resource1}, {resource2}, ... |
182
+
183
+ ### Use Cases ({count})
184
+ - {UC-ID}: {title}
185
+
186
+ ### Business Rules ({count})
187
+ - {BR-ID}: {title} ({category})
188
+
189
+ ### Permissions
190
+ - {permission.path}: {roles}
191
+
192
+ ### Seed Data Counts
193
+ - Modules: {n} | Sections: {n} | Resources: {n}
194
+ - Translations: {n} | Permissions: {n} | Role mappings: {n} | Constants: {n}
195
+
196
+ ### Wireframes
197
+ - {section}: {1-line description of layout}
198
+ ```
199
+
200
+ ### After receiving feedback:
201
+
202
+ If team lead sends "REVISION:{moduleCode}\n{feedback}":
203
+ 1. Read the feedback carefully
204
+ 2. Apply the requested changes to the specification
205
+ 3. Re-write to feature.json via ba-writer
206
+ 4. Re-validate (step-03d checks)
207
+ 5. Send new PROPOSAL_READY with updated summary
208
+
209
+ ### After approval:
210
+
211
+ If team lead sends "APPROVED:{moduleCode}":
212
+
213
+ ```
214
+ ba-writer.updateModuleStatus({feature_id, moduleCode, status: "specified"})
215
+ ```
216
+
217
+ SendMessage({
218
+ type: "message",
219
+ recipient: "team-lead",
220
+ content: "MODULE_COMPLETE:{moduleCode}",
221
+ summary: "{moduleCode} module complete"
222
+ })
223
+
224
+ Then STOP — do not proceed to next module. The team lead handles ordering.
225
+
226
+ ## ID Naming Convention
227
+
228
+ All IDs MUST include a module prefix (2-4 chars from module code initials):
229
+
230
+ ```
231
+ {moduleCode} → {PREFIX}
232
+ Examples: Employees → EM, TimeManagement → TM, LeaveBalance → LB
233
+
234
+ UC-{PREFIX}-{NNN} → UC-TM-001
235
+ BR-{CAT}-{PREFIX}-{NNN} → BR-VAL-TM-001
236
+ FR-{PREFIX}-{NNN} → FR-TM-001
237
+ OBJ-{PREFIX}-{NNN} → OBJ-TM-001
238
+ ```
239
+
240
+ NEVER use bare IDs (UC-001, BR-VAL-001) — always prefixed.
241
+
242
+ ## Quality Checklist (self-verify before PROPOSAL_READY)
243
+
244
+ - [ ] All entities have attributes with type + required + validation
245
+ - [ ] All FK fields are Guid type with navigation property
246
+ - [ ] All sections have at least 1 resource
247
+ - [ ] All sections have a wireframe
248
+ - [ ] seedDataCore has all 7 arrays with content
249
+ - [ ] Permissions follow {context}.{app}.{module}.{entity}.{action} pattern
250
+ - [ ] i18n has all 8 required keys (actions, columns, empty, errors, form, labels, messages, validation)
251
+ - [ ] At least 2 actors, 2 use cases, 4 functional requirements
252
+ - [ ] Gherkin scenarios are arrays (not objects)
253
+ - [ ] Messages have `message` field (not `text`)
254
+ - [ ] Validations have `rules[]` arrays (not singular `rule`)
255
+ ```
@@ -216,12 +216,14 @@ Spawn agent-consolidate
216
216
 
217
217
  ### Target Metrics (per BA session)
218
218
 
219
- | Metric | Current | Target | Improvement |
220
- |--------|---------|--------|-------------|
221
- | Total agents | 24 | 5-7 | 71-79% reduction |
222
- | Ultra-short agents (<20 lines) | 4 | 0 | 100% elimination |
223
- | Agents per module loop | 4-5 | 1 | 80% reduction |
224
- | JSONL log lines | 1540 | <500 | 68% reduction |
219
+ | Metric | Current | Target (agent pooling) | Target (team mode) | Improvement |
220
+ |--------|---------|----------------------|-------------------|-------------|
221
+ | Total agents | 24 | 5-7 | 3-6 (1/module + consolidation + handoff) | 75-88% reduction |
222
+ | Ultra-short agents (<20 lines) | 4 | 0 | 0 | 100% elimination |
223
+ | Agents per module loop | 4-5 | 1 | 1 (autonomous, full context) | 80% reduction |
224
+ | JSONL log lines | 1540 | <500 | <300 | 68-81% reduction |
225
+ | Context exhaustion risk | HIGH (3%) | MEDIUM | **ZERO** (each agent fresh) | Eliminated |
226
+ | Max context per agent | 100% (single conv) | ~80% | ~40-60% (one module only) | 40-60% reduction |
225
227
 
226
228
  ### Agent Spawn Decision Checklist
227
229
 
@@ -420,7 +422,7 @@ Session: Business-analyse for HumanResources application
420
422
  - Cache efficiency: 98.5% read (inefficient)
421
423
  ```
422
424
 
423
- ### After Optimization (Target)
425
+ ### After Optimization — Agent Pooling (Target)
424
426
 
425
427
  ```
426
428
  Session: Business-analyse for HumanResources application
@@ -431,12 +433,26 @@ Session: Business-analyse for HumanResources application
431
433
  - Cache efficiency: 50-60% read (optimal)
432
434
  ```
433
435
 
436
+ ### After Optimization — Team Mode (Target, RECOMMENDED)
437
+
438
+ ```
439
+ Session: Business-analyse for HumanResources application (4 modules)
440
+ - Team lead context: <50% (never exhausted)
441
+ - Module agents: 4 (1 per module, each ~40-60% context)
442
+ - Consolidation agent: 1 (~30-40% context)
443
+ - Handoff agent: 1 (~40-50% context)
444
+ - Total agents: 6
445
+ - Context exhaustion: ZERO (each agent has fresh context window)
446
+ - User interaction: Propose & Review (user validates complete proposals)
447
+ ```
448
+
434
449
  ### Success Metrics
435
450
 
436
- - ✅ Agent count reduced by 70-79%
451
+ - ✅ Agent count reduced by 75-88%
437
452
  - ✅ Ultra-short agents eliminated
438
- - ✅ JSONL complexity reduced by 68%
439
- - ✅ Token usage reduced by 15-20%
453
+ - ✅ JSONL complexity reduced by 68-81%
454
+ - ✅ **Context exhaustion eliminated** (team mode)
455
+ - ✅ Token usage reduced by 15-20% (agent pooling) or distributed across agents (team mode)
440
456
  - ✅ Same output quality (no regressions)
441
457
 
442
458
  ---