@atlashub/smartstack-cli 3.10.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.
- package/dist/index.js +2544 -2461
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +479 -6185
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/agents/db-reader.md +149 -0
- package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +9 -19
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +12 -2
- package/templates/skills/business-analyse/references/deploy-data-build.md +36 -25
- package/templates/skills/business-analyse/references/detection-strategies.md +424 -0
- package/templates/skills/business-analyse/references/html-data-mapping.md +4 -0
- package/templates/skills/business-analyse/references/prd-generation.md +258 -0
- package/templates/skills/business-analyse/references/validate-incremental-html.md +47 -4
- package/templates/skills/business-analyse/references/validation-checklist.md +281 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +50 -221
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +8 -22
- package/templates/skills/business-analyse/steps/step-03a-data.md +20 -446
- package/templates/skills/business-analyse/steps/step-03a1-setup.md +356 -0
- package/templates/skills/business-analyse/steps/step-03a2-analysis.md +143 -0
- package/templates/skills/business-analyse/steps/step-03b-ui.md +3 -0
- package/templates/skills/business-analyse/steps/step-03c-compile.md +1 -1
- package/templates/skills/business-analyse/steps/step-03d-validate.md +21 -262
- package/templates/skills/business-analyse/steps/step-04-consolidation.md +21 -606
- package/templates/skills/business-analyse/steps/step-04a-collect.md +304 -0
- package/templates/skills/business-analyse/steps/step-04b-analyze.md +239 -0
- package/templates/skills/business-analyse/steps/step-04c-decide.md +186 -0
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +21 -0
- package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +27 -35
- package/templates/skills/debug/SKILL.md +156 -53
- package/templates/skills/debug/references/team-protocol.md +232 -0
- package/templates/skills/ralph-loop/references/category-rules.md +46 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +32 -2
- package/templates/skills/ralph-loop/references/core-seed-data.md +60 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +64 -1
- package/templates/skills/ralph-loop/steps/step-04-check.md +27 -2
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-04c-decide
|
|
3
|
+
description: Final client approval, write consolidation, proceed to handoff
|
|
4
|
+
model: opus
|
|
5
|
+
next_step: steps/step-05a-handoff.md
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
> **Context files:** `_shared.md`
|
|
9
|
+
|
|
10
|
+
# Step 4c: Decide - Final Approval & Consolidation Write
|
|
11
|
+
|
|
12
|
+
## MANDATORY EXECUTION RULES
|
|
13
|
+
- Final client approval is BLOCKING before handoff
|
|
14
|
+
- ALWAYS write consolidation section before proceeding
|
|
15
|
+
- ALWAYS update workflow state for resume support
|
|
16
|
+
|
|
17
|
+
## YOUR TASK
|
|
18
|
+
Obtain final client approval for the complete application specification, write the consolidation section to feature.json, and prepare for handoff.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## EXECUTION SEQUENCE
|
|
23
|
+
|
|
24
|
+
### 8. Final Client Approval (BLOCKING)
|
|
25
|
+
|
|
26
|
+
Ask via AskUserQuestion:
|
|
27
|
+
```
|
|
28
|
+
question: "La spécification complète de l'application est prête. Validez-vous l'ensemble ?"
|
|
29
|
+
header: "Approbation"
|
|
30
|
+
options:
|
|
31
|
+
- label: "Approuvé"
|
|
32
|
+
description: "Passer au handoff pour la phase d'implémentation"
|
|
33
|
+
- label: "Réviser un module"
|
|
34
|
+
description: "Retourner à la spécification d'un module spécifique"
|
|
35
|
+
- label: "Modifier les interactions"
|
|
36
|
+
description: "Ajuster les interactions cross-module"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
IF "Réviser un module":
|
|
40
|
+
Ask which module → set currentModuleIndex to that module → load step-03a-data.md
|
|
41
|
+
|
|
42
|
+
IF "Modifier les interactions":
|
|
43
|
+
Re-enter step-04a-collect.md (sections 2-4)
|
|
44
|
+
|
|
45
|
+
### 9. Write Consolidation
|
|
46
|
+
|
|
47
|
+
> **STRUCTURE CARD: consolidation** — Must match `application-schema.json`. Follow this structure exactly.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
ba-writer.enrichSection({
|
|
51
|
+
featureId: {feature_id},
|
|
52
|
+
section: "consolidation",
|
|
53
|
+
data: {
|
|
54
|
+
crossModuleInteractions: [
|
|
55
|
+
{
|
|
56
|
+
"fromModule": "Orders",
|
|
57
|
+
"toModule": "Customers",
|
|
58
|
+
"interactionType": "FK-reference|event-publish|event-subscribe|shared-lookup|cascade-delete|cascade-update",
|
|
59
|
+
"description": "Order references customer via FK",
|
|
60
|
+
"entities": ["Order→Customer"]
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
sharedEntities: [
|
|
64
|
+
{
|
|
65
|
+
"entity": "Customer",
|
|
66
|
+
"ownerModule": "Customers",
|
|
67
|
+
"referencedBy": ["Orders", "Invoices"],
|
|
68
|
+
"sharedFields": ["code", "name"]
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
permissionCoherence: {
|
|
72
|
+
"rolesConsistent": true,
|
|
73
|
+
"pathFormatConsistent": true,
|
|
74
|
+
"hierarchyRespected": true,
|
|
75
|
+
"conflicts": [],
|
|
76
|
+
"warnings": []
|
|
77
|
+
},
|
|
78
|
+
e2eFlows: [
|
|
79
|
+
{
|
|
80
|
+
"name": "Order to Invoice",
|
|
81
|
+
"modules": ["Customers", "Orders", "Invoices"],
|
|
82
|
+
"steps": [
|
|
83
|
+
{ "module": "Orders", "action": "Create order", "permission": "business.sales.orders.create", "dataFlow": "Customer → Order" }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
globalRiskAssessment: [
|
|
88
|
+
{
|
|
89
|
+
"risk": "Cross-module coupling complexity",
|
|
90
|
+
"category": "coupling|complexity|dependency-chain|security|scope",
|
|
91
|
+
"severity": "critical|high|medium|low",
|
|
92
|
+
"mitigation": "Event-driven communication instead of direct FK"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
semanticChecks: [
|
|
96
|
+
{ "check": "permission-orpheline", "status": "PASS|WARNING|ERROR", "details": "..." },
|
|
97
|
+
{ "check": "uc-sans-fr", "status": "PASS|WARNING|ERROR", "details": "..." },
|
|
98
|
+
{ "check": "wireframe-coverage", "status": "PASS|WARNING|ERROR", "details": "..." }
|
|
99
|
+
],
|
|
100
|
+
decision: {
|
|
101
|
+
"approved": true,
|
|
102
|
+
"reason": "All cross-module validations passed",
|
|
103
|
+
"approvedBy": "Client",
|
|
104
|
+
"approvedAt": "{ISO timestamp}"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
ba-writer.updateStatus({feature_id}, "consolidated")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> **STRUCTURE DIFFERENCES FROM OLD FORMAT:**
|
|
113
|
+
> - `crossModuleInteractions` is a FLAT ARRAY (not `{fkReferences, sharedEntities, events}` nested object)
|
|
114
|
+
> - `sharedEntities` is TOP-LEVEL (not nested inside crossModuleInteractions)
|
|
115
|
+
> - `decision` is an OBJECT with `approved`, `reason`, `approvedBy`, `approvedAt` (not `clientApproval` string)
|
|
116
|
+
> - `globalRiskAssessment` is an ARRAY of risk objects (not `{totalEntities: {value, threshold}}`)
|
|
117
|
+
|
|
118
|
+
Add changelog entry:
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"step": "step-04-consolidation",
|
|
122
|
+
"timestamp": "...",
|
|
123
|
+
"changes": [
|
|
124
|
+
"Cross-module interactions: X FK, Y events, Z shared entities",
|
|
125
|
+
"Permission coherence: validated ({count} paths, {conflicts} conflicts resolved)",
|
|
126
|
+
"E2E flows: {count} identified",
|
|
127
|
+
"Global risk: {level}",
|
|
128
|
+
"Client approval: APPROVED"
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 10. Workflow State Save (for resume support)
|
|
134
|
+
|
|
135
|
+
After consolidation approval, update workflow state to enable resume if context is exhausted during handoff steps:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
ba-writer.enrichSection({
|
|
139
|
+
featureId: {feature_id},
|
|
140
|
+
section: "metadata.workflow",
|
|
141
|
+
data: {
|
|
142
|
+
lastCompletedStep: "step-04-consolidation",
|
|
143
|
+
readyForHandoff: true
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> **Why:** Steps 05a-05b arrive late in the conversation when context may be near exhaustion.
|
|
149
|
+
> If BA is interrupted during handoff, the user can resume with `/business-analyse` which will
|
|
150
|
+
> detect `lastCompletedStep: "step-04-consolidation"` and resume directly at step-05a.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## SINGLE-MODULE MODE
|
|
155
|
+
|
|
156
|
+
When only 1 module:
|
|
157
|
+
1. Auto-approve (no cross-module concerns)
|
|
158
|
+
2. Write minimal consolidation section
|
|
159
|
+
3. Display: "Module unique - consolidation automatique ✓"
|
|
160
|
+
4. Proceed to step-05a-handoff.md
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## CONTEXT MANAGEMENT
|
|
165
|
+
|
|
166
|
+
| Loaded | Not Loaded |
|
|
167
|
+
|--------|------------|
|
|
168
|
+
| _shared.md | Full module feature.json files |
|
|
169
|
+
| consolidation data (from steps 04a-04b) | Questionnaires |
|
|
170
|
+
| Master feature.json | Templates |
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## SUCCESS CRITERIA
|
|
175
|
+
|
|
176
|
+
- Client approval obtained (or auto-approved for single module)
|
|
177
|
+
- Consolidation section written to master feature.json
|
|
178
|
+
- Status updated to "consolidated"
|
|
179
|
+
- Workflow state saved for resume support
|
|
180
|
+
- Ready to proceed to handoff phase
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## NEXT STEP
|
|
185
|
+
|
|
186
|
+
Load: `./step-05a-handoff.md`
|
|
@@ -305,6 +305,27 @@ After writing the HTML file, verify:
|
|
|
305
305
|
fi
|
|
306
306
|
```
|
|
307
307
|
|
|
308
|
+
5. **EMBEDDED_ARTIFACTS wireframes must use renamed fields** (`format`/`content`, NOT `mockupFormat`/`mockup`)
|
|
309
|
+
```bash
|
|
310
|
+
# Check that wireframe field rename was applied (mockup → content, mockupFormat → format)
|
|
311
|
+
if grep -q '"mockupFormat"' "{output_path}/ba-interactive.html"; then
|
|
312
|
+
BLOCKING_ERROR("EMBEDDED_ARTIFACTS wireframes still use 'mockupFormat' — must rename to 'format'")
|
|
313
|
+
BLOCKING_ERROR("See references/html-data-mapping.md for correct field mapping")
|
|
314
|
+
fi
|
|
315
|
+
if grep -q '"mockup":' "{output_path}/ba-interactive.html" | grep -v '"mockupNotes"'; then
|
|
316
|
+
# Note: "mockup" in EMBEDDED_ARTIFACTS = wrong, must be "content"
|
|
317
|
+
BLOCKING_ERROR("EMBEDDED_ARTIFACTS wireframes still use 'mockup' — must rename to 'content'")
|
|
318
|
+
fi
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
6. **EMBEDDED_ARTIFACTS wireframes must exist for ALL modules** (not empty `{}`)
|
|
322
|
+
```bash
|
|
323
|
+
# Each module should have at least one wireframe with "format" and "content"
|
|
324
|
+
if ! grep -q '"format"' "{output_path}/ba-interactive.html"; then
|
|
325
|
+
BLOCKING_ERROR("No wireframe 'format' field found — EMBEDDED_ARTIFACTS wireframes not populated")
|
|
326
|
+
fi
|
|
327
|
+
```
|
|
328
|
+
|
|
308
329
|
**IF ANY CHECK FAILS → DO NOT PROCEED. Fix the data mapping and regenerate.**
|
|
309
330
|
|
|
310
331
|
---
|
|
@@ -81,47 +81,39 @@ Validating business analysis completeness before development...
|
|
|
81
81
|
a. Locate expected PRD file: .ralph/prd-{moduleCode}.json
|
|
82
82
|
b. Verify file exists
|
|
83
83
|
c. Read PRD file
|
|
84
|
-
d. Verify structure (see
|
|
84
|
+
d. Verify structure (see [references/prd-generation.md](../references/prd-generation.md))
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
2. **PRD Structure Validation:**
|
|
88
|
+
|
|
89
|
+
Perform the 4 mandatory PRD structure checks:
|
|
90
|
+
- **Check 1:** Version must be "3.0.0"
|
|
91
|
+
- **Check 2:** filesToCreate must be under `implementation` (NOT root level)
|
|
92
|
+
- **Check 3:** All 7 categories present (domain, application, infrastructure, api, frontend, seedData, tests)
|
|
93
|
+
- **Check 4:** File counts match feature.json handoff counts
|
|
94
|
+
|
|
88
95
|
```javascript
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!prd.implementation.filesToCreate[cat]) {
|
|
107
|
-
missingCategories.push(cat);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (missingCategories.length > 0) {
|
|
111
|
-
BLOCKING_ERROR(`Missing categories: ${missingCategories.join(', ')}`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Check 4: File counts match feature.json handoff
|
|
115
|
-
const featureHandoff = moduleFeature.handoff.filesToCreate;
|
|
116
|
-
for (const cat of categories) {
|
|
117
|
-
const prdCount = prd.implementation.filesToCreate[cat]?.length ?? 0;
|
|
118
|
-
const featureCount = featureHandoff[cat]?.length ?? 0;
|
|
119
|
-
if (prdCount !== featureCount) {
|
|
120
|
-
BLOCKING_ERROR(`${cat}: prd has ${prdCount} files but feature.json has ${featureCount}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
96
|
+
const prdErrors = validateAllPRDs(modules);
|
|
97
|
+
|
|
98
|
+
IF prdErrors.length > 0:
|
|
99
|
+
// CONDITIONAL LOAD: Only load PRD reference on validation failure
|
|
100
|
+
Read references/prd-generation.md
|
|
101
|
+
Display:
|
|
102
|
+
- PRD v3.0 structure requirements
|
|
103
|
+
- Detailed validation logic for failed checks
|
|
104
|
+
- Common errors & fix commands for each failure
|
|
105
|
+
- Generation command reference
|
|
106
|
+
|
|
107
|
+
BLOCKING ERROR: {prdErrors.length} PRD file(s) invalid
|
|
108
|
+
→ Fix all PRD errors before proceeding
|
|
109
|
+
|
|
110
|
+
ELSE:
|
|
111
|
+
All PRD files valid ✓
|
|
112
|
+
→ Continue to dependency graph validation
|
|
123
113
|
```
|
|
124
114
|
|
|
115
|
+
**Optimization:** The detailed 300-line prd-generation.md is loaded **only when PRD validation fails** (saves ~12,000 tokens on success path).
|
|
116
|
+
|
|
125
117
|
3. Display PRD validation table:
|
|
126
118
|
|
|
127
119
|
```
|
|
@@ -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
|
-
|
|
35
|
+
### Decision Matrix — Team vs. Inline
|
|
34
36
|
|
|
35
|
-
|
|
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
|
-
**
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
**
|
|
92
|
+
**doc-researcher** (`general-purpose`, haiku)
|
|
48
93
|
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
**
|
|
115
|
+
**data-inspector** (`general-purpose`, haiku) — *only if bug involves data/persistence/DB*
|
|
57
116
|
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
150
|
+
While teammates investigate in parallel:
|
|
72
151
|
|
|
73
|
-
|
|
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
|
-
|
|
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
|
|
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?
|
|
90
|
-
2. Why did X happen?
|
|
91
|
-
3. Why was Y invalid?
|
|
92
|
-
4. Why didn't Z initialize?
|
|
93
|
-
5. Why was dependency missing?
|
|
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
|
-
|
|
205
|
+
## 4. RESEARCH: Solution Investigation (inline or websearch)
|
|
98
206
|
|
|
99
|
-
|
|
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
|
-
|
|
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
|
|
256
|
+
- Use **Agent Teamwork** for parallel investigation (see decision matrix)
|
|
156
257
|
- Document findings and reasoning at each step
|
|
157
|
-
- **NEVER guess**
|
|
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>
|