trinity-method-sdk 2.0.9 → 2.2.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 (147) hide show
  1. package/CHANGELOG.md +702 -267
  2. package/README.md +550 -540
  3. package/dist/cli/commands/deploy/agents.js +1 -1
  4. package/dist/cli/commands/deploy/ci-cd.d.ts +4 -3
  5. package/dist/cli/commands/deploy/ci-cd.js +10 -9
  6. package/dist/cli/commands/deploy/claude-setup.js +28 -35
  7. package/dist/cli/commands/deploy/configuration.js +10 -11
  8. package/dist/cli/commands/deploy/directories.js +13 -14
  9. package/dist/cli/commands/deploy/gitignore.js +3 -5
  10. package/dist/cli/commands/deploy/index.d.ts +1 -1
  11. package/dist/cli/commands/deploy/index.js +7 -3
  12. package/dist/cli/commands/deploy/knowledge-base.js +3 -3
  13. package/dist/cli/commands/deploy/pre-flight.js +1 -1
  14. package/dist/cli/commands/deploy/root-files.js +3 -18
  15. package/dist/cli/commands/deploy/sdk-install.js +1 -1
  16. package/dist/cli/commands/deploy/summary.js +3 -3
  17. package/dist/cli/commands/deploy/templates.js +33 -20
  18. package/dist/cli/commands/update/agents.js +1 -1
  19. package/dist/cli/commands/update/backup.js +6 -12
  20. package/dist/cli/commands/update/commands.d.ts +1 -0
  21. package/dist/cli/commands/update/commands.js +18 -45
  22. package/dist/cli/commands/update/knowledge-base.js +2 -2
  23. package/dist/cli/commands/update/pre-flight.js +11 -11
  24. package/dist/cli/commands/update/summary.js +5 -5
  25. package/dist/cli/commands/update/templates.js +35 -13
  26. package/dist/cli/commands/update/verification.js +5 -5
  27. package/dist/cli/commands/update/version.js +1 -1
  28. package/dist/cli/utils/deploy-ci.d.ts +3 -2
  29. package/dist/cli/utils/deploy-ci.js +24 -24
  30. package/dist/cli/utils/deploy-linting.js +101 -6
  31. package/dist/cli/utils/error-classes.d.ts +2 -2
  32. package/dist/cli/utils/linting-tools.js +14 -6
  33. package/dist/cli/utils/template-processor.js +2 -4
  34. package/dist/templates/{claude → .claude}/EMPLOYEE-DIRECTORY.md.template +16 -22
  35. package/dist/templates/{agents → .claude/agents}/aj-team/apo-documentation-specialist.md.template +10 -10
  36. package/dist/templates/{agents → .claude/agents}/aj-team/bas-quality-gate.md.template +13 -15
  37. package/dist/templates/{agents → .claude/agents}/aj-team/bon-dependency-manager.md.template +4 -4
  38. package/dist/templates/{agents → .claude/agents}/aj-team/cap-configuration-specialist.md.template +3 -3
  39. package/dist/templates/{agents → .claude/agents}/aj-team/dra-code-reviewer.md.template +8 -10
  40. package/dist/templates/{agents → .claude/agents}/aj-team/kil-task-executor.md.template +11 -13
  41. package/dist/templates/{agents → .claude/agents}/aj-team/uro-refactoring-specialist.md.template +3 -3
  42. package/dist/templates/{agents → .claude/agents}/audit/juno-auditor.md.template +46 -42
  43. package/dist/templates/{agents → .claude/agents}/deployment/ein-cicd.md.template +59 -164
  44. package/dist/templates/{agents → .claude/agents}/deployment/ino-context.md.template +25 -22
  45. package/dist/templates/{agents → .claude/agents}/deployment/tan-structure.md.template +32 -30
  46. package/dist/templates/{agents → .claude/agents}/deployment/zen-knowledge.md.template +28 -23
  47. package/dist/templates/{agents → .claude/agents}/leadership/aj-maestro.md.template +10 -6
  48. package/dist/templates/{agents → .claude/agents}/leadership/aly-cto.md.template +22 -19
  49. package/dist/templates/{agents → .claude/agents}/planning/eus-decomposer.md.template +8 -4
  50. package/dist/templates/{agents → .claude/agents}/planning/mon-requirements.md.template +8 -4
  51. package/dist/templates/{agents → .claude/agents}/planning/ror-design.md.template +8 -4
  52. package/dist/templates/{agents → .claude/agents}/planning/tra-planner.md.template +10 -4
  53. package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-audit.md.template +15 -15
  54. package/dist/templates/.claude/commands/execution/trinity-breakdown.md.template +535 -0
  55. package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-orchestrate.md.template +48 -48
  56. package/dist/templates/{shared/claude-commands → .claude/commands/infrastructure}/trinity-init.md.template +32 -54
  57. package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-create-investigation.md.template +13 -7
  58. package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-investigate-templates.md.template +19 -15
  59. package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-plan-investigation.md.template +12 -6
  60. package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-changelog.md.template +9 -8
  61. package/dist/templates/.claude/commands/maintenance/trinity-docs-update.md.template +279 -0
  62. package/dist/templates/.claude/commands/maintenance/trinity-docs.md.template +2828 -0
  63. package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-readme.md.template +21 -20
  64. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-decompose.md.template +6 -4
  65. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-design.md.template +6 -4
  66. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-plan.md.template +7 -5
  67. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-requirements.md.template +6 -4
  68. package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-continue.md.template +30 -24
  69. package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-end.md.template +403 -397
  70. package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-start.md.template +9 -4
  71. package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-agents.md.template +11 -8
  72. package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-verify.md.template +56 -57
  73. package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-workorder.md.template +13 -9
  74. package/dist/templates/ci/ci.yml.template +2 -2
  75. package/dist/templates/root/CLAUDE.md.template +9 -9
  76. package/dist/templates/root/linting/nodejs/.husky-pre-commit.template +5 -0
  77. package/dist/templates/source/base-CLAUDE.md.template +310 -310
  78. package/dist/templates/source/flutter-CLAUDE.md.template +593 -593
  79. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -531
  80. package/dist/templates/source/python-CLAUDE.md.template +510 -510
  81. package/dist/templates/source/react-CLAUDE.md.template +513 -513
  82. package/dist/templates/source/rust-CLAUDE.md.template +653 -653
  83. package/dist/templates/trinity/CLAUDE.md.template +14 -14
  84. package/dist/templates/{knowledge-base → trinity/knowledge-base}/AI-DEVELOPMENT-GUIDE.md.template +1 -1
  85. package/dist/templates/{knowledge-base → trinity/knowledge-base}/ARCHITECTURE.md.template +5 -5
  86. package/dist/templates/{knowledge-base → trinity/knowledge-base}/CODING-PRINCIPLES.md.template +1 -1
  87. package/dist/templates/{knowledge-base → trinity/knowledge-base}/DOCUMENTATION-CRITERIA.md.template +1 -1
  88. package/dist/templates/{knowledge-base → trinity/knowledge-base}/ISSUES.md.template +9 -9
  89. package/dist/templates/{knowledge-base → trinity/knowledge-base}/TESTING-PRINCIPLES.md.template +1 -1
  90. package/dist/templates/{knowledge-base → trinity/knowledge-base}/Technical-Debt.md.template +2 -4
  91. package/dist/templates/{knowledge-base → trinity/knowledge-base}/To-do.md.template +2 -2
  92. package/dist/templates/{knowledge-base → trinity/knowledge-base}/Trinity.md.template +6 -6
  93. package/dist/templates/trinity/templates/documentation/api-docs/README.md.template +218 -0
  94. package/dist/templates/trinity/templates/documentation/configuration/documentation-structure.md.template +71 -0
  95. package/dist/templates/trinity/templates/documentation/configuration/env-example-generator.md.template +387 -0
  96. package/dist/templates/trinity/templates/documentation/discovery/api-endpoint-scanner.md.template +343 -0
  97. package/dist/templates/trinity/templates/documentation/discovery/component-discovery.md.template +254 -0
  98. package/dist/templates/trinity/templates/documentation/discovery/env-variable-extraction.md.template +316 -0
  99. package/dist/templates/trinity/templates/documentation/discovery/framework-detection.md.template +205 -0
  100. package/dist/templates/trinity/templates/documentation/guides/api-development.md.template +375 -0
  101. package/dist/templates/trinity/templates/documentation/guides/contributing.md.template +488 -0
  102. package/dist/templates/trinity/templates/documentation/guides/deployment.md.template +565 -0
  103. package/dist/templates/trinity/templates/documentation/guides/getting-started.md.template +118 -0
  104. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/api-endpoint-map.md.template +56 -0
  105. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/component-hierarchy.md.template +60 -0
  106. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/database-er.md.template +49 -0
  107. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/mvc-flow.md.template +41 -0
  108. package/dist/templates/trinity/templates/documentation/processes/error-handling-protocol.md.template +166 -0
  109. package/dist/templates/trinity/templates/documentation/processes/fallback-mechanism.md.template +88 -0
  110. package/dist/templates/trinity/templates/documentation/reports/apo-docs-update-checklist.md.template +343 -0
  111. package/dist/templates/trinity/templates/documentation/reports/juno-docs-update-checklist.md.template +1337 -0
  112. package/dist/templates/trinity/templates/documentation/reports/juno-final-report.md.template +237 -0
  113. package/dist/templates/trinity/templates/documentation/reports/juno-internal-report.md.template +461 -0
  114. package/dist/templates/trinity/templates/documentation/validation/documentation-verification-rules.md.template +379 -0
  115. package/dist/templates/trinity/templates/documentation/validation/juno-quality-gates.md.template +282 -0
  116. package/dist/templates/{investigations → trinity/templates/investigations}/bug.md.template +14 -14
  117. package/dist/templates/{investigations → trinity/templates/investigations}/feature.md.template +14 -14
  118. package/dist/templates/{investigations → trinity/templates/investigations}/performance.md.template +14 -14
  119. package/dist/templates/{investigations → trinity/templates/investigations}/security.md.template +14 -14
  120. package/dist/templates/{investigations → trinity/templates/investigations}/technical.md.template +14 -14
  121. package/dist/templates/{work-orders → trinity/templates/work-orders}/ANALYSIS-TEMPLATE.md.template +10 -13
  122. package/dist/templates/{work-orders → trinity/templates/work-orders}/AUDIT-TEMPLATE.md.template +10 -26
  123. package/dist/templates/{work-orders → trinity/templates/work-orders}/IMPLEMENTATION-TEMPLATE.md.template +10 -26
  124. package/dist/templates/{work-orders → trinity/templates/work-orders}/INVESTIGATION-TEMPLATE.md.template +10 -25
  125. package/dist/templates/{work-orders → trinity/templates/work-orders}/PATTERN-TEMPLATE.md.template +10 -26
  126. package/dist/templates/{work-orders → trinity/templates/work-orders}/VERIFICATION-TEMPLATE.md.template +10 -26
  127. package/package.json +99 -94
  128. package/dist/templates/agents/leadership/aj-cc.md.template +0 -462
  129. package/dist/templates/ci/cd.yml.template +0 -175
  130. package/dist/templates/ci/github-actions.yml +0 -86
  131. package/dist/templates/root/TRINITY.md.template +0 -52
  132. package/dist/templates/shared/claude-commands/trinity-docs.md.template +0 -2577
  133. /package/dist/templates/{linting → root/linting}/flutter/.pre-commit-config.yaml.template +0 -0
  134. /package/dist/templates/{linting → root/linting}/flutter/analysis_options.yaml.template +0 -0
  135. /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-commonjs.json.template +0 -0
  136. /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-esm.json.template +0 -0
  137. /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-typescript.json.template +0 -0
  138. /package/dist/templates/{linting → root/linting}/nodejs/.pre-commit-config.yaml.template +0 -0
  139. /package/dist/templates/{linting → root/linting}/nodejs/.prettierrc.json.template +0 -0
  140. /package/dist/templates/{linting → root/linting}/python/.flake8.template +0 -0
  141. /package/dist/templates/{linting → root/linting}/python/.pre-commit-config.yaml.template +0 -0
  142. /package/dist/templates/{linting → root/linting}/python/pyproject.toml.template +0 -0
  143. /package/dist/templates/{linting → root/linting}/rust/.pre-commit-config.yaml.template +0 -0
  144. /package/dist/templates/{linting → root/linting}/rust/clippy.toml.template +0 -0
  145. /package/dist/templates/{linting → root/linting}/rust/rustfmt.toml.template +0 -0
  146. /package/dist/templates/{documentation → trinity/templates/documentation}/ROOT-README.md.template +0 -0
  147. /package/dist/templates/{documentation → trinity/templates/documentation}/SUBDIRECTORY-README.md.template +0 -0
@@ -1,397 +1,403 @@
1
- ---
2
- description: End session and archive work to trinity/archive/
3
- ---
4
-
5
- End current Trinity Method session and prepare for commit.
6
-
7
- **Context:** User is finished with current task and ready to commit, push, or move to next work.
8
-
9
- **Process:**
10
- 1. **ALY (CTO)** archives session work:
11
-
12
- **STRICT ARCHIVING PROTOCOL:**
13
-
14
- a. **Archive Completed Work Orders:**
15
- - Read all files from `trinity/sessions/` matching `WO-*.md`
16
- - Move each to `trinity/archive/work-orders/YYYY-MM-DD/`
17
- - These were moved to sessions/ after completion per work order template
18
-
19
- b. **Archive Completed Investigations:**
20
- - Read all files from `trinity/sessions/` matching `INV-*.md`
21
- - Move each to `trinity/archive/investigations/YYYY-MM-DD/`
22
- - These were moved to sessions/ after completion per investigation template
23
-
24
- c. **Archive ALL Reports:**
25
- - Move ALL files from `trinity/reports/` to `trinity/archive/reports/YYYY-MM-DD/`
26
- - This includes:
27
- - Implementation completion reports
28
- - Investigation findings reports
29
- - JUNO audit reports
30
- - Any other session reports
31
- - **NO EXCEPTIONS:** Every file in reports/ must be archived
32
-
33
- d. **Archive Session Files:**
34
- - Move ALL remaining files from `trinity/sessions/` to `trinity/archive/sessions/YYYY-MM-DD/`
35
- - Create session summary document in `trinity/archive/sessions/YYYY-MM-DD/SESSION-SUMMARY-{date}.md`
36
-
37
- e. **Verify Clean Slate:**
38
- - **CRITICAL:** After archiving, `trinity/sessions/` MUST be empty
39
- - **CRITICAL:** After archiving, `trinity/reports/` MUST be empty
40
- - If any files remain, archive them or report error
41
- - Next session MUST start with completely empty sessions/ and reports/ folders
42
-
43
- **Archive Structure:**
44
- ```
45
- trinity/archive/
46
- ├── work-orders/YYYY-MM-DD/
47
- │ ├── WO-001-*.md
48
- │ ├── WO-002-*.md
49
- │ └── ...
50
- ├── investigations/YYYY-MM-DD/
51
- │ ├── INV-001-*.md
52
- ├── INV-002-*.md
53
- └── ...
54
- ├── reports/YYYY-MM-DD/
55
- ├── WO-001-IMPLEMENTATION-COMPLETE-*.md
56
- ├── AUDIT-WO-001-*.md
57
- │ ├── INV-001-findings-*.md
58
- └── ...
59
- └── sessions/YYYY-MM-DD/
60
- ├── SESSION-SUMMARY-{date}.md
61
- └── [any other session files]
62
- ```
63
-
64
- **Important Notes:**
65
- - Keep ONLY active/in-progress work orders in `trinity/work-orders/`
66
- - Keep ONLY active/in-progress investigations in `trinity/investigations/`
67
- - Do NOT archive incomplete work
68
- - Completed work is identified by presence in `trinity/sessions/` folder
69
- - All reports are archived regardless of status
70
-
71
- 2. **ALY analyzes session events:**
72
- - Review all work completed during session
73
- - Identify patterns and learnings
74
- - Update trinity/knowledge-base/ARCHITECTURE.md with architectural changes
75
- - Update trinity/knowledge-base/ISSUES.md with new known issues
76
- - Update trinity/knowledge-base/To-do.md with next tasks
77
- - Update trinity/knowledge-base/Technical-Debt.md with new debt
78
-
79
- 3. **Clean workspace:**
80
- - Verify trinity/work-orders/ contains only active work
81
- - Verify trinity/investigations/ contains only active investigations
82
- - Verify trinity/reports/ is empty
83
- - Verify trinity/sessions/ is empty
84
- - Ready for next session
85
-
86
- 4. **Git commit instructions:**
87
- After archiving, provide user with commit checklist:
88
-
89
- **For Trinity Method SDK project:**
90
- - Update version in package.json (semantic versioning)
91
- - Run `npm run build` to compile changes
92
- - Run `npm pack` to create tarball
93
- - Update CHANGELOG.md with changes
94
- - Git commit with descriptive message
95
- - Git push to repository
96
-
97
- **For client projects using Trinity:**
98
- - Review git status for modified files
99
- - Stage changes: `git add .`
100
- - Commit with message describing work completed
101
- - Push to repository: `git push`
102
-
103
- **Outcome:**
104
- - All completed work properly archived with timestamp
105
- - Active/in-progress work remains in working directories
106
- - Trinity documents updated with session learnings
107
- - Workspace clean and ready for git operations
108
- - User has clear instructions for version updates and commits
109
-
110
- **Note:** Run this before committing your work.
111
-
112
- ---
113
-
114
- ## When to Use /trinity-end
115
-
116
- ### Use When:
117
-
118
- 1. **Work Session Complete**
119
- - All work orders closed
120
- - All commits pushed
121
- - Ready to stop working
122
-
123
- 2. **Major Milestone Reached**
124
- - Feature complete and merged
125
- - Sprint completed
126
- - Release deployed
127
-
128
- 3. **Context Cleanup Needed**
129
- - Long session (>4 hours)
130
- - Multiple work orders completed
131
- - Knowledge base needs updating
132
-
133
- ### ❌ Don't Use When:
134
-
135
- 1. **Mid-Task**
136
- - Work order still in progress
137
- - Uncommitted changes
138
- - Tests failing
139
-
140
- 2. **Just Pausing**
141
- - Taking a break (keep context)
142
- - Switching tasks temporarily
143
- - Waiting for review
144
-
145
- **Instead Use**: `/trinity-continue` when resuming work
146
-
147
- ---
148
-
149
- ## Session Summary Example
150
-
151
- ```markdown
152
- # Session Summary - 2025-12-18
153
-
154
- **Duration**: 4 hours 30 minutes
155
- **Work Orders Completed**: 2 (WO-042, WO-043)
156
- **Commits**: 7 commits pushed to main
157
-
158
- ## Accomplishments
159
-
160
- ### WO-042: JWT Refresh Token Implementation ✅
161
- - Implemented secure refresh token rotation
162
- - Added HttpOnly cookie support
163
- - 87% test coverage (exceeds 80% threshold)
164
- - All BAS quality gates passed
165
-
166
- **Files Changed**: 4 files (service, middleware, types, tests)
167
- **Lines**: +234 additions, -12 deletions
168
-
169
- ### WO-043: User Profile Editing
170
- - Added profile update endpoint
171
- - Validation for all fields
172
- - Integration tests complete
173
- - Documentation updated
174
-
175
- **Files Changed**: 3 files (controller, service, tests)
176
- **Lines**: +156 additions, -8 deletions
177
-
178
- ## Knowledge Base Updates
179
-
180
- **ARCHITECTURE.md**:
181
- - Added OAuth2 refresh token flow diagram
182
- - Documented token rotation strategy
183
-
184
- **ISSUES.md**:
185
- - Closed: #42 (JWT refresh), #45 (profile editing)
186
- - Added: #48 (rate limiting for refresh endpoint)
187
-
188
- **Technical-Debt.md**:
189
- - Added: Refactor auth service (split into 2 files)
190
- - Resolved: Email validation duplication
191
-
192
- ## Metrics
193
-
194
- - **Velocity**: 2 work orders / 4.5 hours = 0.44 WO/hour
195
- - **Test Coverage**: Maintained 85% average
196
- - **Build Status**: All builds passed
197
- - **Code Quality**: Zero linting errors
198
-
199
- ## Next Session
200
-
201
- **Planned Work Orders**:
202
- - WO-048: Rate limiting implementation
203
- - WO-049: Auth service refactoring
204
-
205
- **Estimated Time**: 3-4 hours
206
-
207
- ---
208
-
209
- **Session closed at**: 2025-12-18 18:30
210
- **Knowledge base**: Updated
211
- **All changes**: Committed and pushed
212
- **Status**: ✅ Clean slate for next session
213
- ```
214
-
215
- ---
216
-
217
- ---
218
-
219
- ## Knowledge Base Update Checklist
220
-
221
- Before ending session, ALY updates living documentation based on session work:
222
-
223
- ### Phase 1: Core Document Updates (Required)
224
-
225
- Update these documents based on what changed during the session:
226
-
227
- #### ARCHITECTURE.md
228
- - [ ] **New Components**: Add to Component Architecture table
229
- - [ ] **Technology Changes**: Update Technology Profile (framework versions, new tools)
230
- - [ ] **API Changes**: Update API endpoints or patterns
231
- - [ ] **Integration Changes**: Add/update External Integrations
232
- - [ ] **Performance Changes**: Update baselines if optimization occurred
233
- - [ ] **Architectural Decisions**: Add to Technical Decisions Log
234
- - [ ] **Cross-References**: Verify links to ISSUES.md, Technical-Debt.md still valid
235
- - [ ] **Last Updated**: Set to current date
236
-
237
- #### ISSUES.md
238
- - [ ] **Close Resolved Issues**: Mark issues fixed during session as resolved
239
- - [ ] **Add New Issues**: Document new bugs/patterns discovered
240
- - [ ] **Update Patterns**: Add new recurring patterns discovered
241
- - [ ] **Update Metrics**: Refresh Issue Resolution Metrics
242
- - [ ] **Investigation Links**: Link to investigations completed this session
243
- - [ ] **Cross-References**: Ensure links to Technical-Debt.md, ARCHITECTURE.md accurate
244
- - [ ] **Last Updated**: Set to current date
245
-
246
- #### To-do.md
247
- - [ ] **Remove Completed**: Delete or mark complete tasks finished during session
248
- - [ ] **Add New Tasks**: Add tasks identified during development
249
- - [ ] **Update Priorities**: Re-prioritize based on new information
250
- - [ ] **Update Sprint Planning**: Refresh current sprint status
251
- - [ ] **Update Backlog**: Add items discovered during session
252
- - [ ] **Velocity Metrics**: Calculate session velocity
253
- - [ ] **Last Updated**: Set to current date
254
-
255
- #### Technical-Debt.md
256
- - [ ] **Add New Debt**: Document TODOs/FIXMEs/HACKs added during session
257
- - [ ] **Resolve Debt**: Remove items paid down during session
258
- - [ ] **Update Metrics**: Recalculate debt metrics (TODO count, file complexity, coverage)
259
- - [ ] **Add Patterns**: Document new debt patterns discovered
260
- - [ ] **Update Trends**: Refresh Session Comparison metrics
261
- - [ ] **ROI Analysis**: Update debt reduction plan based on session learnings
262
- - [ ] **Cross-References**: Ensure links to ISSUES.md patterns are current
263
- - [ ] **Last Updated**: Set to current date
264
-
265
- ### Phase 2: Standards Updates (If Changed)
266
-
267
- Only update these if the session introduced new patterns or standards:
268
-
269
- #### CODING-PRINCIPLES.md
270
- - [ ] **New Patterns**: Add new good/bad examples discovered
271
- - [ ] **Refactoring Strategies**: Document new refactoring patterns used
272
- - [ ] **Framework Changes**: Update if framework version changed standards
273
- - [ ] **Last Updated**: Set to current date (only if modified)
274
-
275
- #### TESTING-PRINCIPLES.md
276
- - [ ] **New Test Patterns**: Add testing patterns discovered
277
- - [ ] **Coverage Updates**: Update coverage targets if changed
278
- - [ ] **Testing Strategies**: Document new mocking/stubbing patterns
279
- - [ ] **Last Updated**: Set to current date (only if modified)
280
-
281
- #### AI-DEVELOPMENT-GUIDE.md
282
- - [ ] **Workflow Improvements**: Update if Trinity workflows changed
283
- - [ ] **Scale Examples**: Add new scale examples if discovered
284
- - [ ] **Agent Protocols**: Update if agent communication patterns changed
285
- - [ ] **Last Updated**: Set to current date (only if modified)
286
-
287
- #### Trinity.md
288
- - [ ] **Protocol Updates**: Document protocol changes or improvements
289
- - [ ] **Performance Baselines**: Update if project baselines changed
290
- - [ ] **Session Workflow**: Update if workflow process improved
291
- - [ ] **Success Metrics**: Add metrics from completed session
292
- - [ ] **Last Updated**: Set to current date (only if modified)
293
-
294
- #### DOCUMENTATION-CRITERIA.md
295
- - [ ] **Criteria Changes**: Update if documentation standards evolved
296
- - [ ] **Last Updated**: Set to current date (only if modified)
297
-
298
- ### Phase 3: Quality Verification
299
-
300
- After all updates, verify documentation integrity:
301
-
302
- #### Content Quality
303
- - [ ] All updated files have meaningful changes (not just timestamp)
304
- - [ ] No placeholder syntax `{{VARIABLE}}` introduced during updates
305
- - [ ] Metrics use real project values (not example numbers)
306
- - [ ] Code examples match project's actual framework/language
307
-
308
- #### Cross-Reference Integrity
309
- - [ ] Links between documents still work (no broken references)
310
- - [ ] When updating ARCHITECTURE checked if ISSUES/Technical-Debt need updates
311
- - [ ] When adding ISSUES added related Technical-Debt items if applicable
312
- - [ ] When closing To-do tasks verified linked ISSUES closed
313
-
314
- #### Consistency Checks
315
- - [ ] Timestamps updated ({{CURRENT_DATE}} replaced with actual date)
316
- - [ ] Project name consistent across all files
317
- - [ ] Framework/technology names consistent
318
- - [ ] Component names match across ARCHITECTURE/ISSUES/Technical-Debt
319
-
320
- #### Completeness Validation
321
- - [ ] New components documented in ARCHITECTURE
322
- - [ ] New issues documented in ISSUES.md
323
- - [ ] New technical debt tracked in Technical-Debt.md
324
- - [ ] Completed work removed from To-do.md
325
- - [ ] Session learnings captured somewhere (not lost)
326
-
327
- ### Update Guidelines
328
-
329
- **For each document updated**:
330
- 1. Open the file
331
- 2. Use the document's "When to Update" section as guide (see knowledge-base templates)
332
- 3. Make specific, meaningful changes (don't just change timestamps)
333
- 4. Verify cross-references to other documents
334
- 5. Keep placeholders for future sessions (don't replace with generic examples)
335
-
336
- **When in doubt**:
337
- - If something changed document it
338
- - If nothing changed don't update (stale timestamp is okay)
339
- - If unsure → reference the document's "When to Update This Document" section
340
-
341
- **Cross-Document Update Scenarios**:
342
-
343
- **Scenario: Added New Component**
344
- Update ARCHITECTURE.md (component table)
345
- → Update To-do.md (add testing/documentation tasks)
346
- → Check ISSUES.md (any known issues with this type of component?)
347
-
348
- **Scenario: Fixed Bug**
349
- Update ISSUES.md (close issue)
350
- → Update Technical-Debt.md (if fix paid down debt)
351
- → Update To-do.md (mark task complete)
352
-
353
- **Scenario: Added TODO/FIXME**
354
- Update Technical-Debt.md (increment TODO count)
355
- → Update To-do.md (add task to address it)
356
-
357
- **Scenario: Refactored Large File**
358
- → Update Technical-Debt.md (reduce file complexity metrics)
359
- Update ARCHITECTURE.md (if component structure changed)
360
- → Update ISSUES.md (close related refactoring issues)
361
-
362
- ### Session Summary Integration
363
-
364
- After knowledge base updates, ALY creates session summary including:
365
- - **Documents Updated**: List which knowledge-base files changed
366
- - **Key Changes**: Summarize what was added/removed/modified
367
- - **Cross-References**: Note which documents reference each other
368
- - **Metrics Delta**: Before/after metrics for Technical-Debt.md
369
-
370
- Example:
371
- ```markdown
372
- ## Knowledge Base Updates
373
-
374
- **ARCHITECTURE.md**:
375
- - Added: OAuth2 refresh token flow to API Architecture
376
- - Updated: Authentication section with refresh token rotation
377
-
378
- **ISSUES.md**:
379
- - Closed: ISS-042 (JWT refresh implementation)
380
- - Added: ISS-048 (Rate limiting pattern for auth endpoints)
381
-
382
- **Technical-Debt.md**:
383
- - Resolved: Email validation duplication (was in 3 files)
384
- - Added: Auth service refactoring (split into 2 files)
385
- - Metrics: TODO count decreased 5 → 3, File complexity improved
386
-
387
- **To-do.md**:
388
- - Completed: T-042 (Implement JWT refresh)
389
- - Added: T-048 (Rate limiting), T-049 (Auth refactoring)
390
-
391
- **Cross-References Updated**:
392
- - ARCHITECTURE.md ↔ ISSUES.md (linked refresh token pattern)
393
- - ISSUES.md ↔ Technical-Debt.md (linked auth refactoring debt)
394
- - To-do.md ↔ ISSUES.md (linked rate limiting task to issue)
395
- ```
396
-
397
- ---
1
+ # Trinity End
2
+
3
+ **Command:** `/session:trinity-end`
4
+ **Purpose:** End session and archive work to .claude/trinity/archive/
5
+ **Architecture:** ALY session summary Work archival Documentation update
6
+ **Trinity Version:** 2.1.0
7
+ **Last Updated:** 2026-01-21
8
+
9
+ ---
10
+
11
+ End current Trinity Method session and prepare for commit.
12
+
13
+ **Context:** User is finished with current task and ready to commit, push, or move to next work.
14
+
15
+ **Process:**
16
+ 1. **ALY (CTO)** archives session work:
17
+
18
+ **STRICT ARCHIVING PROTOCOL:**
19
+
20
+ a. **Archive Completed Work Orders:**
21
+ - Read all files from `.claude/trinity/sessions/` matching `WO-*.md`
22
+ - Move each to `.claude/trinity/archive/work-orders/YYYY-MM-DD/`
23
+ - These were moved to sessions/ after completion per work order template
24
+
25
+ b. **Archive Completed Investigations:**
26
+ - Read all files from `.claude/trinity/sessions/` matching `INV-*.md`
27
+ - Move each to `.claude/trinity/archive/investigations/YYYY-MM-DD/`
28
+ - These were moved to sessions/ after completion per investigation template
29
+
30
+ c. **Archive ALL Reports:**
31
+ - Move ALL files from `.claude/trinity/reports/` to `.claude/trinity/archive/reports/YYYY-MM-DD/`
32
+ - This includes:
33
+ - Implementation completion reports
34
+ - Investigation findings reports
35
+ - JUNO audit reports
36
+ - Any other session reports
37
+ - **NO EXCEPTIONS:** Every file in reports/ must be archived
38
+
39
+ d. **Archive Session Files:**
40
+ - Move ALL remaining files from `.claude/trinity/sessions/` to `.claude/trinity/archive/sessions/YYYY-MM-DD/`
41
+ - Create session summary document in `.claude/trinity/archive/sessions/YYYY-MM-DD/SESSION-SUMMARY-{date}.md`
42
+
43
+ e. **Verify Clean Slate:**
44
+ - **CRITICAL:** After archiving, `.claude/trinity/sessions/` MUST be empty
45
+ - **CRITICAL:** After archiving, `.claude/trinity/reports/` MUST be empty
46
+ - If any files remain, archive them or report error
47
+ - Next session MUST start with completely empty sessions/ and reports/ folders
48
+
49
+ **Archive Structure:**
50
+ ```
51
+ .claude/trinity/archive/
52
+ ├── work-orders/YYYY-MM-DD/
53
+ ├── WO-001-*.md
54
+ ├── WO-002-*.md
55
+ └── ...
56
+ ├── investigations/YYYY-MM-DD/
57
+ │ ├── INV-001-*.md
58
+ ├── INV-002-*.md
59
+ └── ...
60
+ ├── reports/YYYY-MM-DD/
61
+ │ ├── WO-001-IMPLEMENTATION-COMPLETE-*.md
62
+ │ ├── AUDIT-WO-001-*.md
63
+ │ ├── INV-001-findings-*.md
64
+ │ └── ...
65
+ └── sessions/YYYY-MM-DD/
66
+ ├── SESSION-SUMMARY-{date}.md
67
+ └── [any other session files]
68
+ ```
69
+
70
+ **Important Notes:**
71
+ - Keep ONLY active/in-progress work orders in `.claude/trinity/work-orders/`
72
+ - Keep ONLY active/in-progress investigations in `.claude/trinity/investigations/`
73
+ - Do NOT archive incomplete work
74
+ - Completed work is identified by presence in `.claude/trinity/sessions/` folder
75
+ - All reports are archived regardless of status
76
+
77
+ 2. **ALY analyzes session events:**
78
+ - Review all work completed during session
79
+ - Identify patterns and learnings
80
+ - Update .claude/trinity/knowledge-base/ARCHITECTURE.md with architectural changes
81
+ - Update .claude/trinity/knowledge-base/ISSUES.md with new known issues
82
+ - Update .claude/trinity/knowledge-base/To-do.md with next tasks
83
+ - Update .claude/trinity/knowledge-base/Technical-Debt.md with new debt
84
+
85
+ 3. **Clean workspace:**
86
+ - Verify .claude/trinity/work-orders/ contains only active work
87
+ - Verify .claude/trinity/investigations/ contains only active investigations
88
+ - Verify .claude/trinity/reports/ is empty
89
+ - Verify .claude/trinity/sessions/ is empty
90
+ - Ready for next session
91
+
92
+ 4. **Git commit instructions:**
93
+ After archiving, provide user with commit checklist:
94
+
95
+ **For Trinity Method SDK project:**
96
+ - Update version in package.json (semantic versioning)
97
+ - Run `npm run build` to compile changes
98
+ - Run `npm pack` to create tarball
99
+ - Update CHANGELOG.md with changes
100
+ - Git commit with descriptive message
101
+ - Git push to repository
102
+
103
+ **For client projects using Trinity:**
104
+ - Review git status for modified files
105
+ - Stage changes: `git add .`
106
+ - Commit with message describing work completed
107
+ - Push to repository: `git push`
108
+
109
+ **Outcome:**
110
+ - All completed work properly archived with timestamp
111
+ - Active/in-progress work remains in working directories
112
+ - Trinity documents updated with session learnings
113
+ - Workspace clean and ready for git operations
114
+ - User has clear instructions for version updates and commits
115
+
116
+ **Note:** Run this before committing your work.
117
+
118
+ ---
119
+
120
+ ## When to Use /trinity-end
121
+
122
+ ### ✅ Use When:
123
+
124
+ 1. **Work Session Complete**
125
+ - All work orders closed
126
+ - All commits pushed
127
+ - Ready to stop working
128
+
129
+ 2. **Major Milestone Reached**
130
+ - Feature complete and merged
131
+ - Sprint completed
132
+ - Release deployed
133
+
134
+ 3. **Context Cleanup Needed**
135
+ - Long session (>4 hours)
136
+ - Multiple work orders completed
137
+ - Knowledge base needs updating
138
+
139
+ ### ❌ Don't Use When:
140
+
141
+ 1. **Mid-Task**
142
+ - Work order still in progress
143
+ - Uncommitted changes
144
+ - Tests failing
145
+
146
+ 2. **Just Pausing**
147
+ - Taking a break (keep context)
148
+ - Switching tasks temporarily
149
+ - Waiting for review
150
+
151
+ **Instead Use**: `/trinity-continue` when resuming work
152
+
153
+ ---
154
+
155
+ ## Session Summary Example
156
+
157
+ ```markdown
158
+ # Session Summary - 2025-12-18
159
+
160
+ **Duration**: 4 hours 30 minutes
161
+ **Work Orders Completed**: 2 (WO-042, WO-043)
162
+ **Commits**: 7 commits pushed to main
163
+
164
+ ## Accomplishments
165
+
166
+ ### WO-042: JWT Refresh Token Implementation
167
+ - Implemented secure refresh token rotation
168
+ - Added HttpOnly cookie support
169
+ - 87% test coverage (exceeds 80% threshold)
170
+ - All BAS quality gates passed
171
+
172
+ **Files Changed**: 4 files (service, middleware, types, tests)
173
+ **Lines**: +234 additions, -12 deletions
174
+
175
+ ### WO-043: User Profile Editing
176
+ - Added profile update endpoint
177
+ - Validation for all fields
178
+ - Integration tests complete
179
+ - Documentation updated
180
+
181
+ **Files Changed**: 3 files (controller, service, tests)
182
+ **Lines**: +156 additions, -8 deletions
183
+
184
+ ## Knowledge Base Updates
185
+
186
+ **ARCHITECTURE.md**:
187
+ - Added OAuth2 refresh token flow diagram
188
+ - Documented token rotation strategy
189
+
190
+ **ISSUES.md**:
191
+ - Closed: #42 (JWT refresh), #45 (profile editing)
192
+ - Added: #48 (rate limiting for refresh endpoint)
193
+
194
+ **Technical-Debt.md**:
195
+ - Added: Refactor auth service (split into 2 files)
196
+ - Resolved: Email validation duplication
197
+
198
+ ## Metrics
199
+
200
+ - **Velocity**: 2 work orders / 4.5 hours = 0.44 WO/hour
201
+ - **Test Coverage**: Maintained 85% average
202
+ - **Build Status**: All builds passed
203
+ - **Code Quality**: Zero linting errors
204
+
205
+ ## Next Session
206
+
207
+ **Planned Work Orders**:
208
+ - WO-048: Rate limiting implementation
209
+ - WO-049: Auth service refactoring
210
+
211
+ **Estimated Time**: 3-4 hours
212
+
213
+ ---
214
+
215
+ **Session closed at**: 2025-12-18 18:30
216
+ **Knowledge base**: Updated
217
+ **All changes**: Committed and pushed
218
+ **Status**: ✅ Clean slate for next session
219
+ ```
220
+
221
+ ---
222
+
223
+ ---
224
+
225
+ ## Knowledge Base Update Checklist
226
+
227
+ Before ending session, ALY updates living documentation based on session work:
228
+
229
+ ### Phase 1: Core Document Updates (Required)
230
+
231
+ Update these documents based on what changed during the session:
232
+
233
+ #### ARCHITECTURE.md
234
+ - [ ] **New Components**: Add to Component Architecture table
235
+ - [ ] **Technology Changes**: Update Technology Profile (framework versions, new tools)
236
+ - [ ] **API Changes**: Update API endpoints or patterns
237
+ - [ ] **Integration Changes**: Add/update External Integrations
238
+ - [ ] **Performance Changes**: Update baselines if optimization occurred
239
+ - [ ] **Architectural Decisions**: Add to Technical Decisions Log
240
+ - [ ] **Cross-References**: Verify links to ISSUES.md, Technical-Debt.md still valid
241
+ - [ ] **Last Updated**: Set to current date
242
+
243
+ #### ISSUES.md
244
+ - [ ] **Close Resolved Issues**: Mark issues fixed during session as resolved
245
+ - [ ] **Add New Issues**: Document new bugs/patterns discovered
246
+ - [ ] **Update Patterns**: Add new recurring patterns discovered
247
+ - [ ] **Update Metrics**: Refresh Issue Resolution Metrics
248
+ - [ ] **Investigation Links**: Link to investigations completed this session
249
+ - [ ] **Cross-References**: Ensure links to Technical-Debt.md, ARCHITECTURE.md accurate
250
+ - [ ] **Last Updated**: Set to current date
251
+
252
+ #### To-do.md
253
+ - [ ] **Remove Completed**: Delete or mark complete tasks finished during session
254
+ - [ ] **Add New Tasks**: Add tasks identified during development
255
+ - [ ] **Update Priorities**: Re-prioritize based on new information
256
+ - [ ] **Update Sprint Planning**: Refresh current sprint status
257
+ - [ ] **Update Backlog**: Add items discovered during session
258
+ - [ ] **Velocity Metrics**: Calculate session velocity
259
+ - [ ] **Last Updated**: Set to current date
260
+
261
+ #### Technical-Debt.md
262
+ - [ ] **Add New Debt**: Document TODOs/FIXMEs/HACKs added during session
263
+ - [ ] **Resolve Debt**: Remove items paid down during session
264
+ - [ ] **Update Metrics**: Recalculate debt metrics (TODO count, file complexity, coverage)
265
+ - [ ] **Add Patterns**: Document new debt patterns discovered
266
+ - [ ] **Update Trends**: Refresh Session Comparison metrics
267
+ - [ ] **ROI Analysis**: Update debt reduction plan based on session learnings
268
+ - [ ] **Cross-References**: Ensure links to ISSUES.md patterns are current
269
+ - [ ] **Last Updated**: Set to current date
270
+
271
+ ### Phase 2: Standards Updates (If Changed)
272
+
273
+ Only update these if the session introduced new patterns or standards:
274
+
275
+ #### CODING-PRINCIPLES.md
276
+ - [ ] **New Patterns**: Add new good/bad examples discovered
277
+ - [ ] **Refactoring Strategies**: Document new refactoring patterns used
278
+ - [ ] **Framework Changes**: Update if framework version changed standards
279
+ - [ ] **Last Updated**: Set to current date (only if modified)
280
+
281
+ #### TESTING-PRINCIPLES.md
282
+ - [ ] **New Test Patterns**: Add testing patterns discovered
283
+ - [ ] **Coverage Updates**: Update coverage targets if changed
284
+ - [ ] **Testing Strategies**: Document new mocking/stubbing patterns
285
+ - [ ] **Last Updated**: Set to current date (only if modified)
286
+
287
+ #### AI-DEVELOPMENT-GUIDE.md
288
+ - [ ] **Workflow Improvements**: Update if Trinity workflows changed
289
+ - [ ] **Scale Examples**: Add new scale examples if discovered
290
+ - [ ] **Agent Protocols**: Update if agent communication patterns changed
291
+ - [ ] **Last Updated**: Set to current date (only if modified)
292
+
293
+ #### Trinity.md
294
+ - [ ] **Protocol Updates**: Document protocol changes or improvements
295
+ - [ ] **Performance Baselines**: Update if project baselines changed
296
+ - [ ] **Session Workflow**: Update if workflow process improved
297
+ - [ ] **Success Metrics**: Add metrics from completed session
298
+ - [ ] **Last Updated**: Set to current date (only if modified)
299
+
300
+ #### DOCUMENTATION-CRITERIA.md
301
+ - [ ] **Criteria Changes**: Update if documentation standards evolved
302
+ - [ ] **Last Updated**: Set to current date (only if modified)
303
+
304
+ ### Phase 3: Quality Verification
305
+
306
+ After all updates, verify documentation integrity:
307
+
308
+ #### Content Quality
309
+ - [ ] All updated files have meaningful changes (not just timestamp)
310
+ - [ ] No placeholder syntax `{{VARIABLE}}` introduced during updates
311
+ - [ ] Metrics use real project values (not example numbers)
312
+ - [ ] Code examples match project's actual framework/language
313
+
314
+ #### Cross-Reference Integrity
315
+ - [ ] Links between documents still work (no broken references)
316
+ - [ ] When updating ARCHITECTURE checked if ISSUES/Technical-Debt need updates
317
+ - [ ] When adding ISSUES → added related Technical-Debt items if applicable
318
+ - [ ] When closing To-do tasks → verified linked ISSUES closed
319
+
320
+ #### Consistency Checks
321
+ - [ ] Timestamps updated ({{CURRENT_DATE}} replaced with actual date)
322
+ - [ ] Project name consistent across all files
323
+ - [ ] Framework/technology names consistent
324
+ - [ ] Component names match across ARCHITECTURE/ISSUES/Technical-Debt
325
+
326
+ #### Completeness Validation
327
+ - [ ] New components documented in ARCHITECTURE
328
+ - [ ] New issues documented in ISSUES.md
329
+ - [ ] New technical debt tracked in Technical-Debt.md
330
+ - [ ] Completed work removed from To-do.md
331
+ - [ ] Session learnings captured somewhere (not lost)
332
+
333
+ ### Update Guidelines
334
+
335
+ **For each document updated**:
336
+ 1. Open the file
337
+ 2. Use the document's "When to Update" section as guide (see knowledge-base templates)
338
+ 3. Make specific, meaningful changes (don't just change timestamps)
339
+ 4. Verify cross-references to other documents
340
+ 5. Keep placeholders for future sessions (don't replace with generic examples)
341
+
342
+ **When in doubt**:
343
+ - If something changed → document it
344
+ - If nothing changed don't update (stale timestamp is okay)
345
+ - If unsure reference the document's "When to Update This Document" section
346
+
347
+ **Cross-Document Update Scenarios**:
348
+
349
+ **Scenario: Added New Component**
350
+ → Update ARCHITECTURE.md (component table)
351
+ → Update To-do.md (add testing/documentation tasks)
352
+ → Check ISSUES.md (any known issues with this type of component?)
353
+
354
+ **Scenario: Fixed Bug**
355
+ → Update ISSUES.md (close issue)
356
+ → Update Technical-Debt.md (if fix paid down debt)
357
+ Update To-do.md (mark task complete)
358
+
359
+ **Scenario: Added TODO/FIXME**
360
+ → Update Technical-Debt.md (increment TODO count)
361
+ → Update To-do.md (add task to address it)
362
+
363
+ **Scenario: Refactored Large File**
364
+ Update Technical-Debt.md (reduce file complexity metrics)
365
+ Update ARCHITECTURE.md (if component structure changed)
366
+ Update ISSUES.md (close related refactoring issues)
367
+
368
+ ### Session Summary Integration
369
+
370
+ After knowledge base updates, ALY creates session summary including:
371
+ - **Documents Updated**: List which knowledge-base files changed
372
+ - **Key Changes**: Summarize what was added/removed/modified
373
+ - **Cross-References**: Note which documents reference each other
374
+ - **Metrics Delta**: Before/after metrics for Technical-Debt.md
375
+
376
+ Example:
377
+ ```markdown
378
+ ## Knowledge Base Updates
379
+
380
+ **ARCHITECTURE.md**:
381
+ - Added: OAuth2 refresh token flow to API Architecture
382
+ - Updated: Authentication section with refresh token rotation
383
+
384
+ **ISSUES.md**:
385
+ - Closed: ISS-042 (JWT refresh implementation)
386
+ - Added: ISS-048 (Rate limiting pattern for auth endpoints)
387
+
388
+ **Technical-Debt.md**:
389
+ - Resolved: Email validation duplication (was in 3 files)
390
+ - Added: Auth service refactoring (split into 2 files)
391
+ - Metrics: TODO count decreased 5 → 3, File complexity improved
392
+
393
+ **To-do.md**:
394
+ - Completed: T-042 (Implement JWT refresh)
395
+ - Added: T-048 (Rate limiting), T-049 (Auth refactoring)
396
+
397
+ **Cross-References Updated**:
398
+ - ARCHITECTURE.md ↔ ISSUES.md (linked refresh token pattern)
399
+ - ISSUES.md ↔ Technical-Debt.md (linked auth refactoring debt)
400
+ - To-do.md ↔ ISSUES.md (linked rate limiting task to issue)
401
+ ```
402
+
403
+ ---