chati-dev 1.4.0 → 2.0.2

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 (208) hide show
  1. package/README.md +40 -24
  2. package/framework/agents/build/dev.md +343 -0
  3. package/framework/agents/clarity/architect.md +112 -0
  4. package/framework/agents/clarity/brief.md +182 -0
  5. package/framework/agents/clarity/brownfield-wu.md +181 -0
  6. package/framework/agents/clarity/detail.md +110 -0
  7. package/framework/agents/clarity/greenfield-wu.md +153 -0
  8. package/framework/agents/clarity/ux.md +112 -0
  9. package/framework/config.yaml +3 -3
  10. package/framework/constitution.md +31 -1
  11. package/framework/context/governance.md +37 -0
  12. package/framework/context/protocols.md +34 -0
  13. package/framework/context/quality.md +27 -0
  14. package/framework/context/root.md +24 -0
  15. package/framework/data/entity-registry.yaml +1 -1
  16. package/framework/domains/agents/architect.yaml +51 -0
  17. package/framework/domains/agents/brief.yaml +47 -0
  18. package/framework/domains/agents/brownfield-wu.yaml +49 -0
  19. package/framework/domains/agents/detail.yaml +47 -0
  20. package/framework/domains/agents/dev.yaml +49 -0
  21. package/framework/domains/agents/devops.yaml +43 -0
  22. package/framework/domains/agents/greenfield-wu.yaml +47 -0
  23. package/framework/domains/agents/orchestrator.yaml +49 -0
  24. package/framework/domains/agents/phases.yaml +47 -0
  25. package/framework/domains/agents/qa-implementation.yaml +43 -0
  26. package/framework/domains/agents/qa-planning.yaml +44 -0
  27. package/framework/domains/agents/tasks.yaml +48 -0
  28. package/framework/domains/agents/ux.yaml +50 -0
  29. package/framework/domains/constitution.yaml +77 -0
  30. package/framework/domains/global.yaml +64 -0
  31. package/framework/domains/workflows/brownfield-discovery.yaml +16 -0
  32. package/framework/domains/workflows/brownfield-fullstack.yaml +26 -0
  33. package/framework/domains/workflows/brownfield-service.yaml +22 -0
  34. package/framework/domains/workflows/brownfield-ui.yaml +22 -0
  35. package/framework/domains/workflows/greenfield-fullstack.yaml +26 -0
  36. package/framework/hooks/constitution-guard.js +101 -0
  37. package/framework/hooks/mode-governance.js +92 -0
  38. package/framework/hooks/model-governance.js +76 -0
  39. package/framework/hooks/prism-engine.js +89 -0
  40. package/framework/hooks/session-digest.js +60 -0
  41. package/framework/hooks/settings.json +44 -0
  42. package/framework/i18n/en.yaml +3 -3
  43. package/framework/i18n/es.yaml +3 -3
  44. package/framework/i18n/fr.yaml +3 -3
  45. package/framework/i18n/pt.yaml +3 -3
  46. package/framework/intelligence/decision-engine.md +1 -1
  47. package/framework/migrations/v1.4-to-v2.0.yaml +167 -0
  48. package/framework/migrations/v2.0-to-v2.0.1.yaml +132 -0
  49. package/framework/orchestrator/chati.md +284 -6
  50. package/framework/tasks/architect-api-design.md +63 -0
  51. package/framework/tasks/architect-consolidate.md +47 -0
  52. package/framework/tasks/architect-db-design.md +73 -0
  53. package/framework/tasks/architect-design.md +95 -0
  54. package/framework/tasks/architect-security-review.md +62 -0
  55. package/framework/tasks/architect-stack-selection.md +53 -0
  56. package/framework/tasks/brief-consolidate.md +249 -0
  57. package/framework/tasks/brief-constraint-identify.md +277 -0
  58. package/framework/tasks/brief-extract-requirements.md +339 -0
  59. package/framework/tasks/brief-stakeholder-map.md +176 -0
  60. package/framework/tasks/brief-validate-completeness.md +121 -0
  61. package/framework/tasks/brownfield-wu-architecture-map.md +394 -0
  62. package/framework/tasks/brownfield-wu-deep-discovery.md +312 -0
  63. package/framework/tasks/brownfield-wu-dependency-scan.md +359 -0
  64. package/framework/tasks/brownfield-wu-migration-plan.md +483 -0
  65. package/framework/tasks/brownfield-wu-report.md +325 -0
  66. package/framework/tasks/brownfield-wu-risk-assess.md +424 -0
  67. package/framework/tasks/detail-acceptance-criteria.md +372 -0
  68. package/framework/tasks/detail-consolidate.md +138 -0
  69. package/framework/tasks/detail-edge-case-analysis.md +300 -0
  70. package/framework/tasks/detail-expand-prd.md +389 -0
  71. package/framework/tasks/detail-nfr-extraction.md +223 -0
  72. package/framework/tasks/dev-code-review.md +404 -0
  73. package/framework/tasks/dev-consolidate.md +543 -0
  74. package/framework/tasks/dev-debug.md +322 -0
  75. package/framework/tasks/dev-implement.md +252 -0
  76. package/framework/tasks/dev-iterate.md +411 -0
  77. package/framework/tasks/dev-pr-prepare.md +497 -0
  78. package/framework/tasks/dev-refactor.md +342 -0
  79. package/framework/tasks/dev-test-write.md +306 -0
  80. package/framework/tasks/devops-ci-setup.md +412 -0
  81. package/framework/tasks/devops-consolidate.md +712 -0
  82. package/framework/tasks/devops-deploy-config.md +598 -0
  83. package/framework/tasks/devops-monitoring-setup.md +658 -0
  84. package/framework/tasks/devops-release-prepare.md +673 -0
  85. package/framework/tasks/greenfield-wu-analyze-empty.md +169 -0
  86. package/framework/tasks/greenfield-wu-report.md +266 -0
  87. package/framework/tasks/greenfield-wu-scaffold-detection.md +203 -0
  88. package/framework/tasks/greenfield-wu-tech-stack-assess.md +255 -0
  89. package/framework/tasks/orchestrator-deviation.md +260 -0
  90. package/framework/tasks/orchestrator-escalate.md +276 -0
  91. package/framework/tasks/orchestrator-handoff.md +243 -0
  92. package/framework/tasks/orchestrator-health.md +372 -0
  93. package/framework/tasks/orchestrator-mode-switch.md +262 -0
  94. package/framework/tasks/orchestrator-resume.md +189 -0
  95. package/framework/tasks/orchestrator-route.md +169 -0
  96. package/framework/tasks/orchestrator-spawn-terminal.md +358 -0
  97. package/framework/tasks/orchestrator-status.md +260 -0
  98. package/framework/tasks/orchestrator-suggest-mode.md +372 -0
  99. package/framework/tasks/phases-breakdown.md +91 -0
  100. package/framework/tasks/phases-dependency-mapping.md +67 -0
  101. package/framework/tasks/phases-mvp-scoping.md +94 -0
  102. package/framework/tasks/qa-impl-consolidate.md +522 -0
  103. package/framework/tasks/qa-impl-performance-test.md +487 -0
  104. package/framework/tasks/qa-impl-regression-check.md +413 -0
  105. package/framework/tasks/qa-impl-sast-scan.md +402 -0
  106. package/framework/tasks/qa-impl-test-execute.md +344 -0
  107. package/framework/tasks/qa-impl-verdict.md +339 -0
  108. package/framework/tasks/qa-planning-consolidate.md +309 -0
  109. package/framework/tasks/qa-planning-coverage-plan.md +338 -0
  110. package/framework/tasks/qa-planning-gate-define.md +339 -0
  111. package/framework/tasks/qa-planning-risk-matrix.md +631 -0
  112. package/framework/tasks/qa-planning-test-strategy.md +217 -0
  113. package/framework/tasks/tasks-acceptance-write.md +75 -0
  114. package/framework/tasks/tasks-consolidate.md +57 -0
  115. package/framework/tasks/tasks-decompose.md +80 -0
  116. package/framework/tasks/tasks-estimate.md +66 -0
  117. package/framework/tasks/ux-a11y-check.md +49 -0
  118. package/framework/tasks/ux-component-map.md +55 -0
  119. package/framework/tasks/ux-consolidate.md +46 -0
  120. package/framework/tasks/ux-user-flow.md +46 -0
  121. package/framework/tasks/ux-wireframe.md +76 -0
  122. package/package.json +2 -2
  123. package/scripts/bundle-framework.js +2 -0
  124. package/scripts/changelog-generator.js +222 -0
  125. package/scripts/codebase-mapper.js +728 -0
  126. package/scripts/commit-message-generator.js +167 -0
  127. package/scripts/coverage-analyzer.js +260 -0
  128. package/scripts/dependency-analyzer.js +280 -0
  129. package/scripts/framework-analyzer.js +308 -0
  130. package/scripts/generate-constitution-domain.js +253 -0
  131. package/scripts/health-check.js +481 -0
  132. package/scripts/ide-sync.js +327 -0
  133. package/scripts/performance-analyzer.js +325 -0
  134. package/scripts/plan-tracker.js +278 -0
  135. package/scripts/populate-entity-registry.js +481 -0
  136. package/scripts/pr-review.js +317 -0
  137. package/scripts/rollback-manager.js +310 -0
  138. package/scripts/stuck-detector.js +343 -0
  139. package/scripts/test-quality-assessment.js +257 -0
  140. package/scripts/validate-agents.js +367 -0
  141. package/scripts/validate-tasks.js +465 -0
  142. package/src/autonomy/autonomous-gate.js +293 -0
  143. package/src/autonomy/index.js +51 -0
  144. package/src/autonomy/mode-manager.js +225 -0
  145. package/src/autonomy/mode-suggester.js +283 -0
  146. package/src/autonomy/progress-reporter.js +268 -0
  147. package/src/autonomy/safety-net.js +320 -0
  148. package/src/context/bracket-tracker.js +79 -0
  149. package/src/context/domain-loader.js +107 -0
  150. package/src/context/engine.js +144 -0
  151. package/src/context/formatter.js +184 -0
  152. package/src/context/index.js +4 -0
  153. package/src/context/layers/l0-constitution.js +28 -0
  154. package/src/context/layers/l1-global.js +37 -0
  155. package/src/context/layers/l2-agent.js +39 -0
  156. package/src/context/layers/l3-workflow.js +42 -0
  157. package/src/context/layers/l4-task.js +24 -0
  158. package/src/decision/analyzer.js +167 -0
  159. package/src/decision/engine.js +270 -0
  160. package/src/decision/index.js +38 -0
  161. package/src/decision/registry-healer.js +450 -0
  162. package/src/decision/registry-updater.js +330 -0
  163. package/src/gates/circuit-breaker.js +119 -0
  164. package/src/gates/g1-planning-complete.js +153 -0
  165. package/src/gates/g2-qa-planning.js +153 -0
  166. package/src/gates/g3-implementation.js +188 -0
  167. package/src/gates/g4-qa-implementation.js +207 -0
  168. package/src/gates/g5-deploy-ready.js +180 -0
  169. package/src/gates/gate-base.js +144 -0
  170. package/src/gates/index.js +46 -0
  171. package/src/installer/brownfield-upgrader.js +249 -0
  172. package/src/installer/core.js +82 -11
  173. package/src/installer/file-hasher.js +51 -0
  174. package/src/installer/manifest.js +117 -0
  175. package/src/installer/templates.js +17 -15
  176. package/src/installer/transaction.js +229 -0
  177. package/src/installer/validator.js +18 -1
  178. package/src/intelligence/registry-manager.js +2 -2
  179. package/src/memory/agent-memory.js +255 -0
  180. package/src/memory/gotchas-injector.js +72 -0
  181. package/src/memory/gotchas.js +361 -0
  182. package/src/memory/index.js +35 -0
  183. package/src/memory/search.js +233 -0
  184. package/src/memory/session-digest.js +239 -0
  185. package/src/merger/env-merger.js +112 -0
  186. package/src/merger/index.js +56 -0
  187. package/src/merger/replace-merger.js +51 -0
  188. package/src/merger/yaml-merger.js +127 -0
  189. package/src/orchestrator/agent-selector.js +285 -0
  190. package/src/orchestrator/deviation-handler.js +350 -0
  191. package/src/orchestrator/handoff-engine.js +271 -0
  192. package/src/orchestrator/index.js +67 -0
  193. package/src/orchestrator/intent-classifier.js +264 -0
  194. package/src/orchestrator/pipeline-manager.js +492 -0
  195. package/src/orchestrator/pipeline-state.js +223 -0
  196. package/src/orchestrator/session-manager.js +409 -0
  197. package/src/tasks/executor.js +195 -0
  198. package/src/tasks/handoff.js +226 -0
  199. package/src/tasks/index.js +4 -0
  200. package/src/tasks/loader.js +210 -0
  201. package/src/tasks/router.js +182 -0
  202. package/src/terminal/collector.js +216 -0
  203. package/src/terminal/index.js +30 -0
  204. package/src/terminal/isolation.js +129 -0
  205. package/src/terminal/monitor.js +277 -0
  206. package/src/terminal/spawner.js +269 -0
  207. package/src/upgrade/checker.js +1 -1
  208. package/src/wizard/i18n.js +3 -3
@@ -0,0 +1,631 @@
1
+ ---
2
+ id: qa-planning-risk-matrix
3
+ agent: qa-planning
4
+ trigger: qa-planning-coverage-plan
5
+ phase: clarity
6
+ requires_input: false
7
+ parallelizable: false
8
+ outputs: [risk-matrix.yaml]
9
+ handoff_to: qa-planning-consolidate
10
+ autonomous_gate: false
11
+ criteria:
12
+ - All features mapped to risk levels
13
+ - Risk mitigation strategies defined
14
+ - Testing priorities established
15
+ ---
16
+
17
+ # Risk Matrix Building
18
+
19
+ ## Purpose
20
+ Build a comprehensive risk matrix mapping all features, components, and workflows to risk levels (critical, high, medium, low) with corresponding mitigation strategies and testing priorities.
21
+
22
+ ## Prerequisites
23
+ - test-strategy.yaml with risk areas identified
24
+ - quality-gates.yaml with risk-based gate enforcement
25
+ - coverage-plan.yaml with module-level coverage targets
26
+ - Architecture and task documents showing all features
27
+
28
+ ## Steps
29
+
30
+ 1. **Enumerate All System Features**
31
+ - Core workflows: greenfield pipeline, brownfield pipeline, mode transitions
32
+ - Agent operations: task execution, handoffs, validation
33
+ - State management: session.yaml CRUD, consistency checks, concurrency
34
+ - File operations: create, read, write, delete, permissions
35
+ - CLI commands: /chati, npx chati-dev *, help, status
36
+ - Configuration: config.yaml loading, merging, validation
37
+ - Internationalization: locale detection, translation loading, rendering
38
+ - Upgrade system: version detection, migrations, backup/restore
39
+ - Error handling: error construction, formatting, recovery
40
+ - Mode governance: autonomous transitions, backward transitions, overrides
41
+
42
+ 2. **Assess Impact for Each Feature**
43
+ - **Critical Impact**: Data loss, corruption, or system unusable
44
+ - **High Impact**: Major functionality broken, workaround difficult
45
+ - **Medium Impact**: Minor functionality impaired, workaround available
46
+ - **Low Impact**: Cosmetic issues, inconvenience only
47
+
48
+ 3. **Assess Likelihood for Each Feature**
49
+ - **High Likelihood**: Complex logic, external dependencies, frequent changes
50
+ - **Medium Likelihood**: Moderate complexity, some dependencies, stable
51
+ - **Low Likelihood**: Simple logic, no dependencies, well-tested patterns
52
+
53
+ 4. **Calculate Risk Level (Impact × Likelihood)**
54
+ - **Critical**: Critical Impact + High Likelihood OR High Impact + High Likelihood
55
+ - **High**: Critical Impact + Medium Likelihood OR High Impact + Medium Likelihood
56
+ - **Medium**: Any Medium Impact OR High Impact + Low Likelihood
57
+ - **Low**: Low Impact (any likelihood)
58
+
59
+ 5. **Map Features to Risk Categories**
60
+ - Create a matrix with features in rows, impact/likelihood/risk in columns
61
+ - Group features by system area (orchestrator, agents, state, file, CLI, etc.)
62
+ - Highlight critical and high-risk items for priority testing
63
+
64
+ 6. **Define Risk-Specific Testing Strategies**
65
+ - **Critical Risk**: 90%+ coverage, integration tests, manual verification, security review
66
+ - **High Risk**: 80%+ coverage, integration tests, regression suite
67
+ - **Medium Risk**: 70%+ coverage, unit tests, spot checks
68
+ - **Low Risk**: 60%+ coverage, unit tests, automated checks
69
+
70
+ 7. **Identify Risk Mitigation Measures**
71
+ - **Technical Mitigations**: Input validation, error handling, rollback mechanisms, backup strategies
72
+ - **Process Mitigations**: Code review, pair programming, manual testing, staged rollouts
73
+ - **Monitoring**: Health checks, error logging, user feedback, metrics
74
+
75
+ 8. **Prioritize Testing Effort**
76
+ - **Priority 1 (Critical Risk)**: Test first, most thorough, block release on failures
77
+ - **Priority 2 (High Risk)**: Test early, comprehensive, block merge on failures
78
+ - **Priority 3 (Medium Risk)**: Test standard, adequate, warn on failures
79
+ - **Priority 4 (Low Risk)**: Test basic, minimal, informational on failures
80
+
81
+ 9. **Map Risk to Quality Gates**
82
+ - Cross-reference risk levels with quality-gates.yaml thresholds
83
+ - Ensure critical/high risk areas have strictest gate enforcement
84
+ - Validate that gate bypass procedures align with risk tolerance
85
+
86
+ 10. **Document Known Risk Acceptances**
87
+ - List risks that are accepted (not mitigated) with justification
88
+ - Document residual risk after mitigation
89
+ - Define monitoring/alerting for accepted risks
90
+
91
+ 11. **Create Risk Evolution Plan**
92
+ - Identify how risks change over project lifecycle (early phase: architecture risks, late phase: regression risks)
93
+ - Plan for risk reassessment triggers (major refactor, new feature, security incident)
94
+ - Schedule periodic risk reviews (monthly, per phase)
95
+
96
+ 12. **Compile Risk Matrix Document**
97
+ - Structure by system area with risk levels
98
+ - Include mitigation strategies and testing priorities
99
+ - Map to coverage targets and quality gates
100
+ - Add risk acceptance records
101
+
102
+ ## Decision Points
103
+
104
+ - **Risk Tolerance Calibration**: If stakeholders have different risk tolerances (e.g., startup vs enterprise), adjust impact/likelihood thresholds. Document the calibration in risk-matrix.yaml.
105
+
106
+ - **Testing Budget Trade-offs**: If timeline or resources are constrained, prioritize critical/high-risk testing. Document deferred medium/low-risk testing and residual risk acceptance.
107
+
108
+ - **Third-Party Risk**: For external dependencies (MCPs, npm packages), decide whether to include in risk matrix. Recommend: include integration points, exclude internal dependency logic (tested upstream).
109
+
110
+ ## Error Handling
111
+
112
+ **Incomplete Feature List**
113
+ - If architecture or task documents don't cover all features, use best judgment from codebase exploration
114
+ - Flag incomplete areas for architect/pm review
115
+ - Assign medium risk by default to unknown features
116
+
117
+ **Ambiguous Impact Assessment**
118
+ - If impact is unclear, err on the side of higher risk classification
119
+ - Document assumption and flag for stakeholder input
120
+ - Provide range (e.g., "Medium to High impact depending on user workflow")
121
+
122
+ **Conflicting Risk Assessments**
123
+ - If coverage-plan.yaml and risk assessment disagree on priority, resolve based on risk matrix (risk-driven approach)
124
+ - Escalate to orchestrator if significant discrepancy
125
+ - Document resolution in risk-matrix.yaml
126
+
127
+ ## Output Format
128
+
129
+ ```yaml
130
+ # risk-matrix.yaml
131
+ version: 1.0.0
132
+ created: YYYY-MM-DD
133
+ agent: qa-planning
134
+
135
+ risk_scoring:
136
+ impact:
137
+ critical: Data loss, corruption, system unusable
138
+ high: Major functionality broken, difficult workaround
139
+ medium: Minor functionality impaired, workaround available
140
+ low: Cosmetic issues, inconvenience only
141
+
142
+ likelihood:
143
+ high: Complex logic, external dependencies, frequent changes
144
+ medium: Moderate complexity, some dependencies, stable
145
+ low: Simple logic, no dependencies, well-tested patterns
146
+
147
+ calculation: "Critical = (Critical Impact + High Likelihood) OR (High Impact + High Likelihood)"
148
+
149
+ features:
150
+ # ORCHESTRATOR
151
+ - feature: Mode transition validation
152
+ area: orchestrator
153
+ impact: critical
154
+ likelihood: high
155
+ risk_level: critical
156
+ rationale: Invalid mode transitions can corrupt workflow state
157
+ mitigation:
158
+ - Strict validation in mode-governance.js
159
+ - Audit trail in session.yaml mode_transitions
160
+ - Rollback mechanism for failed transitions
161
+ testing_priority: 1
162
+ coverage_target: 95%
163
+ test_types: [unit, integration, e2e]
164
+ gate_enforcement: blocker
165
+
166
+ - feature: Agent routing logic
167
+ area: orchestrator
168
+ impact: high
169
+ likelihood: medium
170
+ risk_level: high
171
+ rationale: Incorrect routing can skip critical agents
172
+ mitigation:
173
+ - Decision tree validation
174
+ - Agent completion tracking
175
+ - Manual override with confirmation
176
+ testing_priority: 2
177
+ coverage_target: 85%
178
+ test_types: [unit, integration]
179
+ gate_enforcement: critical
180
+
181
+ - feature: Deviation protocol handling
182
+ area: orchestrator
183
+ impact: high
184
+ likelihood: medium
185
+ risk_level: high
186
+ rationale: Overrides can bypass quality gates
187
+ mitigation:
188
+ - User confirmation required
189
+ - Audit logging
190
+ - Temporal limits on overrides
191
+ testing_priority: 2
192
+ coverage_target: 80%
193
+ test_types: [unit, integration]
194
+ gate_enforcement: critical
195
+
196
+ # STATE MANAGEMENT
197
+ - feature: session.yaml write operations
198
+ area: state_management
199
+ impact: critical
200
+ likelihood: high
201
+ risk_level: critical
202
+ rationale: File corruption can lose all project state
203
+ mitigation:
204
+ - Atomic writes (write to temp, rename)
205
+ - Backup before write
206
+ - Schema validation on read
207
+ - Corruption detection
208
+ testing_priority: 1
209
+ coverage_target: 95%
210
+ test_types: [unit, integration, error_injection]
211
+ gate_enforcement: blocker
212
+
213
+ - feature: Concurrent state access
214
+ area: state_management
215
+ impact: critical
216
+ likelihood: medium
217
+ risk_level: critical
218
+ rationale: Race conditions can cause state inconsistency
219
+ mitigation:
220
+ - File locking mechanism
221
+ - Optimistic concurrency detection
222
+ - Conflict resolution strategy
223
+ testing_priority: 1
224
+ coverage_target: 90%
225
+ test_types: [unit, integration, concurrency]
226
+ gate_enforcement: blocker
227
+
228
+ - feature: State consistency validation
229
+ area: state_management
230
+ impact: high
231
+ likelihood: medium
232
+ risk_level: high
233
+ rationale: Invalid state can cause cascading failures
234
+ mitigation:
235
+ - Schema validation on every read
236
+ - Consistency checks on write
237
+ - Auto-repair for known issues
238
+ testing_priority: 2
239
+ coverage_target: 90%
240
+ test_types: [unit, integration]
241
+ gate_enforcement: critical
242
+
243
+ # FILE OPERATIONS
244
+ - feature: File write with permissions
245
+ area: file_operations
246
+ impact: high
247
+ likelihood: high
248
+ risk_level: critical
249
+ rationale: Permission errors common, can block workflow
250
+ mitigation:
251
+ - Pre-flight permission check
252
+ - Graceful degradation
253
+ - Clear error messages
254
+ testing_priority: 1
255
+ coverage_target: 85%
256
+ test_types: [unit, integration, error_injection]
257
+ gate_enforcement: critical
258
+
259
+ - feature: Path traversal prevention
260
+ area: file_operations
261
+ impact: critical
262
+ likelihood: low
263
+ risk_level: high
264
+ rationale: Security risk if user input in file paths
265
+ mitigation:
266
+ - Path normalization and validation
267
+ - Whitelist allowed directories
268
+ - Reject absolute paths from user input
269
+ testing_priority: 2
270
+ coverage_target: 90%
271
+ test_types: [unit, security]
272
+ gate_enforcement: critical
273
+
274
+ - feature: File read error handling
275
+ area: file_operations
276
+ impact: medium
277
+ likelihood: medium
278
+ risk_level: medium
279
+ rationale: Missing files are expected in some workflows
280
+ mitigation:
281
+ - Distinguish file not found vs read error
282
+ - Provide default for missing optional files
283
+ - Clear error for required files
284
+ testing_priority: 3
285
+ coverage_target: 75%
286
+ test_types: [unit, integration]
287
+ gate_enforcement: major
288
+
289
+ # AGENTS
290
+ - feature: Task definition loading
291
+ area: agents
292
+ impact: high
293
+ likelihood: medium
294
+ risk_level: high
295
+ rationale: Malformed task files can break agent execution
296
+ mitigation:
297
+ - Schema validation for frontmatter
298
+ - Markdown parsing error handling
299
+ - Fallback to safe defaults
300
+ testing_priority: 2
301
+ coverage_target: 85%
302
+ test_types: [unit, integration]
303
+ gate_enforcement: critical
304
+
305
+ - feature: Agent handoff validation
306
+ area: agents
307
+ impact: high
308
+ likelihood: medium
309
+ risk_level: high
310
+ rationale: Invalid handoffs can skip agents or create loops
311
+ mitigation:
312
+ - Validate handoff_to references
313
+ - Detect circular dependencies
314
+ - Enforce phase constraints
315
+ testing_priority: 2
316
+ coverage_target: 80%
317
+ test_types: [unit, integration]
318
+ gate_enforcement: critical
319
+
320
+ - feature: Agent self-validation
321
+ area: agents
322
+ impact: medium
323
+ likelihood: medium
324
+ risk_level: medium
325
+ rationale: Weak validation can pass incomplete work
326
+ mitigation:
327
+ - Criteria checklists per task
328
+ - Output validation
329
+ - Manual review option
330
+ testing_priority: 3
331
+ coverage_target: 75%
332
+ test_types: [unit]
333
+ gate_enforcement: major
334
+
335
+ # CLI
336
+ - feature: Command argument parsing
337
+ area: cli
338
+ impact: medium
339
+ likelihood: high
340
+ risk_level: medium
341
+ rationale: User input is unpredictable
342
+ mitigation:
343
+ - Argument validation with helpful errors
344
+ - Default values for optional args
345
+ - Help text for all commands
346
+ testing_priority: 3
347
+ coverage_target: 70%
348
+ test_types: [unit, integration]
349
+ gate_enforcement: major
350
+
351
+ - feature: IDE detection
352
+ area: cli
353
+ impact: low
354
+ likelihood: medium
355
+ risk_level: low
356
+ rationale: Fallback to generic mode works
357
+ mitigation:
358
+ - Heuristic-based detection
359
+ - Manual override flag
360
+ - Graceful degradation
361
+ testing_priority: 4
362
+ coverage_target: 60%
363
+ test_types: [unit]
364
+ gate_enforcement: minor
365
+
366
+ # CONFIGURATION
367
+ - feature: config.yaml parsing
368
+ area: configuration
369
+ impact: high
370
+ likelihood: medium
371
+ risk_level: high
372
+ rationale: Invalid config can break initialization
373
+ mitigation:
374
+ - Schema validation with JSON Schema
375
+ - Default config fallback
376
+ - Detailed parse error messages
377
+ testing_priority: 2
378
+ coverage_target: 85%
379
+ test_types: [unit, integration]
380
+ gate_enforcement: critical
381
+
382
+ - feature: Config merging (defaults + user)
383
+ area: configuration
384
+ impact: medium
385
+ likelihood: low
386
+ risk_level: medium
387
+ rationale: Merge conflicts are rare but confusing
388
+ mitigation:
389
+ - Deep merge with explicit precedence
390
+ - Validation after merge
391
+ - Log merge decisions
392
+ testing_priority: 3
393
+ coverage_target: 75%
394
+ test_types: [unit]
395
+ gate_enforcement: major
396
+
397
+ # I18N
398
+ - feature: Translation file loading
399
+ area: i18n
400
+ impact: medium
401
+ likelihood: low
402
+ risk_level: medium
403
+ rationale: Missing translations degrade UX but don't block
404
+ mitigation:
405
+ - Fallback to English
406
+ - Log missing translation keys
407
+ - Validate translation files in CI
408
+ testing_priority: 3
409
+ coverage_target: 70%
410
+ test_types: [unit, integration]
411
+ gate_enforcement: major
412
+
413
+ - feature: Locale detection
414
+ area: i18n
415
+ impact: low
416
+ likelihood: low
417
+ risk_level: low
418
+ rationale: Default to English is acceptable
419
+ mitigation:
420
+ - Check LANG env var
421
+ - Manual override via config
422
+ - Clear language in CLI output
423
+ testing_priority: 4
424
+ coverage_target: 60%
425
+ test_types: [unit]
426
+ gate_enforcement: minor
427
+
428
+ # UPGRADE SYSTEM
429
+ - feature: Version migration execution
430
+ area: upgrade
431
+ impact: critical
432
+ likelihood: medium
433
+ risk_level: critical
434
+ rationale: Failed migration can corrupt project
435
+ mitigation:
436
+ - Backup before migration
437
+ - Atomic migration (all or nothing)
438
+ - Rollback on failure
439
+ - Dry-run mode
440
+ testing_priority: 1
441
+ coverage_target: 90%
442
+ test_types: [unit, integration, e2e]
443
+ gate_enforcement: blocker
444
+
445
+ - feature: Backup and restore
446
+ area: upgrade
447
+ impact: critical
448
+ likelihood: low
449
+ risk_level: high
450
+ rationale: Backup failures discovered during restore
451
+ mitigation:
452
+ - Verify backup integrity after creation
453
+ - Test restore in CI
454
+ - Multiple backup slots
455
+ testing_priority: 2
456
+ coverage_target: 85%
457
+ test_types: [unit, integration]
458
+ gate_enforcement: critical
459
+
460
+ - feature: Version compatibility check
461
+ area: upgrade
462
+ impact: medium
463
+ likelihood: medium
464
+ risk_level: medium
465
+ rationale: Incompatible versions can cause errors
466
+ mitigation:
467
+ - Semantic version parsing
468
+ - Clear compatibility messages
469
+ - Graceful degradation
470
+ testing_priority: 3
471
+ coverage_target: 75%
472
+ test_types: [unit]
473
+ gate_enforcement: major
474
+
475
+ # ERROR HANDLING
476
+ - feature: Error recovery strategies
477
+ area: error_handling
478
+ impact: high
479
+ likelihood: medium
480
+ risk_level: high
481
+ rationale: Poor recovery can cascade failures
482
+ mitigation:
483
+ - Structured error types
484
+ - Recovery suggestions in error messages
485
+ - Graceful degradation
486
+ testing_priority: 2
487
+ coverage_target: 80%
488
+ test_types: [unit, integration]
489
+ gate_enforcement: critical
490
+
491
+ - feature: Error message clarity
492
+ area: error_handling
493
+ impact: medium
494
+ likelihood: high
495
+ risk_level: medium
496
+ rationale: Unclear errors increase support burden
497
+ mitigation:
498
+ - Error message templates
499
+ - Include context and suggestions
500
+ - i18n for all error messages
501
+ testing_priority: 3
502
+ coverage_target: 70%
503
+ test_types: [unit, manual]
504
+ gate_enforcement: major
505
+
506
+ mitigation_strategies:
507
+ technical:
508
+ - Input validation and sanitization
509
+ - Schema validation (JSON Schema, YAML)
510
+ - Error handling with recovery
511
+ - Atomic operations (state writes)
512
+ - Rollback mechanisms (mode transitions, migrations)
513
+ - Backup strategies (pre-upgrade, pre-migration)
514
+ - Security measures (path validation, permission checks)
515
+
516
+ process:
517
+ - Code review (all critical/high risk changes)
518
+ - Pair programming (complex logic)
519
+ - Manual testing (critical workflows)
520
+ - Staged rollouts (canary releases)
521
+ - Beta testing (early adopters)
522
+
523
+ monitoring:
524
+ - Health checks (npx chati-dev health)
525
+ - Error logging (structured logs)
526
+ - User feedback (issue templates)
527
+ - Metrics (usage analytics, error rates)
528
+
529
+ testing_priorities:
530
+ priority_1_critical:
531
+ risk_levels: [critical]
532
+ coverage_target: "90-95%"
533
+ test_types: [unit, integration, e2e, security, error_injection]
534
+ gate_enforcement: blocker
535
+ features:
536
+ - Mode transition validation
537
+ - session.yaml write operations
538
+ - Concurrent state access
539
+ - File write with permissions
540
+ - Version migration execution
541
+
542
+ priority_2_high:
543
+ risk_levels: [high]
544
+ coverage_target: "80-85%"
545
+ test_types: [unit, integration, regression]
546
+ gate_enforcement: critical
547
+ features:
548
+ - Agent routing logic
549
+ - Deviation protocol handling
550
+ - State consistency validation
551
+ - Path traversal prevention
552
+ - Task definition loading
553
+ - Agent handoff validation
554
+ - config.yaml parsing
555
+ - Backup and restore
556
+ - Error recovery strategies
557
+
558
+ priority_3_medium:
559
+ risk_levels: [medium]
560
+ coverage_target: "70-75%"
561
+ test_types: [unit, integration, spot_checks]
562
+ gate_enforcement: major
563
+ features:
564
+ - File read error handling
565
+ - Agent self-validation
566
+ - Command argument parsing
567
+ - Config merging
568
+ - Translation file loading
569
+ - Version compatibility check
570
+ - Error message clarity
571
+
572
+ priority_4_low:
573
+ risk_levels: [low]
574
+ coverage_target: "60%"
575
+ test_types: [unit, automated]
576
+ gate_enforcement: minor
577
+ features:
578
+ - IDE detection
579
+ - Locale detection
580
+
581
+ risk_acceptances:
582
+ - risk: Third-party MCP tool failures
583
+ justification: External dependencies, cannot control reliability
584
+ residual_risk: Medium
585
+ mitigation: Graceful error handling, retry logic, clear error messages
586
+ monitoring: Log MCP errors, track failure rates
587
+ review_date: quarterly
588
+
589
+ - risk: IDE-specific behavior variations
590
+ justification: 7 IDEs with different implementations
591
+ residual_risk: Low
592
+ mitigation: Test CLI contract, manual verification matrix
593
+ monitoring: User-reported IDE issues
594
+ review_date: per release
595
+
596
+ - risk: Internationalization display edge cases
597
+ justification: Terminal rendering varies by OS/terminal emulator
598
+ residual_risk: Low
599
+ mitigation: Manual testing on common terminals
600
+ monitoring: User feedback
601
+ review_date: per release
602
+
603
+ risk_evolution:
604
+ early_phase:
605
+ focus: [architecture risks, integration risks, state management]
606
+ reassessment: after each major milestone
607
+
608
+ mid_phase:
609
+ focus: [regression risks, performance risks, error handling]
610
+ reassessment: per sprint
611
+
612
+ late_phase:
613
+ focus: [upgrade risks, compatibility risks, edge cases]
614
+ reassessment: before each release
615
+
616
+ triggers:
617
+ - Major refactor or architecture change
618
+ - New external dependency added
619
+ - Security incident or vulnerability
620
+ - Significant user-reported issues
621
+
622
+ review_schedule:
623
+ frequency: monthly
624
+ participants: [qa-planning, architect, dev, devops]
625
+ outputs: [updated risk-matrix.yaml, new test cases, updated coverage targets]
626
+
627
+ next_steps:
628
+ - Consolidate all QA planning documents
629
+ - Calculate overall QA plan score
630
+ - Validate autonomous transition readiness (95% threshold)
631
+ ```