@atlashub/smartstack-cli 3.9.0 → 3.12.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 (48) hide show
  1. package/dist/index.js +2544 -2461
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +479 -6185
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/agents/ba-writer.md +178 -0
  7. package/templates/agents/db-reader.md +149 -0
  8. package/templates/skills/application/references/application-roles-template.md +227 -0
  9. package/templates/skills/application/references/provider-template.md +30 -6
  10. package/templates/skills/application/steps/step-03-roles.md +45 -7
  11. package/templates/skills/application/steps/step-03b-provider.md +13 -6
  12. package/templates/skills/business-analyse/SKILL.md +56 -4
  13. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +477 -0
  14. package/templates/skills/business-analyse/references/cache-warming-strategy.md +578 -0
  15. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +9 -19
  16. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +12 -2
  17. package/templates/skills/business-analyse/references/deploy-data-build.md +36 -25
  18. package/templates/skills/business-analyse/references/detection-strategies.md +424 -0
  19. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -0
  20. package/templates/skills/business-analyse/references/prd-generation.md +258 -0
  21. package/templates/skills/business-analyse/references/robustness-checks.md +538 -0
  22. package/templates/skills/business-analyse/references/validate-incremental-html.md +47 -4
  23. package/templates/skills/business-analyse/references/validation-checklist.md +281 -0
  24. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +33 -1
  25. package/templates/skills/business-analyse/steps/step-00-init.md +70 -75
  26. package/templates/skills/business-analyse/steps/step-01-cadrage.md +8 -22
  27. package/templates/skills/business-analyse/steps/step-03a-data.md +20 -410
  28. package/templates/skills/business-analyse/steps/step-03a1-setup.md +356 -0
  29. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +143 -0
  30. package/templates/skills/business-analyse/steps/step-03b-ui.md +3 -0
  31. package/templates/skills/business-analyse/steps/step-03c-compile.md +72 -3
  32. package/templates/skills/business-analyse/steps/step-03d-validate.md +36 -3
  33. package/templates/skills/business-analyse/steps/step-04-consolidation.md +21 -440
  34. package/templates/skills/business-analyse/steps/step-04a-collect.md +304 -0
  35. package/templates/skills/business-analyse/steps/step-04b-analyze.md +239 -0
  36. package/templates/skills/business-analyse/steps/step-04c-decide.md +186 -0
  37. package/templates/skills/business-analyse/steps/step-05a-handoff.md +44 -0
  38. package/templates/skills/business-analyse/steps/step-05b-deploy.md +42 -2
  39. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +518 -0
  40. package/templates/skills/controller/steps/step-03-generate.md +184 -24
  41. package/templates/skills/controller/templates.md +11 -2
  42. package/templates/skills/debug/SKILL.md +156 -53
  43. package/templates/skills/debug/references/team-protocol.md +232 -0
  44. package/templates/skills/ralph-loop/references/category-rules.md +46 -0
  45. package/templates/skills/ralph-loop/references/compact-loop.md +32 -2
  46. package/templates/skills/ralph-loop/references/core-seed-data.md +233 -21
  47. package/templates/skills/ralph-loop/steps/step-00-init.md +64 -1
  48. package/templates/skills/ralph-loop/steps/step-04-check.md +27 -2
@@ -1,48 +1,189 @@
1
1
  ---
2
2
  name: step-03-generate
3
- description: Generate controller file and DTOs
3
+ description: Generate controller using MCP scaffold_extension with NavRoute
4
4
  next_step: steps/step-04-perms.md
5
5
  ---
6
6
 
7
7
  # Step 3: Generate Controller
8
8
 
9
- ## YOUR TASK:
9
+ ## MANDATORY EXECUTION RULES
10
10
 
11
- Generate the controller file following SmartStack conventions. Use templates from `templates.md`.
11
+ - ALWAYS use MCP `scaffold_extension` tool - NEVER use templates
12
+ - ALWAYS generate Controller + DTOs as a unit
13
+ - ALWAYS include NavRoute attribute for frontend/backend sync
14
+ - YOU ARE AN ORCHESTRATOR calling MCP, not a generator
15
+ - MCP is the SOURCE OF TRUTH for code generation
12
16
 
13
- **ULTRA THINK about security and patterns.**
17
+ ## YOUR TASK
18
+
19
+ Call the SmartStack MCP `scaffold_extension` tool with type "controller" to generate:
20
+ 1. API Controller with NavRoute attribute
21
+ 2. DTOs (Response, Create, Update)
22
+
23
+ ---
24
+
25
+ ## AVAILABLE STATE
26
+
27
+ From previous steps:
28
+
29
+ | Variable | Description |
30
+ |----------|-------------|
31
+ | `{area}` | Controller folder (Admin, Business, Support, User) |
32
+ | `{module}` | kebab-case module identifier |
33
+ | `{entity}` | Entity name (PascalCase) |
34
+ | `{permission_path}` | Complete navigation path (navRoute) |
35
+ | `{controller_type}` | crud, readonly, custom, auth |
14
36
 
15
37
  ---
16
38
 
17
- ## EXECUTION SEQUENCE:
39
+ ## EXECUTION SEQUENCE
18
40
 
19
- ### 1. Load Templates
41
+ ### 1. Derive Entity Name
20
42
 
21
- **Read template file:**
43
+ Convert `{module}` to PascalCase for entity name:
22
44
 
23
45
  ```
24
- Read: templates/templates.md
46
+ module: "products" → entityName: "Product"
47
+ module: "order-items" → entityName: "OrderItem"
48
+ module: "user-profiles" → entityName: "UserProfile"
25
49
  ```
26
50
 
27
- **Select appropriate template based on {controller_type}:**
28
- - CRUD Controller template
29
- - Auth Controller template
30
- - ReadOnly Controller template
51
+ ### 2. Determine Table Prefix
52
+
53
+ Based on navigation context extracted from `{permission_path}`:
54
+
55
+ | Context | Table Prefix | Controller Folder |
56
+ |---------|--------------|-------------------|
57
+ | platform.administration | `auth_` or `cfg_` | `Admin` |
58
+ | platform.support | `support_` | `Support` |
59
+ | business.* | `ref_` or domain-specific | `Business` |
60
+ | personal.* | `usr_` | `User` |
61
+
62
+ ### 3. Call MCP scaffold_extension (TWO CALLS)
63
+
64
+ **First call: Generate DTOs**
65
+
66
+ ```
67
+ Tool: mcp__smartstack__scaffold_extension
68
+ Args:
69
+ type: "dto"
70
+ name: "{entityName}" # PascalCase from step 1
71
+ options:
72
+ navRoute: "{permission_path}" # For proper namespace hierarchy
73
+ schema: "core"
74
+ dryRun: false
75
+ ```
31
76
 
32
- ### 2. Generate Controller File
77
+ **Second call: Generate Controller with NavRoute**
33
78
 
34
- **Target path:**
35
79
  ```
36
- src/SmartStack.Api/Controllers/{ContextShort}/{Application}/{entity}Controller.cs
80
+ Tool: mcp__smartstack__scaffold_extension
81
+ Args:
82
+ type: "controller"
83
+ name: "{entityName}" # PascalCase from step 1
84
+ options:
85
+ navRoute: "{permission_path}" # MANDATORY for NavRoute attribute
86
+ navRouteSuffix: null # Optional (e.g., "details" → [NavRoute("path", Suffix = "details")])
87
+ dryRun: false
37
88
  ```
38
- > Context mapping: `business` → `Business`, `platform` → `Admin`, `personal` → `User`
39
89
 
40
- See [references/controller-code-templates.md](../references/controller-code-templates.md) for all C# templates:
41
- - **Controller class** with DI constructor (IApplicationDbContext, ICurrentUserService, ILogger)
42
- - **GET endpoint** with pagination (PagedResult, AsNoTracking)
43
- - **DTOs** (CreateDto, UpdateDto, ResponseDto with entity mapping constructor)
44
- - **Security logging** (Create/Update at Info, Delete at Warning)
45
- - **System account protection** guard (UserType.System/LocalAdmin)
90
+ **CRITICAL: NavRoute is MANDATORY** - Without it, frontend/backend sync will fail.
91
+
92
+ **Why two calls?**
93
+ - The skill `/controller` assumes the Entity already exists (verified in step-01-analyze.md)
94
+ - Type "dto" generates DTOs without regenerating the Entity
95
+ - Type "controller" generates the Controller with NavRoute and references to DTOs
96
+
97
+ ### 4. Parse MCP Responses
98
+
99
+ **From first call (DTOs):**
100
+ - `Application/{Context}/{Application}/{Module}/DTOs/{entityName}ResponseDto.cs` - Response DTO
101
+ - `Application/{Context}/{Application}/{Module}/DTOs/Create{entityName}Dto.cs` - Create request
102
+ - `Application/{Context}/{Application}/{Module}/DTOs/Update{entityName}Dto.cs` - Update request
103
+
104
+ **From second call (Controller):**
105
+ - `Api/Controllers/{area}/{entityName}Controller.cs` - REST Controller **with [NavRoute]**
106
+
107
+ ### 5. Present Output to User
108
+
109
+ ```markdown
110
+ ## Controller Generated via MCP
111
+
112
+ ### API Layer
113
+ - `Controllers/{area}/{entityName}Controller.cs`
114
+ - **NavRoute: `{permission_path}`** ✅
115
+ - Endpoints:
116
+ - GET /api/{module} - List all
117
+ - GET /api/{module}/{id} - Get by ID
118
+ - POST /api/{module} - Create
119
+ - PUT /api/{module}/{id} - Update
120
+ - DELETE /api/{module}/{id} - Delete
121
+
122
+ ### Application Layer (DTOs)
123
+ - `{Context}/{Application}/{Module}/DTOs/{entityName}ResponseDto.cs`
124
+ - `{Context}/{Application}/{Module}/DTOs/Create{entityName}Dto.cs`
125
+ - `{Context}/{Application}/{Module}/DTOs/Update{entityName}Dto.cs`
126
+
127
+ ### ✅ NavRoute Integration
128
+ The controller uses `[NavRoute("{permission_path}")]` which enables:
129
+ - ✅ Automatic frontend route generation
130
+ - ✅ Permission-based navigation sync
131
+ - ✅ Dynamic API routing from Navigation entities
132
+
133
+ ### Next Steps
134
+ 1. Permissions will be synchronized in step-04-perms.md
135
+ 2. Validate conventions with MCP `validate_conventions`
136
+ ```
137
+
138
+ ---
139
+
140
+ ## MCP RESPONSE HANDLING
141
+
142
+ ### Success Case
143
+
144
+ **After first call (DTOs):**
145
+ - Display all generated DTO files
146
+ - Verify DTOs match entity properties
147
+ - Continue to second call
148
+
149
+ **After second call (Controller):**
150
+ - Display controller file
151
+ - Show NavRoute attribute included
152
+ - Highlight frontend/backend sync enabled
153
+ - Store controller info for permission sync
154
+ - Proceed to step-04-perms.md
155
+
156
+ ### Error Case
157
+
158
+ **If first call (DTOs) fails:**
159
+ - Display error message
160
+ - Suggest checking entity name format
161
+ - Verify entity properties are defined
162
+ - Verify MCP server is running (`/mcp:healthcheck`)
163
+ - Do NOT proceed to second call
164
+
165
+ **If second call (Controller) fails:**
166
+ - Display error message
167
+ - Note that DTOs were generated successfully
168
+ - Suggest checking navRoute format
169
+ - Verify MCP server is running (`/mcp:healthcheck`)
170
+ - Do NOT proceed to step-04-perms.md
171
+
172
+ ---
173
+
174
+ ## NAVROUTE VALIDATION
175
+
176
+ **After generation, verify NavRoute is present:**
177
+
178
+ ```
179
+ Generated controller MUST contain:
180
+ [NavRoute("{permission_path}")]
181
+
182
+ WITHOUT NavRoute:
183
+ ❌ Frontend routes will be hardcoded
184
+ ❌ No automatic permission sync
185
+ ❌ Manual navigation management required
186
+ ```
46
187
 
47
188
  ---
48
189
 
@@ -53,7 +194,7 @@ Generated Files:
53
194
 
54
195
  | File | Path | Status |
55
196
  |------|------|--------|
56
- | Controller | src/.../Controllers/{area}/{module}Controller.cs | ✅ Created |
197
+ | Controller | src/.../Controllers/{area}/{entity}Controller.cs | ✅ Created with [NavRoute] |
57
198
  | CreateDto | src/.../DTOs/{module}/{entity}CreateDto.cs | ✅ Created |
58
199
  | UpdateDto | src/.../DTOs/{module}/{entity}UpdateDto.cs | ✅ Created |
59
200
  | ResponseDto | src/.../DTOs/{module}/{entity}ResponseDto.cs | ✅ Created |
@@ -63,6 +204,25 @@ Generated Files:
63
204
 
64
205
  ---
65
206
 
207
+ ## SUCCESS METRICS
208
+
209
+ - MCP scaffold_extension called successfully (DTOs)
210
+ - DTOs generated (ResponseDto, CreateDto, UpdateDto)
211
+ - MCP scaffold_extension called successfully (Controller)
212
+ - Controller generated with **[NavRoute]** attribute
213
+ - NavRoute matches permission_path
214
+ - Controller references DTOs correctly
215
+ - Proceeded to step-04-perms.md
216
+
217
+ ## FAILURE MODES
218
+
219
+ - MCP call failed (display error, run /mcp:healthcheck, stop)
220
+ - Invalid entity name (must be PascalCase)
221
+ - Invalid navRoute format
222
+ - MCP server not running
223
+
224
+ ---
225
+
66
226
  ## NEXT STEP:
67
227
 
68
- After generation complete, proceed to `./step-04-perms.md`
228
+ After controller generation complete, proceed to `./step-04-perms.md`
@@ -1,7 +1,16 @@
1
1
  # SmartStack Controller Templates
2
2
 
3
- > **Note:** These templates are used by the `controller` skill and `/controller:create` command.
4
- > Adapt variables `{Area}`, `{Module}`, `{Entity}`, `{PermissionPath}` according to context.
3
+ > **⚠️ OBSOLETE - DO NOT USE THESE TEMPLATES MANUALLY**
4
+ >
5
+ > **The `/controller` skill now uses the MCP `scaffold_extension` tool to generate controllers.**
6
+ > These templates are kept for reference only. All controller generation MUST go through the MCP to ensure:
7
+ > - ✅ `[NavRoute]` attribute is included for frontend/backend sync
8
+ > - ✅ Permissions are correctly generated
9
+ > - ✅ Consistency with SmartStack conventions
10
+ >
11
+ > **To generate a controller, use:** `/controller` skill which calls MCP `scaffold_extension` automatically.
12
+ >
13
+ > **If you modify these templates, they will NOT be used.** The MCP templates in `templates/mcp-scaffolding/controller.cs.hbs` are the source of truth.
5
14
 
6
15
  ---
7
16
 
@@ -10,6 +10,7 @@ $ARGUMENTS
10
10
 
11
11
  <objective>
12
12
  Follow an ultra-deep analysis workflow to identify, understand, and resolve bugs.
13
+ Uses **Agent Teamwork** for parallel investigation with real-time collaboration.
13
14
  **ULTRA THINK** at each phase transition.
14
15
  </objective>
15
16
 
@@ -23,95 +24,194 @@ Follow an ultra-deep analysis workflow to identify, understand, and resolve bugs
23
24
 
24
25
  <workflow>
25
26
 
26
- ## 1. ANALYZE: Deep Log/Error Analysis
27
+ ## 1. ANALYZE: Deep Log/Error Analysis (inline)
27
28
 
28
29
  - Parse the provided log/error message carefully
29
30
  - Extract key error patterns, stack traces, and symptoms
30
31
  - Identify error types: runtime, compile-time, logic, performance
31
32
  - **CRITICAL**: Document exact error context and reproduction steps
33
+ - Determine investigation scope (see decision matrix below)
32
34
 
33
- ## 2. EXPLORE: Targeted Codebase Investigation
35
+ ### Decision Matrix Team vs. Inline
34
36
 
35
- Launch **parallel subagents** to search for error-related code:
37
+ | Condition | Action |
38
+ |-----------|--------|
39
+ | Simple error, obvious from stack trace | NO team — investigate inline |
40
+ | Error involves code + data | Team: `code-investigator` + `data-inspector` |
41
+ | Error involves unknown library | Team: `code-investigator` + `doc-researcher` |
42
+ | Complex bug, multiple suspects | Full team: all 3 agents |
43
+ | Performance issue (no error) | `code-investigator` only (profiling inline) |
36
44
 
37
- **Agent 1: Codebase Search** (`explore-codebase`)
45
+ **If team NOT needed** → skip to phase 3 (ULTRA-THINK) with inline investigation.
46
+ **If team needed** → proceed to phase 2.
47
+
48
+ ## 2. EXPLORE: Team Investigation
49
+
50
+ > **Reference:** Load `references/team-protocol.md` for full protocol details.
51
+
52
+ ### 2.1 Create Team
53
+
54
+ ```yaml
55
+ TeamCreate:
56
+ team_name: "debug-investigate"
57
+ description: "Parallel bug investigation"
58
+ ```
59
+
60
+ ### 2.2 Spawn Teammates (single message, parallel Task calls)
61
+
62
+ Spawn all relevant teammates simultaneously:
63
+
64
+ **code-investigator** (`general-purpose`, haiku)
38
65
  ```
39
- Find code related to this error: {error_description}
40
- Search for:
41
- - Error source location from stack trace
42
- - Related error handling patterns
43
- - Similar code that works correctly
44
- Report file paths with line numbers.
66
+ You are a code investigator on the debug team.
67
+
68
+ ## Bug Context
69
+ Error: {error_description}
70
+ Stack trace: {stack_trace}
71
+
72
+ ## Mission
73
+ 1. Locate the error source in code (from stack trace)
74
+ 2. Find related error handling patterns
75
+ 3. Identify similar code that works correctly (for comparison)
76
+ 4. Check recent commits on affected files (git log, git blame)
77
+ 5. Search for similar error patterns elsewhere in codebase
78
+
79
+ ## Communication
80
+ - Send FINDING messages to team-lead for each significant discovery:
81
+ SendMessage(type: "message", recipient: "team-lead", content: "FINDING: {description with file:line}", summary: "Found {short}")
82
+ - When done:
83
+ SendMessage(type: "message", recipient: "team-lead", content: "INVESTIGATION_COMPLETE: {summary}", summary: "Code investigation done")
84
+ - If team-lead sends a LEAD_HINT, follow that direction
85
+
86
+ ## Rules
87
+ - Bash ONLY for: git log, git blame, git diff (NEVER modify code)
88
+ - Report file paths with line numbers
89
+ - Be precise and factual
45
90
  ```
46
91
 
47
- **Agent 2: Documentation** (`explore-docs`)
92
+ **doc-researcher** (`general-purpose`, haiku)
48
93
  ```
49
- Research documentation for: {libraries_in_stacktrace}
50
- Find:
51
- - Known issues or breaking changes
52
- - Correct usage patterns
53
- - Migration guides if version issues
94
+ You are a documentation researcher on the debug team.
95
+
96
+ ## Bug Context
97
+ Error: {error_description}
98
+ Libraries: {libraries_in_stacktrace}
99
+
100
+ ## Mission
101
+ 1. Research documentation for libraries in the stack trace
102
+ 2. Find known issues or breaking changes
103
+ 3. Find correct usage patterns
104
+ 4. Search for similar issues reported online
105
+ 5. Look for migration guides if version issues suspected
106
+
107
+ ## Communication
108
+ - Send FINDING messages to team-lead for each discovery:
109
+ SendMessage(type: "message", recipient: "team-lead", content: "FINDING: {description}", summary: "Found {short}")
110
+ - When done:
111
+ SendMessage(type: "message", recipient: "team-lead", content: "INVESTIGATION_COMPLETE: {summary}", summary: "Doc research done")
112
+ - If team-lead sends a LEAD_HINT, follow that direction
54
113
  ```
55
114
 
56
- **Agent 3: Web Research** (`websearch`)
115
+ **data-inspector** (`general-purpose`, haiku) — *only if bug involves data/persistence/DB*
57
116
  ```
58
- Search for: {error_message}
59
- Find:
60
- - Similar issues reported by others
61
- - Solutions and workarounds
62
- - Root cause explanations
117
+ You are a READ-ONLY database inspector on the debug team.
118
+
119
+ ## Bug Context
120
+ Error: {error_description}
121
+
122
+ ## ABSOLUTE RESTRICTIONS
123
+ YOU MUST NEVER EXECUTE: INSERT, UPDATE, DELETE, MERGE, TRUNCATE, DROP, ALTER, CREATE, EXEC, dotnet ef database update, dotnet ef migrations
124
+ YOU MAY ONLY EXECUTE: SELECT, INFORMATION_SCHEMA, sys.* views, sp_help
125
+
126
+ ## Mission
127
+ 1. Find connection string (appsettings.json, appsettings.Development.json)
128
+ 2. Check record existence and field values for affected entities
129
+ 3. Verify FK integrity (orphaned records)
130
+ 4. Check tenant isolation (TenantId on all records)
131
+ 5. Verify soft delete and audit field consistency
132
+ 6. Compare schema vs expected EF Core model
133
+
134
+ ## Communication
135
+ - Send FINDING messages to team-lead for each data anomaly:
136
+ SendMessage(type: "message", recipient: "team-lead", content: "FINDING: {description}", summary: "Data issue {short}")
137
+ - When done:
138
+ SendMessage(type: "message", recipient: "team-lead", content: "INVESTIGATION_COMPLETE: {summary}", summary: "DB inspection done")
139
+ - If team-lead sends a LEAD_HINT, follow that direction
140
+
141
+ ## Rules
142
+ - Bash ONLY for SELECT queries (NEVER modify data)
143
+ - If a fix is needed, DESCRIBE it — NEVER execute it
144
+ - Mask sensitive data (passwords, tokens, PII)
145
+ - Limit results with TOP/LIMIT
63
146
  ```
64
147
 
65
- Additional investigation:
66
- - Search for similar error patterns in codebase using Grep
67
- - Find all files related to the failing component/module
68
- - Examine recent changes that might have introduced the bug
69
- - **ULTRA THINK**: Connect error symptoms to potential root causes
148
+ ### 2.3 Orchestrate — Lead Actions During Investigation
70
149
 
71
- ## 3. ULTRA-THINK: Deep Root Cause Analysis
150
+ While teammates investigate in parallel:
72
151
 
73
- **THINK DEEPLY** about the error chain: symptoms -> immediate cause -> root cause
152
+ - **Monitor** incoming `FINDING` messages from agents
153
+ - **Cross-reference** findings between agents (code ↔ data ↔ docs)
154
+ - **Send `LEAD_HINT`** when one agent's finding informs another:
155
+ ```yaml
156
+ SendMessage:
157
+ type: "message"
158
+ recipient: "data-inspector"
159
+ content: "LEAD_HINT: code-investigator found null FK at OrderService.cs:45 — check if Customer records exist for affected OrderIds"
160
+ summary: "Investigate FK from code finding"
161
+ ```
162
+ - **Additional inline investigation**: Grep for error patterns, check related files, examine recent commits
74
163
 
75
- Consider all possible causes:
164
+ ### 2.4 Aggregate & Shutdown
165
+
166
+ Wait for all `INVESTIGATION_COMPLETE` messages, then:
167
+
168
+ 1. Collect all `FINDING` messages from each agent
169
+ 2. Cross-reference: code issues ↔ data anomalies ↔ documentation
170
+ 3. Shutdown teammates:
171
+ ```yaml
172
+ SendMessage:
173
+ type: "shutdown_request"
174
+ recipient: "{each-teammate}"
175
+ content: "Investigation complete"
176
+ # Wait for shutdown_response, then:
177
+ TeamDelete
178
+ ```
179
+
180
+ ## 3. ULTRA-THINK: Deep Root Cause Analysis (inline)
181
+
182
+ **THINK DEEPLY** about the error chain: symptoms → immediate cause → root cause
183
+
184
+ Aggregate all team findings and consider:
76
185
  - Code logic errors
77
186
  - Configuration issues
187
+ - Data integrity problems (from data-inspector findings)
78
188
  - Environment problems
79
189
  - Race conditions
80
190
  - Memory issues
81
191
  - Network problems
82
192
 
83
193
  **CRITICAL**: Map the complete failure path from root cause to visible symptom
84
- Validate hypotheses against the evidence
194
+ Validate hypotheses against evidence from ALL agents
85
195
 
86
196
  ### WHY Technique
87
197
 
88
198
  Ask "why" at least 5 times:
89
- 1. Why did the error occur? -> X happened
90
- 2. Why did X happen? -> Y was in invalid state
91
- 3. Why was Y invalid? -> Z didn't initialize properly
92
- 4. Why didn't Z initialize? -> A dependency was missing
93
- 5. Why was dependency missing? -> Configuration error
94
-
95
- ## 4. RESEARCH: Solution Investigation
199
+ 1. Why did the error occur? X happened
200
+ 2. Why did X happen? Y was in invalid state
201
+ 3. Why was Y invalid? Z didn't initialize properly
202
+ 4. Why didn't Z initialize? A dependency was missing
203
+ 5. Why was dependency missing? Configuration error
96
204
 
97
- Launch **parallel subagents** for solution research:
205
+ ## 4. RESEARCH: Solution Investigation (inline or websearch)
98
206
 
99
- **Agent: Solution Search** (`websearch`)
100
- ```
101
- Search for solutions to: {root_cause}
102
- Find:
103
- - Recommended fixes
104
- - Best practices
105
- - Workarounds if fix is complex
106
- ```
207
+ If root cause needs further research:
107
208
 
108
- Evaluate solutions:
109
- - Search for similar issues and solutions online
209
+ - Use `WebSearch` inline for targeted solution search
110
210
  - Check documentation for affected libraries/frameworks
111
211
  - Look for known bugs, workarounds, and best practices
112
212
  - **THINK**: Evaluate solution approaches for this specific context
113
213
 
114
- ## 5. IMPLEMENT: Systematic Resolution
214
+ ## 5. IMPLEMENT: Systematic Resolution (inline, lead only)
115
215
 
116
216
  - Choose the most appropriate solution based on analysis
117
217
  - Follow existing codebase patterns and conventions
@@ -119,7 +219,7 @@ Evaluate solutions:
119
219
  - **STAY IN SCOPE**: Fix only what's needed for this specific bug
120
220
  - Add defensive programming where appropriate
121
221
 
122
- ## 6. VERIFY: Comprehensive Testing
222
+ ## 6. VERIFY: Comprehensive Testing (inline)
123
223
 
124
224
  - Test the specific scenario that was failing
125
225
  - Run related tests to ensure no regressions
@@ -146,17 +246,19 @@ Evaluate solutions:
146
246
  - Consider environmental factors
147
247
  - Check for timing/concurrency issues
148
248
  - Validate assumptions about data/state
249
+ - Cross-reference team findings (code ↔ data ↔ docs)
149
250
 
150
251
  </analysis_techniques>
151
252
 
152
253
  <execution_rules>
153
254
 
154
255
  - **ULTRA THINK** at each phase transition
155
- - Use parallel agents for comprehensive investigation
256
+ - Use **Agent Teamwork** for parallel investigation (see decision matrix)
156
257
  - Document findings and reasoning at each step
157
- - **NEVER guess** - validate all hypotheses with evidence
258
+ - **NEVER guess** validate all hypotheses with evidence
158
259
  - **MINIMAL CHANGES**: Fix root cause, not symptoms
159
260
  - Test thoroughly before declaring resolution complete
261
+ - **ALWAYS cleanup**: shutdown teammates + TeamDelete after investigation
160
262
 
161
263
  </execution_rules>
162
264
 
@@ -169,4 +271,5 @@ Understanding > Speed > Completeness. Every bug must be fully understood before
169
271
  - Fix implemented with minimal, targeted changes
170
272
  - Original error no longer reproducible
171
273
  - Related tests pass without regressions
274
+ - Team properly shut down (no orphan agents)
172
275
  </success_criteria>