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,1118 @@
1
+ # Documentation Criteria
2
+
3
+ **Version**: 2.0.0
4
+ **Last Updated**: {{date}}
5
+ **Project**: {{projectName}}
6
+
7
+ ---
8
+
9
+ ## Purpose
10
+
11
+ This document establishes documentation standards based on implementation scale. All implementations must create appropriate documentation according to their scale determination.
12
+
13
+ ## 1. Scale-Based Documentation Requirements
14
+
15
+ ### 1.1 Documentation Matrix
16
+
17
+ | Scale | Files | PRD | ADR | Design Doc | Work Plan | Task Breakdown | Inline Docs |
18
+ |-------|-------|-----|-----|------------|-----------|----------------|-------------|
19
+ | **Small** | 1-2 | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ Required |
20
+ | **Medium** | 3-5 | ❌ | ❌ | ✅ Required | ✅ Required | ✅ Required | ✅ Required |
21
+ | **Large** | 6+ | ✅ Required | ✅ Required | ✅ Required | ✅ Required | ✅ Required | ✅ Required |
22
+
23
+ ### 1.2 Scale Determination Rules
24
+
25
+ **Small Scale** (1-2 files):
26
+ - Single utility function
27
+ - Simple bug fix
28
+ - Configuration change
29
+ - Small refactoring
30
+ - Basic validation
31
+
32
+ **Medium Scale** (3-5 files):
33
+ - Feature module
34
+ - API endpoint group
35
+ - Service implementation
36
+ - Integration component
37
+ - Moderate refactoring
38
+
39
+ **Large Scale** (6+ files):
40
+ - System component
41
+ - Multi-service integration
42
+ - Architectural change
43
+ - Complex feature
44
+ - Major refactoring
45
+
46
+ ---
47
+
48
+ ## 2. Document Templates
49
+
50
+ ### 2.1 PRD (Product Requirements Document)
51
+
52
+ **Required For**: Large scale only
53
+ **Creator**: CAP (PRD Creator)
54
+ **Location**: `docs/plans/requirements/`
55
+ **Filename Pattern**: `PRD-{feature-name}-{date}.md`
56
+
57
+ **Template Structure**:
58
+
59
+ ```markdown
60
+ # Product Requirements Document: {Feature Name}
61
+
62
+ **PRD ID**: PRD-{YYYY}-{NNN}
63
+ **Created**: {date}
64
+ **Author**: CAP (from ALY investigation)
65
+ **Status**: Draft | Approved | Implemented
66
+
67
+ ---
68
+
69
+ ## 1. Executive Summary
70
+
71
+ [2-3 sentences describing the feature and its value]
72
+
73
+ ## 2. Background
74
+
75
+ ### 2.1 Problem Statement
76
+ [What problem are we solving?]
77
+
78
+ ### 2.2 User Impact
79
+ [Who is affected and how?]
80
+
81
+ ### 2.3 Business Value
82
+ [Why build this now?]
83
+
84
+ ## 3. Requirements
85
+
86
+ ### 3.1 Functional Requirements
87
+
88
+ #### FR-1: {Requirement Title}
89
+ **Description**: [What the system must do]
90
+ **Priority**: Critical | High | Medium | Low
91
+ **Acceptance Criteria**:
92
+ - [ ] Criterion 1
93
+ - [ ] Criterion 2
94
+ - [ ] Criterion 3
95
+
96
+ [Repeat for FR-2, FR-3, etc.]
97
+
98
+ ### 3.2 Non-Functional Requirements
99
+
100
+ #### NFR-1: Performance
101
+ [Performance requirements]
102
+
103
+ #### NFR-2: Security
104
+ [Security requirements]
105
+
106
+ #### NFR-3: Usability
107
+ [Usability requirements]
108
+
109
+ ## 4. User Stories
110
+
111
+ **As a** [user type]
112
+ **I want** [goal]
113
+ **So that** [benefit]
114
+
115
+ **Acceptance Criteria**:
116
+ - [ ] Criteria 1
117
+ - [ ] Criteria 2
118
+
119
+ [Repeat for multiple user stories]
120
+
121
+ ## 5. Success Metrics
122
+
123
+ **Metric 1**: {Name}
124
+ - **Target**: {Value}
125
+ - **Measurement**: {How to measure}
126
+
127
+ ## 6. Out of Scope
128
+
129
+ [What we're explicitly NOT doing in this iteration]
130
+
131
+ ## 7. Dependencies
132
+
133
+ - Dependency 1: {Description}
134
+ - Dependency 2: {Description}
135
+
136
+ ## 8. Timeline
137
+
138
+ - **Design**: {duration}
139
+ - **Implementation**: {duration}
140
+ - **Testing**: {duration}
141
+ - **Total**: {duration}
142
+
143
+ ## 9. Risks
144
+
145
+ | Risk | Impact | Probability | Mitigation |
146
+ |------|--------|-------------|------------|
147
+ | Risk 1 | High | Medium | Mitigation strategy |
148
+
149
+ ---
150
+
151
+ **Review History**:
152
+ - {date}: Created by CAP
153
+ - {date}: Reviewed and approved by {user}
154
+ ```
155
+
156
+ **Example PRD**:
157
+
158
+ ```markdown
159
+ # Product Requirements Document: Multi-Channel Notification System
160
+
161
+ **PRD ID**: PRD-2025-001
162
+ **Created**: 2025-10-11
163
+ **Author**: CAP
164
+ **Status**: Approved
165
+
166
+ ---
167
+
168
+ ## 1. Executive Summary
169
+
170
+ Build a notification system that sends messages via email, SMS, and push notifications, with centralized queue management, retry logic, and delivery tracking.
171
+
172
+ ## 2. Background
173
+
174
+ ### 2.1 Problem Statement
175
+ Users currently receive notifications only via email, missing time-sensitive alerts when not checking email.
176
+
177
+ ### 2.2 User Impact
178
+ All 10,000+ users will receive faster, more reliable notifications through their preferred channels.
179
+
180
+ ### 2.3 Business Value
181
+ - Increase user engagement by 30% (based on similar implementations)
182
+ - Reduce missed notification rate from 25% to <5%
183
+ - Enable future features requiring real-time alerts
184
+
185
+ ## 3. Requirements
186
+
187
+ ### 3.1 Functional Requirements
188
+
189
+ #### FR-1: Email Notification Support
190
+ **Description**: System sends HTML/text emails via SMTP
191
+ **Priority**: Critical
192
+ **Acceptance Criteria**:
193
+ - [ ] Supports HTML and plain text formats
194
+ - [ ] Includes unsubscribe link in all emails
195
+ - [ ] Tracks open rates and click rates
196
+ - [ ] Handles bounces and failures gracefully
197
+
198
+ #### FR-2: SMS Notification Support
199
+ **Description**: System sends SMS via Twilio API
200
+ **Priority**: High
201
+ **Acceptance Criteria**:
202
+ - [ ] Supports international phone numbers
203
+ - [ ] Limits message length to 160 characters
204
+ - [ ] Tracks delivery status
205
+ - [ ] Respects user opt-out preferences
206
+
207
+ [... continues with remaining requirements]
208
+ ```
209
+
210
+ ---
211
+
212
+ ### 2.2 ADR (Architecture Decision Record)
213
+
214
+ **Required For**: Large scale only (for major architectural decisions)
215
+ **Creator**: ROR (Technical Designer)
216
+ **Location**: `docs/plans/adrs/`
217
+ **Filename Pattern**: `ADR-{NNN}-{decision-title}.md`
218
+
219
+ **Template Structure**:
220
+
221
+ ```markdown
222
+ # ADR-{NNN}: {Decision Title}
223
+
224
+ **Status**: Proposed | Accepted | Deprecated | Superseded by ADR-XXX
225
+ **Date**: {date}
226
+ **Deciders**: {who made the decision}
227
+ **Context**: {related to which feature/component}
228
+
229
+ ---
230
+
231
+ ## Context
232
+
233
+ [What is the issue we're seeing that is motivating this decision or change?]
234
+
235
+ ## Decision
236
+
237
+ [What is the change that we're proposing and/or doing?]
238
+
239
+ ## Consequences
240
+
241
+ ### Positive
242
+
243
+ - [Consequence 1]
244
+ - [Consequence 2]
245
+
246
+ ### Negative
247
+
248
+ - [Consequence 1]
249
+ - [Consequence 2]
250
+
251
+ ### Neutral
252
+
253
+ - [Consequence 1]
254
+
255
+ ## Alternatives Considered
256
+
257
+ ### Alternative 1: {Name}
258
+
259
+ **Description**: [What is this alternative?]
260
+
261
+ **Pros**:
262
+ - Pro 1
263
+ - Pro 2
264
+
265
+ **Cons**:
266
+ - Con 1
267
+ - Con 2
268
+
269
+ **Why Rejected**: [Reasoning]
270
+
271
+ ### Alternative 2: {Name}
272
+
273
+ [Same structure as Alternative 1]
274
+
275
+ ## Implementation Notes
276
+
277
+ [Technical details, gotchas, migration path, etc.]
278
+
279
+ ## References
280
+
281
+ - [Link to related PRD]
282
+ - [Link to external documentation]
283
+ - [Link to proof of concept]
284
+
285
+ ---
286
+
287
+ **Review History**:
288
+ - {date}: Proposed by ROR
289
+ - {date}: Discussed with team
290
+ - {date}: Accepted by {user}
291
+ ```
292
+
293
+ **Example ADR**:
294
+
295
+ ```markdown
296
+ # ADR-002: Use Message Queue for Notification System
297
+
298
+ **Status**: Accepted
299
+ **Date**: 2025-10-11
300
+ **Deciders**: ROR, User
301
+ **Context**: Multi-channel notification system (PRD-2025-001)
302
+
303
+ ---
304
+
305
+ ## Context
306
+
307
+ The notification system must handle 10,000+ notifications daily across email, SMS, and push channels. Peak load can reach 500 notifications/minute during system events.
308
+
309
+ Current approach (direct sending) would:
310
+ - Block request threads during sending
311
+ - Fail silently on third-party API outages
312
+ - Provide no retry mechanism
313
+ - Make it hard to add new channels
314
+
315
+ ## Decision
316
+
317
+ Implement message queue architecture using RabbitMQ with:
318
+ - Separate queues per channel (email-queue, sms-queue, push-queue)
319
+ - Worker processes consuming from queues
320
+ - Dead letter queue (DLQ) for failed messages
321
+ - Retry logic with exponential backoff
322
+
323
+ ## Consequences
324
+
325
+ ### Positive
326
+
327
+ - **Async Processing**: Request threads don't block on notification sending
328
+ - **Reliability**: Failed messages retry automatically (up to 3 attempts)
329
+ - **Scalability**: Can add more workers to handle load
330
+ - **Observability**: Queue depth shows system health
331
+ - **Flexibility**: Easy to add new channels (new queue + worker)
332
+
333
+ ### Negative
334
+
335
+ - **Complexity**: Requires RabbitMQ infrastructure
336
+ - **Eventual Consistency**: Notifications sent eventually, not immediately
337
+ - **Operational Overhead**: Monitor queue health, manage workers
338
+ - **Cost**: Additional infrastructure (RabbitMQ server, worker instances)
339
+
340
+ ### Neutral
341
+
342
+ - **Learning Curve**: Team needs to learn RabbitMQ patterns
343
+ - **Message Format**: Need to standardize message schema
344
+
345
+ ## Alternatives Considered
346
+
347
+ ### Alternative 1: Direct Sending (Status Quo)
348
+
349
+ **Description**: Send notifications directly from API endpoints
350
+
351
+ **Pros**:
352
+ - Simple implementation
353
+ - No additional infrastructure
354
+ - Immediate sending (not async)
355
+
356
+ **Cons**:
357
+ - Blocks request threads (slow API responses)
358
+ - No retry on failure
359
+ - Hard to scale
360
+ - Tight coupling to third-party APIs
361
+
362
+ **Why Rejected**: Doesn't meet reliability and scalability requirements
363
+
364
+ ### Alternative 2: Database-Based Queue
365
+
366
+ **Description**: Use database table as queue (job_queue table), polled by workers
367
+
368
+ **Pros**:
369
+ - No new infrastructure (use existing DB)
370
+ - Simple to implement
371
+ - ACID guarantees
372
+
373
+ **Cons**:
374
+ - DB becomes bottleneck at scale
375
+ - Polling creates DB load
376
+ - Lacks queue-specific features (DLQ, routing)
377
+ - Not designed for high-throughput queuing
378
+
379
+ **Why Rejected**: Won't scale to peak load (500/min), creates DB performance issues
380
+
381
+ ### Alternative 3: AWS SQS
382
+
383
+ **Description**: Use managed message queue service (AWS SQS)
384
+
385
+ **Pros**:
386
+ - Fully managed (no infrastructure to maintain)
387
+ - Highly scalable
388
+ - Pay-per-use pricing
389
+
390
+ **Cons**:
391
+ - Vendor lock-in (AWS only)
392
+ - Higher latency than self-hosted (network)
393
+ - Additional AWS cost
394
+ - Requires AWS account setup
395
+
396
+ **Why Rejected**: We're infrastructure-agnostic, prefer self-hosted solutions
397
+
398
+ ## Implementation Notes
399
+
400
+ **RabbitMQ Setup**:
401
+ - Use Docker Compose for local development
402
+ - Production: dedicated RabbitMQ cluster (3 nodes for HA)
403
+ - Enable management plugin for monitoring
404
+
405
+ **Message Schema**:
406
+ ```json
407
+ {
408
+ "id": "notif-123",
409
+ "channel": "email",
410
+ "recipient": "user@example.com",
411
+ "template": "welcome-email",
412
+ "data": { "userName": "John" },
413
+ "priority": 1,
414
+ "createdAt": "2025-10-11T10:00:00Z"
415
+ }
416
+ ```
417
+
418
+ **Worker Implementation**:
419
+ - Node.js workers using `amqplib`
420
+ - One worker process per channel initially
421
+ - Scale horizontally based on queue depth
422
+
423
+ ## References
424
+
425
+ - [PRD-2025-001: Multi-Channel Notification System](./requirements/PRD-2025-001.md)
426
+ - [RabbitMQ Documentation](https://www.rabbitmq.com/documentation.html)
427
+ - [Message Queue Patterns](https://www.enterpriseintegrationpatterns.com/)
428
+
429
+ ---
430
+
431
+ **Review History**:
432
+ - 2025-10-11: Proposed by ROR
433
+ - 2025-10-11: Discussed alternatives with team
434
+ - 2025-10-11: Accepted by user
435
+ ```
436
+
437
+ ---
438
+
439
+ ### 2.3 Design Document
440
+
441
+ **Required For**: Medium and Large scale
442
+ **Creator**: ROR (Technical Designer)
443
+ **Location**: `docs/plans/design/`
444
+ **Filename Pattern**: `DESIGN-{feature-name}-{date}.md`
445
+
446
+ **Template Structure**:
447
+
448
+ ```markdown
449
+ # Design Document: {Feature Name}
450
+
451
+ **Design ID**: DESIGN-{YYYY}-{NNN}
452
+ **Created**: {date}
453
+ **Author**: ROR
454
+ **Related**: PRD-{NNN} (if large scale)
455
+ **Status**: Draft | Approved | Implemented
456
+
457
+ ---
458
+
459
+ ## 1. Overview
460
+
461
+ [Brief description of what we're designing]
462
+
463
+ ## 2. Goals
464
+
465
+ - Goal 1
466
+ - Goal 2
467
+ - Goal 3
468
+
469
+ ## 3. Non-Goals
470
+
471
+ - Non-goal 1 (what we're explicitly NOT doing)
472
+ - Non-goal 2
473
+
474
+ ## 4. Architecture
475
+
476
+ ### 4.1 High-Level Design
477
+
478
+ [Diagram showing components and interactions]
479
+
480
+ ```mermaid
481
+ graph TD
482
+ A[Component A] --> B[Component B]
483
+ B --> C[Component C]
484
+ B --> D[Component D]
485
+ ```
486
+
487
+ ### 4.2 Component Descriptions
488
+
489
+ #### Component A: {Name}
490
+ **Responsibility**: [What does this component do?]
491
+ **Interface**: [API, functions, events]
492
+ **Dependencies**: [What does it depend on?]
493
+
494
+ [Repeat for each component]
495
+
496
+ ### 4.3 Data Flow
497
+
498
+ [Describe how data flows through the system]
499
+
500
+ ```
501
+ User Request
502
+
503
+ API Controller
504
+
505
+ Service Layer
506
+
507
+ Database
508
+ ```
509
+
510
+ ## 5. Detailed Design
511
+
512
+ ### 5.1 API Endpoints
513
+
514
+ #### POST /api/users
515
+ **Description**: Create new user
516
+ **Request**:
517
+ ```json
518
+ {
519
+ "email": "user@example.com",
520
+ "password": "secure123",
521
+ "name": "John Doe"
522
+ }
523
+ ```
524
+
525
+ **Response** (201 Created):
526
+ ```json
527
+ {
528
+ "id": "user-123",
529
+ "email": "user@example.com",
530
+ "name": "John Doe",
531
+ "createdAt": "2025-10-11T10:00:00Z"
532
+ }
533
+ ```
534
+
535
+ **Errors**:
536
+ - 400: Invalid email format
537
+ - 409: Email already exists
538
+
539
+ [Repeat for each endpoint]
540
+
541
+ ### 5.2 Database Schema
542
+
543
+ ```sql
544
+ CREATE TABLE users (
545
+ id VARCHAR(36) PRIMARY KEY,
546
+ email VARCHAR(255) UNIQUE NOT NULL,
547
+ password_hash VARCHAR(255) NOT NULL,
548
+ name VARCHAR(255),
549
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
550
+ INDEX idx_email (email)
551
+ );
552
+ ```
553
+
554
+ ### 5.3 Core Algorithms
555
+
556
+ #### User Validation Algorithm
557
+
558
+ ```
559
+ function validateUser(user):
560
+ if not user.email:
561
+ throw Error("Email required")
562
+
563
+ if not isValidEmail(user.email):
564
+ throw Error("Invalid email format")
565
+
566
+ if not user.password or user.password.length < 8:
567
+ throw Error("Password must be at least 8 characters")
568
+
569
+ return true
570
+ ```
571
+
572
+ ## 6. Error Handling
573
+
574
+ | Error | Cause | Response | User Message |
575
+ |-------|-------|----------|--------------|
576
+ | EmailExistsError | Duplicate email | 409 Conflict | "Email already registered" |
577
+ | ValidationError | Invalid input | 400 Bad Request | "Invalid email format" |
578
+
579
+ ## 7. Security Considerations
580
+
581
+ - Passwords hashed using bcrypt (cost factor: 12)
582
+ - JWT tokens for authentication (expiry: 7 days)
583
+ - Rate limiting: 5 requests/second per IP
584
+ - Input sanitization to prevent SQL injection
585
+
586
+ ## 8. Performance Considerations
587
+
588
+ - Database indexes on `email` field
589
+ - Connection pooling (max: 20 connections)
590
+ - Response caching for GET requests (TTL: 5 min)
591
+ - Target response time: <200ms (p95)
592
+
593
+ ## 9. Testing Strategy
594
+
595
+ ### 9.1 Unit Tests
596
+ - Test each service method independently
597
+ - Mock database and external APIs
598
+ - Target: 80%+ coverage
599
+
600
+ ### 9.2 Integration Tests
601
+ - Test API endpoints end-to-end
602
+ - Use test database
603
+ - Verify database state changes
604
+
605
+ ### 9.3 E2E Tests (if large scale)
606
+ - Test complete user flows
607
+ - Use real browser/API client
608
+ - Cover critical paths only
609
+
610
+ ## 10. Verification Levels
611
+
612
+ **This design is**: Level 2 (L2)
613
+
614
+ - **L1 (Low)**: Simple CRUD, no external dependencies
615
+ - **L2 (Medium)**: Moderate complexity, <5 dependencies → **This design**
616
+ - **L3 (High)**: Complex, >5 dependencies, critical path
617
+
618
+ **Verification Requirements** (L2):
619
+ - Unit tests required
620
+ - Integration tests required
621
+ - Code review by DRA
622
+
623
+ ## 11. Open Questions
624
+
625
+ - [ ] Question 1: How should we handle password reset flow?
626
+ - [ ] Question 2: Should we support OAuth login?
627
+
628
+ ---
629
+
630
+ **Review History**:
631
+ - {date}: Created by ROR
632
+ - {date}: Reviewed and approved by {user}
633
+ ```
634
+
635
+ ---
636
+
637
+ ### 2.4 Work Plan
638
+
639
+ **Required For**: Medium and Large scale
640
+ **Creator**: TRA (Work Planner)
641
+ **Location**: `docs/plans/plans/`
642
+ **Filename Pattern**: `PLAN-{feature-name}-{date}.md`
643
+
644
+ **Template Structure**:
645
+
646
+ ```markdown
647
+ # Work Plan: {Feature Name}
648
+
649
+ **Plan ID**: PLAN-{YYYY}-{NNN}
650
+ **Created**: {date}
651
+ **Author**: TRA
652
+ **Related**: DESIGN-{NNN}
653
+ **Estimated Duration**: {X} hours/days
654
+
655
+ ---
656
+
657
+ ## 1. Overview
658
+
659
+ [Brief description of implementation plan]
660
+
661
+ ## 2. Implementation Phases
662
+
663
+ ### Phase 1: {Phase Name}
664
+
665
+ **Duration**: {X} hours
666
+ **Deliverables**: {List of deliverables}
667
+
668
+ **Tasks**:
669
+ 1. Task 1 description
670
+ 2. Task 2 description
671
+ 3. Task 3 description
672
+
673
+ **Dependencies**: None | Phase X
674
+
675
+ **Quality Gate**: BAS 6-phase after phase completion
676
+
677
+ ### Phase 2: {Phase Name}
678
+
679
+ [Same structure as Phase 1]
680
+
681
+ ### Phase 3: {Phase Name}
682
+
683
+ [Same structure as Phase 1]
684
+
685
+ ## 3. Task Dependencies
686
+
687
+ ```mermaid
688
+ graph LR
689
+ P1[Phase 1] --> P2[Phase 2]
690
+ P2 --> P3[Phase 3]
691
+ P1 --> P3
692
+ ```
693
+
694
+ ## 4. Stop Points
695
+
696
+ **Stop Point 1**: After Phase X
697
+ - User reviews {deliverable}
698
+ - Approves before proceeding to Phase Y
699
+
700
+ [Repeat for each stop point based on scale]
701
+
702
+ ## 5. Quality Gates
703
+
704
+ **Integration Points**:
705
+ - After each phase: BAS 6-phase quality gate
706
+ - After all phases: Full regression testing
707
+ - Before commit: DRA code review
708
+
709
+ ## 6. Risks
710
+
711
+ | Risk | Mitigation |
712
+ |------|------------|
713
+ | Risk 1: External API downtime | Use mock API for development |
714
+ | Risk 2: Database migration complexity | Test on copy of production data |
715
+
716
+ ## 7. Rollback Plan
717
+
718
+ If implementation fails:
719
+ 1. Revert commits: `git reset --hard HEAD~N`
720
+ 2. Restore database: Use backup from before start
721
+ 3. Notify team: Via Slack/Email
722
+
723
+ ---
724
+
725
+ **Review History**:
726
+ - {date}: Created by TRA
727
+ - {date}: Reviewed and approved by {user}
728
+ ```
729
+
730
+ ---
731
+
732
+ ### 2.5 Task Breakdown
733
+
734
+ **Required For**: Medium and Large scale
735
+ **Creator**: EUS (Task Decomposer)
736
+ **Location**: `docs/plans/tasks/`
737
+ **Filename Pattern**: `TASKS-{feature-name}-{date}.md`
738
+
739
+ **Template Structure**:
740
+
741
+ ```markdown
742
+ # Task Breakdown: {Feature Name}
743
+
744
+ **Task List ID**: TASKS-{YYYY}-{NNN}
745
+ **Created**: {date}
746
+ **Author**: EUS
747
+ **Related**: PLAN-{NNN}
748
+ **Total Tasks**: {N}
749
+
750
+ ---
751
+
752
+ ## Task List
753
+
754
+ ### Task 1: {Task Name}
755
+
756
+ **ID**: T-001
757
+ **Phase**: RED (Test) | GREEN (Implementation) | REFACTOR
758
+ **Estimated**: {X} minutes
759
+ **Dependencies**: None | T-XXX, T-YYY
760
+ **Granularity**: 1 commit
761
+
762
+ **Description**:
763
+ [What this task accomplishes]
764
+
765
+ **Acceptance Criteria**:
766
+ - [ ] Criterion 1
767
+ - [ ] Criterion 2
768
+
769
+ **Files Modified**:
770
+ - `src/file1.js`
771
+ - `tests/file1.test.js`
772
+
773
+ **Test Strategy**:
774
+ - Write failing test for {functionality}
775
+ - Implement {functionality}
776
+ - Ensure test passes
777
+
778
+ ---
779
+
780
+ ### Task 2: {Task Name}
781
+
782
+ [Same structure as Task 1]
783
+
784
+ [Repeat for all tasks]
785
+
786
+ ---
787
+
788
+ ## Task Summary
789
+
790
+ **Total Tasks**: {N}
791
+ **Estimated Duration**: {X} hours
792
+ **Parallel Tasks**: {N} (tasks with no dependencies)
793
+ **Sequential Tasks**: {N} (tasks with dependencies)
794
+
795
+ ## Dependency Graph
796
+
797
+ ```mermaid
798
+ graph TD
799
+ T1[Task 1] --> T3[Task 3]
800
+ T2[Task 2] --> T3
801
+ T3 --> T4[Task 4]
802
+ ```
803
+
804
+ **Critical Path**: T1 → T3 → T4 ({X} hours)
805
+
806
+ **Max Dependency Depth**: 2 levels ✅
807
+
808
+ ---
809
+
810
+ **Review History**:
811
+ - {date}: Created by EUS
812
+ - {date}: Reviewed and approved by {user}
813
+ ```
814
+
815
+ ---
816
+
817
+ ### 2.6 Inline Documentation
818
+
819
+ **Required For**: All scales
820
+ **Creator**: KIL (Task Executor) during implementation
821
+ **Location**: Within source code files
822
+
823
+ **Requirements**:
824
+
825
+ **1. Function Documentation (JSDoc)**:
826
+
827
+ ```javascript
828
+ /**
829
+ * Calculates the total price including tax and shipping
830
+ * @param {Object} order - The order object
831
+ * @param {number} order.subtotal - Order subtotal
832
+ * @param {number} order.taxRate - Tax rate (0-1)
833
+ * @param {number} order.shippingCost - Shipping cost
834
+ * @returns {number} Total price
835
+ * @throws {ValidationError} If order is invalid
836
+ * @example
837
+ * const total = calculateTotal({
838
+ * subtotal: 100,
839
+ * taxRate: 0.10,
840
+ * shippingCost: 5
841
+ * });
842
+ * // Returns: 115
843
+ */
844
+ function calculateTotal(order) {
845
+ // Implementation
846
+ }
847
+ ```
848
+
849
+ **2. Complex Logic Comments**:
850
+
851
+ ```javascript
852
+ function processPayment(payment) {
853
+ // Use exponential backoff for retries to avoid overwhelming payment gateway
854
+ // Formula: delay = baseDelay * 2^retryAttempt
855
+ // Max retries: 3 (delays: 1s, 2s, 4s)
856
+ const delay = baseDelay * Math.pow(2, retryAttempt);
857
+
858
+ // Business rule: Payments over $1000 require additional verification
859
+ // per compliance requirement SEC-042
860
+ if (payment.amount > 1000) {
861
+ requireAdditionalVerification(payment);
862
+ }
863
+ }
864
+ ```
865
+
866
+ **3. File Headers** (for large scale):
867
+
868
+ ```javascript
869
+ /**
870
+ * User Service
871
+ *
872
+ * Handles user CRUD operations and authentication.
873
+ *
874
+ * Architecture:
875
+ * - Uses UserRepository for database access
876
+ * - Emits events via EventEmitter for user lifecycle
877
+ * - Integrates with EmailService for welcome emails
878
+ *
879
+ * Related:
880
+ * - PRD-2025-001: User Management System
881
+ * - DESIGN-2025-005: User Service Architecture
882
+ *
883
+ * @module services/userService
884
+ */
885
+ ```
886
+
887
+ **4. TODOs** (temporary, should be resolved):
888
+
889
+ ```javascript
890
+ // TODO: Add rate limiting to prevent abuse (see ISSUE-123)
891
+ // TODO: Implement caching for frequently accessed users (PERF-045)
892
+ // FIXME: This fails for users with special characters in name (BUG-078)
893
+ ```
894
+
895
+ ---
896
+
897
+ ## 3. Documentation Quality Standards
898
+
899
+ ### 3.1 Completeness
900
+
901
+ **All documents must include**:
902
+ - Clear title and metadata (ID, date, author)
903
+ - Purpose/overview section
904
+ - All required sections per template
905
+ - Review history
906
+
907
+ **BON (Document Reviewer) validates**:
908
+ - All required sections present
909
+ - No placeholder text (e.g., "{TODO}", "TBD")
910
+ - Examples provided where helpful
911
+ - Cross-references to related docs
912
+
913
+ ### 3.2 Clarity
914
+
915
+ **Documentation must be**:
916
+ - Understandable by team members unfamiliar with the feature
917
+ - Free of jargon (or jargon explained)
918
+ - Consistent terminology throughout
919
+ - Well-structured (headings, lists, tables)
920
+
921
+ **BON checks for**:
922
+ - Readability (clear sentences, logical flow)
923
+ - Consistent terminology (e.g., "user" vs "account holder")
924
+ - Proper formatting (markdown syntax)
925
+ - Diagrams where helpful (architecture, flow)
926
+
927
+ ### 3.3 Accuracy
928
+
929
+ **Documentation must**:
930
+ - Match implementation (or vice versa)
931
+ - Be updated when code changes
932
+ - Contain no outdated information
933
+ - Reference correct file paths and IDs
934
+
935
+ **BON validates**:
936
+ - Cross-references are valid (PRD IDs, design IDs exist)
937
+ - Code examples are syntactically correct
938
+ - File paths are accurate
939
+ - Dates and version numbers consistent
940
+
941
+ ### 3.4 Maintainability
942
+
943
+ **Documentation should**:
944
+ - Use templates consistently
945
+ - Be version controlled (git)
946
+ - Have clear review history
947
+ - Be updated as part of feature changes
948
+
949
+ **BON ensures**:
950
+ - Templates followed correctly
951
+ - Review history populated
952
+ - Status updated (Draft → Approved → Implemented)
953
+ - Related docs linked
954
+
955
+ ---
956
+
957
+ ## 4. Documentation Workflow
958
+
959
+ ### 4.1 Small Scale Workflow
960
+
961
+ ```
962
+ User Request → MON (analyze)
963
+
964
+ KIL (implement with inline docs)
965
+
966
+ BAS (quality gate)
967
+
968
+ [Commit with inline docs only]
969
+ ```
970
+
971
+ **No separate documents created** - inline documentation sufficient.
972
+
973
+ ### 4.2 Medium Scale Workflow
974
+
975
+ ```
976
+ User Request → MON (analyze)
977
+
978
+ ROR (create design doc)
979
+
980
+ 🛑 STOP: User reviews DESIGN doc
981
+
982
+ TRA (create work plan)
983
+
984
+ EUS (create task breakdown)
985
+
986
+ 🛑 STOP: User reviews PLAN + TASKS
987
+
988
+ KIL (implement with inline docs)
989
+
990
+ BAS (quality gate)
991
+
992
+ DRA (review code + docs)
993
+
994
+ [Commit with DESIGN, PLAN, TASKS, inline docs]
995
+ ```
996
+
997
+ **Documents created**: Design Doc, Work Plan, Task Breakdown
998
+
999
+ ### 4.3 Large Scale Workflow
1000
+
1001
+ ```
1002
+ Investigation → CAP (create PRD)
1003
+
1004
+ 🛑 STOP: User reviews PRD
1005
+
1006
+ MON (analyze PRD)
1007
+
1008
+ ROR (create ADR for major decisions)
1009
+
1010
+ 🛑 STOP: User reviews ADR
1011
+
1012
+ ROR (create design doc)
1013
+
1014
+ 🛑 STOP: User reviews DESIGN
1015
+
1016
+ TRA (create work plan)
1017
+
1018
+ EUS (create task breakdown)
1019
+
1020
+ 🛑 STOP: User reviews PLAN + TASKS
1021
+
1022
+ KIL (implement with inline docs)
1023
+
1024
+ BAS (quality gate)
1025
+
1026
+ APO (create E2E acceptance tests)
1027
+
1028
+ DRA (review code + docs)
1029
+
1030
+ BON (review all documentation)
1031
+
1032
+ [Commit with PRD, ADR, DESIGN, PLAN, TASKS, inline docs]
1033
+ ```
1034
+
1035
+ **Documents created**: PRD, ADR, Design Doc, Work Plan, Task Breakdown, E2E Tests
1036
+
1037
+ ---
1038
+
1039
+ ## 5. Enforcement
1040
+
1041
+ ### 5.1 BON (Document Reviewer)
1042
+
1043
+ **Reviews**:
1044
+ - PRD completeness (large scale)
1045
+ - ADR completeness (large scale)
1046
+ - Design doc completeness (medium/large)
1047
+ - Work plan completeness (medium/large)
1048
+ - Task breakdown completeness (medium/large)
1049
+ - Documentation consistency across all docs
1050
+
1051
+ **Scores**:
1052
+ - 90-100: Excellent
1053
+ - 80-89: Good
1054
+ - 70-79: Acceptable
1055
+ - <70: Needs improvement
1056
+
1057
+ **Blocks commit if**: Documentation score <70 (large scale only)
1058
+
1059
+ ### 5.2 DRA (Code Reviewer)
1060
+
1061
+ **Reviews**:
1062
+ - Inline documentation quality
1063
+ - JSDoc completeness
1064
+ - Comment clarity
1065
+ - Code-documentation match
1066
+
1067
+ **Provides feedback if**: Inline docs insufficient or outdated
1068
+
1069
+ ### 5.3 ZEN (Documentation Specialist)
1070
+
1071
+ **Maintains**:
1072
+ - This document (DOCUMENTATION-CRITERIA.md)
1073
+ - ARCHITECTURE.md
1074
+ - ISSUES.md
1075
+ - Technical-Debt.md
1076
+
1077
+ **Ensures**: Project-level documentation stays up-to-date
1078
+
1079
+ ---
1080
+
1081
+ ## References
1082
+
1083
+ - AI-DEVELOPMENT-GUIDE.md (scale-based workflows)
1084
+ - CODING-PRINCIPLES.md (inline doc standards)
1085
+ - TESTING-PRINCIPLES.md (test documentation)
1086
+
1087
+ ---
1088
+
1089
+ ## 📝 WHEN TO UPDATE THIS DOCUMENT
1090
+
1091
+ This **standards document** updates rarely - only when documentation standards evolve.
1092
+
1093
+ ### When to Update ⚠️
1094
+
1095
+ Update **only when documentation requirements change**:
1096
+
1097
+ - ✅ **New Template Added**: Team adds new documentation type (e.g., API spec template)
1098
+ - ✅ **Scale Criteria Adjusted**: Team changes file count thresholds for Small/Medium/Large
1099
+ - ✅ **Documentation Quality Standard Changed**: Team adjusts completeness/clarity/accuracy requirements
1100
+ - ✅ **Workflow Improved**: Team discovers better documentation workflow
1101
+
1102
+ ### How to Update
1103
+
1104
+ 1. Add new template to Templates section (if new doc type)
1105
+ 2. Update scale-based requirements matrix if thresholds change
1106
+ 3. Update quality standards if team consensus changes
1107
+ 4. Update workflow diagrams if process improves
1108
+ 5. Update timestamp: `Last reviewed: {{date}}`
1109
+
1110
+ **Cross-References**: When updating, also update [AI-DEVELOPMENT-GUIDE.md](./AI-DEVELOPMENT-GUIDE.md) if workflows changed.
1111
+
1112
+ **Update Frequency**: Very rare (annually or less) - documentation standards are very stable
1113
+
1114
+ ---
1115
+
1116
+ **Document maintained by**: ZEN (Documentation Specialist)
1117
+ **Enforced by**: BON (Document Reviewer), ROR (Design Creator), CAP (PRD Creator)
1118
+ **Last reviewed**: {{date}}