@atlashub/smartstack-cli 3.37.0 → 3.39.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 (228) hide show
  1. package/dist/index.js +16 -24
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +235 -265
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/scripts/extract-api-endpoints.ts +5 -5
  7. package/scripts/generate-doc-with-mock-ui.ts +10 -17
  8. package/templates/agents/ba-reader.md +9 -9
  9. package/templates/agents/ba-writer.md +12 -15
  10. package/templates/agents/code-reviewer.md +1 -1
  11. package/templates/agents/docs-context-reader.md +1 -1
  12. package/templates/agents/efcore/scan.md +3 -1
  13. package/templates/agents/gitflow/commit.md +74 -0
  14. package/templates/agents/gitflow/finish.md +5 -2
  15. package/templates/agents/gitflow/init-clone.md +3 -3
  16. package/templates/agents/gitflow/init-validate.md +3 -2
  17. package/templates/agents/gitflow/merge.md +5 -4
  18. package/templates/agents/gitflow/pr.md +5 -4
  19. package/templates/agents/gitflow/start.md +37 -5
  20. package/templates/hooks/hooks.json +11 -0
  21. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  22. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  23. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  24. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  25. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  26. package/templates/skills/_shared.md +15 -17
  27. package/templates/skills/ai-prompt/SKILL.md +1 -1
  28. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  29. package/templates/skills/apex/SKILL.md +3 -4
  30. package/templates/skills/apex/_shared.md +10 -20
  31. package/templates/skills/apex/references/analysis-methods.md +141 -0
  32. package/templates/skills/apex/references/challenge-questions.md +1 -21
  33. package/templates/skills/apex/references/core-seed-data.md +35 -58
  34. package/templates/skills/apex/references/examine-build-validation.md +82 -0
  35. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  36. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  37. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  38. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  39. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  40. package/templates/skills/apex/references/post-checks.md +145 -40
  41. package/templates/skills/apex/references/smartstack-api.md +35 -51
  42. package/templates/skills/apex/references/smartstack-frontend.md +18 -18
  43. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  44. package/templates/skills/apex/steps/step-00-init.md +14 -26
  45. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  46. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  47. package/templates/skills/apex/steps/step-03-execute.md +45 -252
  48. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  49. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  50. package/templates/skills/apex/steps/step-08-run-tests.md +1 -0
  51. package/templates/skills/application/SKILL.md +241 -242
  52. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  53. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  54. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  55. package/templates/skills/application/references/backend-verification.md +1 -1
  56. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  57. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  58. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  59. package/templates/skills/application/references/frontend-verification.md +12 -12
  60. package/templates/skills/application/references/init-parameter-detection.md +121 -0
  61. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  62. package/templates/skills/application/references/nav-fallback-procedure.md +199 -200
  63. package/templates/skills/application/references/provider-template.md +2 -6
  64. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  65. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  66. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  67. package/templates/skills/application/references/test-frontend.md +3 -3
  68. package/templates/skills/application/steps/step-00-init.md +130 -260
  69. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  70. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  71. package/templates/skills/application/steps/step-03-roles.md +182 -339
  72. package/templates/skills/application/steps/step-03b-provider.md +133 -134
  73. package/templates/skills/application/steps/step-04-backend.md +174 -265
  74. package/templates/skills/application/steps/step-05-frontend.md +18 -144
  75. package/templates/skills/application/steps/step-06-migration.md +12 -60
  76. package/templates/skills/application/steps/step-07-tests.md +9 -76
  77. package/templates/skills/application/templates-backend.md +29 -27
  78. package/templates/skills/application/templates-frontend.md +49 -49
  79. package/templates/skills/application/templates-seed.md +57 -131
  80. package/templates/skills/business-analyse/SKILL.md +27 -30
  81. package/templates/skills/business-analyse/_architecture.md +6 -6
  82. package/templates/skills/business-analyse/_shared.md +60 -88
  83. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  84. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  85. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  86. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  87. package/templates/skills/business-analyse/react/components.md +8 -12
  88. package/templates/skills/business-analyse/react/schema.md +836 -836
  89. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  90. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  91. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  92. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  93. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  94. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  95. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  96. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  97. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  98. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  99. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  100. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  101. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  102. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  103. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  104. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  105. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  106. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  107. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  108. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  109. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  110. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  111. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  112. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  113. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  114. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  115. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  116. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  117. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  118. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  119. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  120. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  121. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  122. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  123. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  124. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  125. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  126. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  127. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  128. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  129. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  130. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  131. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  132. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  133. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  134. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  135. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  136. package/templates/skills/business-analyse/templates-frd.md +25 -25
  137. package/templates/skills/business-analyse/templates-react.md +15 -21
  138. package/templates/skills/controller/SKILL.md +1 -1
  139. package/templates/skills/controller/postman-templates.md +1 -1
  140. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  141. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  142. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  143. package/templates/skills/controller/steps/step-00-init.md +11 -11
  144. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  145. package/templates/skills/controller/templates.md +67 -71
  146. package/templates/skills/debug/SKILL.md +13 -218
  147. package/templates/skills/debug/steps/step-00-init.md +57 -0
  148. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  149. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  150. package/templates/skills/documentation/SKILL.md +49 -345
  151. package/templates/skills/documentation/data-schema.md +11 -8
  152. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  153. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  154. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  155. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  156. package/templates/skills/documentation/templates.md +480 -322
  157. package/templates/skills/efcore/SKILL.md +1 -1
  158. package/templates/skills/efcore/references/both-contexts.md +32 -0
  159. package/templates/skills/efcore/references/database-operations.md +67 -0
  160. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  161. package/templates/skills/efcore/references/reset-operations.md +81 -0
  162. package/templates/skills/efcore/references/seed-methods.md +86 -0
  163. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  164. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  165. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  166. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  167. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  168. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  169. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  170. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  171. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  172. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  173. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  174. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  175. package/templates/skills/feature-full/SKILL.md +1 -1
  176. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  177. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  178. package/templates/skills/gitflow/SKILL.md +28 -5
  179. package/templates/skills/gitflow/_shared.md +109 -12
  180. package/templates/skills/gitflow/phases/abort.md +4 -0
  181. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  182. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  183. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  184. package/templates/skills/gitflow/references/finish-cleanup.md +55 -0
  185. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  186. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  187. package/templates/skills/gitflow/references/init-questions.md +185 -0
  188. package/templates/skills/gitflow/references/init-structure-creation.md +75 -0
  189. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  190. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  191. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  192. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  193. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  194. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  195. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  196. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  197. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  198. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  199. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  200. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  201. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  202. package/templates/skills/gitflow/steps/step-init.md +24 -326
  203. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  204. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  205. package/templates/skills/gitflow/steps/step-start.md +16 -109
  206. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  207. package/templates/skills/ralph-loop/SKILL.md +6 -0
  208. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  209. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  210. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  211. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  212. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  213. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  214. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  215. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  216. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  217. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  218. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  219. package/templates/skills/ralph-loop/steps/step-04-check.md +20 -73
  220. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  221. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  222. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  223. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  224. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -3
  225. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  226. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  227. package/templates/skills/workflow/SKILL.md +1 -1
  228. package/templates/skills/workflow/steps/step-00-init.md +57 -0
@@ -3,6 +3,7 @@ name: debug
3
3
  description: Systematic bug debugging with deep analysis and resolution
4
4
  argument-hint: <log|error|problem-description>
5
5
  model: opus
6
+ entry_point: steps/step-00-init.md
6
7
  ---
7
8
 
8
9
  ## Bug to investigate
@@ -24,231 +25,25 @@ Uses **Agent Teamwork** for parallel investigation with real-time collaboration.
24
25
 
25
26
  <workflow>
26
27
 
27
- ## 1. ANALYZE: Deep Log/Error Analysis (inline)
28
+ This skill follows a **3-step progressive loading architecture**:
28
29
 
29
- - Parse the provided log/error message carefully
30
- - Extract key error patterns, stack traces, and symptoms
31
- - Identify error types: runtime, compile-time, logic, performance
32
- - **CRITICAL**: Document exact error context and reproduction steps
33
- - Determine investigation scope (see decision matrix below)
30
+ 1. **step-00-init**: Gather context, reproduce the bug, and determine investigation approach (inline vs team)
31
+ 2. **step-01-analyze**: Deep root cause analysis using team investigation or inline analysis with ULTRA-THINK
32
+ 3. **step-02-resolve**: Implement fix, verify resolution, and test for regressions
34
33
 
35
- ### Decision Matrix Team vs. Inline
36
-
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) |
44
-
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)
65
- ```
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
90
- ```
91
-
92
- **doc-researcher** (`general-purpose`, haiku)
93
- ```
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
113
- ```
114
-
115
- **data-inspector** (`general-purpose`, haiku) — *only if bug involves data/persistence/DB*
116
- ```
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
146
- ```
147
-
148
- ### 2.3 Orchestrate — Lead Actions During Investigation
149
-
150
- While teammates investigate in parallel:
151
-
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
163
-
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:
185
- - Code logic errors
186
- - Configuration issues
187
- - Data integrity problems (from data-inspector findings)
188
- - Environment problems
189
- - Race conditions
190
- - Memory issues
191
- - Network problems
192
-
193
- **CRITICAL**: Map the complete failure path from root cause to visible symptom
194
- Validate hypotheses against evidence from ALL agents
195
-
196
- ### WHY Technique
197
-
198
- Ask "why" at least 5 times:
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
204
-
205
- ## 4. RESEARCH: Solution Investigation (inline or websearch)
206
-
207
- If root cause needs further research:
208
-
209
- - Use `WebSearch` inline for targeted solution search
210
- - Check documentation for affected libraries/frameworks
211
- - Look for known bugs, workarounds, and best practices
212
- - **THINK**: Evaluate solution approaches for this specific context
213
-
214
- ## 5. IMPLEMENT: Systematic Resolution (inline, lead only)
215
-
216
- - Choose the most appropriate solution based on analysis
217
- - Follow existing codebase patterns and conventions
218
- - Implement minimal, targeted fixes
219
- - **STAY IN SCOPE**: Fix only what's needed for this specific bug
220
- - Add defensive programming where appropriate
221
-
222
- ## 6. VERIFY: Comprehensive Testing (inline)
223
-
224
- - Test the specific scenario that was failing
225
- - Run related tests to ensure no regressions
226
- - Check edge cases around the fix
227
- - **CRITICAL**: Verify the original error is completely resolved
34
+ See `steps/` directory for complete implementation details.
228
35
 
229
36
  </workflow>
230
37
 
231
- <analysis_techniques>
232
-
233
- ### Log Analysis
234
- - Extract timestamps, error codes, stack traces
235
- - Identify error propagation patterns
236
- - Look for correlation with system events
237
-
238
- ### Code Investigation
239
- - Trace execution path to error location
240
- - Check variable states and data flow
241
- - Examine error handling patterns
242
- - Review recent commits affecting the area
38
+ <step_files>
243
39
 
244
- ### Root Cause Mapping
245
- - **WHY technique**: Ask "why" 5 times minimum
246
- - Consider environmental factors
247
- - Check for timing/concurrency issues
248
- - Validate assumptions about data/state
249
- - Cross-reference team findings (code ↔ data ↔ docs)
40
+ | Step | File | Purpose |
41
+ |------|------|---------|
42
+ | 00 | `steps/step-00-init.md` | Parse error, gather context, classify scope, decide investigation approach |
43
+ | 01 | `steps/step-01-analyze.md` | Deep root cause analysis, team orchestration (code-investigator, doc-researcher, data-inspector), ULTRA-THINK |
44
+ | 02 | `steps/step-02-resolve.md` | Research solutions, implement fix, verify resolution, test regressions |
250
45
 
251
- </analysis_techniques>
46
+ </step_files>
252
47
 
253
48
  <execution_rules>
254
49
 
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: Initialize Debug Investigation
3
+ description: Gather context, reproduce the bug, and perform initial analysis
4
+ next_step: step-01-analyze
5
+ ---
6
+
7
+ ## Step 00: Initialize Debug Investigation
8
+
9
+ ### Objective
10
+ Gather all necessary context about the bug, reproduce it in a controlled manner, and establish the foundation for deep analysis.
11
+
12
+ ### Actions
13
+
14
+ #### 1. Parse Input and Gather Context
15
+
16
+ - Extract the provided log/error message carefully
17
+ - Extract key error patterns, stack traces, and symptoms
18
+ - Identify error types: runtime, compile-time, logic, performance
19
+ - **CRITICAL**: Document exact error context and reproduction steps
20
+
21
+ #### 2. Classify Bug Scope
22
+
23
+ Determine investigation scope using the Decision Matrix:
24
+
25
+ | Condition | Action |
26
+ |-----------|--------|
27
+ | Simple error, obvious from stack trace | NO team — investigate inline |
28
+ | Error involves code + data | Team: `code-investigator` + `data-inspector` |
29
+ | Error involves unknown library | Team: `code-investigator` + `doc-researcher` |
30
+ | Complex bug, multiple suspects | Full team: all 3 agents |
31
+ | Performance issue (no error) | `code-investigator` only (profiling inline) |
32
+
33
+ #### 3. Decision: Inline or Team Investigation?
34
+
35
+ **If team NOT needed** → Proceed directly to step-01-analyze with inline investigation.
36
+
37
+ **If team needed** → Create team and spawn teammates in step-01-analyze.
38
+
39
+ ### Initial Analysis Checklist
40
+
41
+ - [ ] Error message parsed and documented
42
+ - [ ] Stack trace (if available) extracted and categorized
43
+ - [ ] Reproduction steps identified or attempted
44
+ - [ ] Error context documented (environment, user actions, etc.)
45
+ - [ ] Error type classified (runtime/compile/logic/performance)
46
+ - [ ] Investigation scope determined (inline vs. team)
47
+
48
+ ### Success Metrics
49
+
50
+ - All available context about the error is documented
51
+ - Error classification is clear and justified
52
+ - Investigation approach (inline vs. team) is decided
53
+ - Ready to proceed to deep root cause analysis
54
+
55
+ ### Next Step
56
+
57
+ Proceed to **step-01-analyze** for deep root cause analysis.
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: Deep Root Cause Analysis
3
+ description: Conduct team investigation or inline analysis to identify root cause
4
+ next_step: step-02-resolve
5
+ ---
6
+
7
+ ## Step 01: Deep Root Cause Analysis
8
+
9
+ ### Objective
10
+ Identify the root cause of the bug through systematic investigation, using either inline analysis or parallel agent teamwork.
11
+
12
+ ### Pre-Step: Decision from step-00-init
13
+
14
+ Based on decision matrix from step-00:
15
+ - **Inline path**: Investigate directly using grep, code review, log analysis
16
+ - **Team path**: Create team and spawn parallel investigators
17
+
18
+ ---
19
+
20
+ ### Path A: Team Investigation (if needed)
21
+
22
+ #### 2.1 Create Team
23
+
24
+ ```yaml
25
+ TeamCreate:
26
+ team_name: "debug-investigate"
27
+ description: "Parallel bug investigation"
28
+ ```
29
+
30
+ #### 2.2 Spawn Teammates (single message, parallel Task calls)
31
+
32
+ Spawn all relevant teammates simultaneously:
33
+
34
+ **code-investigator** (`general-purpose`, haiku)
35
+ ```
36
+ You are a code investigator on the debug team.
37
+
38
+ ## Bug Context
39
+ Error: {error_description}
40
+ Stack trace: {stack_trace}
41
+
42
+ ## Mission
43
+ 1. Locate the error source in code (from stack trace)
44
+ 2. Find related error handling patterns
45
+ 3. Identify similar code that works correctly (for comparison)
46
+ 4. Check recent commits on affected files (git log, git blame)
47
+ 5. Search for similar error patterns elsewhere in codebase
48
+
49
+ ## Communication
50
+ - Send FINDING messages to team-lead for each significant discovery:
51
+ SendMessage(type: "message", recipient: "team-lead", content: "FINDING: {description with file:line}", summary: "Found {short}")
52
+ - When done:
53
+ SendMessage(type: "message", recipient: "team-lead", content: "INVESTIGATION_COMPLETE: {summary}", summary: "Code investigation done")
54
+ - If team-lead sends a LEAD_HINT, follow that direction
55
+
56
+ ## Rules
57
+ - Bash ONLY for: git log, git blame, git diff (NEVER modify code)
58
+ - Report file paths with line numbers
59
+ - Be precise and factual
60
+ ```
61
+
62
+ **doc-researcher** (`general-purpose`, haiku)
63
+ ```
64
+ You are a documentation researcher on the debug team.
65
+
66
+ ## Bug Context
67
+ Error: {error_description}
68
+ Libraries: {libraries_in_stacktrace}
69
+
70
+ ## Mission
71
+ 1. Research documentation for libraries in the stack trace
72
+ 2. Find known issues or breaking changes
73
+ 3. Find correct usage patterns
74
+ 4. Search for similar issues reported online
75
+ 5. Look for migration guides if version issues suspected
76
+
77
+ ## Communication
78
+ - Send FINDING messages to team-lead for each discovery:
79
+ SendMessage(type: "message", recipient: "team-lead", content: "FINDING: {description}", summary: "Found {short}")
80
+ - When done:
81
+ SendMessage(type: "message", recipient: "team-lead", content: "INVESTIGATION_COMPLETE: {summary}", summary: "Doc research done")
82
+ - If team-lead sends a LEAD_HINT, follow that direction
83
+ ```
84
+
85
+ **data-inspector** (`general-purpose`, haiku) — *only if bug involves data/persistence/DB*
86
+ ```
87
+ You are a READ-ONLY database inspector on the debug team.
88
+
89
+ ## Bug Context
90
+ Error: {error_description}
91
+
92
+ ## ABSOLUTE RESTRICTIONS
93
+ YOU MUST NEVER EXECUTE: INSERT, UPDATE, DELETE, MERGE, TRUNCATE, DROP, ALTER, CREATE, EXEC, dotnet ef database update, dotnet ef migrations
94
+ YOU MAY ONLY EXECUTE: SELECT, INFORMATION_SCHEMA, sys.* views, sp_help
95
+
96
+ ## Mission
97
+ 1. Find connection string (appsettings.json, appsettings.Development.json)
98
+ 2. Check record existence and field values for affected entities
99
+ 3. Verify FK integrity (orphaned records)
100
+ 4. Check tenant isolation (TenantId on all records)
101
+ 5. Verify soft delete and audit field consistency
102
+ 6. Compare schema vs expected EF Core model
103
+
104
+ ## Communication
105
+ - Send FINDING messages to team-lead for each data anomaly:
106
+ SendMessage(type: "message", recipient: "team-lead", content: "FINDING: {description}", summary: "Data issue {short}")
107
+ - When done:
108
+ SendMessage(type: "message", recipient: "team-lead", content: "INVESTIGATION_COMPLETE: {summary}", summary: "DB inspection done")
109
+ - If team-lead sends a LEAD_HINT, follow that direction
110
+
111
+ ## Rules
112
+ - Bash ONLY for SELECT queries (NEVER modify data)
113
+ - If a fix is needed, DESCRIBE it — NEVER execute it
114
+ - Mask sensitive data (passwords, tokens, PII)
115
+ - Limit results with TOP/LIMIT
116
+ ```
117
+
118
+ #### 2.3 Orchestrate — Lead Actions During Investigation
119
+
120
+ While teammates investigate in parallel:
121
+
122
+ - **Monitor** incoming `FINDING` messages from agents
123
+ - **Cross-reference** findings between agents (code ↔ data ↔ docs)
124
+ - **Send `LEAD_HINT`** when one agent's finding informs another:
125
+ ```yaml
126
+ SendMessage:
127
+ type: "message"
128
+ recipient: "data-inspector"
129
+ content: "LEAD_HINT: code-investigator found null FK at OrderService.cs:45 — check if Customer records exist for affected OrderIds"
130
+ summary: "Investigate FK from code finding"
131
+ ```
132
+ - **Additional inline investigation**: Grep for error patterns, check related files, examine recent commits
133
+
134
+ #### 2.4 Aggregate & Shutdown
135
+
136
+ Wait for all `INVESTIGATION_COMPLETE` messages, then:
137
+
138
+ 1. Collect all `FINDING` messages from each agent
139
+ 2. Cross-reference: code issues ↔ data anomalies ↔ documentation
140
+ 3. Shutdown teammates:
141
+ ```yaml
142
+ SendMessage:
143
+ type: "shutdown_request"
144
+ recipient: "{each-teammate}"
145
+ content: "Investigation complete"
146
+ # Wait for shutdown_response, then:
147
+ TeamDelete
148
+ ```
149
+
150
+ ---
151
+
152
+ ### Path B: Inline Investigation (if team NOT needed)
153
+
154
+ #### Log Analysis
155
+ - Extract timestamps, error codes, stack traces
156
+ - Identify error propagation patterns
157
+ - Look for correlation with system events
158
+
159
+ #### Code Investigation
160
+ - Trace execution path to error location
161
+ - Check variable states and data flow
162
+ - Examine error handling patterns
163
+ - Review recent commits affecting the area
164
+
165
+ ---
166
+
167
+ ### ULTRA-THINK: Deep Root Cause Analysis
168
+
169
+ **THINK DEEPLY** about the error chain: symptoms → immediate cause → root cause
170
+
171
+ Aggregate all team findings (or inline evidence) and consider:
172
+ - Code logic errors
173
+ - Configuration issues
174
+ - Data integrity problems (from data-inspector findings)
175
+ - Environment problems
176
+ - Race conditions
177
+ - Memory issues
178
+ - Network problems
179
+
180
+ **CRITICAL**: Map the complete failure path from root cause to visible symptom
181
+ Validate hypotheses against evidence from ALL agents
182
+
183
+ #### WHY Technique
184
+
185
+ Ask "why" at least 5 times:
186
+ 1. Why did the error occur? → X happened
187
+ 2. Why did X happen? → Y was in invalid state
188
+ 3. Why was Y invalid? → Z didn't initialize properly
189
+ 4. Why didn't Z initialize? → A dependency was missing
190
+ 5. Why was dependency missing? → Configuration error
191
+
192
+ ### Root Cause Mapping
193
+ - **WHY technique**: Ask "why" 5 times minimum
194
+ - Consider environmental factors
195
+ - Check for timing/concurrency issues
196
+ - Validate assumptions about data/state
197
+ - Cross-reference team findings (code ↔ data ↔ docs)
198
+
199
+ ### Analysis Success Checklist
200
+
201
+ - [ ] Root cause hypothesis formulated with evidence
202
+ - [ ] Evidence validates hypothesis (from all sources)
203
+ - [ ] Team findings cross-referenced and reconciled
204
+ - [ ] WHY chain completed (5+ levels)
205
+ - [ ] Environmental/config factors considered
206
+ - [ ] Edge cases and timing issues identified
207
+ - [ ] Team (if used) properly shut down
208
+
209
+ ### Success Metrics
210
+
211
+ - Root cause identified with supporting evidence (not just symptoms)
212
+ - All team findings integrated and validated
213
+ - Complete failure path mapped from root cause to visible symptom
214
+ - Investigation approach justified and documented
215
+ - Ready to move to resolution phase
216
+
217
+ ### Next Step
218
+
219
+ Proceed to **step-02-resolve** for implementation and verification.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: Implementation and Verification
3
+ description: Implement the fix, verify resolution, and test for regressions
4
+ next_step: null
5
+ ---
6
+
7
+ ## Step 02: Implementation and Verification
8
+
9
+ ### Objective
10
+ Implement the root cause fix identified in step-01, verify the resolution, and ensure no regressions.
11
+
12
+ ### 4. RESEARCH: Solution Investigation (inline or websearch)
13
+
14
+ If root cause needs further research:
15
+
16
+ - Use `WebSearch` inline for targeted solution search
17
+ - Check documentation for affected libraries/frameworks
18
+ - Look for known bugs, workarounds, and best practices
19
+ - **THINK**: Evaluate solution approaches for this specific context
20
+
21
+ ### 5. IMPLEMENT: Systematic Resolution
22
+
23
+ #### Implementation Strategy
24
+
25
+ - Choose the most appropriate solution based on analysis
26
+ - Follow existing codebase patterns and conventions
27
+ - Implement minimal, targeted fixes
28
+ - **STAY IN SCOPE**: Fix only what's needed for this specific bug
29
+ - Add defensive programming where appropriate
30
+
31
+ #### Implementation Rules
32
+
33
+ - **Minimal changes**: Fix root cause, not symptoms
34
+ - **Pattern matching**: Follow existing codebase conventions
35
+ - **No scope creep**: Only address the identified bug
36
+ - **Defensive programming**: Add guards for edge cases
37
+ - **Documentation**: Comment on non-obvious fixes
38
+
39
+ ### 6. VERIFY: Comprehensive Testing
40
+
41
+ #### Testing Strategy
42
+
43
+ - Test the specific scenario that was failing
44
+ - Run related tests to ensure no regressions
45
+ - Check edge cases around the fix
46
+ - **CRITICAL**: Verify the original error is completely resolved
47
+
48
+ #### Test Checklist
49
+
50
+ - [ ] Original error scenario reproduced and verified as fixed
51
+ - [ ] Related unit tests pass
52
+ - [ ] Integration tests (if applicable) pass
53
+ - [ ] Edge cases around the fix tested
54
+ - [ ] Regressions checked in related code
55
+ - [ ] Fix behavior validated in different environments (if applicable)
56
+
57
+ ### Execution Rules
58
+
59
+ - **NEVER guess** — validate all fixes with evidence
60
+ - **MINIMAL CHANGES**: Fix root cause, not symptoms
61
+ - Test thoroughly before declaring resolution complete
62
+ - **ALWAYS cleanup**: shutdown teammates + TeamDelete after investigation (from step-01)
63
+
64
+ ### Priority
65
+
66
+ Understanding > Speed > Completeness. Every fix must be fully understood before declaring complete.
67
+
68
+ ### Success Criteria
69
+
70
+ - Root cause identified with evidence (not just symptoms)
71
+ - Fix implemented with minimal, targeted changes
72
+ - Original error no longer reproducible
73
+ - Related tests pass without regressions
74
+ - Team properly shut down (no orphan agents from step-01)
75
+
76
+ ### Completion Checklist
77
+
78
+ - [ ] Root cause from step-01 fully understood
79
+ - [ ] Solution approach documented and justified
80
+ - [ ] Fix implemented following codebase patterns
81
+ - [ ] Original error scenario verified as resolved
82
+ - [ ] Regression testing completed
83
+ - [ ] Edge cases tested
84
+ - [ ] Team agents shut down (if used in step-01)
85
+ - [ ] Resolution documented