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,725 @@
1
+ ---
2
+ description: Guide to Trinity investigation templates for structured problem-solving
3
+ ---
4
+
5
+ # Trinity Investigation Templates
6
+
7
+ **Purpose:** Guide users through selecting and using investigation templates for structured, comprehensive problem-solving.
8
+
9
+ ## Overview
10
+
11
+ Trinity provides 5 comprehensive investigation templates that guide you through structured problem-solving with best practices built-in. Each template is optimized for a specific investigation type and integrates seamlessly with the Trinity Method workflow.
12
+
13
+ **Investigation templates ensure:**
14
+ - Comprehensive analysis and documentation
15
+ - Consistent investigation quality
16
+ - Knowledge preservation for future learning
17
+ - Integration with workflow orchestration
18
+ - Archival for organizational memory
19
+
20
+ ## Template Types
21
+
22
+ ### 1. Bug Investigation Template
23
+
24
+ **Use When:** You need to reproduce, debug, and fix a known issue or defect.
25
+
26
+ **Template Structure:**
27
+ ```markdown
28
+ # Bug Investigation: [Issue Title]
29
+
30
+ ## Issue Description
31
+ - What is broken?
32
+ - How does it manifest?
33
+ - User impact and severity
34
+
35
+ ## Reproduction Steps
36
+ 1. Detailed steps to reproduce
37
+ 2. Expected behavior
38
+ 3. Actual behavior
39
+ 4. Environment details
40
+
41
+ ## Root Cause Analysis (Five Whys)
42
+ - Why 1: [First level cause]
43
+ - Why 2: [Deeper cause]
44
+ - Why 3: [Root cause emerging]
45
+ - Why 4: [Systemic issue]
46
+ - Why 5: [True root cause]
47
+
48
+ ## Debugging Strategy
49
+ - Hypothesis formation
50
+ - Evidence gathering
51
+ - Testing approach
52
+ - Diagnostic tools used
53
+
54
+ ## Solution Implementation
55
+ - Fix approach and rationale
56
+ - Code changes summary
57
+ - Edge cases handled
58
+
59
+ ## Testing Strategy
60
+ - Unit tests added
61
+ - Integration tests
62
+ - Regression prevention
63
+ - Manual verification
64
+
65
+ ## Lessons Learned
66
+ - What caused this bug?
67
+ - How to prevent similar issues?
68
+ - Patterns extracted
69
+ ```
70
+
71
+ **Best For:**
72
+ - Production bugs and defects
73
+ - Regression issues
74
+ - User-reported problems
75
+ - Edge case failures
76
+
77
+ **Example:** "JWT token refresh fails after 24 hours"
78
+
79
+ ---
80
+
81
+ ### 2. Performance Investigation Template
82
+
83
+ **Use When:** You need to diagnose and optimize slow operations, bottlenecks, or resource issues.
84
+
85
+ **Template Structure:**
86
+ ```markdown
87
+ # Performance Investigation: [Performance Issue]
88
+
89
+ ## Performance Problem
90
+ - What is slow?
91
+ - Current metrics vs. target metrics
92
+ - User impact and business cost
93
+
94
+ ## Profiling Strategy
95
+ ### Browser Profiling (Frontend)
96
+ - Chrome DevTools Performance tab
97
+ - React DevTools Profiler
98
+ - Lighthouse audits
99
+
100
+ ### Backend Profiling
101
+ - Application profiling (0x, clinic.js)
102
+ - Database query analysis
103
+ - APM tool metrics (New Relic, Datadog)
104
+
105
+ ### Database Profiling
106
+ - EXPLAIN ANALYZE for queries
107
+ - Index analysis
108
+ - Query plan examination
109
+
110
+ ## Bottleneck Analysis
111
+ - Identified bottlenecks with evidence
112
+ - Resource utilization (CPU, Memory, I/O)
113
+ - Network latency measurements
114
+
115
+ ## Optimization Strategy
116
+ - Optimization approaches considered
117
+ - Trade-offs evaluated
118
+ - Chosen approach and rationale
119
+
120
+ ## Implementation
121
+ - Code changes for optimization
122
+ - Database index changes
123
+ - Caching strategy
124
+ - Resource allocation adjustments
125
+
126
+ ## Benchmarks
127
+ ### Before Optimization
128
+ - Baseline metrics
129
+ - Response times
130
+ - Throughput
131
+
132
+ ### After Optimization
133
+ - Improved metrics
134
+ - Response times
135
+ - Throughput
136
+ - Percentage improvement
137
+
138
+ ## Performance Budgets
139
+ - New performance targets
140
+ - Monitoring alerts configured
141
+ - Regression prevention
142
+ ```
143
+
144
+ **Best For:**
145
+ - Slow API endpoints
146
+ - Memory leaks
147
+ - Database query optimization
148
+ - Frontend rendering issues
149
+
150
+ **Example:** "User dashboard loads in 8 seconds, target is 2 seconds"
151
+
152
+ ---
153
+
154
+ ### 3. Security Investigation Template
155
+
156
+ **Use When:** You need to assess, remediate, or disclose a security vulnerability.
157
+
158
+ **Template Structure:**
159
+ ```markdown
160
+ # Security Investigation: [Vulnerability Title]
161
+
162
+ ## Vulnerability Overview
163
+ - CVE ID (if applicable)
164
+ - Vulnerability type (OWASP Top 10 category)
165
+ - Affected components and versions
166
+
167
+ ## CVSS v3.1 Scoring
168
+ ### Base Metrics
169
+ - Attack Vector (Network/Adjacent/Local/Physical)
170
+ - Attack Complexity (Low/High)
171
+ - Privileges Required (None/Low/High)
172
+ - User Interaction (None/Required)
173
+ - Scope (Unchanged/Changed)
174
+ - Confidentiality Impact (None/Low/High)
175
+ - Integrity Impact (None/Low/High)
176
+ - Availability Impact (None/Low/High)
177
+
178
+ **CVSS Score:** [0.0-10.0]
179
+ **Severity:** Critical/High/Medium/Low
180
+
181
+ ## Proof of Concept (PoC)
182
+ - Steps to exploit vulnerability
183
+ - PoC code or demonstration
184
+ - Screenshots or evidence
185
+ - Blast radius analysis
186
+
187
+ ## Impact Assessment
188
+ - Data at risk
189
+ - Systems affected
190
+ - Potential attack scenarios
191
+ - Business impact
192
+
193
+ ## Remediation Plan
194
+ ### Immediate Mitigations
195
+ - Temporary fixes or workarounds
196
+ - Risk reduction measures
197
+ - Monitoring enhancements
198
+
199
+ ### Permanent Fix
200
+ - Code changes required
201
+ - Configuration updates
202
+ - Dependency updates
203
+ - Architecture changes
204
+
205
+ ## Validation
206
+ - Security testing performed
207
+ - Penetration test results
208
+ - Vulnerability scan results
209
+ - Third-party audit (if applicable)
210
+
211
+ ## Disclosure Timeline
212
+ - Discovery date
213
+ - Vendor notification (if applicable)
214
+ - Patch development timeline
215
+ - Public disclosure date
216
+ - Communication plan
217
+ ```
218
+
219
+ **Best For:**
220
+ - CVE assessments
221
+ - Dependency vulnerabilities
222
+ - Security audits
223
+ - Penetration test findings
224
+
225
+ **Example:** "SQL injection vulnerability in user search endpoint"
226
+
227
+ ---
228
+
229
+ ### 4. Technical Investigation Template
230
+
231
+ **Use When:** You need to make architecture decisions, design new systems, or document technical choices.
232
+
233
+ **Template Structure:**
234
+ ```markdown
235
+ # Technical Investigation: [Technical Decision]
236
+
237
+ ## Context
238
+ - Current situation
239
+ - Business requirements
240
+ - Technical constraints
241
+ - Stakeholders involved
242
+
243
+ ## Problem Statement
244
+ - What problem are we solving?
245
+ - Why is this important?
246
+ - Success criteria
247
+
248
+ ## Requirements Analysis
249
+ ### Functional Requirements
250
+ - What must the system do?
251
+
252
+ ### Non-Functional Requirements
253
+ - Performance targets
254
+ - Scalability needs
255
+ - Security requirements
256
+ - Reliability/availability
257
+ - Maintainability
258
+
259
+ ## Architecture Options
260
+
261
+ ### Option 1: [Approach Name]
262
+ **Description:** [How it works]
263
+ **Pros:**
264
+ - Advantage 1
265
+ - Advantage 2
266
+
267
+ **Cons:**
268
+ - Disadvantage 1
269
+ - Disadvantage 2
270
+
271
+ **Complexity:** Low/Medium/High
272
+ **Risk:** Low/Medium/High
273
+
274
+ ### Option 2: [Approach Name]
275
+ [Same structure]
276
+
277
+ ### Option 3: [Approach Name]
278
+ [Same structure]
279
+
280
+ ## Decision Matrix
281
+ | Criteria | Weight | Option 1 | Option 2 | Option 3 |
282
+ |----------|--------|----------|----------|----------|
283
+ | Performance | 30% | 8/10 | 6/10 | 9/10 |
284
+ | Maintainability | 25% | 7/10 | 9/10 | 5/10 |
285
+ | Cost | 20% | 6/10 | 8/10 | 4/10 |
286
+ | Risk | 15% | 7/10 | 7/10 | 5/10 |
287
+ | Time to Implement | 10% | 8/10 | 7/10 | 5/10 |
288
+ | **Total** | | **7.3** | **7.5** | **6.4** |
289
+
290
+ ## Recommended Approach
291
+ **Choice:** [Selected option]
292
+ **Rationale:** [Why this option was chosen]
293
+
294
+ ## Architecture Design Record (ADR)
295
+ - Decision made
296
+ - Context and constraints
297
+ - Considered alternatives
298
+ - Consequences and trade-offs
299
+ - Implementation notes
300
+
301
+ ## Implementation Plan
302
+ - 4-phase implementation approach
303
+ - Milestones and timeline
304
+ - Resource requirements
305
+ - Risk mitigation
306
+ ```
307
+
308
+ **Best For:**
309
+ - Architecture decisions
310
+ - Technology selection
311
+ - Design pattern choices
312
+ - Refactoring strategies
313
+
314
+ **Example:** "Choose caching strategy for API responses"
315
+
316
+ ---
317
+
318
+ ### 5. Feature Investigation Template
319
+
320
+ **Use When:** You need to plan, design, and implement new functionality or enhancements.
321
+
322
+ **Template Structure:**
323
+ ```markdown
324
+ # Feature Investigation: [Feature Name]
325
+
326
+ ## Feature Overview
327
+ - What is this feature?
328
+ - Why do users need it?
329
+ - Expected user impact
330
+
331
+ ## User Stories
332
+ ### Epic
333
+ As a [user type], I want [goal] so that [benefit].
334
+
335
+ ### User Stories
336
+ 1. As a [user], I want to [action] so that [benefit]
337
+ - Acceptance Criteria:
338
+ - [ ] Criterion 1
339
+ - [ ] Criterion 2
340
+ - [ ] Criterion 3
341
+
342
+ 2. [Additional user stories]
343
+
344
+ ## Feature Requirements
345
+ ### Functional Requirements
346
+ - Feature behavior specification
347
+ - User interactions
348
+ - Business logic
349
+
350
+ ### Non-Functional Requirements
351
+ - Performance expectations
352
+ - Security considerations
353
+ - Accessibility requirements
354
+ - Mobile responsiveness
355
+
356
+ ## Design Mockups
357
+ - UI/UX wireframes
358
+ - User flow diagrams
359
+ - Interaction patterns
360
+
361
+ ## Technical Design
362
+ - Architecture approach
363
+ - Data model changes
364
+ - API endpoints (if applicable)
365
+ - Frontend components
366
+ - Backend services
367
+
368
+ ## Implementation Breakdown
369
+
370
+ ### Phase 1: Foundation
371
+ - Database schema updates
372
+ - API scaffolding
373
+ - Core business logic
374
+
375
+ ### Phase 2: User Interface
376
+ - Component development
377
+ - Styling and responsiveness
378
+ - Integration with backend
379
+
380
+ ### Phase 3: Refinement
381
+ - Edge case handling
382
+ - Error handling
383
+ - Loading states
384
+ - Validation
385
+
386
+ ### Phase 4: Testing & Polish
387
+ - Unit tests
388
+ - Integration tests
389
+ - E2E tests
390
+ - Performance testing
391
+ - Accessibility audit
392
+
393
+ ## Feature Flags
394
+ - Flag name and configuration
395
+ - Rollout strategy (% of users)
396
+ - Monitoring plan
397
+ - Rollback plan
398
+
399
+ ## Success Metrics
400
+ - KPIs to track
401
+ - Target metrics
402
+ - Analytics events
403
+ - A/B testing plan (if applicable)
404
+
405
+ ## Release Plan
406
+ - Beta testing approach
407
+ - Staged rollout timeline
408
+ - User communication
409
+ - Documentation updates
410
+ ```
411
+
412
+ **Best For:**
413
+ - New features and enhancements
414
+ - User-facing functionality
415
+ - Product improvements
416
+ - Feature additions
417
+
418
+ **Example:** "Add two-factor authentication to user accounts"
419
+
420
+ ---
421
+
422
+ ## Template Selection Guide
423
+
424
+ Use this decision tree to select the right template:
425
+
426
+ ```
427
+ Is it a defect or bug?
428
+ → YES: Use Bug Investigation Template
429
+
430
+ Is it a performance issue?
431
+ → YES: Use Performance Investigation Template
432
+
433
+ Is it a security concern?
434
+ → YES: Use Security Investigation Template
435
+
436
+ Is it an architecture or design decision?
437
+ → YES: Use Technical Investigation Template
438
+
439
+ Is it new functionality?
440
+ → YES: Use Feature Investigation Template
441
+ ```
442
+
443
+ ## Usage Instructions
444
+
445
+ ### 1. Create Investigation from Template
446
+
447
+ ```bash
448
+ # Copy template to investigations folder
449
+ cp trinity/templates/investigations/[type].md \
450
+ trinity/investigations/INV-XXX-[title].md
451
+
452
+ # Fill out investigation
453
+ # Edit: trinity/investigations/INV-XXX-[title].md
454
+ ```
455
+
456
+ ### 2. Link to Design Doc
457
+
458
+ Every investigation should reference the Design Doc:
459
+
460
+ ```markdown
461
+ **Design Doc:** [Link to trinity/design-docs/[name].md]
462
+ ```
463
+
464
+ ### 3. Complete Investigation Thoroughly
465
+
466
+ - Fill out ALL sections (don't skip)
467
+ - Provide evidence (logs, metrics, screenshots)
468
+ - Document rationale for decisions
469
+ - Include lessons learned
470
+
471
+ ### 4. Archive When Complete
472
+
473
+ **IMPORTANT:** Archiving is handled automatically by the `/trinity-end` command.
474
+
475
+ **Do NOT manually move files to archive.** When you're ready to end your session:
476
+
477
+ ```bash
478
+ /trinity-end
479
+ ```
480
+
481
+ This command will:
482
+ - Archive all completed investigations to `trinity/archive/investigations/`
483
+ - Archive work orders to `trinity/archive/work-orders/`
484
+ - Archive reports to `trinity/archive/reports/`
485
+ - Archive session logs to `trinity/archive/sessions/`
486
+ - Organize archives by date (YYYY-MM format)
487
+
488
+ ## Integration with Workflow Orchestration
489
+
490
+ Templates work seamlessly with `/trinity-orchestrate`:
491
+
492
+ 1. **Start with Template:** Choose appropriate template type
493
+ 2. **Orchestrate Workflow:** Use `/trinity-orchestrate` to generate implementation plan
494
+ 3. **Investigation Phase:** Use template to guide analysis
495
+ 4. **Implementation:** Workflow coordinates agents for implementation
496
+ 5. **Documentation:** Template ensures comprehensive documentation
497
+ 6. **Archival:** Learning system extracts patterns
498
+
499
+ **Example Workflow:**
500
+ ```bash
501
+ # 1. Create investigation from template
502
+ /trinity-create-investigation
503
+ # Choose "Performance" template
504
+ # Fill in API performance details
505
+
506
+ # 2. Plan your workflow approach
507
+ /trinity-orchestrate
508
+ # Claude guides you through appropriate workflow based on scale
509
+
510
+ # 3. Execute workflow with template guidance
511
+ # Template guides investigation phase
512
+ # Claude adopts agent personas for each phase
513
+ # BAS quality gates ensure quality
514
+ ```
515
+
516
+ ## Best Practices
517
+
518
+ ### Selecting the Right Template
519
+
520
+ **Do:**
521
+ - Match investigation type to template type
522
+ - Use Bug template for defects, not Feature template
523
+ - Use Technical template for architecture decisions
524
+ - Combine templates if investigation spans multiple types
525
+
526
+ **Don't:**
527
+ - Skip template selection (always use a template)
528
+ - Force fit investigation into wrong template
529
+ - Leave template sections empty
530
+
531
+ ### Filling Out Templates Effectively
532
+
533
+ **Do:**
534
+ - Be thorough and specific
535
+ - Provide evidence (logs, metrics, screenshots)
536
+ - Document decision rationale
537
+ - Include failure analysis (what didn't work)
538
+ - Update investigation as you learn more
539
+
540
+ **Don't:**
541
+ - Copy-paste without customization
542
+ - Skip sections because they seem optional
543
+ - Assume context is obvious (document everything)
544
+ - Leave placeholders like "[TODO]"
545
+
546
+ ### Common Mistakes to Avoid
547
+
548
+ 1. **Skipping Investigation Phase**
549
+ - ❌ Jump directly to implementation
550
+ - ✅ Complete investigation template first
551
+
552
+ 2. **Insufficient Evidence**
553
+ - ❌ "Performance is bad"
554
+ - ✅ "API response time: 8.2s (target: <2s, measured with curl)"
555
+
556
+ 3. **Missing Testing Strategy**
557
+ - ❌ Implement fix without tests
558
+ - ✅ Define test strategy in investigation, implement with fix
559
+
560
+ 4. **Not Documenting Failures**
561
+ - ❌ Only document what worked
562
+ - ✅ Document approaches tried and why they didn't work
563
+
564
+ 5. **Archiving Incomplete Investigations**
565
+ - ❌ Archive investigation with empty sections
566
+ - ✅ Complete all sections before archiving
567
+
568
+ ## Template Locations
569
+
570
+ After deployment, templates are located in:
571
+ ```
572
+ trinity/templates/investigations/
573
+ ├── bug.md
574
+ ├── performance.md
575
+ ├── security.md
576
+ ├── technical.md
577
+ └── feature.md
578
+ ```
579
+
580
+ Source templates (before deployment):
581
+ ```
582
+ src/templates/investigations/
583
+ ├── bug.md.template
584
+ ├── performance.md.template
585
+ ├── security.md.template
586
+ ├── technical.md.template
587
+ └── feature.md.template
588
+ ```
589
+
590
+ ## Related Commands
591
+
592
+ - `/trinity-orchestrate` - Generate workflow plan for investigation
593
+ - `/trinity-plan` - TRA strategic planning for complex investigations
594
+ - `/trinity-create-investigation` - Interactive investigation creation wizard
595
+
596
+ ## Real-World Examples
597
+
598
+ ### Example 1: Bug Investigation
599
+ **Title:** "JWT token refresh fails after 24 hours"
600
+ **Template:** Bug Investigation
601
+ **Outcome:** Used Five Whys to discover token refresh logic had hardcoded 24h limit. Fixed and added tests. Pattern learned: "Check for hardcoded time limits in auth code."
602
+
603
+ ### Example 2: Performance Investigation
604
+ **Title:** "Dashboard loads in 8 seconds"
605
+ **Template:** Performance Investigation
606
+ **Outcome:** Profiled with Chrome DevTools. Found N+1 query loading user data. Added database index and query optimization. Reduced to 1.8s (78% improvement).
607
+
608
+ ### Example 3: Security Investigation
609
+ **Title:** "SQL injection in user search"
610
+ **Template:** Security Investigation
611
+ **Outcome:** CVSS score: 9.1 (Critical). PoC demonstrated data exfiltration. Fixed with parameterized queries. Security audit passed.
612
+
613
+ ### Example 4: Technical Investigation
614
+ **Title:** "Choose state management for React app"
615
+ **Template:** Technical Investigation
616
+ **Outcome:** Evaluated Redux, Zustand, Context. Decision matrix favored Zustand for simplicity and performance. ADR documented.
617
+
618
+ ### Example 5: Feature Investigation
619
+ **Title:** "Add two-factor authentication"
620
+ **Template:** Feature Investigation
621
+ **Outcome:** 12 user stories defined. 4-phase implementation plan. Feature flag for gradual rollout. Success metric: 40% adoption in 30 days.
622
+
623
+ ## What template do you need?
624
+
625
+ Describe your investigation:
626
+ - **Bug or defect?** → `/trinity-investigate-templates bug`
627
+ - **Performance issue?** → `/trinity-investigate-templates performance`
628
+ - **Security concern?** → `/trinity-investigate-templates security`
629
+ - **Architecture decision?** → `/trinity-investigate-templates technical`
630
+ - **New feature?** → `/trinity-investigate-templates feature`
631
+
632
+ Templates ensure comprehensive, consistent investigations that contribute to organizational knowledge and accelerate future work.
633
+ ---
634
+
635
+ ## Investigation Workflow Example
636
+
637
+ ### Step 1: Create Investigation
638
+
639
+ ```bash
640
+ /trinity-create-investigation
641
+ ```
642
+
643
+ User provides: "Investigate why API response times increased"
644
+
645
+ Creates: `INV-023-api-performance-degradation.md`
646
+
647
+ ### Step 2: Plan Investigation
648
+
649
+ ```bash
650
+ /trinity-plan-investigation INV-023
651
+ ```
652
+
653
+ Generates research plan with tasks:
654
+ 1. Collect baseline metrics
655
+ 2. Profile current endpoints
656
+ 3. Analyze database queries
657
+ 4. Check external API calls
658
+ 5. Review recent code changes
659
+ 6. Document findings
660
+
661
+ ### Step 3: Execute Investigation
662
+
663
+ Follow plan, document findings in INV-023
664
+
665
+ ### Step 4: Conclude
666
+
667
+ Update INV-023 with:
668
+ - Root cause identified
669
+ - Recommended solutions
670
+ - Create work orders for fixes
671
+
672
+ ---
673
+
674
+ ---
675
+
676
+ ## Template Verification Instructions
677
+
678
+ After investigating templates, verify your findings:
679
+
680
+ ### Verification Checklist
681
+
682
+ **1. Template Structure**:
683
+ ```bash
684
+ # Count template files
685
+ find src/templates -name "*.template" | wc -l
686
+ # Expected: 19 agent templates + knowledge base templates
687
+
688
+ # Verify organization
689
+ ls -la src/templates/agents/leadership/
690
+ ls -la src/templates/agents/deployment/
691
+ ls -la src/templates/agents/planning/
692
+ ls -la src/templates/agents/aj-team/
693
+ ls -la src/templates/agents/audit/
694
+ ```
695
+
696
+ **2. Placeholder Variables**:
697
+ ```bash
698
+ # Find all placeholders
699
+ grep -r "{{" src/templates/ | cut -d: -f2 | sort -u
700
+
701
+ # Common placeholders:
702
+ # {{PROJECT_NAME}}
703
+ # {{FRAMEWORK}}
704
+ # {{TECH_STACK}}
705
+ # {{SOURCE_DIR}}
706
+ # {{TRINITY_VERSION}}
707
+ # {{DEPLOYMENT_TIMESTAMP}}
708
+ ```
709
+
710
+ **3. Cross-References**:
711
+ ```bash
712
+ # Check for broken references
713
+ grep -r "See \[" src/templates/
714
+
715
+ # Verify agent name consistency
716
+ grep -r "**MON**\|**ROR**\|**TRA**" src/templates/ | wc -l
717
+ ```
718
+
719
+ **4. Build Verification**:
720
+ ```bash
721
+ npm run build
722
+ # Should compile without errors
723
+ ```
724
+
725
+ ---