trinity-method-sdk 2.0.8 → 2.0.9

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 (49) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +1 -1
  3. package/dist/cli/commands/deploy/index.js +1 -1
  4. package/dist/cli/commands/deploy/root-files.js +1 -1
  5. package/dist/cli/commands/deploy/sdk-install.js +1 -1
  6. package/dist/cli/utils/template-processor.js +1 -1
  7. package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +2 -2
  8. package/dist/templates/agents/aj-team/bas-quality-gate.md.template +3 -3
  9. package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +7 -7
  10. package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +2 -2
  11. package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +2 -2
  12. package/dist/templates/agents/aj-team/kil-task-executor.md.template +2 -2
  13. package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +2 -2
  14. package/dist/templates/agents/audit/juno-auditor.md.template +1 -1
  15. package/dist/templates/agents/deployment/ein-cicd.md.template +3 -2
  16. package/dist/templates/agents/deployment/ino-context.md.template +3 -3
  17. package/dist/templates/agents/deployment/tan-structure.md.template +1 -1
  18. package/dist/templates/agents/deployment/zen-knowledge.md.template +5 -5
  19. package/dist/templates/agents/leadership/aj-cc.md.template +2 -2
  20. package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +1 -1
  21. package/dist/templates/documentation/SUBDIRECTORY-README.md.template +1 -1
  22. package/dist/templates/investigations/bug.md.template +2 -2
  23. package/dist/templates/investigations/feature.md.template +2 -2
  24. package/dist/templates/investigations/performance.md.template +2 -2
  25. package/dist/templates/investigations/security.md.template +2 -2
  26. package/dist/templates/investigations/technical.md.template +2 -2
  27. package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +1 -1
  28. package/dist/templates/knowledge-base/ARCHITECTURE.md.template +2 -2
  29. package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +1 -1
  30. package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1 -1
  31. package/dist/templates/knowledge-base/ISSUES.md.template +2 -2
  32. package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +1 -1
  33. package/dist/templates/knowledge-base/Technical-Debt.md.template +2 -2
  34. package/dist/templates/knowledge-base/To-do.md.template +2 -2
  35. package/dist/templates/knowledge-base/Trinity.md.template +4 -3
  36. package/dist/templates/root/TRINITY.md.template +1 -1
  37. package/dist/templates/shared/claude-commands/trinity-changelog.md.template +2 -2
  38. package/dist/templates/shared/claude-commands/trinity-continue.md.template +1 -1
  39. package/dist/templates/shared/claude-commands/trinity-docs.md.template +376 -7
  40. package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -397
  41. package/dist/templates/shared/claude-commands/trinity-readme.md.template +141 -33
  42. package/dist/templates/shared/claude-commands/trinity-verify.md.template +1 -1
  43. package/dist/templates/source/base-CLAUDE.md.template +310 -310
  44. package/dist/templates/source/flutter-CLAUDE.md.template +593 -593
  45. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -531
  46. package/dist/templates/source/python-CLAUDE.md.template +510 -510
  47. package/dist/templates/source/react-CLAUDE.md.template +513 -513
  48. package/dist/templates/source/rust-CLAUDE.md.template +653 -653
  49. package/package.json +1 -1
@@ -1,397 +1,397 @@
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
+ ---
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
+ ---