sqlew 4.0.5 → 4.1.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 (201) hide show
  1. package/CHANGELOG.md +1805 -1782
  2. package/README.md +409 -468
  3. package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
  4. package/assets/config.example.toml +282 -284
  5. package/assets/sample-agents/README.md +36 -40
  6. package/assets/sample-agents/sqlew-architect.md +321 -322
  7. package/assets/sample-agents/sqlew-researcher.md +292 -293
  8. package/assets/sample-agents/sqlew-scrum-master.md +286 -287
  9. package/assets/sample-commands/README.md +56 -57
  10. package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
  11. package/dist/cli/hooks/check-completion.d.ts +19 -0
  12. package/dist/cli/hooks/check-completion.d.ts.map +1 -0
  13. package/dist/cli/hooks/check-completion.js +104 -0
  14. package/dist/cli/hooks/check-completion.js.map +1 -0
  15. package/dist/cli/hooks/init-hooks.d.ts +35 -0
  16. package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
  17. package/dist/cli/hooks/init-hooks.js +425 -0
  18. package/dist/cli/hooks/init-hooks.js.map +1 -0
  19. package/dist/cli/hooks/mark-done.d.ts +25 -0
  20. package/dist/cli/hooks/mark-done.d.ts.map +1 -0
  21. package/dist/cli/hooks/mark-done.js +128 -0
  22. package/dist/cli/hooks/mark-done.js.map +1 -0
  23. package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
  24. package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
  25. package/dist/cli/hooks/plan-id-utils.js +183 -0
  26. package/dist/cli/hooks/plan-id-utils.js.map +1 -0
  27. package/dist/cli/hooks/save.d.ts +23 -0
  28. package/dist/cli/hooks/save.d.ts.map +1 -0
  29. package/dist/cli/hooks/save.js +90 -0
  30. package/dist/cli/hooks/save.js.map +1 -0
  31. package/dist/cli/hooks/stdin-parser.d.ts +139 -0
  32. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
  33. package/dist/cli/hooks/stdin-parser.js +127 -0
  34. package/dist/cli/hooks/stdin-parser.js.map +1 -0
  35. package/dist/cli/hooks/suggest.d.ts +19 -0
  36. package/dist/cli/hooks/suggest.d.ts.map +1 -0
  37. package/dist/cli/hooks/suggest.js +157 -0
  38. package/dist/cli/hooks/suggest.js.map +1 -0
  39. package/dist/cli/hooks/track-plan.d.ts +36 -0
  40. package/dist/cli/hooks/track-plan.d.ts.map +1 -0
  41. package/dist/cli/hooks/track-plan.js +152 -0
  42. package/dist/cli/hooks/track-plan.js.map +1 -0
  43. package/dist/cli.d.ts.map +1 -1
  44. package/dist/cli.js +56 -16
  45. package/dist/cli.js.map +1 -1
  46. package/dist/config/global-config.d.ts +187 -0
  47. package/dist/config/global-config.d.ts.map +1 -0
  48. package/dist/config/global-config.js +206 -0
  49. package/dist/config/global-config.js.map +1 -0
  50. package/dist/config/loader.d.ts +42 -0
  51. package/dist/config/loader.d.ts.map +1 -1
  52. package/dist/config/loader.js +96 -0
  53. package/dist/config/loader.js.map +1 -1
  54. package/dist/constants.d.ts +4 -0
  55. package/dist/constants.d.ts.map +1 -1
  56. package/dist/constants.js +10 -0
  57. package/dist/constants.js.map +1 -1
  58. package/dist/database/operations/queries.d.ts.map +1 -1
  59. package/dist/database/operations/queries.js +11 -2
  60. package/dist/database/operations/queries.js.map +1 -1
  61. package/dist/index.js +4 -1
  62. package/dist/index.js.map +1 -1
  63. package/dist/init-agents.js +0 -1
  64. package/dist/init-agents.js.map +1 -1
  65. package/dist/init-skills.d.ts +4 -3
  66. package/dist/init-skills.d.ts.map +1 -1
  67. package/dist/init-skills.js +10 -3
  68. package/dist/init-skills.js.map +1 -1
  69. package/dist/server/setup.d.ts +8 -0
  70. package/dist/server/setup.d.ts.map +1 -1
  71. package/dist/server/setup.js +141 -21
  72. package/dist/server/setup.js.map +1 -1
  73. package/dist/sync-agents.d.ts.map +1 -1
  74. package/dist/sync-agents.js +48 -3
  75. package/dist/sync-agents.js.map +1 -1
  76. package/dist/sync-commands.d.ts.map +1 -1
  77. package/dist/sync-commands.js +43 -3
  78. package/dist/sync-commands.js.map +1 -1
  79. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  80. package/dist/tools/constraints/actions/get.js +5 -8
  81. package/dist/tools/constraints/actions/get.js.map +1 -1
  82. package/dist/tools/constraints/help/help.d.ts.map +1 -1
  83. package/dist/tools/constraints/help/help.js +1 -6
  84. package/dist/tools/constraints/help/help.js.map +1 -1
  85. package/dist/tools/context/actions/get.d.ts.map +1 -1
  86. package/dist/tools/context/actions/get.js.map +1 -1
  87. package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
  88. package/dist/tools/context/actions/search-layer.js +5 -3
  89. package/dist/tools/context/actions/search-layer.js.map +1 -1
  90. package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
  91. package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
  92. package/dist/tools/context/actions/set-from-policy.js.map +1 -1
  93. package/dist/tools/context/help/help.d.ts.map +1 -1
  94. package/dist/tools/context/help/help.js +1 -7
  95. package/dist/tools/context/help/help.js.map +1 -1
  96. package/dist/tools/context/internal/queries.d.ts.map +1 -1
  97. package/dist/tools/context/internal/queries.js +5 -2
  98. package/dist/tools/context/internal/queries.js.map +1 -1
  99. package/dist/tools/context/types.d.ts +1 -1
  100. package/dist/tools/context/types.d.ts.map +1 -1
  101. package/dist/tools/files/actions/get.d.ts.map +1 -1
  102. package/dist/tools/files/actions/get.js +4 -6
  103. package/dist/tools/files/actions/get.js.map +1 -1
  104. package/dist/tools/files/help/help.d.ts.map +1 -1
  105. package/dist/tools/files/help/help.js +1 -6
  106. package/dist/tools/files/help/help.js.map +1 -1
  107. package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
  108. package/dist/tools/suggest/help/constraint-help.js +0 -2
  109. package/dist/tools/suggest/help/constraint-help.js.map +1 -1
  110. package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
  111. package/dist/tools/suggest/internal/constraint-queries.js +12 -5
  112. package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
  113. package/dist/tools/suggest/internal/queries.js +2 -2
  114. package/dist/tools/suggest/internal/queries.js.map +1 -1
  115. package/dist/tools/tasks/help/help.d.ts.map +1 -1
  116. package/dist/tools/tasks/help/help.js +0 -6
  117. package/dist/tools/tasks/help/help.js.map +1 -1
  118. package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
  119. package/dist/tools/tasks/help/use-case.js +0 -1
  120. package/dist/tools/tasks/help/use-case.js.map +1 -1
  121. package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
  122. package/dist/tools/tasks/watcher/status.js +5 -1
  123. package/dist/tools/tasks/watcher/status.js.map +1 -1
  124. package/dist/types/decision/params.d.ts +7 -6
  125. package/dist/types/decision/params.d.ts.map +1 -1
  126. package/dist/types/decision/templates.d.ts +3 -2
  127. package/dist/types/decision/templates.d.ts.map +1 -1
  128. package/dist/types/view-entities.d.ts +2 -1
  129. package/dist/types/view-entities.d.ts.map +1 -1
  130. package/dist/types.d.ts +19 -11
  131. package/dist/types.d.ts.map +1 -1
  132. package/dist/types.js +4 -1
  133. package/dist/types.js.map +1 -1
  134. package/dist/utils/enum-converter.d.ts +72 -0
  135. package/dist/utils/enum-converter.d.ts.map +1 -0
  136. package/dist/utils/enum-converter.js +76 -0
  137. package/dist/utils/enum-converter.js.map +1 -0
  138. package/dist/utils/hook-queue.d.ts +81 -0
  139. package/dist/utils/hook-queue.d.ts.map +1 -0
  140. package/dist/utils/hook-queue.js +156 -0
  141. package/dist/utils/hook-queue.js.map +1 -0
  142. package/dist/utils/project-root.d.ts +9 -2
  143. package/dist/utils/project-root.d.ts.map +1 -1
  144. package/dist/utils/project-root.js +16 -2
  145. package/dist/utils/project-root.js.map +1 -1
  146. package/dist/utils/tag-parser.d.ts.map +1 -1
  147. package/dist/utils/tag-parser.js +6 -0
  148. package/dist/utils/tag-parser.js.map +1 -1
  149. package/dist/utils/validators.d.ts +1 -1
  150. package/dist/utils/validators.d.ts.map +1 -1
  151. package/dist/utils/validators.js +1 -1
  152. package/dist/utils/validators.js.map +1 -1
  153. package/dist/utils/vcs-adapter.d.ts +44 -0
  154. package/dist/utils/vcs-adapter.d.ts.map +1 -1
  155. package/dist/utils/vcs-adapter.js +88 -0
  156. package/dist/utils/vcs-adapter.js.map +1 -1
  157. package/dist/utils/view-queries.d.ts.map +1 -1
  158. package/dist/utils/view-queries.js +9 -19
  159. package/dist/utils/view-queries.js.map +1 -1
  160. package/dist/watcher/base-watcher.d.ts +69 -0
  161. package/dist/watcher/base-watcher.d.ts.map +1 -0
  162. package/dist/watcher/base-watcher.js +130 -0
  163. package/dist/watcher/base-watcher.js.map +1 -0
  164. package/dist/watcher/index.d.ts +3 -0
  165. package/dist/watcher/index.d.ts.map +1 -1
  166. package/dist/watcher/index.js +2 -0
  167. package/dist/watcher/index.js.map +1 -1
  168. package/dist/watcher/queue-watcher.d.ts +64 -0
  169. package/dist/watcher/queue-watcher.d.ts.map +1 -0
  170. package/dist/watcher/queue-watcher.js +187 -0
  171. package/dist/watcher/queue-watcher.js.map +1 -0
  172. package/docs/ADR_CONCEPTS.md +140 -0
  173. package/docs/CONFIGURATION.md +922 -925
  174. package/docs/CROSS_DATABASE.md +153 -0
  175. package/docs/DATABASE_AUTH.md +70 -356
  176. package/docs/HOOKS_GUIDE.md +159 -0
  177. package/docs/SLASH_COMMANDS.md +329 -337
  178. package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
  179. package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
  180. package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
  181. package/docs/cli/README.md +276 -277
  182. package/package.json +123 -124
  183. package/docs/ACCEPTANCE_CRITERIA.md +0 -625
  184. package/docs/AI_AGENT_GUIDE.md +0 -299
  185. package/docs/ARCHITECTURE.md +0 -167
  186. package/docs/AUTO_FILE_TRACKING.md +0 -841
  187. package/docs/BATCH_VALIDATION.md +0 -617
  188. package/docs/BEST_PRACTICES.md +0 -168
  189. package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
  190. package/docs/DECISION_CONTEXT.md +0 -697
  191. package/docs/DECISION_INTELLIGENCE.md +0 -605
  192. package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
  193. package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
  194. package/docs/SHARED_CONCEPTS.md +0 -225
  195. package/docs/SPECIALIZED_AGENTS.md +0 -126
  196. package/docs/TASK_ACTIONS.md +0 -1177
  197. package/docs/TASK_OVERVIEW.md +0 -452
  198. package/docs/TASK_PRUNING.md +0 -594
  199. package/docs/TOOL_REFERENCE.md +0 -1077
  200. package/docs/TOOL_SELECTION.md +0 -83
  201. package/docs/WORKFLOWS.md +0 -941
@@ -1,1077 +0,0 @@
1
- # Tool Reference
2
-
3
- **Complete technical reference for all sqlew MCP tools**
4
-
5
- ## 🚨 Most Important Rule
6
-
7
- **ALWAYS include the `action` parameter in EVERY tool call.** This is the #1 cause of errors.
8
-
9
- ```javascript
10
- // ❌ WRONG - Missing action
11
- {
12
- key: "some_key",
13
- value: "some value"
14
- }
15
-
16
- // ✅ CORRECT - action parameter present
17
- {
18
- action: "set",
19
- key: "some_key",
20
- value: "some value"
21
- }
22
- ```
23
-
24
- ---
25
-
26
- ## Parameter Validation
27
-
28
- **v4.0.0**: sqlew now provides comprehensive parameter validation with helpful error messages.
29
-
30
- ### Validation Features
31
-
32
- 1. **Required vs Optional Detection** - Clear indication of which parameters must be provided
33
- 2. **Typo Suggestions** - Levenshtein distance-based suggestions for mistyped parameter names
34
- 3. **Structured Error Messages** - JSON format with examples showing correct usage
35
- 4. **Visual Markers** - Help responses show 🔴 REQUIRED and ⚪ OPTIONAL parameter markers
36
-
37
- ### Example Error Message
38
-
39
- ```json
40
- {
41
- "error": "Missing required parameter for action 'set': value",
42
- "action": "set",
43
- "missing_params": ["value"],
44
- "required_params": ["key", "value"],
45
- "optional_params": ["layer", "tags", "status", "version", "scopes"],
46
- "you_provided": ["key", "layer"],
47
- "example": {
48
- "action": "set",
49
- "key": "database/postgresql-choice",
50
- "value": "Selected PostgreSQL over MongoDB",
51
- "layer": "data",
52
- "tags": ["database", "architecture"]
53
- },
54
- "hint": "Use 'quick_set' for simpler usage with auto-inferred metadata"
55
- }
56
- ```
57
-
58
- ### Typo Detection Example
59
-
60
- ```json
61
- {
62
- "error": "Unknown parameter for action 'set': tgas",
63
- "action": "set",
64
- "invalid_params": ["tgas"],
65
- "did_you_mean": {
66
- "tgas": "tags"
67
- },
68
- "valid_params": ["action", "key", "value", "layer", "tags", "status", "version", "scopes"],
69
- "hint": "Parameter names are case-sensitive"
70
- }
71
- ```
72
-
73
- ### Common Validation Errors
74
-
75
- | Error Type | Cause | Solution |
76
- |------------|-------|----------|
77
- | Missing required parameter | Omitted required field | Check error message for required_params list |
78
- | Unknown parameter | Typo or invalid field | Check did_you_mean suggestions |
79
- | Wrong parameter for action | Using parameter from different action | Verify action name and consult example |
80
-
81
- ---
82
-
83
- ## Quick Start
84
-
85
- ### Basic Decision Workflow
86
-
87
- ```javascript
88
- // 1. Set a decision
89
- {
90
- action: "set",
91
- key: "auth_method",
92
- value: "jwt",
93
- layer: "business",
94
- tags: ["security", "authentication"]
95
- }
96
-
97
- // 2. Get the decision
98
- {
99
- action: "get",
100
- key: "auth_method"
101
- }
102
-
103
- // 3. List decisions with filters
104
- {
105
- action: "list",
106
- status: "active",
107
- layer: "business"
108
- }
109
- ```
110
-
111
- ### Basic Suggestion Workflow (v3.9.0)
112
-
113
- ```javascript
114
- // 1. Check for duplicates before creating
115
- {
116
- action: "check_duplicate",
117
- key: "api-rate-limiting",
118
- tags: ["api", "performance"]
119
- }
120
-
121
- // 2. Find related decisions by tags
122
- {
123
- action: "by_tags",
124
- tags: ["api", "security"],
125
- limit: 5
126
- }
127
-
128
- // 3. Search by key pattern
129
- {
130
- action: "by_key",
131
- key: "api/*",
132
- limit: 10
133
- }
134
- ```
135
-
136
- ---
137
-
138
- ## Parameter Validation
139
-
140
- sqlew provides structured error messages with examples and typo suggestions to help you fix parameter errors quickly.
141
-
142
- ### Structured Error Format
143
-
144
- When required parameters are missing or incorrect, sqlew returns a detailed JSON error response:
145
-
146
- ```json
147
- {
148
- "error": "Missing required parameters for 'set': key",
149
- "action": "set",
150
- "missing_params": ["key"],
151
- "required_params": ["key", "value"],
152
- "optional_params": ["layer", "tags", "status", "version", "scopes"],
153
- "you_provided": ["action", "context_key", "value"],
154
- "did_you_mean": {
155
- "context_key": "key"
156
- },
157
- "example": {
158
- "action": "set",
159
- "key": "database/pre-existence-requirement",
160
- "value": "Database must pre-exist before connection...",
161
- "layer": "infrastructure",
162
- "tags": ["database", "security"]
163
- },
164
- "hint": "💡 TIP: Use 'quick_set' action for simpler usage with smart defaults"
165
- }
166
- ```
167
-
168
- ### Error Response Fields
169
-
170
- | Field | Description |
171
- |-------|-------------|
172
- | **error** | Human-readable error message |
173
- | **action** | The action that was attempted |
174
- | **missing_params** | List of missing required parameters |
175
- | **required_params** | All required parameters for this action |
176
- | **optional_params** | All optional parameters for this action |
177
- | **you_provided** | Parameters you actually provided |
178
- | **did_you_mean** | Typo suggestions (parameter name → correct name) |
179
- | **example** | Working example showing correct usage |
180
- | **hint** | Optional helpful tip for this action |
181
-
182
- ### Example Error Scenarios
183
-
184
- #### Scenario 1: Wrong Parameter Name
185
-
186
- ```javascript
187
- // ❌ Wrong
188
- { action: "set", context_key: "db/feature", value: "..." }
189
-
190
- // Error Response:
191
- {
192
- "error": "Missing required parameter 'key' for action 'set'",
193
- "did_you_mean": { "context_key": "key" },
194
- "example": { action: "set", key: "db/feature", value: "..." }
195
- }
196
- ```
197
-
198
- #### Scenario 2: Missing Required Parameter
199
-
200
- ```javascript
201
- // ❌ Wrong
202
- { action: "add", category: "architecture", constraint_text: "..." }
203
-
204
- // Error Response:
205
- {
206
- "error": "Missing required parameter 'priority' for action 'add'",
207
- "required_params": ["category", "constraint_text", "priority"],
208
- "optional_params": ["layer", "tags", "created_by"],
209
- "example": {
210
- action: "add",
211
- category: "architecture",
212
- constraint_text: "...",
213
- priority: "critical"
214
- }
215
- }
216
- ```
217
-
218
- #### Scenario 3: Typo Detection
219
-
220
- ```javascript
221
- // ❌ Wrong
222
- { action: "add", cat: "architecture", constraint_text: "...", priority: "high" }
223
-
224
- // Error Response:
225
- {
226
- "error": "Missing required parameter 'category' for action 'add'",
227
- "did_you_mean": { "cat": "category" },
228
- "example": { ... }
229
- }
230
- ```
231
-
232
- ### Typo Detection
233
-
234
- sqlew uses Levenshtein distance (≤2 edits) to detect common typos:
235
-
236
- | Common Typo | Suggestion |
237
- |-------------|------------|
238
- | context_key | key |
239
- | constraint | constraint_text |
240
- | cat | category |
241
- | prio | priority |
242
- | msg | message |
243
- | desc | description |
244
-
245
- ### Best Practices
246
-
247
- 1. **Read the error response** - It includes everything you need to fix the issue
248
- 2. **Check `did_you_mean`** - Often catches simple typos
249
- 3. **Copy the example** - Use it as a template for your call
250
- 4. **Verify required params** - Make sure you provide all items in `required_params`
251
- 5. **Use hints** - Look for simpler alternatives (e.g., `quick_set` vs `set`)
252
-
253
- ---
254
-
255
- ## Parameter Requirements by Tool
256
-
257
- ### `decision` Tool
258
-
259
- | Action | Required | Optional |
260
- |--------|----------|----------|
261
- | **set** | action, key, value, layer | version, status, tags, scopes |
262
- | **get** | action, key | version, include_context |
263
- | **list** | action | status, layer, tags, scope, tag_match, limit, offset |
264
- | **search_tags** | action, tags | match_mode, status, layer |
265
- | **search_layer** | action, layer | status, include_tags |
266
- | **versions** | action, key | - |
267
- | **quick_set** | action, key, value | layer, version, status, tags, scopes |
268
- | **search_advanced** | action | layers, tags_all, tags_any, exclude_tags, scopes, updated_after, updated_before, decided_by, statuses, search_text, sort_by, sort_order, limit, offset |
269
- | **set_batch** | action, decisions | atomic |
270
- | **set_from_template** | action, template, key, value, layer | version, status, tags, scopes |
271
- | **create_template** | action, name, defaults | required_fields, created_by |
272
- | **list_templates** | action | - |
273
- | **add_decision_context** | action, key, rationale | alternatives_considered, tradeoffs, decided_by, related_task_id, related_constraint_id |
274
- | **list_decision_contexts** | action | decision_key, related_task_id, related_constraint_id, decided_by, limit, offset |
275
-
276
- ### `file` Tool
277
-
278
- | Action | Required | Optional |
279
- |--------|----------|----------|
280
- | **record** | action, file_path, change_type | layer, description |
281
- | **get** | action | file_path, layer, change_type, since, limit |
282
- | **check_lock** | action, file_path | lock_duration |
283
- | **record_batch** | action, file_changes | atomic |
284
- | **sqlite_flush** | action | - |
285
-
286
- ### `constraint` Tool
287
-
288
- | Action | Required | Optional |
289
- |--------|----------|----------|
290
- | **add** | action, category, constraint_text | priority, layer, tags, created_by |
291
- | **get** | action | category, layer, priority, tags, active_only, limit |
292
- | **deactivate** | action, constraint_id | - |
293
-
294
- ### `task` Tool
295
-
296
- | Action | Required | Optional |
297
- |--------|----------|----------|
298
- | **create** | action, title | description, acceptance_criteria, notes, priority, layer, tags, status, **watch_files** (v3.4.1) |
299
- | **update** | action, task_id | title, priority, layer, description, acceptance_criteria, notes, **watch_files** (v3.4.1) |
300
- | **get** | action, task_id | include_dependencies |
301
- | **list** | action | status, layer, tags, limit, offset, include_dependency_counts |
302
- | **move** | action, task_id, status | rejection_reason (when status="rejected") |
303
- | **link** | action, task_id, link_type, target_id | link_relation (⚠️ link_type="file" deprecated in v3.4.1) |
304
- | **archive** | action, task_id | - |
305
- | **create_batch** | action, tasks | atomic |
306
- | **add_dependency** | action, blocker_task_id, blocked_task_id | - |
307
- | **remove_dependency** | action, blocker_task_id, blocked_task_id | - |
308
- | **get_dependencies** | action, task_id | include_details |
309
- | **watch_files** (v3.4.1) | action, task_id, action (watch/unwatch/list) | file_paths |
310
- | **watcher** | action | subaction (status/list_files/list_tasks/help) |
311
-
312
- ### `suggest` Tool (v3.9.0)
313
-
314
- | Action | Required | Optional |
315
- |--------|----------|----------|
316
- | **by_key** | action, key | limit, min_score, layer |
317
- | **by_tags** | action, tags | limit, min_score, layer |
318
- | **by_context** | action | key, tags, layer, limit, min_score, priority |
319
- | **check_duplicate** | action, key | tags, layer, min_score |
320
- | **help** | action | - |
321
-
322
- ### `help` Tool (v3.6.0)
323
-
324
- | Action | Required | Optional |
325
- |--------|----------|----------|
326
- | **query_action** | action, tool, target_action | - |
327
- | **query_params** | action, tool, target_action | - |
328
- | **query_tool** | action, tool | - |
329
- | **workflow_hints** | action, tool, current_action | - |
330
- | **batch_guide** | action, operation | - |
331
- | **error_recovery** | action, error_message | - |
332
-
333
- ### `example` Tool (v3.6.0)
334
-
335
- | Action | Required | Optional |
336
- |--------|----------|----------|
337
- | **get** | action | tool, action_name, topic |
338
- | **search** | action, keyword | tool, action_name, complexity |
339
- | **list_all** | action | tool, complexity, limit, offset |
340
-
341
- ### `use_case` Tool (v3.6.0)
342
-
343
- | Action | Required | Optional |
344
- |--------|----------|----------|
345
- | **get** | action, use_case_id | - |
346
- | **search** | action, keyword | category, complexity |
347
- | **list_all** | action | category, complexity, limit, offset |
348
-
349
- ---
350
-
351
- ## Search Actions Decision Tree
352
-
353
- ### When to use which search action?
354
-
355
- ```
356
- ┌─────────────────────────────────────┐
357
- │ What do you want to search by? │
358
- └──────────┬──────────────────────────┘
359
-
360
- ├─ Simple filters (status, layer, tags)?
361
- │ └─> Use action: "list"
362
-
363
- ├─ Primarily by tags?
364
- │ └─> Use action: "search_tags"
365
- │ • match_mode: "AND" (all tags) or "OR" (any tag)
366
-
367
- ├─ Primarily by layer?
368
- │ └─> Use action: "search_layer"
369
-
370
- ├─ Complex multi-filter query?
371
- │ └─> Use action: "search_advanced"
372
- │ • Multiple layers (OR)
373
- │ • Tag combinations (AND/OR)
374
- │ • Temporal filtering
375
- │ • Full-text search
376
- │ • Pagination
377
-
378
- └─ Need version history?
379
- └─> Use action: "versions"
380
- ```
381
-
382
- ### Detailed Search Comparison
383
-
384
- | Action | Use When | Key Features |
385
- |--------|----------|--------------|
386
- | **list** | Basic filtering | Simple status/layer/tag filters, no pagination |
387
- | **search_tags** | Tag-focused search | AND/OR logic for tags, optional status/layer |
388
- | **search_layer** | Layer-focused search | Get all decisions in specific layer(s) |
389
- | **search_advanced** | Complex queries | Full filtering, pagination, sorting, text search |
390
- | **versions** | History tracking | Get all versions of a specific decision |
391
-
392
- ---
393
-
394
- ## Batch Operations Guide
395
-
396
- ### Atomic vs Non-Atomic Mode
397
-
398
- **Atomic Mode** (`atomic: true`, default):
399
- - All succeed or all fail as a single transaction
400
- - If ANY item fails, entire batch is rolled back
401
- - Error is thrown immediately on first failure
402
- - Use for: Critical operations requiring consistency
403
-
404
- **Non-Atomic Mode** (`atomic: false`, **recommended for AI agents**):
405
- - Each item processed independently
406
- - If some fail, others still succeed
407
- - Returns partial results with per-item success/error status
408
- - Use for: Best-effort batch operations, when individual failures are acceptable
409
-
410
- ### Batch Operation Examples
411
-
412
- #### Decision Batch (Recommended: atomic: false)
413
-
414
- ```javascript
415
- {
416
- action: "set_batch",
417
- atomic: false, // Recommended for AI agents
418
- decisions: [
419
- {
420
- key: "feature-1",
421
- value: "Implemented user authentication",
422
- layer: "business",
423
- tags: ["feature", "auth"],
424
- status: "active"
425
- },
426
- {
427
- key: "feature-2",
428
- value: "Added rate limiting",
429
- layer: "infrastructure",
430
- tags: ["feature", "security"],
431
- status: "active"
432
- }
433
- ]
434
- }
435
- ```
436
-
437
- **Response Format:**
438
- ```json
439
- {
440
- "success": true,
441
- "inserted": 2,
442
- "failed": 0,
443
- "results": [
444
- {
445
- "key": "feature-1",
446
- "key_id": 123,
447
- "version": "1.0.0",
448
- "success": true
449
- },
450
- {
451
- "key": "feature-2",
452
- "key_id": 124,
453
- "version": "1.0.0",
454
- "success": true
455
- }
456
- ]
457
- }
458
- ```
459
-
460
- #### File Change Batch
461
-
462
- ```javascript
463
- {
464
- action: "record_batch",
465
- atomic: false,
466
- file_changes: [
467
- {
468
- file_path: "src/types.ts",
469
- change_type: "modified",
470
- layer: "data"
471
- },
472
- {
473
- file_path: "src/index.ts",
474
- change_type: "modified",
475
- layer: "infrastructure"
476
- }
477
- ]
478
- }
479
- ```
480
-
481
- ### Batch Limits
482
-
483
- - **Maximum items per batch**: 50
484
- - **Recommended batch size**: 10-20 (for readability and debugging)
485
- - **Token savings**: ~52% vs individual calls
486
-
487
- ---
488
-
489
- ## File Watching with Tasks (v3.4.1)
490
-
491
- ### New: watch_files Parameter
492
-
493
- **Replaces:** `task.link(link_type="file")` (deprecated in v3.4.1)
494
-
495
- Create tasks with automatic file monitoring in one step:
496
-
497
- ```javascript
498
- {
499
- action: "create",
500
- title: "Implement user authentication",
501
- watch_files: ["src/auth.ts", "src/auth.test.ts"],
502
- acceptance_criteria: [
503
- {type: "tests_pass", command: "npm test auth", expected_pattern: "passing"},
504
- {type: "code_contains", file: "src/auth.ts", pattern: "export class AuthService"}
505
- ],
506
- priority: 3
507
- }
508
- ```
509
-
510
- **Benefits:**
511
- - 75% fewer MCP calls (1 call vs 4 calls in v3.2.x)
512
- - 35% token reduction
513
- - Clearer intent
514
- - Atomic file registration
515
-
516
- ### New: watch_files Action
517
-
518
- Manage file watches dynamically:
519
-
520
- ```javascript
521
- // Watch files
522
- {
523
- action: "watch_files",
524
- task_id: 123,
525
- action: "watch",
526
- file_paths: ["src/auth.ts", "src/middleware/jwt.ts"]
527
- }
528
-
529
- // Unwatch files
530
- {
531
- action: "watch_files",
532
- task_id: 123,
533
- action: "unwatch",
534
- file_paths: ["src/middleware/jwt.ts"]
535
- }
536
-
537
- // List watched files
538
- {
539
- action: "watch_files",
540
- task_id: 123,
541
- action: "list"
542
- }
543
- // Response: { files: ["src/auth.ts"], files_count: 1 }
544
- ```
545
-
546
- ### Migration from v3.2.x
547
-
548
- **Before (deprecated):**
549
- ```javascript
550
- // Create task
551
- {action: "create", title: "Feature"}
552
- // Link files (separate calls)
553
- {action: "link", task_id: 123, link_type: "file", target_id: "src/file1.ts"}
554
- {action: "link", task_id: 123, link_type: "file", target_id: "src/file2.ts"}
555
- ```
556
-
557
- **After (v3.4.1):**
558
- ```javascript
559
- // Create task with files in one call
560
- {
561
- action: "create",
562
- title: "Feature",
563
- watch_files: ["src/file1.ts", "src/file2.ts"]
564
- }
565
- ```
566
-
567
- ---
568
-
569
- ## Decision Context System (v3.2.2)
570
-
571
- ### What is Decision Context?
572
-
573
- Decision Context allows you to attach rich documentation to decisions, including:
574
- - **Rationale**: WHY the decision was made
575
- - **Alternatives Considered**: What options were evaluated and rejected
576
- - **Tradeoffs**: Pros and cons analysis
577
-
578
- ### Key Features
579
-
580
- - **Multi-Session Development**: Preserve decision reasoning across days/weeks
581
- - **Architecture Reviews**: Document non-standard choices for future developers
582
- - **Team Handoffs**: Transfer knowledge with full context
583
- - **Linked Relationships**: Connect contexts to tasks and constraints
584
-
585
- ### Adding Decision Context
586
-
587
- ```javascript
588
- {
589
- action: "add_decision_context",
590
- key: "database_choice",
591
- rationale: "Selected PostgreSQL because: (1) Complex relational queries required for reporting, (2) ACID compliance critical for financial data, (3) Team has strong SQL expertise",
592
- alternatives_considered: [
593
- {
594
- option: "MongoDB",
595
- reason: "Rejected due to weak consistency guarantees for financial data"
596
- },
597
- {
598
- option: "MySQL",
599
- reason: "Rejected due to limited JSON support needed for metadata"
600
- }
601
- ],
602
- tradeoffs: {
603
- pros: ["Strong consistency", "Complex queries", "Team expertise"],
604
- cons: ["Less flexible schema", "Vertical scaling limitations"]
605
- },
606
- decided_by: "backend-team",
607
- related_task_id: 42
608
- }
609
- ```
610
-
611
- **Response:**
612
- ```json
613
- {
614
- "success": true,
615
- "context_id": 1,
616
- "decision_key": "database_choice",
617
- "message": "Decision context added successfully"
618
- }
619
- ```
620
-
621
- ### Retrieving Decision with Context
622
-
623
- ```javascript
624
- // Standard get (backward compatible)
625
- {
626
- action: "get",
627
- key: "database_choice"
628
- }
629
- // → Returns: { key, value, layer, status, version, tags, ... }
630
-
631
- // Get with context
632
- {
633
- action: "get",
634
- key: "database_choice",
635
- include_context: true
636
- }
637
- // → Returns: { key, value, ..., contexts: [{rationale, alternatives_considered, tradeoffs, ...}] }
638
- ```
639
-
640
- ### Listing Decision Contexts
641
-
642
- ```javascript
643
- // List all contexts
644
- {
645
- action: "list_decision_contexts",
646
- limit: 50
647
- }
648
-
649
- // Filter by decision key
650
- {
651
- action: "list_decision_contexts",
652
- decision_key: "database_choice"
653
- }
654
-
655
- // Filter by related task
656
- {
657
- action: "list_decision_contexts",
658
- related_task_id: 42
659
- }
660
- ```
661
-
662
- **Response:**
663
- ```json
664
- {
665
- "success": true,
666
- "contexts": [
667
- {
668
- "id": 1,
669
- "decision_key": "database_choice",
670
- "rationale": "Selected PostgreSQL because...",
671
- "alternatives_considered": [...],
672
- "tradeoffs": {...},
673
- "decided_by": "backend-team",
674
- "decision_date": "2025-10-18T06:48:00Z",
675
- "related_task_id": 42,
676
- "related_constraint_id": null
677
- }
678
- ],
679
- "count": 1
680
- }
681
- ```
682
-
683
- ### Parameter Details
684
-
685
- | Parameter | Type | Required | Description |
686
- |-----------|------|----------|-------------|
687
- | **key** | string | ✅ | Decision key to attach context to |
688
- | **rationale** | string | ✅ | WHY the decision was made |
689
- | **alternatives_considered** | JSON array | ❌ | List of {option, reason} objects |
690
- | **tradeoffs** | JSON object | ❌ | {pros: [...], cons: [...]} analysis |
691
- | **decided_by** | string | ❌ | Agent/team who made the decision |
692
- | **related_task_id** | number | ❌ | Link to implementation task |
693
- | **related_constraint_id** | number | ❌ | Link to system constraint |
694
-
695
- ### When to Use Decision Context
696
-
697
- ✅ **Use for:**
698
- - Architectural decisions with multiple viable options
699
- - Non-obvious implementation choices
700
- - Breaking changes that need justification
701
- - Security/performance trade-off analysis
702
- - Cross-team collaboration documentation
703
-
704
- ❌ **Don't use for:**
705
- - Routine implementation details
706
- - Temporary decisions
707
- - Obvious or standard choices
708
-
709
- ### Best Practices
710
-
711
- 1. **Be Specific**: "Chose X because Y" not "Chose X"
712
- 2. **Document Alternatives**: Show what was considered and rejected
713
- 3. **Quantify Tradeoffs**: "5ms overhead acceptable for security" not "minor overhead"
714
- 4. **Link to Tasks**: Connect decision context to implementation tasks
715
- 5. **Update Over Time**: Add new contexts as decisions evolve
716
-
717
- ### See Also
718
-
719
- - **[Decision Context Guide](DECISION_CONTEXT.md)** - Comprehensive examples and workflows (500+ lines)
720
- - **[Workflows](WORKFLOWS.md)** - Multi-step decision context workflows
721
-
722
- ---
723
-
724
- ## Template System
725
-
726
- ### What are Templates?
727
-
728
- Templates provide reusable defaults for common decision patterns.
729
-
730
- ### Built-in Templates
731
-
732
- 1. **breaking_change**: Breaking API/interface changes
733
- 2. **security_vulnerability**: Security issues
734
- 3. **performance_optimization**: Performance improvements
735
- 4. **deprecation**: Deprecation notices
736
- 5. **architecture_decision**: Major architectural decisions
737
-
738
- ### Using Templates
739
-
740
- ```javascript
741
- {
742
- action: "set_from_template",
743
- template: "breaking_change",
744
- key: "oscillator-type-moved",
745
- value: "oscillator_type moved to MonophonicSynthConfig",
746
- // Optional overrides:
747
- tags: ["migration", "v0.3.3"],
748
- status: "active"
749
- }
750
- ```
751
-
752
- ### Template vs Direct Parameters
753
-
754
- **When to use `set_from_template`**:
755
- - You have a common decision pattern
756
- - You want consistent metadata (tags, status, layer)
757
- - You want to enforce required fields
758
-
759
- **When to use `set`**:
760
- - One-off decisions
761
- - Unique metadata requirements
762
- - Full control over all parameters
763
-
764
- ### Creating Custom Templates
765
-
766
- ```javascript
767
- {
768
- action: "create_template",
769
- name: "bug_fix",
770
- defaults: {
771
- layer: "business",
772
- tags: ["bug", "fix"],
773
- status: "active"
774
- },
775
- required_fields: ["version"],
776
- created_by: "my-agent"
777
- }
778
- ```
779
-
780
- ### Listing Templates
781
-
782
- ```javascript
783
- {
784
- action: "list_templates"
785
- }
786
- ```
787
-
788
- ---
789
-
790
- ## Valid Values Reference
791
-
792
- ### Layers
793
-
794
- 💡 **See [ARCHITECTURE.md](ARCHITECTURE.md#layers) for detailed layer definitions.**
795
-
796
- **FILE_REQUIRED layers** (require file_actions for file tool):
797
- - **presentation**: UI, API endpoints, user-facing interfaces
798
- - **business**: Service logic, workflows, business rules
799
- - **data**: Database models, schemas, data access
800
- - **infrastructure**: Configuration, deployment, DevOps
801
- - **cross-cutting**: Logging, monitoring, security (affects multiple layers)
802
- - **documentation**: README, API docs, technical documentation
803
-
804
- **FILE_OPTIONAL layers** (file_actions optional):
805
- - **planning**: Task planning, sprint organization
806
- - **coordination**: Multi-agent coordination, workflow management
807
- - **review**: Code review, architectural review decisions
808
-
809
- ### Statuses
810
-
811
- - **active**: Currently active decision/constraint
812
- - **deprecated**: No longer recommended but still valid
813
- - **draft**: Work in progress, not finalized
814
-
815
- ### Message Types
816
-
817
- - **decision**: Notification about a decision made
818
- - **warning**: Alert about issues or concerns
819
- - **request**: Request for action or input
820
- - **info**: General informational message
821
-
822
- ### Priorities
823
-
824
- - **low** (1): Non-urgent, can wait
825
- - **medium** (2): Normal priority (default)
826
- - **high** (3): Important, address soon
827
- - **critical** (4): Urgent, immediate attention required
828
-
829
- ### Change Types (File)
830
-
831
- - **created**: New file created
832
- - **modified**: Existing file changed
833
- - **deleted**: File removed
834
-
835
- ### Task Statuses
836
-
837
- - **todo**: Not started
838
- - **in_progress**: Currently being worked on
839
- - **waiting_review**: Completed, awaiting review
840
- - **blocked**: Cannot proceed due to blocker
841
- - **done**: Completed successfully
842
- - **archived**: Completed and archived (auto-archived after 48 hours)
843
- - **rejected**: Cancelled or rejected task (terminal state)
844
-
845
- ### Constraint Categories
846
-
847
- - **performance**: Performance requirements
848
- - **architecture**: Architectural rules
849
- - **security**: Security requirements
850
-
851
- ---
852
-
853
- ## Help Actions
854
-
855
- All tools support `action: "help"` for comprehensive on-demand documentation:
856
-
857
- ```javascript
858
- // Get detailed help for decision tool
859
- {
860
- action: "help"
861
- }
862
- ```
863
-
864
- This returns:
865
- - All actions and their parameters
866
- - Examples for each action
867
- - Valid values for enum parameters
868
- - Behavior descriptions
869
-
870
- ---
871
-
872
- ## Decision Intelligence System (v3.9.0)
873
-
874
- ### Overview
875
-
876
- The Decision Intelligence System provides automatic duplicate detection and smart suggestions when creating decisions. It uses a three-tier approach to handle different similarity levels.
877
-
878
- ### Three-Tier Detection
879
-
880
- | Tier | Score Range | Behavior | Use Case |
881
- |------|-------------|----------|----------|
882
- | **Gentle Nudge** | 35-44 | Non-blocking warning in `duplicate_risk` | May be related, user decides |
883
- | **Hard Block** | 45-59 | Blocking error, requires resolution | Likely duplicate, needs review |
884
- | **Auto-Update** | 60+ | Transparent update of existing decision | Clearly same decision |
885
-
886
- ### Similarity Scoring
887
-
888
- **Total Score: 0-100 points**
889
-
890
- | Factor | Max Points | Calculation |
891
- |--------|------------|-------------|
892
- | Tag overlap | 40 | 10 per matching tag (max 4) |
893
- | Layer match | 25 | Same layer = 25, different = 0 |
894
- | Key similarity | 20 | Pattern + Levenshtein distance |
895
- | Recency | 10 | <30 days = 10, decay over time |
896
- | Priority | 5 | Critical = 5, High = 4, etc. |
897
-
898
- ### Using the suggest Tool
899
-
900
- ```javascript
901
- // Find by key pattern
902
- {
903
- action: "by_key",
904
- key: "api/*/latency",
905
- limit: 5,
906
- min_score: 30
907
- }
908
-
909
- // Find by tag similarity
910
- {
911
- action: "by_tags",
912
- tags: ["performance", "api"],
913
- limit: 5
914
- }
915
-
916
- // Combined search
917
- {
918
- action: "by_context",
919
- key: "api/*",
920
- tags: ["performance"],
921
- layer: "infrastructure",
922
- limit: 5
923
- }
924
-
925
- // Pre-creation duplicate check
926
- {
927
- action: "check_duplicate",
928
- key: "new-decision",
929
- tags: ["tag1", "tag2"]
930
- }
931
- ```
932
-
933
- ### Auto-Trigger with Policies
934
-
935
- Enable automatic duplicate detection in policies:
936
-
937
- ```javascript
938
- {
939
- action: "create_policy",
940
- name: "security-decisions",
941
- defaults: {
942
- layer: "cross-cutting",
943
- tags: ["security"]
944
- },
945
- suggest_similar: 1, // Enable auto-trigger
946
- validation_rules: {
947
- patterns: { key: "^security/" }
948
- }
949
- }
950
- ```
951
-
952
- When a decision matches this policy, suggestions are automatically triggered.
953
-
954
- ### Bypass Mechanism
955
-
956
- Override duplicate detection when needed:
957
-
958
- ```javascript
959
- {
960
- action: "set",
961
- key: "intentionally-similar",
962
- value: "Different use case",
963
- tags: ["same", "tags"],
964
- ignore_suggest: true, // Skip duplicate detection
965
- ignore_reason: "Different use case - async tasks vs event bus"
966
- }
967
- ```
968
-
969
- ### Enhanced Response Fields (v3.9.0)
970
-
971
- **Tier 1 (Gentle Nudge):**
972
- ```json
973
- {
974
- "success": true,
975
- "key": "new-decision",
976
- "duplicate_risk": {
977
- "severity": "MODERATE",
978
- "max_score": 42,
979
- "suggestions": [...]
980
- }
981
- }
982
- ```
983
-
984
- **Tier 3 (Auto-Update):**
985
- ```json
986
- {
987
- "success": true,
988
- "auto_updated": true,
989
- "requested_key": "similar-key",
990
- "actual_key": "existing-key",
991
- "similarity_score": 85,
992
- "version": "1.0.1"
993
- }
994
- ```
995
-
996
- ### See Also
997
-
998
- - **[DECISION_INTELLIGENCE.md](DECISION_INTELLIGENCE.md)** - Comprehensive three-tier system guide
999
-
1000
- ---
1001
-
1002
- ## Constraint Intelligence System (v4.0.0)
1003
-
1004
- ### Overview
1005
-
1006
- The Constraint Intelligence System provides duplicate detection and similarity-based suggestions for architectural constraints. Use `target: "constraint"` with the suggest tool.
1007
-
1008
- ### Scoring
1009
-
1010
- **Total Score: 0-100 points**
1011
-
1012
- | Factor | Max Points | Calculation |
1013
- |--------|------------|-------------|
1014
- | Tag overlap | 40 | 10 per matching tag (max 4) |
1015
- | Layer match | 25 | Same layer = 25, different = 0 |
1016
- | Text similarity | 20 | Levenshtein distance |
1017
- | Recency | 10 | <30 days = 10, decay over time |
1018
- | Priority | 5 | Critical = 5, High = 4, etc. |
1019
-
1020
- ### Thresholds
1021
-
1022
- | Threshold | Value | Description |
1023
- |-----------|-------|-------------|
1024
- | Default min_score | 30 | Minimum score for suggestions |
1025
- | Duplicate threshold | 70 | Score triggering duplicate warning |
1026
-
1027
- ### Using the suggest Tool for Constraints
1028
-
1029
- ```javascript
1030
- // Find by text pattern
1031
- {
1032
- action: "by_key",
1033
- target: "constraint", // Required for constraints
1034
- text: "API response time",
1035
- limit: 5
1036
- }
1037
-
1038
- // Find by tags
1039
- {
1040
- action: "by_tags",
1041
- target: "constraint",
1042
- tags: ["api", "performance"],
1043
- layer: "business"
1044
- }
1045
-
1046
- // Combined search
1047
- {
1048
- action: "by_context",
1049
- target: "constraint",
1050
- text: "database query",
1051
- tags: ["sql"],
1052
- layer: "data"
1053
- }
1054
-
1055
- // Pre-creation duplicate check
1056
- {
1057
- action: "check_duplicate",
1058
- target: "constraint",
1059
- text: "API response time must be under 100ms"
1060
- }
1061
- ```
1062
-
1063
- ### See Also
1064
-
1065
- - **[CONSTRAINT_INTELLIGENCE.md](CONSTRAINT_INTELLIGENCE.md)** - Comprehensive constraint intelligence guide
1066
-
1067
- ---
1068
-
1069
- ## Related Documentation
1070
-
1071
- - **[TOOL_SELECTION.md](TOOL_SELECTION.md)** - Choosing the right tool for your task
1072
- - **[WORKFLOWS.md](WORKFLOWS.md)** - Multi-step workflow examples
1073
- - **[BEST_PRACTICES.md](BEST_PRACTICES.md)** - Common errors and best practices
1074
- - **[ARCHITECTURE.md](ARCHITECTURE.md)** - Layer definitions and system architecture
1075
- - **[AI_AGENT_GUIDE.md](AI_AGENT_GUIDE.md)** - Complete guide (original comprehensive version)
1076
- - **[DECISION_INTELLIGENCE.md](DECISION_INTELLIGENCE.md)** - Decision Intelligence System (v3.9.0)
1077
- - **[CONSTRAINT_INTELLIGENCE.md](CONSTRAINT_INTELLIGENCE.md)** - Constraint Intelligence System (v4.0.0)