sqlew 4.0.4 → 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 (203) hide show
  1. package/CHANGELOG.md +1805 -1762
  2. package/LICENSE +177 -39
  3. package/NOTICE +24 -0
  4. package/README.md +409 -390
  5. package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
  6. package/assets/config.example.toml +282 -284
  7. package/assets/sample-agents/README.md +36 -40
  8. package/assets/sample-agents/sqlew-architect.md +321 -322
  9. package/assets/sample-agents/sqlew-researcher.md +292 -293
  10. package/assets/sample-agents/sqlew-scrum-master.md +286 -287
  11. package/assets/sample-commands/README.md +56 -57
  12. package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
  13. package/dist/cli/hooks/check-completion.d.ts +19 -0
  14. package/dist/cli/hooks/check-completion.d.ts.map +1 -0
  15. package/dist/cli/hooks/check-completion.js +104 -0
  16. package/dist/cli/hooks/check-completion.js.map +1 -0
  17. package/dist/cli/hooks/init-hooks.d.ts +35 -0
  18. package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
  19. package/dist/cli/hooks/init-hooks.js +425 -0
  20. package/dist/cli/hooks/init-hooks.js.map +1 -0
  21. package/dist/cli/hooks/mark-done.d.ts +25 -0
  22. package/dist/cli/hooks/mark-done.d.ts.map +1 -0
  23. package/dist/cli/hooks/mark-done.js +128 -0
  24. package/dist/cli/hooks/mark-done.js.map +1 -0
  25. package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
  26. package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
  27. package/dist/cli/hooks/plan-id-utils.js +183 -0
  28. package/dist/cli/hooks/plan-id-utils.js.map +1 -0
  29. package/dist/cli/hooks/save.d.ts +23 -0
  30. package/dist/cli/hooks/save.d.ts.map +1 -0
  31. package/dist/cli/hooks/save.js +90 -0
  32. package/dist/cli/hooks/save.js.map +1 -0
  33. package/dist/cli/hooks/stdin-parser.d.ts +139 -0
  34. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
  35. package/dist/cli/hooks/stdin-parser.js +127 -0
  36. package/dist/cli/hooks/stdin-parser.js.map +1 -0
  37. package/dist/cli/hooks/suggest.d.ts +19 -0
  38. package/dist/cli/hooks/suggest.d.ts.map +1 -0
  39. package/dist/cli/hooks/suggest.js +157 -0
  40. package/dist/cli/hooks/suggest.js.map +1 -0
  41. package/dist/cli/hooks/track-plan.d.ts +36 -0
  42. package/dist/cli/hooks/track-plan.d.ts.map +1 -0
  43. package/dist/cli/hooks/track-plan.js +152 -0
  44. package/dist/cli/hooks/track-plan.js.map +1 -0
  45. package/dist/cli.d.ts.map +1 -1
  46. package/dist/cli.js +56 -16
  47. package/dist/cli.js.map +1 -1
  48. package/dist/config/global-config.d.ts +187 -0
  49. package/dist/config/global-config.d.ts.map +1 -0
  50. package/dist/config/global-config.js +206 -0
  51. package/dist/config/global-config.js.map +1 -0
  52. package/dist/config/loader.d.ts +42 -0
  53. package/dist/config/loader.d.ts.map +1 -1
  54. package/dist/config/loader.js +96 -0
  55. package/dist/config/loader.js.map +1 -1
  56. package/dist/constants.d.ts +4 -0
  57. package/dist/constants.d.ts.map +1 -1
  58. package/dist/constants.js +10 -0
  59. package/dist/constants.js.map +1 -1
  60. package/dist/database/operations/queries.d.ts.map +1 -1
  61. package/dist/database/operations/queries.js +11 -2
  62. package/dist/database/operations/queries.js.map +1 -1
  63. package/dist/index.js +5 -2
  64. package/dist/index.js.map +1 -1
  65. package/dist/init-agents.js +0 -1
  66. package/dist/init-agents.js.map +1 -1
  67. package/dist/init-skills.d.ts +4 -3
  68. package/dist/init-skills.d.ts.map +1 -1
  69. package/dist/init-skills.js +10 -3
  70. package/dist/init-skills.js.map +1 -1
  71. package/dist/server/setup.d.ts +8 -0
  72. package/dist/server/setup.d.ts.map +1 -1
  73. package/dist/server/setup.js +141 -21
  74. package/dist/server/setup.js.map +1 -1
  75. package/dist/sync-agents.d.ts.map +1 -1
  76. package/dist/sync-agents.js +48 -3
  77. package/dist/sync-agents.js.map +1 -1
  78. package/dist/sync-commands.d.ts.map +1 -1
  79. package/dist/sync-commands.js +43 -3
  80. package/dist/sync-commands.js.map +1 -1
  81. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  82. package/dist/tools/constraints/actions/get.js +5 -8
  83. package/dist/tools/constraints/actions/get.js.map +1 -1
  84. package/dist/tools/constraints/help/help.d.ts.map +1 -1
  85. package/dist/tools/constraints/help/help.js +1 -6
  86. package/dist/tools/constraints/help/help.js.map +1 -1
  87. package/dist/tools/context/actions/get.d.ts.map +1 -1
  88. package/dist/tools/context/actions/get.js.map +1 -1
  89. package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
  90. package/dist/tools/context/actions/search-layer.js +5 -3
  91. package/dist/tools/context/actions/search-layer.js.map +1 -1
  92. package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
  93. package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
  94. package/dist/tools/context/actions/set-from-policy.js.map +1 -1
  95. package/dist/tools/context/help/help.d.ts.map +1 -1
  96. package/dist/tools/context/help/help.js +1 -7
  97. package/dist/tools/context/help/help.js.map +1 -1
  98. package/dist/tools/context/internal/queries.d.ts.map +1 -1
  99. package/dist/tools/context/internal/queries.js +5 -2
  100. package/dist/tools/context/internal/queries.js.map +1 -1
  101. package/dist/tools/context/types.d.ts +1 -1
  102. package/dist/tools/context/types.d.ts.map +1 -1
  103. package/dist/tools/files/actions/get.d.ts.map +1 -1
  104. package/dist/tools/files/actions/get.js +4 -6
  105. package/dist/tools/files/actions/get.js.map +1 -1
  106. package/dist/tools/files/help/help.d.ts.map +1 -1
  107. package/dist/tools/files/help/help.js +1 -6
  108. package/dist/tools/files/help/help.js.map +1 -1
  109. package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
  110. package/dist/tools/suggest/help/constraint-help.js +0 -2
  111. package/dist/tools/suggest/help/constraint-help.js.map +1 -1
  112. package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
  113. package/dist/tools/suggest/internal/constraint-queries.js +12 -5
  114. package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
  115. package/dist/tools/suggest/internal/queries.js +2 -2
  116. package/dist/tools/suggest/internal/queries.js.map +1 -1
  117. package/dist/tools/tasks/help/help.d.ts.map +1 -1
  118. package/dist/tools/tasks/help/help.js +0 -6
  119. package/dist/tools/tasks/help/help.js.map +1 -1
  120. package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
  121. package/dist/tools/tasks/help/use-case.js +0 -1
  122. package/dist/tools/tasks/help/use-case.js.map +1 -1
  123. package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
  124. package/dist/tools/tasks/watcher/status.js +5 -1
  125. package/dist/tools/tasks/watcher/status.js.map +1 -1
  126. package/dist/types/decision/params.d.ts +7 -6
  127. package/dist/types/decision/params.d.ts.map +1 -1
  128. package/dist/types/decision/templates.d.ts +3 -2
  129. package/dist/types/decision/templates.d.ts.map +1 -1
  130. package/dist/types/view-entities.d.ts +2 -1
  131. package/dist/types/view-entities.d.ts.map +1 -1
  132. package/dist/types.d.ts +19 -11
  133. package/dist/types.d.ts.map +1 -1
  134. package/dist/types.js +4 -1
  135. package/dist/types.js.map +1 -1
  136. package/dist/utils/enum-converter.d.ts +72 -0
  137. package/dist/utils/enum-converter.d.ts.map +1 -0
  138. package/dist/utils/enum-converter.js +76 -0
  139. package/dist/utils/enum-converter.js.map +1 -0
  140. package/dist/utils/hook-queue.d.ts +81 -0
  141. package/dist/utils/hook-queue.d.ts.map +1 -0
  142. package/dist/utils/hook-queue.js +156 -0
  143. package/dist/utils/hook-queue.js.map +1 -0
  144. package/dist/utils/project-root.d.ts +9 -2
  145. package/dist/utils/project-root.d.ts.map +1 -1
  146. package/dist/utils/project-root.js +16 -2
  147. package/dist/utils/project-root.js.map +1 -1
  148. package/dist/utils/tag-parser.d.ts.map +1 -1
  149. package/dist/utils/tag-parser.js +6 -0
  150. package/dist/utils/tag-parser.js.map +1 -1
  151. package/dist/utils/validators.d.ts +1 -1
  152. package/dist/utils/validators.d.ts.map +1 -1
  153. package/dist/utils/validators.js +1 -1
  154. package/dist/utils/validators.js.map +1 -1
  155. package/dist/utils/vcs-adapter.d.ts +44 -0
  156. package/dist/utils/vcs-adapter.d.ts.map +1 -1
  157. package/dist/utils/vcs-adapter.js +88 -0
  158. package/dist/utils/vcs-adapter.js.map +1 -1
  159. package/dist/utils/view-queries.d.ts.map +1 -1
  160. package/dist/utils/view-queries.js +9 -19
  161. package/dist/utils/view-queries.js.map +1 -1
  162. package/dist/watcher/base-watcher.d.ts +69 -0
  163. package/dist/watcher/base-watcher.d.ts.map +1 -0
  164. package/dist/watcher/base-watcher.js +130 -0
  165. package/dist/watcher/base-watcher.js.map +1 -0
  166. package/dist/watcher/index.d.ts +3 -0
  167. package/dist/watcher/index.d.ts.map +1 -1
  168. package/dist/watcher/index.js +2 -0
  169. package/dist/watcher/index.js.map +1 -1
  170. package/dist/watcher/queue-watcher.d.ts +64 -0
  171. package/dist/watcher/queue-watcher.d.ts.map +1 -0
  172. package/dist/watcher/queue-watcher.js +187 -0
  173. package/dist/watcher/queue-watcher.js.map +1 -0
  174. package/docs/ADR_CONCEPTS.md +140 -0
  175. package/docs/CONFIGURATION.md +922 -925
  176. package/docs/CROSS_DATABASE.md +153 -0
  177. package/docs/DATABASE_AUTH.md +70 -356
  178. package/docs/HOOKS_GUIDE.md +159 -0
  179. package/docs/SLASH_COMMANDS.md +329 -337
  180. package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
  181. package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
  182. package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
  183. package/docs/cli/README.md +276 -277
  184. package/package.json +123 -119
  185. package/docs/ACCEPTANCE_CRITERIA.md +0 -625
  186. package/docs/AI_AGENT_GUIDE.md +0 -198
  187. package/docs/ARCHITECTURE.md +0 -167
  188. package/docs/AUTO_FILE_TRACKING.md +0 -841
  189. package/docs/BATCH_VALIDATION.md +0 -617
  190. package/docs/BEST_PRACTICES.md +0 -168
  191. package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
  192. package/docs/DECISION_CONTEXT.md +0 -675
  193. package/docs/DECISION_INTELLIGENCE.md +0 -605
  194. package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
  195. package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
  196. package/docs/SHARED_CONCEPTS.md +0 -225
  197. package/docs/SPECIALIZED_AGENTS.md +0 -126
  198. package/docs/TASK_ACTIONS.md +0 -1177
  199. package/docs/TASK_OVERVIEW.md +0 -452
  200. package/docs/TASK_PRUNING.md +0 -594
  201. package/docs/TOOL_REFERENCE.md +0 -1077
  202. package/docs/TOOL_SELECTION.md +0 -83
  203. package/docs/WORKFLOWS.md +0 -941
package/docs/WORKFLOWS.md DELETED
@@ -1,941 +0,0 @@
1
- # Multi-Step Workflow Examples
2
-
3
- **Comprehensive workflows demonstrating coordinated use of multiple sqlew tools**
4
-
5
- This document demonstrates real-world scenarios showing how different tools work together in practice. All workflows are v4.0.0 compatible and focus on decision → constraint → task workflows without the agent system.
6
-
7
- ---
8
-
9
- ## Workflow 1: Feature Implementation Planning
10
-
11
- **Scenario**: Plan and track implementation of a new authentication feature across multiple layers (business logic, API, database).
12
-
13
- ### Phase 1: Record Architectural Decision
14
-
15
- ```javascript
16
- // 1. Record the architecture decision
17
- {
18
- action: "set",
19
- key: "auth_v2_implementation",
20
- value: "Implement OAuth2 + JWT refresh token system for v2.0.0 release",
21
- layer: "business",
22
- tags: ["auth", "feature", "v2.0.0"]
23
- }
24
-
25
- // 2. Add security constraints
26
- {
27
- action: "add",
28
- category: "security",
29
- constraint_text: "All auth tokens must expire within 15 minutes",
30
- priority: "critical",
31
- layer: "business",
32
- tags: ["auth", "security"]
33
- }
34
-
35
- // 3. Add architectural constraint
36
- {
37
- action: "add",
38
- category: "architecture",
39
- constraint_text: "OAuth2 integration must use provider-agnostic abstraction layer",
40
- priority: "high",
41
- layer: "business",
42
- tags: ["auth", "architecture"]
43
- }
44
- ```
45
-
46
- ### Phase 2: Create Implementation Tasks
47
-
48
- ```javascript
49
- // Create implementation tasks for different layers
50
- {
51
- action: "create_batch",
52
- atomic: false,
53
- tasks: [
54
- {
55
- title: "Implement OAuth2 provider integration",
56
- description: "Create OAuth2 service with support for Google and GitHub providers",
57
- layer: "business",
58
- priority: 4,
59
- tags: ["auth", "oauth2"],
60
- status: "todo",
61
- watch_files: ["src/auth/oauth2.ts", "src/auth/providers/"]
62
- },
63
- {
64
- title: "Create JWT token refresh endpoint",
65
- description: "Implement /auth/refresh endpoint with token rotation",
66
- layer: "presentation",
67
- priority: 4,
68
- tags: ["auth", "api"],
69
- status: "todo",
70
- watch_files: ["src/routes/auth.ts"]
71
- },
72
- {
73
- title: "Update auth database schema",
74
- description: "Add oauth_tokens table and migration for token storage",
75
- layer: "data",
76
- priority: 4,
77
- tags: ["auth", "database"],
78
- status: "todo",
79
- watch_files: ["src/db/migrations/", "src/db/schema.ts"]
80
- }
81
- ]
82
- }
83
- ```
84
-
85
- ### Phase 3: Track Progress
86
-
87
- ```javascript
88
- // As implementation progresses, record file changes
89
- {
90
- action: "record",
91
- file_path: "src/auth/oauth2.ts",
92
- change_type: "created",
93
- layer: "business",
94
- description: "OAuth2 provider integration with provider abstraction"
95
- }
96
-
97
- // Link tasks to the architectural decision
98
- {
99
- action: "link",
100
- task_id: 1,
101
- link_type: "decision",
102
- target_id: "auth_v2_implementation",
103
- link_relation: "implements"
104
- }
105
-
106
- // Move tasks through workflow
107
- {
108
- action: "move",
109
- task_id: 1,
110
- status: "in_progress"
111
- }
112
-
113
- // Record additional file changes
114
- {
115
- action: "record",
116
- file_path: "src/auth/jwt.ts",
117
- change_type: "created",
118
- layer: "business",
119
- description: "JWT token generation and refresh logic"
120
- }
121
-
122
- // Update task status
123
- {
124
- action: "move",
125
- task_id: 1,
126
- status: "waiting_review"
127
- }
128
- ```
129
-
130
- ### Phase 4: Verify Constraints Compliance
131
-
132
- ```javascript
133
- // Check that all constraints are satisfied
134
- {
135
- action: "get",
136
- category: "security",
137
- layer: "business",
138
- tags: ["auth"]
139
- }
140
-
141
- // Record completion decision
142
- {
143
- action: "set",
144
- key: "auth_v2_implementation_complete",
145
- value: "OAuth2 + JWT implementation complete and tested",
146
- layer: "business",
147
- tags: ["auth", "v2.0.0", "completed"],
148
- status: "active"
149
- }
150
-
151
- // Complete all related tasks
152
- {
153
- action: "move",
154
- task_id: 1,
155
- status: "done"
156
- }
157
-
158
- {
159
- action: "move",
160
- task_id: 2,
161
- status: "done"
162
- }
163
-
164
- {
165
- action: "move",
166
- task_id: 3,
167
- status: "done"
168
- }
169
- ```
170
-
171
- ---
172
-
173
- ## Workflow 2: Breaking Change Migration
174
-
175
- **Scenario**: API endpoint is being deprecated and migrated to a new version.
176
-
177
- ### Phase 1: Document Deprecation Decision
178
-
179
- ```javascript
180
- // 1. Record deprecation decision
181
- {
182
- action: "set",
183
- key: "api_v1_users_endpoint_deprecated",
184
- value: "/v1/users endpoint deprecated, use /v2/users instead. Sunset date: 2025-12-01",
185
- layer: "presentation",
186
- tags: ["api", "deprecation", "v2.0.0"]
187
- }
188
-
189
- // 2. Add migration constraint
190
- {
191
- action: "add",
192
- category: "architecture",
193
- constraint_text: "All new API endpoints must use /v2 prefix and maintain backwards compatibility for 30 days",
194
- priority: "high",
195
- layer: "presentation",
196
- tags: ["api", "migration"]
197
- }
198
-
199
- // 3. Add timeline constraint
200
- {
201
- action: "add",
202
- category: "timeline",
203
- constraint_text: "/v1/users endpoint sunset on 2025-12-01",
204
- priority: "high",
205
- layer: "presentation",
206
- tags: ["api", "deprecation", "deadline"]
207
- }
208
-
209
- // 4. Create migration task
210
- {
211
- action: "create",
212
- title: "Migrate API clients to /v2/users endpoint",
213
- description: "Update all client integrations to use new /v2/users endpoint before sunset",
214
- acceptance_criteria: "All documented clients successfully calling /v2/users with no errors; /v1 endpoint deprecated in docs",
215
- layer: "presentation",
216
- priority: 3,
217
- tags: ["migration", "client", "api"],
218
- status: "todo",
219
- watch_files: ["src/routes/api/", "docs/api/"]
220
- }
221
- ```
222
-
223
- ### Phase 2: Implement Migration
224
-
225
- ```javascript
226
- // 1. Create the new v2 endpoint implementation task
227
- {
228
- action: "create",
229
- title: "Implement /v2/users endpoint",
230
- description: "Create new v2 endpoint with enhanced response format",
231
- layer: "presentation",
232
- priority: 4,
233
- tags: ["api", "v2", "implementation"],
234
- status: "todo",
235
- watch_files: ["src/routes/users.ts"]
236
- }
237
-
238
- // 2. Record implementation changes
239
- {
240
- action: "record",
241
- file_path: "src/routes/users.ts",
242
- change_type: "modified",
243
- layer: "presentation",
244
- description: "Added /v2/users endpoint with enhanced response schema"
245
- }
246
-
247
- // 3. Record backwards compatibility changes
248
- {
249
- action: "record",
250
- file_path: "src/routes/api.ts",
251
- change_type: "modified",
252
- layer: "presentation",
253
- description: "Updated /v1/users to redirect to /v2/users with deprecation warning header"
254
- }
255
-
256
- // 4. Link tasks to the deprecation decision
257
- {
258
- action: "link",
259
- task_id: 1,
260
- link_type: "decision",
261
- target_id: "api_v1_users_endpoint_deprecated",
262
- link_relation: "implements"
263
- }
264
-
265
- // 5. Move endpoint implementation to in progress
266
- {
267
- action: "move",
268
- task_id: 2,
269
- status: "in_progress"
270
- }
271
- ```
272
-
273
- ### Phase 3: Client Migration
274
-
275
- ```javascript
276
- // 1. Record documentation updates
277
- {
278
- action: "record",
279
- file_path: "docs/api/endpoints.md",
280
- change_type: "modified",
281
- layer: "documentation",
282
- description: "Updated API docs - marked /v1/users as deprecated, added /v2/users examples"
283
- }
284
-
285
- // 2. Update migration task status
286
- {
287
- action: "move",
288
- task_id: 1,
289
- status: "in_progress"
290
- }
291
-
292
- // 3. Record client update changes (example for one client)
293
- {
294
- action: "record_batch",
295
- atomic: false,
296
- file_changes: [
297
- {
298
- file_path: "integrations/client-sdk/src/api.ts",
299
- change_type: "modified",
300
- layer: "presentation",
301
- description: "Updated to use /v2/users endpoint"
302
- },
303
- {
304
- file_path: "integrations/client-sdk/CHANGELOG.md",
305
- change_type: "modified",
306
- layer: "documentation",
307
- description: "Documented migration from /v1/users to /v2/users"
308
- }
309
- ]
310
- }
311
- ```
312
-
313
- ### Phase 4: Complete and Deactivate
314
-
315
- ```javascript
316
- // 1. Create decision confirming migration completion
317
- {
318
- action: "set",
319
- key: "api_v2_migration_complete",
320
- value: "All documented clients have been migrated to /v2/users endpoint",
321
- layer: "presentation",
322
- tags: ["api", "migration", "complete"],
323
- status: "active"
324
- }
325
-
326
- // 2. Deactivate migration constraints (v1 now removed)
327
- {
328
- action: "deactivate",
329
- constraint_id: 1
330
- }
331
-
332
- // 3. Complete implementation task
333
- {
334
- action: "move",
335
- task_id: 2,
336
- status: "done"
337
- }
338
-
339
- // 4. Complete migration task
340
- {
341
- action: "move",
342
- task_id: 1,
343
- status: "done"
344
- }
345
-
346
- // 5. Create decision to schedule v1 removal
347
- {
348
- action: "set",
349
- key: "api_v1_users_removal_scheduled",
350
- value: "Schedule removal of /v1/users endpoint after 2025-12-01 sunset",
351
- layer: "presentation",
352
- tags: ["api", "cleanup"],
353
- status: "active"
354
- }
355
- ```
356
-
357
- ---
358
-
359
- ## Workflow 3: Context Recovery and Task Continuation
360
-
361
- **Scenario**: Resume complex refactoring work across multiple files, tracking progress and constraints.
362
-
363
- ### Phase 1: Record Work-In-Progress State
364
-
365
- ```javascript
366
- // 1. Save refactoring scope and current state
367
- {
368
- action: "set",
369
- key: "refactor_auth_module_state",
370
- value: "Refactoring auth module: Completed 3/5 files. Current: src/auth/oauth2.ts line 145 - token refresh logic needs review",
371
- layer: "business",
372
- tags: ["refactor", "auth", "wip"],
373
- scopes: ["auth-module"]
374
- }
375
-
376
- // 2. Create or update refactoring task with detailed notes
377
- {
378
- action: "create",
379
- title: "Refactor authentication module (5 files)",
380
- description: "Modernize auth module with improved separation of concerns. Files: oauth2, jwt, session, mfa, providers",
381
- acceptance_criteria: "All 5 files refactored; tests passing; no breaking API changes",
382
- layer: "business",
383
- priority: 3,
384
- tags: ["refactor", "auth"],
385
- status: "in_progress"
386
- }
387
-
388
- // 3. Create sub-tasks for each file
389
- {
390
- action: "create_batch",
391
- atomic: false,
392
- tasks: [
393
- {
394
- title: "Refactor oauth2.ts - provider abstraction",
395
- layer: "business",
396
- priority: 3,
397
- tags: ["refactor", "auth", "oauth2"],
398
- status: "in_progress",
399
- watch_files: ["src/auth/oauth2.ts"]
400
- },
401
- {
402
- title: "Refactor jwt.ts - token generation",
403
- layer: "business",
404
- priority: 3,
405
- tags: ["refactor", "auth", "jwt"],
406
- status: "todo",
407
- watch_files: ["src/auth/jwt.ts"]
408
- },
409
- {
410
- title: "Refactor session.ts - session management",
411
- layer: "business",
412
- priority: 3,
413
- tags: ["refactor", "auth", "session"],
414
- status: "todo",
415
- watch_files: ["src/auth/session.ts"]
416
- }
417
- ]
418
- }
419
- ```
420
-
421
- ### Phase 2: Record Current Progress
422
-
423
- ```javascript
424
- // Record WIP changes to oauth2.ts (incomplete work)
425
- {
426
- action: "record",
427
- file_path: "src/auth/oauth2.ts",
428
- change_type: "modified",
429
- layer: "business",
430
- description: "WIP: Refactoring provider abstraction - token refresh logic needs review before proceeding"
431
- }
432
-
433
- // Retrieve context for resuming work
434
- {
435
- action: "get",
436
- key: "refactor_auth_module_state"
437
- }
438
-
439
- // Check recent file changes to understand what's been modified
440
- {
441
- action: "get",
442
- file_path: "src/auth/oauth2.ts",
443
- since: "2025-10-17T00:00:00Z"
444
- }
445
-
446
- // Check related constraints
447
- {
448
- action: "get",
449
- layer: "business",
450
- tags: ["auth"],
451
- active_only: true
452
- }
453
- ```
454
-
455
- ### Phase 3: Resume Work and Track Progress
456
-
457
- ```javascript
458
- // After review, move oauth2 task forward
459
- {
460
- action: "move",
461
- task_id: 1, // oauth2 refactor task
462
- status: "waiting_review"
463
- }
464
-
465
- // Record additional changes to oauth2.ts
466
- {
467
- action: "record",
468
- file_path: "src/auth/oauth2.ts",
469
- change_type: "modified",
470
- layer: "business",
471
- description: "Provider abstraction refactoring complete - added factory pattern for provider creation"
472
- }
473
-
474
- // Move to next file in refactoring sequence
475
- {
476
- action: "move",
477
- task_id: 1,
478
- status: "done"
479
- }
480
-
481
- {
482
- action: "move",
483
- task_id: 2, // jwt.ts refactor task
484
- status: "in_progress"
485
- }
486
-
487
- // Record JWT refactoring changes
488
- {
489
- action: "record",
490
- file_path: "src/auth/jwt.ts",
491
- change_type: "modified",
492
- layer: "business",
493
- description: "JWT token generation refactored - separated signing and verification concerns"
494
- }
495
- ```
496
-
497
- ### Phase 4: Complete Refactoring and Track Completion
498
-
499
- ```javascript
500
- // Mark JWT refactoring complete
501
- {
502
- action: "move",
503
- task_id: 2,
504
- status: "done"
505
- }
506
-
507
- // Move to session refactoring
508
- {
509
- action: "move",
510
- task_id: 3,
511
- status: "in_progress"
512
- }
513
-
514
- // Record session refactoring
515
- {
516
- action: "record_batch",
517
- atomic: false,
518
- file_changes: [
519
- {
520
- file_path: "src/auth/session.ts",
521
- change_type: "modified",
522
- layer: "business",
523
- description: "Session management refactored - improved cookie handling and timeout logic"
524
- },
525
- {
526
- file_path: "src/auth/index.ts",
527
- change_type: "modified",
528
- layer: "business",
529
- description: "Updated module exports - all submodules now expose clean APIs"
530
- }
531
- ]
532
- }
533
-
534
- // Record completion of refactoring work
535
- {
536
- action: "set",
537
- key: "refactor_auth_module_complete",
538
- value: "Auth module refactoring complete - all 5 files modernized with improved separation of concerns",
539
- layer: "business",
540
- tags: ["refactor", "auth", "completed"],
541
- status: "active"
542
- }
543
-
544
- // Mark main task and subtasks as complete
545
- {
546
- action: "move",
547
- task_id: 3,
548
- status: "done"
549
- }
550
-
551
- {
552
- action: "move",
553
- task_id: 1, // Main refactoring task
554
- status: "done"
555
- }
556
- ```
557
-
558
- ---
559
-
560
- ## Workflow 4: Status Monitoring and Health Checks
561
-
562
- **Scenario**: Monitor project health by tracking task statuses, constraints compliance, and identifying blocked work.
563
-
564
- ### Phase 1: Check Task Status and Blocked Items
565
-
566
- ```javascript
567
- // 1. Get all active tasks
568
- {
569
- action: "list",
570
- status: "in_progress,waiting_review",
571
- limit: 20
572
- }
573
-
574
- // 2. Identify blocked tasks requiring attention
575
- {
576
- action: "list",
577
- status: "blocked",
578
- priority: "high,critical"
579
- }
580
-
581
- // 3. Check for tasks with dependencies that might cause delays
582
- {
583
- action: "list",
584
- tags: ["critical"],
585
- status: "todo,waiting_review"
586
- }
587
-
588
- // 4. Create decision tracking monitoring scope
589
- {
590
- action: "set",
591
- key: "project_health_check_2025_11_27",
592
- value: "Health check timestamp and baseline metrics",
593
- layer: "planning",
594
- tags: ["monitoring", "health-check"],
595
- status: "active"
596
- }
597
- ```
598
-
599
- ### Phase 2: Constraint Compliance Review
600
-
601
- ```javascript
602
- // 1. Get all active constraints
603
- {
604
- action: "get",
605
- active_only: true
606
- }
607
-
608
- // 2. Check constraints by priority
609
- {
610
- action: "get",
611
- priority: "critical,high",
612
- active_only: true
613
- }
614
-
615
- // 3. Check constraints by specific layers
616
- {
617
- action: "get",
618
- layer: "business,cross-cutting",
619
- active_only: true
620
- }
621
-
622
- // 4. Check constraints that might conflict
623
- {
624
- action: "get",
625
- category: "architecture",
626
- active_only: true
627
- }
628
- ```
629
-
630
- ### Phase 3: Decision Review and Consistency
631
-
632
- ```javascript
633
- // 1. Search for recent decisions
634
- {
635
- action: "search",
636
- layer: "business",
637
- limit: 20
638
- }
639
-
640
- // 2. Check for potentially conflicting decisions
641
- {
642
- action: "search",
643
- tags: ["breaking-change"],
644
- layer: "presentation"
645
- }
646
-
647
- // 3. Look for stale or inactive decisions
648
- {
649
- action: "search",
650
- status: "inactive",
651
- limit: 10
652
- }
653
-
654
- // 4. Verify decision implementation with tasks
655
- {
656
- action: "list",
657
- tags: ["implementation"],
658
- status: "todo"
659
- }
660
- ```
661
-
662
- ### Phase 4: Database Health and Cleanup
663
-
664
- ```javascript
665
- // 1. Check overall statistics
666
- {
667
- action: "stats"
668
- }
669
-
670
- // Response includes:
671
- // {
672
- // files: 42,
673
- // context_keys: 156,
674
- // active_decisions: 312,
675
- // total_decisions: 342,
676
- // file_changes: 589,
677
- // active_constraints: 12,
678
- // total_constraints: 15,
679
- // tags: 10,
680
- // scopes: 8,
681
- // layers: 9,
682
- // total_tasks: 47,
683
- // active_tasks: 23,
684
- // tasks_by_status: {
685
- // todo: 15,
686
- // in_progress: 5,
687
- // waiting_review: 3,
688
- // blocked: 2,
689
- // done: 20,
690
- // archived: 4
691
- // }
692
- // }
693
-
694
- // 2. Identify old file changes for cleanup
695
- {
696
- action: "get",
697
- file_path: "src/",
698
- since: "2025-10-17T00:00:00Z" // Last 40 days
699
- }
700
-
701
- // 3. Check for excessive file history
702
- // If file_changes are too numerous, create cleanup decision
703
- {
704
- action: "set",
705
- key: "database_cleanup_scheduled",
706
- value: "Archive old file history and inactive decisions older than 30 days",
707
- layer: "infrastructure",
708
- tags: ["maintenance", "cleanup"],
709
- status: "active"
710
- }
711
-
712
- // 4. Document cleanup action
713
- {
714
- action: "create",
715
- title: "Clean up old file changes and inactive decisions",
716
- description: "Archive file_changes older than 30 days to reduce database size",
717
- layer: "infrastructure",
718
- priority: 1,
719
- tags: ["maintenance"],
720
- status: "todo"
721
- }
722
- ```
723
-
724
- ### Phase 5: Report and Document Findings
725
-
726
- ```javascript
727
- // 1. Create monitoring decision with findings
728
- {
729
- action: "set",
730
- key: "health_check_findings_2025_11_27",
731
- value: "Health check complete: 2 blocked tasks, 1 critical constraint violation, database size nominal",
732
- layer: "review",
733
- tags: ["monitoring", "health-check"],
734
- status: "active"
735
- }
736
-
737
- // 2. If issues found, create tasks to address them
738
- {
739
- action: "create_batch",
740
- atomic: false,
741
- tasks: [
742
- {
743
- title: "Unblock database migration task",
744
- description: "Database schema task blocked by dependency - review and unblock",
745
- layer: "data",
746
- priority: 4,
747
- tags: ["blocker", "critical"],
748
- status: "todo"
749
- },
750
- {
751
- title: "Review constraint violation in API layer",
752
- description: "Check why new API endpoint violates backwards compatibility constraint",
753
- layer: "presentation",
754
- priority: 4,
755
- tags: ["constraint", "violation"],
756
- status: "todo"
757
- }
758
- ]
759
- }
760
-
761
- // 3. Document health check completion
762
- {
763
- action: "record",
764
- file_path: "docs/monitoring/health-checks.md",
765
- change_type: "modified",
766
- layer: "documentation",
767
- description: "Added health check report for 2025-11-27"
768
- }
769
- ```
770
-
771
- ---
772
-
773
- ## Workflow 5: Decision Intelligence & Duplicate Prevention (v3.9.0)
774
-
775
- **Scenario**: Agent maintains decision consistency using the three-tier duplicate detection system.
776
-
777
- ### Step 1: Check for Existing Decisions Before Creating
778
-
779
- ```javascript
780
- // 1. Search for related decisions by key pattern
781
- {
782
- action: "by_key",
783
- key: "api/*/authentication",
784
- limit: 5,
785
- min_score: 30
786
- }
787
-
788
- // 2. Check for duplicates by tags
789
- {
790
- action: "by_tags",
791
- tags: ["api", "security", "authentication"],
792
- limit: 5
793
- }
794
-
795
- // 3. Pre-creation duplicate check
796
- {
797
- action: "check_duplicate",
798
- key: "api-authentication-jwt",
799
- tags: ["api", "security", "jwt"]
800
- }
801
- ```
802
-
803
- ### Step 2: Handle Three-Tier Responses
804
-
805
- ```javascript
806
- // Tier 1: Gentle Nudge (35-44 score)
807
- // Decision is created but with warnings
808
- {
809
- action: "set",
810
- key: "api-rate-limiting-v2",
811
- value: "100 requests/minute for free tier",
812
- layer: "infrastructure",
813
- tags: ["api", "rate-limiting", "performance"]
814
- }
815
-
816
- // Response includes duplicate_risk:
817
- // {
818
- // "success": true,
819
- // "key": "api-rate-limiting-v2",
820
- // "duplicate_risk": {
821
- // "severity": "MODERATE",
822
- // "max_score": 42,
823
- // "suggestions": [{
824
- // "key": "api-rate-limiting",
825
- // "score": 42,
826
- // "reasoning": "2 matching tags, same layer"
827
- // }]
828
- // }
829
- // }
830
-
831
- // Tier 2: Hard Block (45-59 score)
832
- // Must update existing or bypass
833
- {
834
- action: "set",
835
- key: "api-throttling",
836
- value: "100 requests/minute for free tier", // Nearly identical
837
- layer: "infrastructure",
838
- tags: ["api", "rate-limiting", "performance"],
839
- // Option A: Update existing decision
840
- // Option B: Bypass with reason
841
- ignore_suggest: true,
842
- ignore_reason: "Different use case - async queue vs real-time API"
843
- }
844
-
845
- // Tier 3: Auto-Update (60+ score)
846
- // Transparently updates existing decision
847
- {
848
- action: "set",
849
- key: "api-rate-limit-config",
850
- value: "Updated: 150 requests/minute for free tier",
851
- layer: "infrastructure",
852
- tags: ["api", "rate-limiting", "performance"]
853
- }
854
-
855
- // Response shows auto-update:
856
- // {
857
- // "success": true,
858
- // "auto_updated": true,
859
- // "requested_key": "api-rate-limit-config",
860
- // "actual_key": "api-rate-limiting",
861
- // "similarity_score": 85,
862
- // "version": "1.0.1"
863
- // }
864
- ```
865
-
866
- ### Step 3: Policy-Based Auto-Triggering
867
-
868
- ```javascript
869
- // 1. Create policy with suggestion enabled
870
- {
871
- action: "create_policy",
872
- name: "security-decisions",
873
- defaults: {
874
- layer: "cross-cutting",
875
- tags: ["security"]
876
- },
877
- suggest_similar: 1, // Enable auto-trigger
878
- validation_rules: {
879
- patterns: { key: "^security/" }
880
- }
881
- }
882
-
883
- // 2. All security/* decisions now auto-check for duplicates
884
- {
885
- action: "set",
886
- key: "security/jwt-expiration",
887
- value: "15 minute token expiration",
888
- tags: ["security", "jwt", "authentication"]
889
- // Auto-triggers duplicate detection!
890
- }
891
-
892
- // Response includes suggestions:
893
- // {
894
- // "success": true,
895
- // "key": "security/jwt-expiration",
896
- // "suggestions": {
897
- // "triggered_by": "security-decisions",
898
- // "reason": "Policy has suggest_similar enabled",
899
- // "suggestions": [...]
900
- // }
901
- // }
902
- ```
903
-
904
- ### Step 4: Context-Aware Search
905
-
906
- ```javascript
907
- // Hybrid search combining multiple factors
908
- {
909
- action: "by_context",
910
- key: "api/*",
911
- tags: ["security", "performance"],
912
- layer: "infrastructure",
913
- priority: 3,
914
- limit: 5
915
- }
916
-
917
- // Returns decisions matching:
918
- // - Key pattern: api/*
919
- // - Tags: security, performance
920
- // - Layer: infrastructure
921
- // - Priority: high (3)
922
- ```
923
-
924
- ### Token Efficiency
925
-
926
- **Suggest Tool Savings:**
927
- - Pattern search: ~50-100 tokens vs manual scanning
928
- - Duplicate detection: ~100 tokens vs creating duplicates
929
- - Auto-update: Eliminates error handling overhead
930
-
931
- **Best Practice**: Always use `check_duplicate` before `set` for high-value decisions.
932
-
933
- ---
934
-
935
- ## Related Documentation
936
-
937
- - **[TOOL_SELECTION.md](TOOL_SELECTION.md)** - Choosing the right tool for your task
938
- - **[TOOL_REFERENCE.md](TOOL_REFERENCE.md)** - Complete parameter reference for all 6 MCP tools
939
- - **[BEST_PRACTICES.md](BEST_PRACTICES.md)** - Common errors and best practices
940
- - **[DECISION_CONTEXT.md](DECISION_CONTEXT.md)** - Managing decision rationale and alternatives
941
- - **[TASK_OVERVIEW.md](TASK_OVERVIEW.md)** - Task system architecture and workflows