trinity-method-sdk 2.0.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 (191) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/LICENSE +21 -0
  3. package/README.md +555 -0
  4. package/dist/cli/commands/deploy/agents.d.ts +14 -0
  5. package/dist/cli/commands/deploy/agents.js +59 -0
  6. package/dist/cli/commands/deploy/ci-cd.d.ts +13 -0
  7. package/dist/cli/commands/deploy/ci-cd.js +50 -0
  8. package/dist/cli/commands/deploy/claude-setup.d.ts +17 -0
  9. package/dist/cli/commands/deploy/claude-setup.js +91 -0
  10. package/dist/cli/commands/deploy/configuration.d.ts +13 -0
  11. package/dist/cli/commands/deploy/configuration.js +215 -0
  12. package/dist/cli/commands/deploy/directories.d.ts +12 -0
  13. package/dist/cli/commands/deploy/directories.js +38 -0
  14. package/dist/cli/commands/deploy/gitignore.d.ts +12 -0
  15. package/dist/cli/commands/deploy/gitignore.js +53 -0
  16. package/dist/cli/commands/deploy/index.d.ts +38 -0
  17. package/dist/cli/commands/deploy/index.js +156 -0
  18. package/dist/cli/commands/deploy/knowledge-base.d.ts +16 -0
  19. package/dist/cli/commands/deploy/knowledge-base.js +75 -0
  20. package/dist/cli/commands/deploy/linting.d.ts +18 -0
  21. package/dist/cli/commands/deploy/linting.js +51 -0
  22. package/dist/cli/commands/deploy/metrics.d.ts +13 -0
  23. package/dist/cli/commands/deploy/metrics.js +34 -0
  24. package/dist/cli/commands/deploy/pre-flight.d.ts +13 -0
  25. package/dist/cli/commands/deploy/pre-flight.js +29 -0
  26. package/dist/cli/commands/deploy/root-files.d.ts +16 -0
  27. package/dist/cli/commands/deploy/root-files.js +178 -0
  28. package/dist/cli/commands/deploy/sdk-install.d.ts +12 -0
  29. package/dist/cli/commands/deploy/sdk-install.js +57 -0
  30. package/dist/cli/commands/deploy/summary.d.ts +14 -0
  31. package/dist/cli/commands/deploy/summary.js +130 -0
  32. package/dist/cli/commands/deploy/templates.d.ts +14 -0
  33. package/dist/cli/commands/deploy/templates.js +84 -0
  34. package/dist/cli/commands/deploy/types.d.ts +39 -0
  35. package/dist/cli/commands/deploy/types.js +5 -0
  36. package/dist/cli/commands/update/agents.d.ts +14 -0
  37. package/dist/cli/commands/update/agents.js +31 -0
  38. package/dist/cli/commands/update/backup.d.ts +31 -0
  39. package/dist/cli/commands/update/backup.js +97 -0
  40. package/dist/cli/commands/update/commands.d.ts +14 -0
  41. package/dist/cli/commands/update/commands.js +75 -0
  42. package/dist/cli/commands/update/index.d.ts +15 -0
  43. package/dist/cli/commands/update/index.js +118 -0
  44. package/dist/cli/commands/update/knowledge-base.d.ts +14 -0
  45. package/dist/cli/commands/update/knowledge-base.js +38 -0
  46. package/dist/cli/commands/update/pre-flight.d.ts +13 -0
  47. package/dist/cli/commands/update/pre-flight.js +37 -0
  48. package/dist/cli/commands/update/summary.d.ts +20 -0
  49. package/dist/cli/commands/update/summary.js +47 -0
  50. package/dist/cli/commands/update/templates.d.ts +14 -0
  51. package/dist/cli/commands/update/templates.js +25 -0
  52. package/dist/cli/commands/update/types.d.ts +13 -0
  53. package/dist/cli/commands/update/types.js +7 -0
  54. package/dist/cli/commands/update/utils.d.ts +11 -0
  55. package/dist/cli/commands/update/utils.js +19 -0
  56. package/dist/cli/commands/update/verification.d.ts +20 -0
  57. package/dist/cli/commands/update/verification.js +54 -0
  58. package/dist/cli/commands/update/version.d.ts +18 -0
  59. package/dist/cli/commands/update/version.js +36 -0
  60. package/dist/cli/commands/update.d.ts +7 -0
  61. package/dist/cli/commands/update.js +7 -0
  62. package/dist/cli/index.d.ts +3 -0
  63. package/dist/cli/index.js +36 -0
  64. package/dist/cli/types.d.ts +77 -0
  65. package/dist/cli/types.js +5 -0
  66. package/dist/cli/utils/deploy-ci.d.ts +22 -0
  67. package/dist/cli/utils/deploy-ci.js +138 -0
  68. package/dist/cli/utils/deploy-linting.d.ts +3 -0
  69. package/dist/cli/utils/deploy-linting.js +136 -0
  70. package/dist/cli/utils/detect-stack.d.ts +3 -0
  71. package/dist/cli/utils/detect-stack.js +270 -0
  72. package/dist/cli/utils/error-classes.d.ts +63 -0
  73. package/dist/cli/utils/error-classes.js +84 -0
  74. package/dist/cli/utils/error-handler.d.ts +59 -0
  75. package/dist/cli/utils/error-handler.js +127 -0
  76. package/dist/cli/utils/errors.d.ts +52 -0
  77. package/dist/cli/utils/errors.js +102 -0
  78. package/dist/cli/utils/get-sdk-path.d.ts +18 -0
  79. package/dist/cli/utils/get-sdk-path.js +31 -0
  80. package/dist/cli/utils/inject-dependencies.d.ts +2 -0
  81. package/dist/cli/utils/inject-dependencies.js +55 -0
  82. package/dist/cli/utils/linting-tools.d.ts +8 -0
  83. package/dist/cli/utils/linting-tools.js +206 -0
  84. package/dist/cli/utils/metrics/code-quality.d.ts +32 -0
  85. package/dist/cli/utils/metrics/code-quality.js +122 -0
  86. package/dist/cli/utils/metrics/dependency-parser.d.ts +21 -0
  87. package/dist/cli/utils/metrics/dependency-parser.js +153 -0
  88. package/dist/cli/utils/metrics/file-complexity.d.ts +26 -0
  89. package/dist/cli/utils/metrics/file-complexity.js +77 -0
  90. package/dist/cli/utils/metrics/framework-detector.d.ts +17 -0
  91. package/dist/cli/utils/metrics/framework-detector.js +120 -0
  92. package/dist/cli/utils/metrics/git-metrics.d.ts +30 -0
  93. package/dist/cli/utils/metrics/git-metrics.js +83 -0
  94. package/dist/cli/utils/metrics/index.d.ts +28 -0
  95. package/dist/cli/utils/metrics/index.js +100 -0
  96. package/dist/cli/utils/template-processor.d.ts +10 -0
  97. package/dist/cli/utils/template-processor.js +188 -0
  98. package/dist/cli/utils/validate-path.d.ts +80 -0
  99. package/dist/cli/utils/validate-path.js +180 -0
  100. package/dist/index.d.ts +6 -0
  101. package/dist/index.js +8 -0
  102. package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +572 -0
  103. package/dist/templates/agents/aj-team/bas-quality-gate.md.template +906 -0
  104. package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +636 -0
  105. package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +670 -0
  106. package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +768 -0
  107. package/dist/templates/agents/aj-team/kil-task-executor.md.template +764 -0
  108. package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +759 -0
  109. package/dist/templates/agents/audit/juno-auditor.md.template +447 -0
  110. package/dist/templates/agents/deployment/ein-cicd.md.template +694 -0
  111. package/dist/templates/agents/deployment/ino-context.md.template +733 -0
  112. package/dist/templates/agents/deployment/tan-structure.md.template +661 -0
  113. package/dist/templates/agents/deployment/zen-knowledge.md.template +451 -0
  114. package/dist/templates/agents/leadership/aj-cc.md.template +462 -0
  115. package/dist/templates/agents/leadership/aj-maestro.md.template +943 -0
  116. package/dist/templates/agents/leadership/aly-cto.md.template +407 -0
  117. package/dist/templates/agents/planning/eus-decomposer.md.template +496 -0
  118. package/dist/templates/agents/planning/mon-requirements.md.template +323 -0
  119. package/dist/templates/agents/planning/ror-design.md.template +465 -0
  120. package/dist/templates/agents/planning/tra-planner.md.template +432 -0
  121. package/dist/templates/ci/cd.yml.template +175 -0
  122. package/dist/templates/ci/ci.yml.template +196 -0
  123. package/dist/templates/ci/generic-ci.yml +115 -0
  124. package/dist/templates/ci/github-actions.yml +86 -0
  125. package/dist/templates/ci/gitlab-ci.yml +103 -0
  126. package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +545 -0
  127. package/dist/templates/documentation/ROOT-README.md.template +307 -0
  128. package/dist/templates/documentation/SUBDIRECTORY-README.md.template +261 -0
  129. package/dist/templates/investigations/bug.md.template +484 -0
  130. package/dist/templates/investigations/feature.md.template +564 -0
  131. package/dist/templates/investigations/performance.md.template +625 -0
  132. package/dist/templates/investigations/security.md.template +714 -0
  133. package/dist/templates/investigations/technical.md.template +433 -0
  134. package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +957 -0
  135. package/dist/templates/knowledge-base/ARCHITECTURE.md.template +452 -0
  136. package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +750 -0
  137. package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1118 -0
  138. package/dist/templates/knowledge-base/ISSUES.md.template +539 -0
  139. package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +894 -0
  140. package/dist/templates/knowledge-base/Technical-Debt.md.template +640 -0
  141. package/dist/templates/knowledge-base/To-do.md.template +407 -0
  142. package/dist/templates/knowledge-base/Trinity.md.template +464 -0
  143. package/dist/templates/linting/flutter/.pre-commit-config.yaml.template +27 -0
  144. package/dist/templates/linting/flutter/analysis_options.yaml.template +26 -0
  145. package/dist/templates/linting/nodejs/.eslintrc-commonjs.json.template +19 -0
  146. package/dist/templates/linting/nodejs/.eslintrc-esm.json.template +19 -0
  147. package/dist/templates/linting/nodejs/.eslintrc-typescript.json.template +22 -0
  148. package/dist/templates/linting/nodejs/.pre-commit-config.yaml.template +51 -0
  149. package/dist/templates/linting/nodejs/.prettierrc.json.template +10 -0
  150. package/dist/templates/linting/python/.flake8.template +16 -0
  151. package/dist/templates/linting/python/.pre-commit-config.yaml.template +30 -0
  152. package/dist/templates/linting/python/pyproject.toml.template +38 -0
  153. package/dist/templates/linting/rust/.pre-commit-config.yaml.template +28 -0
  154. package/dist/templates/linting/rust/clippy.toml.template +14 -0
  155. package/dist/templates/linting/rust/rustfmt.toml.template +12 -0
  156. package/dist/templates/root/CLAUDE.md.template +65 -0
  157. package/dist/templates/root/TRINITY.md.template +52 -0
  158. package/dist/templates/shared/claude-commands/trinity-agents.md.template +168 -0
  159. package/dist/templates/shared/claude-commands/trinity-audit.md.template +646 -0
  160. package/dist/templates/shared/claude-commands/trinity-changelog.md.template +624 -0
  161. package/dist/templates/shared/claude-commands/trinity-continue.md.template +549 -0
  162. package/dist/templates/shared/claude-commands/trinity-create-investigation.md.template +232 -0
  163. package/dist/templates/shared/claude-commands/trinity-decompose.md.template +181 -0
  164. package/dist/templates/shared/claude-commands/trinity-design.md.template +347 -0
  165. package/dist/templates/shared/claude-commands/trinity-docs.md.template +2093 -0
  166. package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -0
  167. package/dist/templates/shared/claude-commands/trinity-init.md.template +606 -0
  168. package/dist/templates/shared/claude-commands/trinity-investigate-templates.md.template +725 -0
  169. package/dist/templates/shared/claude-commands/trinity-orchestrate.md.template +1061 -0
  170. package/dist/templates/shared/claude-commands/trinity-plan-investigation.md.template +135 -0
  171. package/dist/templates/shared/claude-commands/trinity-plan.md.template +201 -0
  172. package/dist/templates/shared/claude-commands/trinity-readme.md.template +1971 -0
  173. package/dist/templates/shared/claude-commands/trinity-requirements.md.template +148 -0
  174. package/dist/templates/shared/claude-commands/trinity-start.md.template +268 -0
  175. package/dist/templates/shared/claude-commands/trinity-verify.md.template +453 -0
  176. package/dist/templates/shared/claude-commands/trinity-workorder.md.template +249 -0
  177. package/dist/templates/source/base-CLAUDE.md.template +310 -0
  178. package/dist/templates/source/flutter-CLAUDE.md.template +593 -0
  179. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -0
  180. package/dist/templates/source/python-CLAUDE.md.template +510 -0
  181. package/dist/templates/source/react-CLAUDE.md.template +513 -0
  182. package/dist/templates/source/rust-CLAUDE.md.template +653 -0
  183. package/dist/templates/source/tests-CLAUDE.md.template +432 -0
  184. package/dist/templates/trinity/CLAUDE.md.template +372 -0
  185. package/dist/templates/work-orders/ANALYSIS-TEMPLATE.md.template +276 -0
  186. package/dist/templates/work-orders/AUDIT-TEMPLATE.md.template +262 -0
  187. package/dist/templates/work-orders/IMPLEMENTATION-TEMPLATE.md.template +260 -0
  188. package/dist/templates/work-orders/INVESTIGATION-TEMPLATE.md.template +206 -0
  189. package/dist/templates/work-orders/PATTERN-TEMPLATE.md.template +320 -0
  190. package/dist/templates/work-orders/VERIFICATION-TEMPLATE.md.template +273 -0
  191. package/package.json +94 -0
@@ -0,0 +1,484 @@
1
+ # Bug Investigation: {{title}}
2
+
3
+ **Investigation ID:** {{investigationId}}
4
+ **Created:** {{createdAt}}
5
+ **Investigator:** {{investigator}}
6
+ **Status:** {{status}}
7
+ **Priority:** {{priority}}
8
+
9
+ ---
10
+
11
+ ## 🐛 Bug Summary
12
+
13
+ **Brief Description:**
14
+ {{description}}
15
+
16
+ **Observed Behavior:**
17
+ [Describe what is currently happening]
18
+
19
+ **Expected Behavior:**
20
+ [Describe what should happen]
21
+
22
+ **Impact:**
23
+ - [ ] Production users affected
24
+ - [ ] Development blocked
25
+ - [ ] Data integrity at risk
26
+ - [ ] Performance degraded
27
+ - [ ] Security implications
28
+
29
+ **Affected Components:**
30
+ -
31
+
32
+ **Affected Users/Systems:**
33
+ -
34
+
35
+ ---
36
+
37
+ ## 🔍 Trinity Method Guided Questions
38
+
39
+ ### Investigation Phase
40
+
41
+ **1. Reproduction**
42
+ - Can you reproduce the bug consistently?
43
+ - [ ] Yes, 100% reproducible
44
+ - [ ] Sometimes (intermittent)
45
+ - [ ] No, cannot reproduce
46
+
47
+ - What are the exact steps to reproduce?
48
+ 1.
49
+ 2.
50
+ 3.
51
+
52
+ - What conditions are necessary?
53
+ - Environment:
54
+ - Data state:
55
+ - User permissions:
56
+ - Timing/race conditions:
57
+
58
+ **2. Evidence Collection**
59
+ - What error messages appear?
60
+ ```
61
+ [Paste error messages, stack traces]
62
+ ```
63
+
64
+ - What do the logs show?
65
+ - Error logs:
66
+ - Application logs:
67
+ - System logs:
68
+
69
+ - What are the relevant metrics?
70
+ - Response times:
71
+ - Error rates:
72
+ - Resource usage:
73
+
74
+ **3. Timeline Analysis**
75
+ - When was the bug first observed?
76
+ Date/Time:
77
+
78
+ - What changed before the bug appeared?
79
+ - [ ] Code deployment
80
+ - [ ] Configuration change
81
+ - [ ] Data migration
82
+ - [ ] Infrastructure change
83
+ - [ ] Dependency update
84
+
85
+ - Git commits around the time bug appeared:
86
+ ```bash
87
+ git log --oneline --since="YYYY-MM-DD"
88
+ ```
89
+
90
+ **4. Scope Analysis**
91
+ - How widespread is the issue?
92
+ - [ ] All users
93
+ - [ ] Specific user segment
94
+ - [ ] Single user
95
+ - [ ] All environments
96
+ - [ ] Production only
97
+ - [ ] Dev/Staging only
98
+
99
+ - What is NOT affected?
100
+ - Working features:
101
+ - Working environments:
102
+ - Working user segments:
103
+
104
+ **5. Root Cause Hypothesis**
105
+ - What do you think is causing this?
106
+ Hypothesis:
107
+
108
+ - What evidence supports this hypothesis?
109
+ -
110
+
111
+ - How would you test this hypothesis?
112
+ -
113
+
114
+ ---
115
+
116
+ ## 🔬 Investigation Plan
117
+
118
+ ### Phase 1: Reproduce & Isolate
119
+ **Goal:** Consistently reproduce the bug in a controlled environment
120
+
121
+ **Steps:**
122
+ 1. [ ] Set up isolated test environment
123
+ 2. [ ] Follow reproduction steps
124
+ 3. [ ] Document exact conditions needed
125
+ 4. [ ] Capture logs/screenshots/video
126
+ 5. [ ] Verify bug occurs in isolation
127
+
128
+ **Success Criteria:**
129
+ - [ ] Bug reproduced 3+ times consistently
130
+ - [ ] Minimal reproduction steps documented
131
+ - [ ] Environment variables identified
132
+
133
+ ### Phase 2: Debug & Analyze
134
+ **Goal:** Identify the root cause
135
+
136
+ **Steps:**
137
+ 1. [ ] Add debug logging at decision points
138
+ 2. [ ] Use debugger to step through code
139
+ 3. [ ] Review recent code changes (git blame, git diff)
140
+ 4. [ ] Check for related closed issues
141
+ 5. [ ] Test hypothesis with targeted experiments
142
+
143
+ **Debug Commands:**
144
+ ```bash
145
+ # Add your debugging commands here
146
+ npm run debug
147
+ node --inspect app.js
148
+ ```
149
+
150
+ **Success Criteria:**
151
+ - [ ] Root cause identified with certainty
152
+ - [ ] Evidence collected proving root cause
153
+ - [ ] Understanding of why bug wasn't caught earlier
154
+
155
+ ### Phase 3: Verify Fix Approach
156
+ **Goal:** Confirm fix strategy before implementing
157
+
158
+ **Steps:**
159
+ 1. [ ] Design fix approach
160
+ 2. [ ] Consider edge cases
161
+ 3. [ ] Evaluate fix risks
162
+ 4. [ ] Review fix with team (if high-risk)
163
+ 5. [ ] Document fix reasoning
164
+
165
+ **Fix Approach:**
166
+ [Describe your planned fix]
167
+
168
+ **Risks:**
169
+ -
170
+
171
+ **Alternatives Considered:**
172
+ 1.
173
+ 2.
174
+
175
+ ---
176
+
177
+ ## 🧪 Testing Strategy
178
+
179
+ ### Test Cases to Add
180
+ **1. Reproduction Test:**
181
+ ```typescript
182
+ describe('Bug: {{title}}', () => {
183
+ it('should reproduce the bug', () => {
184
+ // Steps that currently fail
185
+ });
186
+ });
187
+ ```
188
+
189
+ **2. Fix Validation Test:**
190
+ ```typescript
191
+ describe('Fix: {{title}}', () => {
192
+ it('should verify the bug is fixed', () => {
193
+ // Steps that should now pass
194
+ });
195
+ });
196
+ ```
197
+
198
+ **3. Regression Prevention Tests:**
199
+ ```typescript
200
+ describe('Regression: {{title}}', () => {
201
+ it('should prevent this bug from recurring', () => {
202
+ // Edge cases to prevent future regressions
203
+ });
204
+ });
205
+ ```
206
+
207
+ ### Manual Testing Checklist
208
+ - [ ] Test exact reproduction steps (should now pass)
209
+ - [ ] Test edge cases
210
+ - [ ] Test related functionality (no new bugs)
211
+ - [ ] Test in all environments (dev, staging, prod)
212
+ - [ ] Test with different user permissions
213
+ - [ ] Test with different data states
214
+
215
+ ---
216
+
217
+ ## 📊 Evidence & Findings
218
+
219
+ ### Logs
220
+ ```
221
+ [Paste relevant log entries]
222
+ ```
223
+
224
+ ### Stack Traces
225
+ ```
226
+ [Paste stack traces]
227
+ ```
228
+
229
+ ### Screenshots/Videos
230
+ - [Link to screenshot/video 1]
231
+ - [Link to screenshot/video 2]
232
+
233
+ ### Database Queries
234
+ ```sql
235
+ -- Queries that reveal the issue
236
+ ```
237
+
238
+ ### Metrics
239
+ - Error rate before: X errors/min
240
+ - Error rate after: Y errors/min
241
+ - Affected users: N users
242
+ - Duration: H hours
243
+
244
+ ---
245
+
246
+ ## 💡 Root Cause Analysis
247
+
248
+ ### Root Cause
249
+ [Detailed explanation of what caused the bug]
250
+
251
+ **Why did this happen?**
252
+ - Immediate cause:
253
+ - Underlying cause:
254
+ - Contributing factors:
255
+
256
+ **Why wasn't this caught earlier?**
257
+ - [ ] Missing test coverage
258
+ - [ ] Edge case not considered
259
+ - [ ] Race condition only in production
260
+ - [ ] Configuration difference
261
+ - [ ] Other:
262
+
263
+ ### Five Whys Analysis
264
+ 1. **Why did the bug occur?**
265
+ Answer:
266
+
267
+ 2. **Why did that happen?**
268
+ Answer:
269
+
270
+ 3. **Why did that happen?**
271
+ Answer:
272
+
273
+ 4. **Why did that happen?**
274
+ Answer:
275
+
276
+ 5. **Why did that happen?**
277
+ Answer: [Root cause]
278
+
279
+ ---
280
+
281
+ ## 🔧 Solution
282
+
283
+ ### Fix Implementation
284
+ **Files Changed:**
285
+ - `path/to/file1.ts` - [Brief description of change]
286
+ - `path/to/file2.ts` - [Brief description of change]
287
+
288
+ **Code Changes:**
289
+ ```diff
290
+ - // Old code
291
+ + // New code
292
+ ```
293
+
294
+ **Configuration Changes:**
295
+ -
296
+
297
+ ### Fix Validation
298
+ - [ ] All new tests pass
299
+ - [ ] All existing tests still pass
300
+ - [ ] Manual testing completed
301
+ - [ ] Code review approved
302
+ - [ ] Deployed to staging
303
+ - [ ] Verified in staging
304
+ - [ ] Deployed to production
305
+ - [ ] Monitoring shows fix worked
306
+
307
+ ---
308
+
309
+ ## 🛡️ Prevention Strategy
310
+
311
+ ### Prevent This Bug
312
+ **Immediate Actions:**
313
+ - [ ] Add test coverage for this scenario
314
+ - [ ] Add input validation
315
+ - [ ] Add error handling
316
+ - [ ] Add monitoring/alerts
317
+ - [ ] Document edge case
318
+
319
+ ### Prevent Similar Bugs
320
+ **Long-term Actions:**
321
+ - [ ] Update coding standards
322
+ - [ ] Add linting rule
323
+ - [ ] Improve error messages
324
+ - [ ] Enhance documentation
325
+ - [ ] Team knowledge sharing
326
+ - [ ] Update onboarding materials
327
+
328
+ ### Tests Added
329
+ **Test Coverage:**
330
+ - Unit tests: X tests added
331
+ - Integration tests: Y tests added
332
+ - E2E tests: Z tests added
333
+ - Coverage increased by: N%
334
+
335
+ **Test Files:**
336
+ - `path/to/test1.spec.ts`
337
+ - `path/to/test2.spec.ts`
338
+
339
+ ---
340
+
341
+ ## 📚 Lessons Learned
342
+
343
+ ### What Went Well
344
+ -
345
+
346
+ ### What Could Be Improved
347
+ -
348
+
349
+ ### Knowledge Gained
350
+ -
351
+
352
+ ### Patterns to Share
353
+ -
354
+
355
+ ---
356
+
357
+ ## ✅ Success Criteria
358
+
359
+ **Definition of Done:**
360
+ - [x] Bug reproduced consistently
361
+ - [ ] Root cause identified
362
+ - [ ] Fix implemented
363
+ - [ ] Tests added (≥80% coverage for changed code)
364
+ - [ ] Code reviewed
365
+ - [ ] Deployed to production
366
+ - [ ] Verified in production
367
+ - [ ] No new bugs introduced
368
+ - [ ] Documentation updated
369
+ - [ ] Team notified
370
+
371
+ **Verification:**
372
+ - [ ] Original reporter confirms fix
373
+ - [ ] No errors in logs for 24 hours
374
+ - [ ] Monitoring shows normal metrics
375
+ - [ ] No related support tickets
376
+
377
+ ---
378
+
379
+ ## 🔗 Related Resources
380
+
381
+ **Related Issues:**
382
+ - Issue #123 - [Similar bug]
383
+ - Issue #456 - [Related feature]
384
+
385
+ **Related Investigations:**
386
+ - Investigation INV-001 - [Related investigation]
387
+
388
+ **Documentation:**
389
+ - [Link to relevant docs]
390
+
391
+ **External Resources:**
392
+ - [Stack Overflow thread]
393
+ - [GitHub issue]
394
+ - [Blog post]
395
+
396
+ ---
397
+
398
+ ## 📋 DELIVERABLE REQUIREMENTS
399
+
400
+ ### Investigation Report Format
401
+ **Filename:** `INV-{{investigationId}}-findings-[TIMESTAMP].md`
402
+ **Location:** `trinity/reports/`
403
+
404
+ ### Required Sections
405
+ 1. **Investigation Summary** - Brief overview of what was investigated
406
+ 2. **Findings** - Detailed findings with evidence (logs, screenshots, metrics)
407
+ 3. **Root Cause Analysis** - Complete five-whys analysis and root cause explanation
408
+ 4. **Fix Validation** - Proof that fix works (test results, metrics)
409
+ 5. **Prevention Strategy** - How to prevent similar bugs in future
410
+ 6. **Recommendations** - Next steps or related work orders needed
411
+
412
+ ### Evidence to Provide
413
+ - Stack traces and error logs
414
+ - Before/after metrics comparison
415
+ - Test coverage improvements
416
+ - Code change summary (files modified, lines changed)
417
+ - Screenshots/videos demonstrating fix
418
+
419
+ ---
420
+
421
+ ## ✅ AFTER COMPLETION
422
+
423
+ When investigation is complete:
424
+ 1. **Create Investigation Report:**
425
+ - [ ] Save findings report to `trinity/reports/INV-{{investigationId}}-findings-[TIMESTAMP].md`
426
+ - [ ] Include all required sections listed above
427
+ - [ ] Attach all evidence and supporting documentation
428
+
429
+ 2. **Move Investigation File:**
430
+ - [ ] Move this investigation file (INV-{{investigationId}}.md) to `trinity/sessions/`
431
+ - [ ] Keep report in `trinity/reports/` until end of session
432
+
433
+ 3. **Session Cleanup:**
434
+ - [ ] Run `/trinity-end` to archive both investigation and report
435
+ - [ ] Investigation will be archived to `trinity/archive/investigations/YYYY-MM-DD/`
436
+ - [ ] Report will be archived to `trinity/archive/reports/YYYY-MM-DD/`
437
+
438
+ 4. **Clean Slate:**
439
+ - [ ] Verify `trinity/sessions/` is empty (ready for next session)
440
+ - [ ] Verify `trinity/reports/` is empty (ready for next session)
441
+
442
+ ---
443
+
444
+ ## 📚 Reference Documentation
445
+
446
+ **Trinity Method Core:**
447
+ - [Trinity Method Protocols](../../CLAUDE.md) - Root Trinity guidance
448
+ - [Investigation Requirements](../../trinity/CLAUDE.md#investigation-protocols) - Investigation-first methodology
449
+ - [Agent Directory](../../.claude/EMPLOYEE-DIRECTORY.md) - 19-agent Trinity team
450
+
451
+ **Knowledge Base:**
452
+ - [Architecture](../../trinity/knowledge-base/ARCHITECTURE.md) - System architecture and patterns
453
+ - [Known Issues](../../trinity/knowledge-base/ISSUES.md) - Issue patterns database
454
+ - [Technical Debt](../../trinity/knowledge-base/Technical-Debt.md) - Debt tracking
455
+ - [Testing Standards](../../trinity/knowledge-base/TESTING-PRINCIPLES.md) - Test requirements
456
+ - [Coding Standards](../../trinity/knowledge-base/CODING-PRINCIPLES.md) - Code quality
457
+
458
+ **Investigation Protocols:**
459
+ - READ-ONLY: No file modifications during investigation
460
+ - Document findings thoroughly
461
+ - Provide evidence-based recommendations
462
+ - Implementation requires separate approval
463
+
464
+ ---
465
+
466
+ ## 📝 Investigation Log
467
+
468
+ ### {{timestamp1}}
469
+ [Note about what you discovered/tried]
470
+
471
+ ### {{timestamp2}}
472
+ [Note about what you discovered/tried]
473
+
474
+ ### {{timestamp3}}
475
+ [Note about what you discovered/tried]
476
+
477
+ ---
478
+
479
+ **Investigation Status:** {{status}}
480
+ **Priority:** {{priority}}
481
+ **Created:** {{createdAt}}
482
+ **Last Updated:** {{lastUpdated}}
483
+ **Next Review:** {{nextReview}}
484
+ **Investigator:** {{investigator}}