sqlew 3.5.3 → 3.6.1

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 (257) hide show
  1. package/CHANGELOG.md +247 -1772
  2. package/README.md +70 -304
  3. package/assets/config.example.toml +106 -0
  4. package/dist/adapters/index.d.ts +11 -0
  5. package/dist/adapters/index.d.ts.map +1 -0
  6. package/dist/adapters/index.js +21 -0
  7. package/dist/adapters/index.js.map +1 -0
  8. package/dist/adapters/mysql-adapter.d.ts +31 -0
  9. package/dist/adapters/mysql-adapter.d.ts.map +1 -0
  10. package/dist/adapters/mysql-adapter.js +63 -0
  11. package/dist/adapters/mysql-adapter.js.map +1 -0
  12. package/dist/adapters/postgresql-adapter.d.ts +31 -0
  13. package/dist/adapters/postgresql-adapter.d.ts.map +1 -0
  14. package/dist/adapters/postgresql-adapter.js +63 -0
  15. package/dist/adapters/postgresql-adapter.js.map +1 -0
  16. package/dist/adapters/sqlite-adapter.d.ts +37 -0
  17. package/dist/adapters/sqlite-adapter.d.ts.map +1 -0
  18. package/dist/adapters/sqlite-adapter.js +129 -0
  19. package/dist/adapters/sqlite-adapter.js.map +1 -0
  20. package/dist/adapters/types.d.ts +33 -0
  21. package/dist/adapters/types.d.ts.map +1 -0
  22. package/dist/adapters/types.js +2 -0
  23. package/dist/adapters/types.js.map +1 -0
  24. package/dist/cli.js +55 -54
  25. package/dist/cli.js.map +1 -1
  26. package/dist/config/example-generator.d.ts +11 -0
  27. package/dist/config/example-generator.d.ts.map +1 -0
  28. package/dist/config/example-generator.js +48 -0
  29. package/dist/config/example-generator.js.map +1 -0
  30. package/dist/config/loader.d.ts.map +1 -1
  31. package/dist/config/loader.js +4 -0
  32. package/dist/config/loader.js.map +1 -1
  33. package/dist/config/types.d.ts +11 -0
  34. package/dist/config/types.d.ts.map +1 -1
  35. package/dist/config/types.js.map +1 -1
  36. package/dist/database.d.ts +56 -121
  37. package/dist/database.d.ts.map +1 -1
  38. package/dist/database.js +266 -414
  39. package/dist/database.js.map +1 -1
  40. package/dist/index.js +329 -245
  41. package/dist/index.js.map +1 -1
  42. package/dist/knexfile.d.ts +6 -0
  43. package/dist/knexfile.d.ts.map +1 -0
  44. package/dist/knexfile.js +85 -0
  45. package/dist/knexfile.js.map +1 -0
  46. package/dist/migrations/add-help-system-tables.d.ts +35 -0
  47. package/dist/migrations/add-help-system-tables.d.ts.map +1 -0
  48. package/dist/migrations/add-help-system-tables.js +206 -0
  49. package/dist/migrations/add-help-system-tables.js.map +1 -0
  50. package/dist/migrations/add-token-tracking.d.ts +28 -0
  51. package/dist/migrations/add-token-tracking.d.ts.map +1 -0
  52. package/dist/migrations/add-token-tracking.js +108 -0
  53. package/dist/migrations/add-token-tracking.js.map +1 -0
  54. package/dist/migrations/index.d.ts +25 -12
  55. package/dist/migrations/index.d.ts.map +1 -1
  56. package/dist/migrations/index.js +147 -20
  57. package/dist/migrations/index.js.map +1 -1
  58. package/dist/migrations/knex/20251025020452_create_master_tables.d.ts +4 -0
  59. package/dist/migrations/knex/20251025020452_create_master_tables.d.ts.map +1 -0
  60. package/dist/migrations/knex/20251025020452_create_master_tables.js +65 -0
  61. package/dist/migrations/knex/20251025020452_create_master_tables.js.map +1 -0
  62. package/dist/migrations/knex/20251025021152_create_transaction_tables.d.ts +4 -0
  63. package/dist/migrations/knex/20251025021152_create_transaction_tables.d.ts.map +1 -0
  64. package/dist/migrations/knex/20251025021152_create_transaction_tables.js +235 -0
  65. package/dist/migrations/knex/20251025021152_create_transaction_tables.js.map +1 -0
  66. package/dist/migrations/knex/20251025021351_create_indexes.d.ts +4 -0
  67. package/dist/migrations/knex/20251025021351_create_indexes.d.ts.map +1 -0
  68. package/dist/migrations/knex/20251025021351_create_indexes.js +62 -0
  69. package/dist/migrations/knex/20251025021351_create_indexes.js.map +1 -0
  70. package/dist/migrations/knex/20251025021416_seed_master_data.d.ts +4 -0
  71. package/dist/migrations/knex/20251025021416_seed_master_data.d.ts.map +1 -0
  72. package/dist/migrations/knex/20251025021416_seed_master_data.js +58 -0
  73. package/dist/migrations/knex/20251025021416_seed_master_data.js.map +1 -0
  74. package/dist/migrations/knex/20251025070349_create_views.d.ts +4 -0
  75. package/dist/migrations/knex/20251025070349_create_views.d.ts.map +1 -0
  76. package/dist/migrations/knex/20251025070349_create_views.js +143 -0
  77. package/dist/migrations/knex/20251025070349_create_views.js.map +1 -0
  78. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.d.ts +4 -0
  79. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.d.ts.map +1 -0
  80. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.js +15 -0
  81. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.js.map +1 -0
  82. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.d.ts +8 -0
  83. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.d.ts.map +1 -0
  84. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.js +12 -0
  85. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.js.map +1 -0
  86. package/dist/migrations/knex/20251025090000_create_help_system_tables.d.ts +19 -0
  87. package/dist/migrations/knex/20251025090000_create_help_system_tables.d.ts.map +1 -0
  88. package/dist/migrations/knex/20251025090000_create_help_system_tables.js +115 -0
  89. package/dist/migrations/knex/20251025090000_create_help_system_tables.js.map +1 -0
  90. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.d.ts +13 -0
  91. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.d.ts.map +1 -0
  92. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.js +377 -0
  93. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.js.map +1 -0
  94. package/dist/migrations/knex/20251025100000_seed_help_metadata.d.ts +15 -0
  95. package/dist/migrations/knex/20251025100000_seed_help_metadata.d.ts.map +1 -0
  96. package/dist/migrations/knex/20251025100000_seed_help_metadata.js +253 -0
  97. package/dist/migrations/knex/20251025100000_seed_help_metadata.js.map +1 -0
  98. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.d.ts +16 -0
  99. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.d.ts.map +1 -0
  100. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.js +276 -0
  101. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.js.map +1 -0
  102. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.d.ts +8 -0
  103. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.d.ts.map +1 -0
  104. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.js +64 -0
  105. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.js.map +1 -0
  106. package/dist/migrations/knex/20251027000000_add_agent_reuse_system.d.ts +14 -0
  107. package/dist/migrations/knex/20251027000000_add_agent_reuse_system.d.ts.map +1 -0
  108. package/dist/migrations/knex/20251027000000_add_agent_reuse_system.js +34 -0
  109. package/dist/migrations/knex/20251027000000_add_agent_reuse_system.js.map +1 -0
  110. package/dist/migrations/knex/20251027010000_add_task_constraint_to_decision_context.d.ts +4 -0
  111. package/dist/migrations/knex/20251027010000_add_task_constraint_to_decision_context.d.ts.map +1 -0
  112. package/dist/migrations/knex/20251027010000_add_task_constraint_to_decision_context.js +24 -0
  113. package/dist/migrations/knex/20251027010000_add_task_constraint_to_decision_context.js.map +1 -0
  114. package/dist/migrations/knex/20251027020000_update_agent_reusability.d.ts +16 -0
  115. package/dist/migrations/knex/20251027020000_update_agent_reusability.d.ts.map +1 -0
  116. package/dist/migrations/knex/20251027020000_update_agent_reusability.js +27 -0
  117. package/dist/migrations/knex/20251027020000_update_agent_reusability.js.map +1 -0
  118. package/dist/migrations/seed-help-data.d.ts +48 -0
  119. package/dist/migrations/seed-help-data.d.ts.map +1 -0
  120. package/dist/migrations/seed-help-data.js +1466 -0
  121. package/dist/migrations/seed-help-data.js.map +1 -0
  122. package/dist/migrations/seed-tool-metadata.d.ts +24 -0
  123. package/dist/migrations/seed-tool-metadata.d.ts.map +1 -0
  124. package/dist/migrations/seed-tool-metadata.js +392 -0
  125. package/dist/migrations/seed-tool-metadata.js.map +1 -0
  126. package/dist/migrations/v3.6.0-help-system-refactor.d.ts +46 -0
  127. package/dist/migrations/v3.6.0-help-system-refactor.d.ts.map +1 -0
  128. package/dist/migrations/v3.6.0-help-system-refactor.js +223 -0
  129. package/dist/migrations/v3.6.0-help-system-refactor.js.map +1 -0
  130. package/dist/schema.d.ts.map +1 -1
  131. package/dist/schema.js +2 -0
  132. package/dist/schema.js.map +1 -1
  133. package/dist/tests/agent-reuse.test.d.ts +6 -0
  134. package/dist/tests/agent-reuse.test.d.ts.map +1 -0
  135. package/dist/tests/agent-reuse.test.js +242 -0
  136. package/dist/tests/agent-reuse.test.js.map +1 -0
  137. package/dist/tests/all-features.test.d.ts +7 -0
  138. package/dist/tests/all-features.test.d.ts.map +1 -0
  139. package/dist/tests/all-features.test.js +514 -0
  140. package/dist/tests/all-features.test.js.map +1 -0
  141. package/dist/tests/git-aware-completion.test.js +89 -70
  142. package/dist/tests/git-aware-completion.test.js.map +1 -1
  143. package/dist/tests/help-system.test.d.ts +23 -0
  144. package/dist/tests/help-system.test.d.ts.map +1 -0
  145. package/dist/tests/help-system.test.js +374 -0
  146. package/dist/tests/help-system.test.js.map +1 -0
  147. package/dist/tests/tasks.auto-pruning-decision-link.test.js +92 -78
  148. package/dist/tests/tasks.auto-pruning-decision-link.test.js.map +1 -1
  149. package/dist/tests/tasks.auto-pruning-partial.test.js +106 -95
  150. package/dist/tests/tasks.auto-pruning-partial.test.js.map +1 -1
  151. package/dist/tests/tasks.auto-pruning-persistence.test.js +115 -97
  152. package/dist/tests/tasks.auto-pruning-persistence.test.js.map +1 -1
  153. package/dist/tests/tasks.auto-pruning-safety.test.js +124 -103
  154. package/dist/tests/tasks.auto-pruning-safety.test.js.map +1 -1
  155. package/dist/tests/tasks.dependencies.test.js +338 -307
  156. package/dist/tests/tasks.dependencies.test.js.map +1 -1
  157. package/dist/tests/tasks.link-file-backward-compat.test.js +116 -104
  158. package/dist/tests/tasks.link-file-backward-compat.test.js.map +1 -1
  159. package/dist/tests/tasks.watch-files-action.test.js +122 -101
  160. package/dist/tests/tasks.watch-files-action.test.js.map +1 -1
  161. package/dist/tests/tasks.watch-files-parameter.test.js +105 -94
  162. package/dist/tests/tasks.watch-files-parameter.test.js.map +1 -1
  163. package/dist/tests/two-step-git-completion.test.js +176 -133
  164. package/dist/tests/two-step-git-completion.test.js.map +1 -1
  165. package/dist/tests/vcs-staging.test.js +1 -1
  166. package/dist/tests/vcs-staging.test.js.map +1 -1
  167. package/dist/tools/config.d.ts +9 -6
  168. package/dist/tools/config.d.ts.map +1 -1
  169. package/dist/tools/config.js +16 -14
  170. package/dist/tools/config.js.map +1 -1
  171. package/dist/tools/constraints.d.ts +10 -7
  172. package/dist/tools/constraints.d.ts.map +1 -1
  173. package/dist/tools/constraints.js +73 -51
  174. package/dist/tools/constraints.js.map +1 -1
  175. package/dist/tools/context.d.ts +36 -33
  176. package/dist/tools/context.d.ts.map +1 -1
  177. package/dist/tools/context.js +441 -340
  178. package/dist/tools/context.js.map +1 -1
  179. package/dist/tools/files.d.ts +12 -9
  180. package/dist/tools/files.d.ts.map +1 -1
  181. package/dist/tools/files.js +173 -95
  182. package/dist/tools/files.js.map +1 -1
  183. package/dist/tools/help-queries.d.ts +130 -0
  184. package/dist/tools/help-queries.d.ts.map +1 -0
  185. package/dist/tools/help-queries.js +393 -0
  186. package/dist/tools/help-queries.js.map +1 -0
  187. package/dist/tools/messaging.d.ts +14 -11
  188. package/dist/tools/messaging.d.ts.map +1 -1
  189. package/dist/tools/messaging.js +239 -133
  190. package/dist/tools/messaging.js.map +1 -1
  191. package/dist/tools/tasks.d.ts +18 -16
  192. package/dist/tools/tasks.d.ts.map +1 -1
  193. package/dist/tools/tasks.js +519 -442
  194. package/dist/tools/tasks.js.map +1 -1
  195. package/dist/tools/utils.d.ts +14 -11
  196. package/dist/tools/utils.d.ts.map +1 -1
  197. package/dist/tools/utils.js +90 -122
  198. package/dist/tools/utils.js.map +1 -1
  199. package/dist/types.d.ts +1 -0
  200. package/dist/types.d.ts.map +1 -1
  201. package/dist/utils/activity-logging.d.ts +114 -0
  202. package/dist/utils/activity-logging.d.ts.map +1 -0
  203. package/dist/utils/activity-logging.js +162 -0
  204. package/dist/utils/activity-logging.js.map +1 -0
  205. package/dist/utils/batch.d.ts +2 -2
  206. package/dist/utils/batch.d.ts.map +1 -1
  207. package/dist/utils/batch.js +8 -8
  208. package/dist/utils/batch.js.map +1 -1
  209. package/dist/utils/cleanup.d.ts +24 -14
  210. package/dist/utils/cleanup.d.ts.map +1 -1
  211. package/dist/utils/cleanup.js +37 -27
  212. package/dist/utils/cleanup.js.map +1 -1
  213. package/dist/utils/debug-logger.d.ts +99 -0
  214. package/dist/utils/debug-logger.d.ts.map +1 -0
  215. package/dist/utils/debug-logger.js +267 -0
  216. package/dist/utils/debug-logger.js.map +1 -0
  217. package/dist/utils/error-handler.d.ts +28 -0
  218. package/dist/utils/error-handler.d.ts.map +1 -0
  219. package/dist/utils/error-handler.js +121 -0
  220. package/dist/utils/error-handler.js.map +1 -0
  221. package/dist/utils/help-tracking.d.ts +55 -0
  222. package/dist/utils/help-tracking.d.ts.map +1 -0
  223. package/dist/utils/help-tracking.js +88 -0
  224. package/dist/utils/help-tracking.js.map +1 -0
  225. package/dist/utils/param-parser.d.ts +23 -0
  226. package/dist/utils/param-parser.d.ts.map +1 -0
  227. package/dist/utils/param-parser.js +52 -0
  228. package/dist/utils/param-parser.js.map +1 -0
  229. package/dist/utils/retention.d.ts +17 -7
  230. package/dist/utils/retention.d.ts.map +1 -1
  231. package/dist/utils/retention.js +31 -12
  232. package/dist/utils/retention.js.map +1 -1
  233. package/dist/utils/task-stale-detection.d.ts +15 -13
  234. package/dist/utils/task-stale-detection.d.ts.map +1 -1
  235. package/dist/utils/task-stale-detection.js +100 -302
  236. package/dist/utils/task-stale-detection.js.map +1 -1
  237. package/dist/utils/token-estimation.d.ts +72 -0
  238. package/dist/utils/token-estimation.d.ts.map +1 -0
  239. package/dist/utils/token-estimation.js +71 -0
  240. package/dist/utils/token-estimation.js.map +1 -0
  241. package/dist/utils/token-logging.d.ts +48 -0
  242. package/dist/utils/token-logging.d.ts.map +1 -0
  243. package/dist/utils/token-logging.js +112 -0
  244. package/dist/utils/token-logging.js.map +1 -0
  245. package/dist/utils/view-queries.d.ts +34 -0
  246. package/dist/utils/view-queries.d.ts.map +1 -0
  247. package/dist/utils/view-queries.js +192 -0
  248. package/dist/utils/view-queries.js.map +1 -0
  249. package/dist/watcher/file-watcher.d.ts.map +1 -1
  250. package/dist/watcher/file-watcher.js +25 -11
  251. package/dist/watcher/file-watcher.js.map +1 -1
  252. package/docs/BEST_PRACTICES.md +56 -448
  253. package/docs/MIGRATION_v3.6.0.md +170 -0
  254. package/docs/SHARED_CONCEPTS.md +63 -208
  255. package/docs/TASK_OVERVIEW.md +2 -2
  256. package/docs/TOOL_SELECTION.md +41 -248
  257. package/package.json +17 -4
@@ -1,51 +1,6 @@
1
1
  # Tool Selection Guide
2
2
 
3
- **Quick reference for choosing the right sqlew tool for your task**
4
-
5
- ## Understanding Tool Purposes
6
-
7
- Each tool serves a distinct purpose in the MCP sqlew ecosystem:
8
-
9
- ```
10
- ┌──────────────────────────────────────────────────────────┐
11
- │ What do you need to do? │
12
- └────────────────┬─────────────────────────────────────────┘
13
-
14
- ├─ Record a CHOICE that was made?
15
- │ └─> Use `decision` tool
16
- │ • Examples: "We chose JWT auth", "Selected PostgreSQL"
17
- │ • Key: Captures PAST decisions
18
- │ • Supports: versioning, tags, layers, scopes
19
-
20
- ├─ Communicate with other agents?
21
- │ └─> Use `message` tool
22
- │ • Examples: Task updates, warnings, requests
23
- │ • Key: Real-time communication
24
- │ • Supports: priority, broadcast, read tracking
25
-
26
- ├─ Define a REQUIREMENT that must be followed?
27
- │ └─> Use `constraint` tool
28
- │ • Examples: "API must be <100ms", "Code coverage >80%"
29
- │ • Key: Enforces RULES
30
- │ • Supports: priority, categories, layers
31
-
32
- ├─ Track WORK to be done?
33
- │ └─> Use `task` tool
34
- │ • Examples: "Implement feature X", "Fix bug Y"
35
- │ • Key: Tracks TODO items and progress
36
- │ • Supports: status transitions, auto-stale, linking
37
-
38
- ├─ Record file modifications?
39
- │ └─> Use `file` tool
40
- │ • Examples: Track changes, check locks
41
- │ • Key: File change history
42
- │ • Supports: layers, change types, lock detection
43
-
44
- └─ Get statistics or manage data?
45
- └─> Use `stats` or `config` tools
46
- • stats: Database metrics, cleanup, activity logs
47
- • config: Retention settings, auto-deletion
48
- ```
3
+ **Quick reference for choosing the right tool**
49
4
 
50
5
  ## Tool Comparison Table
51
6
 
@@ -61,219 +16,57 @@ Each tool serves a distinct purpose in the MCP sqlew ecosystem:
61
16
 
62
17
  ## Decision vs Constraint vs Task
63
18
 
64
- This is the most common confusion. Here's the distinction:
65
-
66
- | Concept | Definition | Example | Tool |
67
- |---------|------------|---------|------|
68
- | **Decision** | A choice that WAS made | "We chose JWT authentication" | `decision` |
69
- | **Constraint** | A requirement that MUST be followed | "Response time must be <100ms" | `constraint` |
70
- | **Task** | Work that NEEDS to be done | "Implement JWT authentication" | `task` |
71
-
72
- ## ⚠️ Decision vs Task: WHY vs WHAT
73
-
74
- **Critical distinction**: `decision` stores WHY (reasoning), `task` stores WHAT (work status).
75
-
76
- | Question | Answer | Tool |
77
- |----------|--------|------|
78
- | **WHY** did we choose this approach? | "Chose JWT because stateless auth scales horizontally" | **decision** |
79
- | **WHAT** needs to be done? | "Implement JWT authentication (status: in_progress)" | **task** |
80
- | **WHY** was this bug introduced? | "Nested transaction bug: setDecision wraps in transaction, batch also wraps" | **decision** |
81
- | **WHAT** is the completion status? | "Fixed nested transaction bug (status: done)" | **task** |
82
-
83
- ### Common Mistakes
84
-
85
- ```javascript
86
- // ❌ WRONG - Using decision for task completion
87
- {
88
- action: "set",
89
- key: "jwt-implementation-complete",
90
- value: "JWT authentication implemented. All tests passing."
91
- }
92
- // This is WHAT was done (completion status), not WHY decisions were made.
93
- // FIX: Use task tool for tracking implementation progress.
94
-
95
- // ✅ CORRECT - Using decision for architectural reasoning
96
- {
97
- action: "set",
98
- key: "api/auth/jwt-choice",
99
- value: "Chose JWT over sessions because: (1) Stateless design scales, (2) Mobile clients cache tokens, (3) Microservice auth requires distributed validation."
100
- }
101
- // This explains WHY JWT was chosen with architectural reasoning.
102
-
103
- // ✅ CORRECT - Using task for work tracking
104
- {
105
- action: "create",
106
- title: "Implement JWT authentication with refresh tokens",
107
- status: "in_progress",
108
- assigned_agent: "backend-agent"
109
- }
110
- // This tracks WHAT work is being done and its current status.
111
- ```
112
-
113
- 💡 **See [BEST_PRACTICES.md](BEST_PRACTICES.md#critical-what-to-store-in-decisions) for detailed examples of WHY vs WHAT.**
114
-
115
- ## Scenario-Based Tool Selection
116
-
117
- ### Scenario 1: Breaking API Change
118
-
119
- ```javascript
120
- // 1. Record the decision (WHY the change was necessary)
121
- {
122
- action: "set",
123
- key: "api/v2/versioning-decision",
124
- value: "Moved /users to /v2/users because: (1) Enables backward compatibility via versioning, (2) Allows gradual client migration without breaking production apps, (3) Future API changes won't force all clients to update simultaneously. Trade-off: More complex routing layer, but necessary for production stability with 50+ client apps.",
125
- layer: "presentation",
126
- tags: ["api", "versioning", "architecture-decision"]
127
- }
128
-
129
- // 2. Add a constraint (requirement going forward)
130
- {
131
- action: "add",
132
- category: "architecture",
133
- constraint_text: "All API endpoints must include version prefix",
134
- layer: "presentation",
135
- tags: ["api", "versioning"]
136
- }
137
-
138
- // 3. Create migration task
139
- {
140
- action: "create",
141
- title: "Migrate clients to /v2/users endpoint",
142
- status: "todo",
143
- layer: "presentation",
144
- tags: ["migration", "v2.0.0"]
145
- }
146
-
147
- // 4. Notify other agents
148
- {
149
- action: "send",
150
- from_agent: "api-agent",
151
- msg_type: "warning",
152
- message: "Breaking change: /users moved to /v2/users",
153
- priority: "critical"
154
- }
155
- ```
156
-
157
- ### Scenario 2: Performance Issue
158
-
159
- ```javascript
160
- // 1. Record the analysis and solution decision (WHY this approach)
161
- {
162
- action: "set",
163
- key: "db/user_sessions/index-strategy",
164
- value: "Adding composite index (user_id, created_at DESC) to user_sessions table because: (1) Query analysis shows 300% latency increase from full table scans on 10M+ rows, (2) 95% of queries filter by user_id + sort by timestamp, (3) Index reduces query time from 850ms to <50ms in staging tests. Trade-off: 15% slower inserts and 200MB additional storage, but read performance critical for user experience.",
165
- layer: "data",
166
- tags: ["performance", "database", "indexing-strategy"]
167
- }
168
-
169
- // 2. Add performance constraint
170
- {
171
- action: "add",
172
- category: "performance",
173
- constraint_text: "Database queries must complete within 50ms",
174
- priority: "high",
175
- layer: "data"
176
- }
177
-
178
- // 3. Create optimization task
179
- {
180
- action: "create",
181
- title: "Add indexes to user_sessions table",
182
- status: "in_progress",
183
- priority: 4,
184
- layer: "data",
185
- tags: ["performance", "database"]
186
- }
187
- ```
188
-
189
- ### Scenario 3: Security Vulnerability
19
+ | Concept | Definition | Example |
20
+ |---------|------------|---------|
21
+ | **Decision** | A choice that WAS made | "We chose JWT authentication" |
22
+ | **Constraint** | A requirement that MUST be followed | "Response time must be <100ms" |
23
+ | **Task** | Work that NEEDS to be done | "Implement JWT authentication" |
190
24
 
191
- ```javascript
192
- // 1. Record the solution decision (WHY this mitigation approach)
193
- {
194
- action: "set",
195
- key: "security/jwt/timing-attack-mitigation",
196
- value: "Upgrading JWT library to v9.2.0+ and implementing constant-time comparison because: (1) CVE-2025-1234 timing attack allows token forgery via timing analysis, (2) Library v9.2.0+ includes constant-time string comparison preventing timing leaks, (3) Alternative approach (rewriting auth layer) would take 3 weeks vs 2-day upgrade. Trade-off: Breaking change requires updating all microservices, but security risk is critical and affects all user sessions.",
197
- layer: "business",
198
- tags: ["security", "authentication", "mitigation-strategy"]
199
- }
25
+ ## Decision vs Task: WHY vs WHAT
200
26
 
201
- // 2. Add security constraint
202
- {
203
- action: "add",
204
- category: "security",
205
- constraint_text: "All auth tokens must use constant-time comparison",
206
- priority: "critical",
207
- layer: "business"
208
- }
27
+ **Critical**: `decision` = WHY (reasoning), `task` = WHAT (work status)
209
28
 
210
- // 3. Create fix task
211
- {
212
- action: "create",
213
- title: "Upgrade JWT library and implement constant-time comparison",
214
- status: "in_progress",
215
- priority: 4,
216
- assigned_agent: "security-agent",
217
- layer: "business"
218
- }
29
+ | Question | Tool |
30
+ |----------|------|
31
+ | WHY did we choose this? | **decision** |
32
+ | WHAT needs to be done? | **task** |
33
+ | WHY was this bug introduced? | **decision** |
34
+ | WHAT is the completion status? | **task** |
219
35
 
220
- // 4. Alert all agents
221
- {
222
- action: "send",
223
- from_agent: "security-agent",
224
- to_agent: null, // Broadcast
225
- msg_type: "warning",
226
- message: "URGENT: Auth vulnerability found, fix in progress",
227
- priority: "critical"
228
- }
229
- ```
36
+ ## Common Scenarios
230
37
 
231
- ## Search Actions Decision Tree
38
+ **Breaking API Change:**
39
+ 1. `decision` - Record WHY change was necessary with reasoning
40
+ 2. `constraint` - Add requirement for version prefixes going forward
41
+ 3. `task` - Create migration work item
42
+ 4. `message` - Alert other agents
232
43
 
233
- ### When to use which search action?
44
+ **Performance Issue:**
45
+ 1. `decision` - Record analysis and WHY this solution
46
+ 2. `constraint` - Add performance requirement
47
+ 3. `task` - Create optimization work item
234
48
 
235
- ```
236
- ┌─────────────────────────────────────┐
237
- What do you want to search by? │
238
- └──────────┬──────────────────────────┘
239
-
240
- ├─ Simple filters (status, layer, tags)?
241
- │ └─> Use action: "list"
242
-
243
- ├─ Primarily by tags?
244
- │ └─> Use action: "search_tags"
245
- │ • match_mode: "AND" (all tags) or "OR" (any tag)
246
-
247
- ├─ Primarily by layer?
248
- │ └─> Use action: "search_layer"
249
-
250
- ├─ Complex multi-filter query?
251
- │ └─> Use action: "search_advanced"
252
- │ • Multiple layers (OR)
253
- │ • Tag combinations (AND/OR)
254
- │ • Temporal filtering
255
- │ • Full-text search
256
- │ • Pagination
257
-
258
- └─ Need version history?
259
- └─> Use action: "versions"
260
- ```
49
+ **Security Vulnerability:**
50
+ 1. `decision` - Record WHY this mitigation approach
51
+ 2. `constraint` - Add security requirement
52
+ 3. `task` - Create fix work item
53
+ 4. `message` - Alert all agents
261
54
 
262
- ### Detailed Search Comparison
55
+ ## Search Action Selection
263
56
 
264
- | Action | Use When | Key Features |
265
- |--------|----------|--------------|
266
- | **list** | Basic filtering | Simple status/layer/tag filters, no pagination |
267
- | **search_tags** | Tag-focused search | AND/OR logic for tags, optional status/layer |
268
- | **search_layer** | Layer-focused search | Get all decisions in specific layer(s) |
269
- | **search_advanced** | Complex queries | Full filtering, pagination, sorting, text search |
270
- | **versions** | History tracking | Get all versions of a specific decision |
57
+ | Action | Use For |
58
+ |--------|---------|
59
+ | **list** | Simple status/layer/tag filters |
60
+ | **search_tags** | Tag-focused with AND/OR logic |
61
+ | **search_layer** | Layer-focused queries |
62
+ | **search_advanced** | Complex multi-filter, pagination, full-text |
63
+ | **versions** | Version history of specific decision |
271
64
 
272
65
  ---
273
66
 
274
67
  ## Related Documentation
275
68
 
276
- - **[TOOL_REFERENCE.md](TOOL_REFERENCE.md)** - Complete parameter reference for all tools
277
- - **[WORKFLOWS.md](WORKFLOWS.md)** - Multi-step workflow examples
278
- - **[BEST_PRACTICES.md](BEST_PRACTICES.md)** - Common errors and best practices
279
- - **[ARCHITECTURE.md](ARCHITECTURE.md)** - Layer definitions and system architecture
69
+ - [TOOL_REFERENCE.md](TOOL_REFERENCE.md) - Parameter reference
70
+ - [WORKFLOWS.md](WORKFLOWS.md) - Multi-step workflows
71
+ - [BEST_PRACTICES.md](BEST_PRACTICES.md) - Common errors
72
+ - [SHARED_CONCEPTS.md](SHARED_CONCEPTS.md) - Layers, enums, concepts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sqlew",
3
- "version": "3.5.3",
4
- "description": "MCP server for efficient context sharing between Claude Code sub-agents with Kanban Task Watcher, auto-pruning for non-existent files, Git-aware auto-complete, Decision Context, auto-file-tracking, and 60-75% token reduction in multi-session projects",
3
+ "version": "3.6.1",
4
+ "description": "MCP server for efficient context sharing between Claude Code sub-agents with database-driven help system (60-70% token reduction), Kanban Task Watcher, Git-aware auto-complete, Decision Context, and streamlined documentation",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
@@ -27,8 +27,17 @@
27
27
  "clean": "rm -rf dist",
28
28
  "rebuild": "npm run clean && npm run build",
29
29
  "test": "npm run build && node --test dist/tests/tasks.dependencies.test.js",
30
+ "test:all-features": "npm run build && node dist/tests/all-features.test.js",
30
31
  "test:migrations": "npm run build && node dist/tests/migrations/test-v3.2-migration.js",
31
- "prepublishOnly": "npm run rebuild"
32
+ "prepublishOnly": "npm run rebuild",
33
+ "knex": "tsx node_modules/.bin/knex --knexfile src/knexfile.ts",
34
+ "migrate:make": "npm run knex migrate:make",
35
+ "migrate:latest": "npm run knex migrate:latest",
36
+ "migrate:rollback": "npm run knex migrate:rollback",
37
+ "migrate:rollback:all": "npm run knex migrate:rollback --all",
38
+ "migrate:status": "npm run knex migrate:status",
39
+ "seed:make": "npm run knex seed:make",
40
+ "seed:run": "npm run knex seed:run"
32
41
  },
33
42
  "engines": {
34
43
  "node": ">=18.0.0"
@@ -59,11 +68,15 @@
59
68
  "better-sqlite3": "^11.0.0",
60
69
  "chokidar": "^4.0.3",
61
70
  "ignore": "^7.0.5",
62
- "smol-toml": "^1.4.2"
71
+ "knex": "^3.1.0",
72
+ "smol-toml": "^1.4.2",
73
+ "sqlite3": "^5.1.7"
63
74
  },
64
75
  "devDependencies": {
65
76
  "@types/better-sqlite3": "^7.6.0",
77
+ "@types/knex": "^0.15.2",
66
78
  "@types/node": "^20.0.0",
79
+ "tsx": "^4.20.6",
67
80
  "typescript": "^5.0.0"
68
81
  }
69
82
  }