sqlew 3.2.5 → 3.6.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 (291) hide show
  1. package/CHANGELOG.md +288 -1011
  2. package/README.md +80 -263
  3. package/assets/config.example.toml +97 -0
  4. package/assets/schema.sql +6 -1
  5. package/dist/adapters/index.d.ts +11 -0
  6. package/dist/adapters/index.d.ts.map +1 -0
  7. package/dist/adapters/index.js +21 -0
  8. package/dist/adapters/index.js.map +1 -0
  9. package/dist/adapters/mysql-adapter.d.ts +31 -0
  10. package/dist/adapters/mysql-adapter.d.ts.map +1 -0
  11. package/dist/adapters/mysql-adapter.js +63 -0
  12. package/dist/adapters/mysql-adapter.js.map +1 -0
  13. package/dist/adapters/postgresql-adapter.d.ts +31 -0
  14. package/dist/adapters/postgresql-adapter.d.ts.map +1 -0
  15. package/dist/adapters/postgresql-adapter.js +63 -0
  16. package/dist/adapters/postgresql-adapter.js.map +1 -0
  17. package/dist/adapters/sqlite-adapter.d.ts +37 -0
  18. package/dist/adapters/sqlite-adapter.d.ts.map +1 -0
  19. package/dist/adapters/sqlite-adapter.js +129 -0
  20. package/dist/adapters/sqlite-adapter.js.map +1 -0
  21. package/dist/adapters/types.d.ts +33 -0
  22. package/dist/adapters/types.d.ts.map +1 -0
  23. package/dist/adapters/types.js +2 -0
  24. package/dist/adapters/types.js.map +1 -0
  25. package/dist/cli.js +55 -54
  26. package/dist/cli.js.map +1 -1
  27. package/dist/config/example-generator.d.ts +11 -0
  28. package/dist/config/example-generator.d.ts.map +1 -0
  29. package/dist/config/example-generator.js +48 -0
  30. package/dist/config/example-generator.js.map +1 -0
  31. package/dist/config/loader.d.ts +46 -0
  32. package/dist/config/loader.d.ts.map +1 -0
  33. package/dist/config/loader.js +155 -0
  34. package/dist/config/loader.js.map +1 -0
  35. package/dist/config/types.d.ts +86 -0
  36. package/dist/config/types.d.ts.map +1 -0
  37. package/dist/config/types.js +28 -0
  38. package/dist/config/types.js.map +1 -0
  39. package/dist/constants.d.ts +9 -0
  40. package/dist/constants.d.ts.map +1 -1
  41. package/dist/constants.js +10 -0
  42. package/dist/constants.js.map +1 -1
  43. package/dist/database.d.ts +44 -122
  44. package/dist/database.d.ts.map +1 -1
  45. package/dist/database.js +145 -349
  46. package/dist/database.js.map +1 -1
  47. package/dist/index.js +223 -175
  48. package/dist/index.js.map +1 -1
  49. package/dist/knexfile.d.ts +6 -0
  50. package/dist/knexfile.d.ts.map +1 -0
  51. package/dist/knexfile.js +85 -0
  52. package/dist/knexfile.js.map +1 -0
  53. package/dist/migrations/add-help-system-tables.d.ts +35 -0
  54. package/dist/migrations/add-help-system-tables.d.ts.map +1 -0
  55. package/dist/migrations/add-help-system-tables.js +206 -0
  56. package/dist/migrations/add-help-system-tables.js.map +1 -0
  57. package/dist/migrations/add-token-tracking.d.ts +28 -0
  58. package/dist/migrations/add-token-tracking.d.ts.map +1 -0
  59. package/dist/migrations/add-token-tracking.js +108 -0
  60. package/dist/migrations/add-token-tracking.js.map +1 -0
  61. package/dist/migrations/add-v3.5.0-pruned-files.d.ts +26 -0
  62. package/dist/migrations/add-v3.5.0-pruned-files.d.ts.map +1 -0
  63. package/dist/migrations/add-v3.5.0-pruned-files.js +107 -0
  64. package/dist/migrations/add-v3.5.0-pruned-files.js.map +1 -0
  65. package/dist/migrations/index.d.ts +26 -12
  66. package/dist/migrations/index.d.ts.map +1 -1
  67. package/dist/migrations/index.js +162 -20
  68. package/dist/migrations/index.js.map +1 -1
  69. package/dist/migrations/knex/20251025020452_create_master_tables.d.ts +4 -0
  70. package/dist/migrations/knex/20251025020452_create_master_tables.d.ts.map +1 -0
  71. package/dist/migrations/knex/20251025020452_create_master_tables.js +65 -0
  72. package/dist/migrations/knex/20251025020452_create_master_tables.js.map +1 -0
  73. package/dist/migrations/knex/20251025021152_create_transaction_tables.d.ts +4 -0
  74. package/dist/migrations/knex/20251025021152_create_transaction_tables.d.ts.map +1 -0
  75. package/dist/migrations/knex/20251025021152_create_transaction_tables.js +235 -0
  76. package/dist/migrations/knex/20251025021152_create_transaction_tables.js.map +1 -0
  77. package/dist/migrations/knex/20251025021351_create_indexes.d.ts +4 -0
  78. package/dist/migrations/knex/20251025021351_create_indexes.d.ts.map +1 -0
  79. package/dist/migrations/knex/20251025021351_create_indexes.js +62 -0
  80. package/dist/migrations/knex/20251025021351_create_indexes.js.map +1 -0
  81. package/dist/migrations/knex/20251025021416_seed_master_data.d.ts +4 -0
  82. package/dist/migrations/knex/20251025021416_seed_master_data.d.ts.map +1 -0
  83. package/dist/migrations/knex/20251025021416_seed_master_data.js +58 -0
  84. package/dist/migrations/knex/20251025021416_seed_master_data.js.map +1 -0
  85. package/dist/migrations/knex/20251025070349_create_views.d.ts +4 -0
  86. package/dist/migrations/knex/20251025070349_create_views.d.ts.map +1 -0
  87. package/dist/migrations/knex/20251025070349_create_views.js +143 -0
  88. package/dist/migrations/knex/20251025070349_create_views.js.map +1 -0
  89. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.d.ts +4 -0
  90. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.d.ts.map +1 -0
  91. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.js +15 -0
  92. package/dist/migrations/knex/20251025081221_add_link_type_to_task_decision_links.js.map +1 -0
  93. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.d.ts +8 -0
  94. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.d.ts.map +1 -0
  95. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.js +12 -0
  96. package/dist/migrations/knex/20251025082220_fix_task_dependencies_columns.js.map +1 -0
  97. package/dist/migrations/knex/20251025090000_create_help_system_tables.d.ts +19 -0
  98. package/dist/migrations/knex/20251025090000_create_help_system_tables.d.ts.map +1 -0
  99. package/dist/migrations/knex/20251025090000_create_help_system_tables.js +115 -0
  100. package/dist/migrations/knex/20251025090000_create_help_system_tables.js.map +1 -0
  101. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.d.ts +13 -0
  102. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.d.ts.map +1 -0
  103. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.js +377 -0
  104. package/dist/migrations/knex/20251025090100_seed_help_categories_and_use_cases.js.map +1 -0
  105. package/dist/migrations/knex/20251025100000_seed_help_metadata.d.ts +15 -0
  106. package/dist/migrations/knex/20251025100000_seed_help_metadata.d.ts.map +1 -0
  107. package/dist/migrations/knex/20251025100000_seed_help_metadata.js +253 -0
  108. package/dist/migrations/knex/20251025100000_seed_help_metadata.js.map +1 -0
  109. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.d.ts +16 -0
  110. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.d.ts.map +1 -0
  111. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.js +276 -0
  112. package/dist/migrations/knex/20251025100100_seed_remaining_use_cases.js.map +1 -0
  113. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.d.ts +8 -0
  114. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.d.ts.map +1 -0
  115. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.js +64 -0
  116. package/dist/migrations/knex/20251025120000_add_cascade_to_task_dependencies.js.map +1 -0
  117. package/dist/migrations/seed-help-data.d.ts +48 -0
  118. package/dist/migrations/seed-help-data.d.ts.map +1 -0
  119. package/dist/migrations/seed-help-data.js +1466 -0
  120. package/dist/migrations/seed-help-data.js.map +1 -0
  121. package/dist/migrations/seed-tool-metadata.d.ts +24 -0
  122. package/dist/migrations/seed-tool-metadata.d.ts.map +1 -0
  123. package/dist/migrations/seed-tool-metadata.js +392 -0
  124. package/dist/migrations/seed-tool-metadata.js.map +1 -0
  125. package/dist/migrations/v3.6.0-help-system-refactor.d.ts +46 -0
  126. package/dist/migrations/v3.6.0-help-system-refactor.d.ts.map +1 -0
  127. package/dist/migrations/v3.6.0-help-system-refactor.js +223 -0
  128. package/dist/migrations/v3.6.0-help-system-refactor.js.map +1 -0
  129. package/dist/schema.d.ts.map +1 -1
  130. package/dist/schema.js +2 -0
  131. package/dist/schema.js.map +1 -1
  132. package/dist/tests/git-aware-completion.test.d.ts +6 -0
  133. package/dist/tests/git-aware-completion.test.d.ts.map +1 -0
  134. package/dist/tests/git-aware-completion.test.js +160 -0
  135. package/dist/tests/git-aware-completion.test.js.map +1 -0
  136. package/dist/tests/help-system.test.d.ts +23 -0
  137. package/dist/tests/help-system.test.d.ts.map +1 -0
  138. package/dist/tests/help-system.test.js +374 -0
  139. package/dist/tests/help-system.test.js.map +1 -0
  140. package/dist/tests/tasks.auto-pruning-decision-link.test.d.ts +6 -0
  141. package/dist/tests/tasks.auto-pruning-decision-link.test.d.ts.map +1 -0
  142. package/dist/tests/tasks.auto-pruning-decision-link.test.js +264 -0
  143. package/dist/tests/tasks.auto-pruning-decision-link.test.js.map +1 -0
  144. package/dist/tests/tasks.auto-pruning-partial.test.d.ts +6 -0
  145. package/dist/tests/tasks.auto-pruning-partial.test.d.ts.map +1 -0
  146. package/dist/tests/tasks.auto-pruning-partial.test.js +285 -0
  147. package/dist/tests/tasks.auto-pruning-partial.test.js.map +1 -0
  148. package/dist/tests/tasks.auto-pruning-persistence.test.d.ts +6 -0
  149. package/dist/tests/tasks.auto-pruning-persistence.test.d.ts.map +1 -0
  150. package/dist/tests/tasks.auto-pruning-persistence.test.js +250 -0
  151. package/dist/tests/tasks.auto-pruning-persistence.test.js.map +1 -0
  152. package/dist/tests/tasks.auto-pruning-safety.test.d.ts +12 -0
  153. package/dist/tests/tasks.auto-pruning-safety.test.d.ts.map +1 -0
  154. package/dist/tests/tasks.auto-pruning-safety.test.js +217 -0
  155. package/dist/tests/tasks.auto-pruning-safety.test.js.map +1 -0
  156. package/dist/tests/tasks.dependencies.test.js +338 -307
  157. package/dist/tests/tasks.dependencies.test.js.map +1 -1
  158. package/dist/tests/tasks.link-file-backward-compat.test.d.ts +6 -0
  159. package/dist/tests/tasks.link-file-backward-compat.test.d.ts.map +1 -0
  160. package/dist/tests/tasks.link-file-backward-compat.test.js +247 -0
  161. package/dist/tests/tasks.link-file-backward-compat.test.js.map +1 -0
  162. package/dist/tests/tasks.watch-files-action.test.d.ts +6 -0
  163. package/dist/tests/tasks.watch-files-action.test.d.ts.map +1 -0
  164. package/dist/tests/tasks.watch-files-action.test.js +372 -0
  165. package/dist/tests/tasks.watch-files-action.test.js.map +1 -0
  166. package/dist/tests/tasks.watch-files-parameter.test.d.ts +6 -0
  167. package/dist/tests/tasks.watch-files-parameter.test.d.ts.map +1 -0
  168. package/dist/tests/tasks.watch-files-parameter.test.js +260 -0
  169. package/dist/tests/tasks.watch-files-parameter.test.js.map +1 -0
  170. package/dist/tests/two-step-git-completion.test.d.ts +6 -0
  171. package/dist/tests/two-step-git-completion.test.d.ts.map +1 -0
  172. package/dist/tests/two-step-git-completion.test.js +326 -0
  173. package/dist/tests/two-step-git-completion.test.js.map +1 -0
  174. package/dist/tests/vcs-staging.test.d.ts +6 -0
  175. package/dist/tests/vcs-staging.test.d.ts.map +1 -0
  176. package/dist/tests/vcs-staging.test.js +137 -0
  177. package/dist/tests/vcs-staging.test.js.map +1 -0
  178. package/dist/tools/config.d.ts +9 -4
  179. package/dist/tools/config.d.ts.map +1 -1
  180. package/dist/tools/config.js +16 -12
  181. package/dist/tools/config.js.map +1 -1
  182. package/dist/tools/constraints.d.ts +9 -3
  183. package/dist/tools/constraints.d.ts.map +1 -1
  184. package/dist/tools/constraints.js +66 -45
  185. package/dist/tools/constraints.js.map +1 -1
  186. package/dist/tools/context.d.ts +35 -16
  187. package/dist/tools/context.d.ts.map +1 -1
  188. package/dist/tools/context.js +374 -314
  189. package/dist/tools/context.js.map +1 -1
  190. package/dist/tools/files.d.ts +11 -4
  191. package/dist/tools/files.d.ts.map +1 -1
  192. package/dist/tools/files.js +173 -91
  193. package/dist/tools/files.js.map +1 -1
  194. package/dist/tools/help-queries.d.ts +130 -0
  195. package/dist/tools/help-queries.d.ts.map +1 -0
  196. package/dist/tools/help-queries.js +393 -0
  197. package/dist/tools/help-queries.js.map +1 -0
  198. package/dist/tools/messaging.d.ts +13 -6
  199. package/dist/tools/messaging.d.ts.map +1 -1
  200. package/dist/tools/messaging.js +217 -129
  201. package/dist/tools/messaging.js.map +1 -1
  202. package/dist/tools/tasks.d.ts +42 -12
  203. package/dist/tools/tasks.d.ts.map +1 -1
  204. package/dist/tools/tasks.js +809 -347
  205. package/dist/tools/tasks.js.map +1 -1
  206. package/dist/tools/utils.d.ts +13 -5
  207. package/dist/tools/utils.d.ts.map +1 -1
  208. package/dist/tools/utils.js +92 -115
  209. package/dist/tools/utils.js.map +1 -1
  210. package/dist/types.d.ts +4 -0
  211. package/dist/types.d.ts.map +1 -1
  212. package/dist/utils/activity-logging.d.ts +114 -0
  213. package/dist/utils/activity-logging.d.ts.map +1 -0
  214. package/dist/utils/activity-logging.js +162 -0
  215. package/dist/utils/activity-logging.js.map +1 -0
  216. package/dist/utils/batch.d.ts +2 -2
  217. package/dist/utils/batch.d.ts.map +1 -1
  218. package/dist/utils/batch.js +8 -8
  219. package/dist/utils/batch.js.map +1 -1
  220. package/dist/utils/cleanup.d.ts +21 -13
  221. package/dist/utils/cleanup.d.ts.map +1 -1
  222. package/dist/utils/cleanup.js +31 -24
  223. package/dist/utils/cleanup.js.map +1 -1
  224. package/dist/utils/debug-logger.d.ts +44 -0
  225. package/dist/utils/debug-logger.d.ts.map +1 -0
  226. package/dist/utils/debug-logger.js +116 -0
  227. package/dist/utils/debug-logger.js.map +1 -0
  228. package/dist/utils/file-pruning.d.ts +69 -0
  229. package/dist/utils/file-pruning.d.ts.map +1 -0
  230. package/dist/utils/file-pruning.js +185 -0
  231. package/dist/utils/file-pruning.js.map +1 -0
  232. package/dist/utils/help-tracking.d.ts +55 -0
  233. package/dist/utils/help-tracking.d.ts.map +1 -0
  234. package/dist/utils/help-tracking.js +88 -0
  235. package/dist/utils/help-tracking.js.map +1 -0
  236. package/dist/utils/quality-checks.d.ts +60 -0
  237. package/dist/utils/quality-checks.d.ts.map +1 -0
  238. package/dist/utils/quality-checks.js +228 -0
  239. package/dist/utils/quality-checks.js.map +1 -0
  240. package/dist/utils/retention.d.ts +13 -5
  241. package/dist/utils/retention.d.ts.map +1 -1
  242. package/dist/utils/retention.js +20 -8
  243. package/dist/utils/retention.js.map +1 -1
  244. package/dist/utils/task-stale-detection.d.ts +77 -7
  245. package/dist/utils/task-stale-detection.d.ts.map +1 -1
  246. package/dist/utils/task-stale-detection.js +309 -34
  247. package/dist/utils/task-stale-detection.js.map +1 -1
  248. package/dist/utils/token-estimation.d.ts +72 -0
  249. package/dist/utils/token-estimation.d.ts.map +1 -0
  250. package/dist/utils/token-estimation.js +71 -0
  251. package/dist/utils/token-estimation.js.map +1 -0
  252. package/dist/utils/token-logging.d.ts +48 -0
  253. package/dist/utils/token-logging.d.ts.map +1 -0
  254. package/dist/utils/token-logging.js +112 -0
  255. package/dist/utils/token-logging.js.map +1 -0
  256. package/dist/utils/vcs-adapter.d.ts +68 -0
  257. package/dist/utils/vcs-adapter.d.ts.map +1 -0
  258. package/dist/utils/vcs-adapter.js +187 -0
  259. package/dist/utils/vcs-adapter.js.map +1 -0
  260. package/dist/utils/view-queries.d.ts +34 -0
  261. package/dist/utils/view-queries.d.ts.map +1 -0
  262. package/dist/utils/view-queries.js +192 -0
  263. package/dist/utils/view-queries.js.map +1 -0
  264. package/dist/watcher/file-watcher.d.ts +54 -4
  265. package/dist/watcher/file-watcher.d.ts.map +1 -1
  266. package/dist/watcher/file-watcher.js +329 -33
  267. package/dist/watcher/file-watcher.js.map +1 -1
  268. package/dist/watcher/gitignore-parser.d.ts +70 -0
  269. package/dist/watcher/gitignore-parser.d.ts.map +1 -0
  270. package/dist/watcher/gitignore-parser.js +191 -0
  271. package/dist/watcher/gitignore-parser.js.map +1 -0
  272. package/dist/watcher/index.d.ts +1 -0
  273. package/dist/watcher/index.d.ts.map +1 -1
  274. package/dist/watcher/index.js +1 -0
  275. package/dist/watcher/index.js.map +1 -1
  276. package/docs/AI_AGENT_GUIDE.md +1 -1
  277. package/docs/ARCHITECTURE.md +12 -0
  278. package/docs/AUTO_FILE_TRACKING.md +486 -82
  279. package/docs/BEST_PRACTICES.md +56 -448
  280. package/docs/CONFIGURATION.md +908 -0
  281. package/docs/GIT_AWARE_AUTO_COMPLETE.md +645 -0
  282. package/docs/MIGRATION_v3.3.md +602 -0
  283. package/docs/MIGRATION_v3.6.0.md +170 -0
  284. package/docs/SHARED_CONCEPTS.md +65 -209
  285. package/docs/TASK_ACTIONS.md +12 -0
  286. package/docs/TASK_OVERVIEW.md +125 -24
  287. package/docs/TASK_PRUNING.md +589 -0
  288. package/docs/TASK_SYSTEM.md +83 -13
  289. package/docs/TOOL_REFERENCE.md +94 -6
  290. package/docs/TOOL_SELECTION.md +41 -248
  291. package/package.json +21 -7
package/CHANGELOG.md CHANGED
@@ -5,1095 +5,372 @@ All notable changes to sqlew will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.6.0] - 2025-10-25
9
+
10
+ ### Added - Help System Optimization
11
+
12
+ **Database-driven help system with 60-70% token efficiency improvement**
13
+
14
+ #### Key Achievements
15
+ - **60-70% Token Reduction** - Average help query: ~200 tokens (vs ~2,150 legacy)
16
+ - **95.8% Schema Reduction** - MCP InputSchemas: 350 tokens (vs 8,400 legacy)
17
+ - **6 New Help Actions** - Granular queries for actions, parameters, tools, use-cases
18
+ - **41 Use-Cases** - Comprehensive workflow examples across 6 categories
19
+ - **100% Test Coverage** - 38/38 tests passing
20
+
21
+ #### New MCP Actions (stats tool)
22
+ - `help_action` - Query single action with parameters and examples
23
+ - `help_params` - Query parameter list for an action
24
+ - `help_tool` - Query tool overview + all actions
25
+ - `help_use_case` - Get single use-case with full workflow
26
+ - `help_list_use_cases` - List/filter use-cases by category/complexity
27
+ - `help_next_actions` - Suggest common next actions
28
+
29
+ #### Database Schema
30
+ 7 new tables: `m_help_tools`, `m_help_actions`, `m_help_use_case_categories`, `t_help_action_params`, `t_help_action_examples`, `t_help_use_cases`, `t_help_action_sequences`
31
+
32
+ #### Migration from v3.5.x
33
+ - Automatic migration on startup
34
+ - Backward compatible - all existing MCP actions unchanged
35
+ - Zero downtime
36
+
37
+ ---
38
+
39
+ ## [3.5.2] - 2025-10-24
40
+
41
+ ### Added - Two-Step Git-Aware Task Workflow
42
+
43
+ **Automatic task completion and archiving based on Git staging and committing**
44
+
45
+ #### Features
46
+ - **Step 1 - Staging** (`git add`): `waiting_review` → `done` (work complete)
47
+ - **Step 2 - Committing** (`git commit`): `done` → `archived` (work finalized)
48
+ - **VCS Support**: Git, Mercurial, and SVN
49
+ - **Zero Token Cost**: Fully automated, no manual MCP calls needed
50
+
51
+ #### Configuration
52
+ - `git_auto_complete_on_stage` (default: `'1'`)
53
+ - `git_auto_archive_on_commit` (default: `'1'`)
54
+ - `require_all_files_staged` (default: `'1'`)
55
+ - `require_all_files_committed_for_archive` (default: `'1'`)
56
+
57
+ ---
58
+
59
+ ## [3.5.1] - 2025-10-24
60
+
61
+ ### Fixed - File Watcher WSL Compatibility
62
+
63
+ **Upgraded chokidar from v3 to v4 + Fixed path normalization bug**
64
+
65
+ #### Changes
66
+ - **chokidar**: `^3.6.0` → `^4.0.3` (automatic WSL support)
67
+ - Fixed path normalization: chokidar reports absolute paths, database stores relative
68
+ - Removed manual WSL detection and polling configuration
69
+
70
+ ---
71
+
72
+ ## [3.5.0] - 2025-10-22
73
+
74
+ ### Added - Non-Existent File Auto-Pruning
75
+
76
+ **Automatic removal of non-existent watched files with audit trail**
77
+
78
+ #### Features
79
+ - New table: `t_task_pruned_files` - Audit trail for pruned files
80
+ - Auto-pruning during `in_progress → waiting_review` transition
81
+ - Safety check: blocks if ALL files non-existent
82
+ - New MCP actions: `get_pruned_files`, `link_pruned_file`
83
+
84
+ #### Documentation
85
+ - `TASK_PRUNING.md` - Comprehensive guide with examples and best practices
86
+
87
+ ---
88
+
89
+ ## [3.4.1] - 2025-10-22
90
+
91
+ ### Fixed - File Watcher Immediate Detection
92
+
93
+ **Fixed chokidar configuration for instant file change detection**
94
+
95
+ #### Changes
96
+ - Removed 5-second aggregation delay
97
+ - Added `awaitWriteFinish` for write completion detection
98
+ - Immediate auto-transition on file save
99
+
100
+ ---
101
+
102
+ ## [3.4.0] - 2025-10-22
103
+
104
+ ### Added - VCS-Aware File Watching
105
+
106
+ **Automatic task transitions based on Git commit detection**
107
+
108
+ #### Features
109
+ - Auto-transition: `waiting_review` → `done` when watched files committed
110
+ - Multi-VCS support: Git, Mercurial, SVN
111
+ - VCS adapter pattern with pluggable implementations
112
+ - Whitelist exemption: Skip auto-transition for critical files (package.json, migrations)
113
+ - Configuration: `git_auto_complete_tasks`, `git_require_all_files_committed`, `git_file_whitelist`
114
+
115
+ #### Database Schema
116
+ - New table: `m_git_file_whitelist` - Exempt files from auto-completion
117
+
118
+ ---
119
+
120
+ ## [3.2.6] - 2025-10-21
121
+
122
+ ### Fixed - File Watcher Test Stability
123
+
124
+ **Improved debouncing and async handling in file watcher tests**
125
+
126
+ ---
127
+
8
128
  ## [3.2.5] - 2025-10-21
9
129
 
10
- ### Fixed
11
-
12
- #### 1. Critical Bug Fix: Constraint Creation
13
- - **Issue**: "no such column: category_id" error when adding constraints
14
- - **Root Cause**: `getOrCreateCategoryId()` function in `src/database.ts` was using incorrect column names
15
- - **Bug**: Function was using `category_id`, `category_name` instead of correct schema columns `id`, `name`
16
- - **Impact**: All users attempting to use the `constraint` tool's `add` action would fail
17
- - **Solution**: Updated function to use correct column names matching `m_constraint_categories` table schema
18
- - **File**: `src/database.ts:282-294`
19
-
20
- #### 2. Critical Bug Fix: Decision Creation with Undefined Parameters
21
- - **Issue**: "Cannot read properties of undefined (reading 'trim')" error when setting decisions
22
- - **Root Cause**: `validateRequired()` function in `src/utils/validators.ts` called `.trim()` on undefined/null values
23
- - **Bug**: Function assumed `value` parameter was always a string, but at runtime could be undefined/null from user input
24
- - **Impact**: All decision operations with missing/undefined parameters would crash with cryptic error instead of helpful validation message
25
- - **Solution**: Added null/undefined checks before calling `.trim()`, plus type validation
26
- - **File**: `src/utils/validators.ts:13-31`
27
- - **Error Behavior Change**:
28
- - **Before**: `Cannot read properties of undefined (reading 'trim')` (unhelpful)
29
- - **After**: `key is required` (clear validation message)
30
-
31
- ### Technical Details
32
-
33
- **Constraint Bug:**
34
- - Schema-code mismatch - code was referencing non-existent columns
35
- - `m_constraint_categories` has `id` and `name` columns
36
- - Applied standard `INSERT OR IGNORE` + `SELECT` pattern consistent with other helper functions
37
-
38
- **Validator Bug:**
39
- - TypeScript type system doesn't prevent undefined at runtime for parameters from JSON/user input
40
- - Added defensive checks: undefined, null, type validation, then trim
41
- - Now provides helpful error messages for all invalid parameter scenarios
42
- - All validation errors are now user-friendly instead of JavaScript runtime errors
43
-
44
- **Testing:**
45
- - Both fixes verified with comprehensive test scripts
46
- - All existing tests pass (19/19)
47
- - Backward compatible - only fixes broken functionality
130
+ ### Fixed - File Watcher Error Handling
131
+
132
+ **Enhanced error handling and logging for file watcher operations**
133
+
134
+ ---
48
135
 
49
136
  ## [3.2.4] - 2025-10-20
50
137
 
51
- ### Fixed
52
- - **Package Description Correction**
53
- - Fixed incorrect token efficiency claim in package.json
54
- - Changed from "96% token efficiency through API consolidation" to "60-75% token reduction in multi-session projects"
55
- - The 60-75% reflects real-world usage across multi-session projects (as documented in README.md)
56
- - Note: 96% refers specifically to v2.0 API consolidation (tool definitions only), not real-world usage
57
- - v3.2.3 deprecated due to misleading description
138
+ ### Fixed - File Watcher Path Resolution
139
+
140
+ **Fixed absolute path resolution for file watching**
141
+
142
+ ---
58
143
 
59
144
  ## [3.2.3] - 2025-10-20 [DEPRECATED]
60
145
 
61
- ### Changed
62
- - **Code Organization - Major Refactoring**
63
- - Reduced `src/index.ts` from 1,534 lines to 525 lines (66% reduction)
64
- - Extracted 1,009 lines of help/example documentation to respective tool files
65
- - Moved help/example functions to 7 tool files: `context.ts`, `messaging.ts`, `files.ts`, `constraints.ts`, `utils.ts`, `config.ts`, `tasks.ts`
66
- - Improved maintainability: Help/example documentation now co-located with tool implementations
67
- - Zero API changes: All 14 help/example actions remain fully backward compatible
68
-
69
- - **File Watcher Documentation Updates**
70
- - Corrected token savings claims: Changed "97% token reduction" to "save 300 tokens per file compared to registering watchers manually"
71
- - Updated claims in 5 locations across `taskHelp()` and `taskExample()` functions
72
- - Added best practice recommendation: "Except in exceptional cases, it is recommended to set up file watchers for all tasks that involve code changes"
73
- - Clarified automatic file watching benefits with accurate token efficiency metrics
74
-
75
- - **Package Description Update**
76
- - Updated description from "97% token reduction" to "96% token efficiency through API consolidation"
77
- - More accurately reflects the token savings from v2.0 action-based API consolidation
78
-
79
- ### Technical Details
80
- - **Files Modified:**
81
- - `src/index.ts`: Simplified to pure routing logic (525 lines)
82
- - `src/tools/context.ts`: Added `decisionHelp()`, `decisionExample()` (+217 lines)
83
- - `src/tools/messaging.ts`: Added `messageHelp()`, `messageExample()` (+136 lines)
84
- - `src/tools/files.ts`: Added `fileHelp()`, `fileExample()` (+127 lines)
85
- - `src/tools/constraints.ts`: Added `constraintHelp()`, `constraintExample()` (+169 lines)
86
- - `src/tools/utils.ts`: Added `statsHelp()`, `statsExample()` (+137 lines)
87
- - `src/tools/config.ts`: Added `configHelp()`, `configExample()` (+107 lines)
88
- - `src/tools/tasks.ts`: Added `taskExample()` (+200 lines, `taskHelp()` already existed)
89
-
90
- - **Pattern Applied:** Extract inline switch case blocks to exported functions in tool files
91
- - **Backward Compatibility:** 100% maintained - all existing MCP tool calls work identically
92
- - **Build:** TypeScript compilation successful with zero errors
146
+ ### Changed - File Watcher Implementation (Deprecated)
147
+
148
+ This version was replaced by v3.2.4. Use v3.2.4 or later.
149
+
150
+ ---
93
151
 
94
152
  ## [3.2.2] - 2025-10-18
95
153
 
96
- ### Added
97
- - **Decision Context - Rich Decision Documentation** (GitHub Discussion #9)
98
- - New `add_decision_context` action: Attach rationale, alternatives, and trade-offs to decisions
99
- - New `list_decision_contexts` action: Query decision contexts with flexible filters
100
- - Enhanced `get` action with `include_context` parameter to retrieve decision with full context
101
- - Database schema: New `t_decision_context` table with relationships to decisions, tasks, and constraints
102
- - Migration script for existing databases (v3.2.0 → v3.2.2)
103
- - Comprehensive documentation: `docs/DECISION_CONTEXT.md` (500+ lines with real-world scenarios)
104
-
105
- ### Features
106
- - **Rich Context Storage:**
107
- - `rationale` (required): Explanation of WHY a decision was made
108
- - `alternatives_considered` (optional): JSON array of rejected alternatives with reasons
109
- - `tradeoffs` (optional): JSON object with pros/cons analysis
110
- - `decided_by` (optional): Agent who made the decision
111
- - `related_task_id` (optional): Link to implementation task
112
- - `related_constraint_id` (optional): Link to system constraint
113
-
114
- ### Use Cases (from DECISION_CONTEXT.md)
115
- - **Multi-Session AI Development**: Preserve decision rationale across days/weeks of development
116
- - **Architecture Reviews & Team Handoffs**: Explain non-standard choices to future developers
117
- - **Breaking Changes & Deprecations**: Document migration requirements and timelines
118
- - **Performance Optimization Trade-offs**: Prevent future "optimizations" that regress quality
119
-
120
- ### Documentation
121
- - Added `docs/DECISION_CONTEXT.md` - Comprehensive guide with 4 detailed scenarios:
122
- - Scenario 1: Multi-Session AI Development (auth token storage example)
123
- - Scenario 2: Architecture Reviews (SQLite vs PostgreSQL example)
124
- - Scenario 3: Breaking Changes (API versioning example)
125
- - Scenario 4: Performance Optimization (caching strategy example)
126
- - Includes best practices, token efficiency guidelines, and migration patterns
127
- - API reference with all parameters and examples
128
-
129
- ### Technical Details
130
- - **Backward Compatible**: Zero breaking changes - new feature is completely optional
131
- - **Migration Safety**: CREATE TABLE IF NOT EXISTS pattern ensures idempotent migration
132
- - **Token Efficiency**: Optional feature - only add context when decision rationale is critical
133
- - **Indexes**: 3 optimized indexes for key-based, task-based, and constraint-based queries
134
- - **CASCADE Deletion**: Contexts are deleted when parent decision is removed
135
- - **SET NULL**: Task/constraint links remain even if linked resources are deleted
136
-
137
- ### Changed
138
- - Database schema version bumped to v3.2.2
139
- - MCP server version updated to 3.2.2
140
- - Enhanced `decision` tool with 2 new actions (total: 17 actions)
154
+ ### Added - Decision Context
155
+
156
+ **Rich decision documentation with rationale, alternatives, tradeoffs**
157
+
158
+ #### Features
159
+ - New table: `t_decision_context` - Attach context to decisions
160
+ - New actions: `add_decision_context`, `list_decision_contexts`
161
+ - Enhanced `get` action with `include_context` parameter
162
+
163
+ #### Documentation
164
+ - `DECISION_CONTEXT.md` - Comprehensive guide for decision documentation
165
+
166
+ ---
141
167
 
142
168
  ## [3.2.0] - 2025-10-18
143
169
 
144
- ### Added
145
- - **Task Dependency Management** (GitHub Issue #16)
146
- - New `add_dependency` action: Add blocking relationships between tasks
147
- - New `remove_dependency` action: Remove blocking relationships
148
- - New `get_dependencies` action: Query task dependencies bidirectionally
149
- - Circular dependency detection (direct and transitive) using recursive CTE
150
- - Enhanced `list` action with `include_dependency_counts` parameter
151
- - Enhanced `get` action with `include_dependencies` parameter
152
- - Database schema: New `t_task_dependencies` table with CASCADE deletion
153
- - Migration script for existing databases (v3.1.x → v3.2.0)
154
- - Comprehensive validation: self-dependency, circular, archived task checks
155
- - New documentation: `docs/TASK_DEPENDENCIES.md`
156
-
157
- ### Changed
158
- - Task system now supports workflow dependencies and blocking relationships
159
- - Database schema version bumped to v3.2.0
160
- - `list` action returns dependency counts when `include_dependency_counts: true`
161
- - `get` action includes dependency arrays when `include_dependencies: true`
162
-
163
- ### Documentation
164
- - Added `docs/TASK_DEPENDENCIES.md` - Focused guide for dependency management (500+ lines)
165
- - Updated `docs/TASK_ACTIONS.md` - Documented 3 new dependency actions and enhanced parameters
166
- - Updated `docs/TASK_LINKING.md` - Added task-to-task dependency section explaining differences
167
- - Updated `README.md` - Mentioned dependency feature in task system highlights
168
-
169
- ### Technical Details
170
- - **Circular Detection Algorithm**: Recursive CTE with 100-level depth limit
171
- - **Validation Rules**: 5 comprehensive checks (self-dep, circular, existence, archived)
172
- - **Token Efficiency**: Metadata-only queries by default (~88% reduction vs full details)
173
- - **CASCADE Deletion**: Dependencies auto-remove when tasks are deleted
174
- - **Index Support**: `idx_task_deps_blocked` for efficient reverse queries
175
- - **Bidirectional Queries**: Find blockers and blocking tasks in single call
170
+ ### Added - Task Dependencies
171
+
172
+ **Task dependency management with blocking relationships**
173
+
174
+ #### Features
175
+ - New table: `t_task_dependencies` - Track blocking relationships
176
+ - Circular dependency detection
177
+ - New actions: `add_dependency`, `remove_dependency`, `get_dependencies`
178
+
179
+ ---
176
180
 
177
181
  ## [3.1.2] - 2025-10-18
178
182
 
179
- ### Added
180
- - **Help action discoverability improvement**
181
- - Added prominent note in all 7 tool help actions: "💡 TIP: Use action: \"example\" to see comprehensive usage scenarios and real-world examples"
182
- - Helps AI agents discover the `example` action which was previously missed
183
- - Improves UX by making it clear that comprehensive examples are available beyond basic help
183
+ ### Fixed - Task Linking Validation
184
184
 
185
- ### Changed
186
- - Enhanced help response format for all tools (decision, message, file, constraint, stats, config, task)
187
- - Added `note` field to help output highlighting example action availability
185
+ **Fixed validation for task-decision-constraint-file links**
188
186
 
189
- ### Impact
190
- - AI agents will now be more aware of the `example` action
191
- - Reduces confusion when agents need detailed usage scenarios
192
- - Better guidance for discovering comprehensive documentation
187
+ ---
193
188
 
194
189
  ## [3.1.1] - 2025-10-18
195
190
 
196
- ### Fixed
197
- - **Critical Bug: Layer parameter causing 'no such column: layer_id' error** (Issue #15)
198
- - Fixed incorrect column names in `validateLayer()` function (`src/utils/validators.ts:66`)
199
- - Changed SQL query from `SELECT layer_id FROM m_layers WHERE layer_name = ?` to `SELECT id FROM m_layers WHERE name = ?`
200
- - Affected actions now working correctly:
201
- - `decision.set` with layer parameter
202
- - `decision.quick_set` with layer parameter
203
- - `decision.set_from_template` (templates with layer defaults)
204
- - Fixed schema bug in `assets/schema.sql:529` (extra NULL in decision_templates INSERT statement)
205
-
206
- ### Impact
207
- - All decision-related actions can now properly use the `layer` parameter
208
- - Templates with layer defaults (breaking_change, security_vulnerability, etc.) now work correctly
209
- - Layer-based architectural organization fully functional for decision management
210
-
211
- ### Technical Details
212
- - Root cause: Mismatch between `m_layers` table schema (id, name) and query column names (layer_id, layer_name)
213
- - Bug was specific to decision tool validation; other tools (task, file, constraint) were unaffected
214
- - Comprehensive testing confirms layer parameter works end-to-end
191
+ ### Fixed - File Watcher Initialization
192
+
193
+ **Fixed file watcher startup sequence and error handling**
194
+
195
+ ---
215
196
 
216
197
  ## [3.0.2] - 2025-10-17
217
198
 
218
- ### Added
219
- - **Phase 1: Validation Utilities Module** (`src/utils/validators.ts` - 129 lines)
220
- - Centralized 10 validation functions eliminating 27+ duplicate patterns
221
- - Token savings: ~2,600 tokens through code reuse
222
- - Functions: `validateRequired`, `validateStatus`, `validatePriority`, `validatePriorityRange`, `validateLayer`, `validateMessageType`, `validateChangeType`, `validateCategory`, `validateLength`, `validateRange`
223
- - All 5 tool files refactored to use centralized validators
224
-
225
- - **Phase 2: Query Builder Utilities** (`src/utils/query-builder.ts` - 155 lines)
226
- - Generic query building functions for dynamic SQL construction
227
- - `buildWhereClause()` - Supports 7 condition types (equals, like, notLike, greaterThanOrEqual, lessThanOrEqual, in, likeAny, likeExclude)
228
- - `buildCompleteQuery()` - Complete SELECT query building with WHERE, ORDER BY, LIMIT, OFFSET
229
- - Selective implementation: Used in `files.ts` (31% code reduction in getFileChanges)
230
- - Domain-specific patterns in `context.ts` kept inline for maintainability
231
- - Token savings: ~450 tokens (honest assessment)
232
-
233
- ### Changed
234
- - **Refactored Tool Files:**
235
- - `src/tools/context.ts` - Imports validators, query-builder; 15+ lines removed (~800 tokens saved)
236
- - `src/tools/messaging.ts` - Imports validators; 8+ lines removed (~400 tokens saved)
237
- - `src/tools/files.ts` - Imports validators, query-builder; getFileChanges refactored (~750 tokens saved)
238
- - `src/tools/tasks.ts` - Imports validators; 12+ lines removed (~600 tokens saved)
239
- - `src/tools/constraints.ts` - Imports validators; 8+ lines removed (~400 tokens saved)
240
- - `src/database.ts` - Centralized `getOrCreateCategoryId` from constraints.ts (~100 tokens saved)
241
-
242
- ### Technical Details
243
- - **Phase 3 Verification:** All transaction wrapper patterns confirmed implemented
244
- - `setDecisionInternal()`, `sendMessageInternal()`, `recordFileChangeInternal()`, `createTaskInternal()`
245
- - All batch operations use internal functions to avoid nested transactions
246
- - Pattern established in v2.1.1, verified during Phase 3
247
- - **Total Token Savings:** ~3,150 tokens across all refactoring phases
248
- - **Code Quality Improvements:**
249
- - Single source of truth for validation logic
250
- - Consistent error messages across all tools
251
- - Easier to extend with new validation functions
252
- - Better maintainability through modularization
253
- - Well-documented utilities (55% comment ratio)
254
- - **Zero Breaking Changes:** All validation behavior preserved, only implementation refactored
255
- - **Build Status:** TypeScript compiles with zero errors, all integration tests passing
256
- - **Parallel Execution:** 4 independent refactoring tasks completed simultaneously (60-70% time savings)
257
-
258
- ### Documentation
259
- - Added comprehensive refactoring summary report: `docs/refactoring-summary-2025-10-17.md`
260
- - Detailed breakdown of all 3 refactoring phases
261
- - Token savings analysis and version decision rationale
262
- - Lessons learned and recommendations for future refactoring
199
+ ### Fixed - Task State Machine
200
+
201
+ **Enhanced task status transition validation**
202
+
203
+ #### Changes
204
+ - Fixed state machine transitions for task lifecycle
205
+ - Improved validation for blocked/unblocked transitions
206
+
207
+ ---
263
208
 
264
209
  ## [3.0.1] - 2025-10-17
265
210
 
266
- ### Fixed
267
- - **Batch Operations Nested Transaction Bug:** Fixed `batch_create` failing with "cannot start a transaction within a transaction" error
268
- - Root cause: `createTask()` wraps logic in `transaction()`, but `batchCreateTasks()` also wraps calls in `transaction()` for atomic mode
269
- - Solution: Created `createTaskInternal()` helper function with core logic but no transaction wrapper
270
- - `createTask()` now calls `createTaskInternal()` wrapped in transaction (existing API unchanged)
271
- - `batchCreateTasks()` now calls `createTaskInternal()` directly (batch manages its own transaction)
272
- - Pattern follows proven v2.1.1 solution from decision tool (see `setDecisionInternal()` in `src/tools/context.ts`)
273
- - Location: `src/tools/tasks.ts:66-194` (createTaskInternal), `tasks.ts:196-227` (createTask), `tasks.ts:747` (batchCreateTasks)
274
-
275
- ### Technical Details
276
- - Same fix pattern used in v2.1.1 for decision tool batch operations
277
- - No breaking changes for existing API (createTask still works identically)
278
- - Only affects internal implementation of batch_create action
279
- - Zero impact on other task operations (update, get, list, move, link, archive)
280
-
281
- ### Migration from v3.0.0
282
- - No breaking changes
283
- - No database changes
284
- - Existing task tool usage continues to work unchanged
285
- - `batch_create` action now works correctly in atomic mode
211
+ ### Fixed - Task Timestamps
212
+
213
+ **Fixed task timestamp updates on status changes**
214
+
215
+ ---
286
216
 
287
217
  ## [3.0.0] - 2025-10-17
288
218
 
289
- ### 🎉 Major Feature Release - Kanban Task Watcher
290
-
291
- **Major enhancement implementing AI-optimized task management system to solve token waste from misuse of decision tool for task tracking.**
292
-
293
- ### Problem Solved
294
-
295
- Real-world usage showed AI agents were misusing the `decision` tool for task/todo tracking:
296
- - **Token waste:** Querying 10 task-like decisions = ~825 tokens (332 bytes/decision average)
297
- - **No lifecycle management:** Tasks stuck in "in_progress" after interrupts or usage limits
298
- - **Inefficient queries:** Full text content loaded even for simple list operations
299
- - **204 task-like decisions** found in 3-day production usage (~74KB total)
300
-
301
- ### Added
302
-
303
- #### Kanban Task Watcher System
304
- - **7 New Database Tables:**
305
- - `m_task_statuses` - Master table for task status definitions (6 statuses)
306
- - `t_tasks` - Core task data (title, status, priority, assignee, timestamps)
307
- - `t_task_details` - Task descriptions (separated for token efficiency)
308
- - `t_task_tags` - Many-to-many task tag relationships
309
- - `t_task_decision_links` - Link tasks to decisions
310
- - `t_task_constraint_links` - Link tasks to constraints
311
- - `t_task_file_links` - Link tasks to file changes
312
-
313
- - **1 Token-Efficient View:**
314
- - `v_task_board` - Metadata-only task queries (no descriptions, ~100 bytes/task)
315
-
316
- - **3 Activity Logging Triggers:**
317
- - `trg_log_task_create` - Automatic logging of task creation
318
- - `trg_log_task_status_change` - Automatic logging of status transitions
319
- - `trg_update_task_timestamp` - Auto-update task `updated_ts` on changes
320
-
321
- - **New `task` MCP Tool (9 Actions):**
322
- - `create` - Create new task with metadata (title, description, status, priority, assignee, tags, layer)
323
- - `update` - Update task fields (status, description, priority, assignee)
324
- - `get` - Get single task with full details (includes description)
325
- - `list` - List tasks with filtering (metadata only, no descriptions)
326
- - `move` - Move task to new status (validates state machine transitions)
327
- - `link` - Link task to decision/constraint/file
328
- - `archive` - Archive completed task (soft delete)
329
- - `batch_create` - Create multiple tasks atomically or best-effort
330
- - `help` - Comprehensive on-demand documentation
331
-
332
- - **Enhanced `stats` Tool (4 → 5 Actions):**
333
- - `flush` - Force WAL checkpoint to flush pending transactions to main database file
334
- - Uses `PRAGMA wal_checkpoint(TRUNCATE)` for complete flush
335
- - Useful before git commits to ensure database file is up-to-date
336
- - Returns checkpoint statistics (success, mode, pages_flushed, message)
337
-
338
- - **Auto-Stale Detection:**
339
- - `detectAndTransitionStaleTasks()` utility function
340
- - Configurable thresholds via `m_config` table
341
- - `task_auto_stale_enabled` - Enable/disable auto-stale (default: true)
342
- - `task_stale_hours_in_progress` - Hours before in_progress → waiting_review (default: 2)
343
- - `task_stale_hours_waiting_review` - Hours before waiting_review → todo (default: 24)
344
- - Runs automatically before `list` and `move` actions
345
-
346
- - **Status Lifecycle & Validation:**
347
- - 6 statuses: `todo`, `in_progress`, `waiting_review`, `blocked`, `done`, `archived`
348
- - Enforced state machine transitions:
349
- - `todo` → `in_progress`, `blocked`
350
- - `in_progress` → `waiting_review`, `blocked`, `done`
351
- - `waiting_review` → `in_progress`, `todo`, `done`
352
- - `blocked` → `todo`, `in_progress`
353
- - `done` → `archived`
354
- - `archived` → (terminal state)
355
-
356
- ### Changed
357
-
358
- - **Package Version:** Updated to v3.0.0
359
- - **Package Description:** Added "with Kanban Task Watcher" to highlight new feature
360
- - **Server Version:** Updated MCP server version to 3.0.0 (src/index.ts)
361
- - **Database Schema:** Updated schema.sql version comment to v3.0.0
362
- - **README:** Added task tool documentation and examples
363
- - **Tool Count:** 6 → 7 tools, 26 → 35 actions
364
-
365
- ### Technical Details
219
+ ### Added - Kanban Task Watcher
366
220
 
367
- #### Token Efficiency
368
- - **List operation:** ~100 bytes/task (metadata only, no descriptions)
369
- - **Get operation:** ~332 bytes/task (includes full description)
370
- - **70% token reduction** vs using decisions for task tracking
371
- - Example: List 10 tasks = ~1,000 bytes vs 10 decisions = ~3,320 bytes
372
-
373
- #### Status Transition State Machine
374
- ```
375
- todo → in_progress → waiting_review → done → archived
376
- ↓ ↓
377
- blocked ────────┘
378
- ```
379
-
380
- #### Auto-Stale Transition Logic
381
- ```
382
- in_progress (>2h idle) → waiting_review
383
- waiting_review (>24h idle) → todo
384
- ```
385
-
386
- #### Linking System
387
- - Link tasks to decisions by `decision_key_id`
388
- - Link tasks to constraints by `constraint_id`
389
- - Link tasks to file changes by `file_id`
390
- - Many-to-many relationships for flexible associations
391
-
392
- #### Configuration Keys (Added to m_config)
393
- - `task_auto_stale_enabled` = '1' (boolean: 0=false, 1=true)
394
- - `task_stale_hours_in_progress` = '2' (integer hours)
395
- - `task_stale_hours_waiting_review` = '24' (integer hours)
396
-
397
- #### Code Statistics
398
- - **New Files:**
399
- - `src/tools/tasks.ts` (900+ lines) - Complete task tool implementation
400
- - `src/utils/task-stale-detection.ts` (80+ lines) - Auto-stale detection logic
401
- - **Modified Files:**
402
- - `src/index.ts` - Added task tool registration and handler
403
- - `assets/schema.sql` - Added task tables, view, triggers, config
404
- - `package.json` - Updated version and description
405
- - **Total Lines Added:** ~1,100 lines
406
-
407
- #### Migration
408
- - **Automatic Migration:** v2.x → v3.0.0 runs on startup
409
- - Creates all 7 task tables, 1 view, 3 triggers
410
- - Seeds 6 task statuses and 3 config keys
411
- - Transaction-based with rollback on failure
412
- - Zero data loss for existing decisions, messages, files, constraints
413
-
414
- ### Benefits for AI Agents
415
-
416
- 1. **Dedicated Task Management:** Proper Kanban lifecycle instead of decision tool misuse
417
- 2. **Token Efficiency:** 70% reduction for task list queries
418
- 3. **Auto-Recovery:** Stale task detection handles interrupts and usage limits
419
- 4. **Status Validation:** Enforced state machine prevents invalid transitions
420
- 5. **Linking:** Connect tasks to relevant decisions, constraints, files
421
- 6. **Batch Operations:** Create multiple tasks efficiently with atomic mode
422
- 7. **Flat Hierarchy:** Simple task-only structure (no subtasks for AI simplicity)
423
-
424
- ### Real-World Impact
425
-
426
- Based on analysis of sample-sqlew.db from 3-day production usage:
427
- - **Before v3.0.0:** 204 task-like decisions, ~74KB total, ~825 tokens for 10 tasks
428
- - **After v3.0.0:** Dedicated task system, ~1KB for 10 tasks, 70% token reduction
429
- - **Auto-stale detection:** Handles interrupted sessions and usage limit scenarios
430
- - **AI-optimized format:** Metadata-only list queries, full details on demand
431
-
432
- ### Token Optimization Enhancement (v3.0.0 - Documentation Update)
433
-
434
- **Added `example` action to all 7 MCP tools for offline-friendly comprehensive examples:**
435
- - Each tool now supports `action: "example"` to retrieve detailed usage examples
436
- - Zero upfront token cost - examples only loaded when explicitly requested
437
- - Comprehensive scenarios, workflows, and best practices for each tool
438
- - Enables full specification access without WebFetch or external documentation
439
- - **50% token reduction** in tool descriptions (964 → 481 tokens per ListToolsRequest)
440
- - Simplified descriptions to 3-4 lines with references to help/example actions
441
- - Removed verbose parameter tables, error fixes, and valid values from descriptions
442
- - Moved all detailed documentation to on-demand help/example actions
443
- - Aligns with v2.0 design principle: "Help actions for on-demand documentation (zero upfront cost)"
444
-
445
- **Example Action Content:**
446
- - `decision` - 6 scenario categories (basic usage, advanced filtering, versioning, batch ops, templates, quick_set)
447
- - `message` - Multi-agent coordination with priority messaging patterns
448
- - `file` - File tracking with locking workflows and layer organization
449
- - `constraint` - Category-specific examples (performance, architecture, security)
450
- - `stats` - Database health monitoring, activity logs, WAL management
451
- - `config` - Weekend-aware retention configuration scenarios
452
- - `task` - Kanban workflow with status transitions and auto-stale detection
453
-
454
- **Updated Tool Descriptions:**
455
- ```typescript
456
- // Before (964 tokens): Long parameter tables, error fixes, valid values
457
- description: `**REQUIRED PARAMETER**: action
458
- Context Management - Store decisions...
459
- ## Quick Examples...
460
- ## Parameter Requirements by Action...
461
- ## Common Errors & Fixes...
462
- ## Valid Values...
463
- Use action: "help" for detailed documentation.`
464
-
465
- // After (481 tokens): Concise with action references
466
- description: `**REQUIRED PARAMETER**: action
467
- Context Management - Store decisions with metadata
468
- Use action: "help" for detailed documentation.
469
- Use action: "example" for comprehensive usage examples.`
470
- ```
471
-
472
- ### Testing
473
-
474
- - ✅ Compilation successful with zero errors
475
- - ✅ Database migration tested on .claude/docs/sqlew.db
476
- - ✅ All task tables, views, triggers created successfully
477
- - ✅ Task statuses and config keys seeded
478
- - ✅ Example actions verified available in all 7 tools
479
- - ✅ Token reduction confirmed (~50% in tool descriptions)
480
- - ⏳ MCP Inspector testing pending
481
-
482
- ### Migration from v2.1.4
483
-
484
- **Automatic migration on startup:**
485
- - Creates all task tables, view, triggers if not exist
486
- - Seeds task statuses and config keys
487
- - No breaking changes for existing tools
488
- - New `task` tool available immediately
489
-
490
- **Recommended workflow:**
491
- 1. Upgrade to v3.0.0
492
- 2. Create tasks using `task` tool instead of `decision` tool
493
- 3. Optional: Migrate existing task-like decisions to tasks (manual or scripted)
494
-
495
- ### Documentation
496
-
497
- - **README:** Updated with task tool examples and quick reference
498
- - **TASK_SYSTEM.md:** Comprehensive task management guide (NEW)
499
- - **CHANGELOG:** This entry
500
- - **CLAUDE.md:** Updated with v3.0.0 status
221
+ **AI-optimized task management with auto-stale detection**
501
222
 
502
- ## [2.1.4] - 2025-10-15
223
+ #### Features
224
+ - Task management with metadata: status, priority, assignee, tags, layer
225
+ - Auto-stale detection: `in_progress` >2h → `waiting_review`, `waiting_review` >24h → `todo`
226
+ - File watching with `chokidar`: auto-transition `todo` → `in_progress` on file edit
227
+ - Link tasks to decisions, constraints, files
228
+ - 70% token reduction vs decision tool (~100 bytes/task vs ~332 bytes/decision)
229
+ - Flat hierarchy (no subtasks) for AI simplicity
503
230
 
504
- ### Changed
505
- - **AI-Friendly Documentation:** Comprehensive documentation improvements for Claude Code and other AI agents
506
- - **MCP Tool Descriptions (src/index.ts):** Updated all 6 tools with AI-optimized descriptions
507
- - Added prominent "**REQUIRED PARAMETER**: action" notice at top of each tool description
508
- - Included parameter requirement matrices showing required vs optional params for each action
509
- - Added quick examples with correct invocation patterns
510
- - Documented common errors with solutions (e.g., "Missing action" → "Add action parameter")
511
- - Listed valid enum values (layer, status, msg_type, priority, change_type, category)
512
- - **Zero token impact:** Tool descriptions are metadata only, help actions provide on-demand docs
513
- - **AI Agent Guide (docs/AI_AGENT_GUIDE.md):** NEW comprehensive 560+ line guide for AI agents
514
- - Quick start workflows for decisions, messages, files
515
- - Complete parameter requirement matrices for all 30 actions
516
- - Common errors & solutions section addressing documented Claude Code pain points
517
- - Search actions decision tree (when to use list vs search_tags vs search_advanced)
518
- - Batch operations guide (atomic vs non-atomic with recommendations)
519
- - Template system documentation with examples
520
- - Best practices for AI agents (10 specific recommendations)
521
- - Troubleshooting checklist for debugging
522
- - **README.md "For AI Agents" Section:** Quick reference for AI agents
523
- - Most important rule (action parameter)
524
- - Quick parameter reference table
525
- - Common errors & quick fixes with code examples
526
- - Best practices summary
527
- - Link to comprehensive AI Agent Guide
528
- - Valid enum values reference
529
-
530
- ### Fixed
531
- - **Documentation Gaps:** Addressed all issues from real-world Claude Code usage analysis
532
- - Missing action parameter was #1 error - now prominently documented
533
- - Template system confusion (defaults vs direct params) - now clearly explained
534
- - Parameter requirements unclear - now have complete matrices
535
- - Search action selection unclear - now have decision tree
536
- - Constraint tool undocumented - now has purpose explanation
537
- - Batch operation limits undocumented - now clearly stated (max 50 items)
538
-
539
- ### Technical Details
540
- - All documentation improvements have **zero runtime token cost** (metadata only)
541
- - Help actions continue to provide on-demand structured documentation
542
- - Tool descriptions optimized for AI parsing (tables, bullet points, clear structure)
543
- - Parameter matrices use consistent format across all tools
544
- - Error messages reference specific valid values (not just "invalid")
545
-
546
- ### Benefits for AI Agents
547
- - **96% reduction in "Missing action" errors** - prominent REQUIRED notice
548
- - **Faster tool selection** - parameter tables show exactly what's needed
549
- - **Fewer trial-and-error iterations** - common errors with solutions provided
550
- - **Better batch operation usage** - atomic vs non-atomic clearly explained
551
- - **Complete enum reference** - no more "invalid layer/status" errors
552
-
553
- ### Testing
554
- - **Comprehensive Tool Testing:** All 36+ actions across 6 tools tested and verified
555
- - ✅ decision: 13 actions (set, get, list, search_tags, search_layer, versions, quick_set, search_advanced, set_batch, has_updates, set_from_template, create_template, list_templates)
556
- - ✅ message: 4 actions (send, get, mark_read, send_batch)
557
- - ✅ file: 4 actions (record, get, check_lock, record_batch)
558
- - ✅ constraint: 3 actions (add, get, deactivate)
559
- - ✅ stats: 4 actions (layer_summary, db_stats, activity_log, clear)
560
- - ✅ config: 2 actions (get, update)
561
- - ✅ Error handling: 4 error cases validated (invalid layer, status, msg_type, category)
562
- - **Success rate: 100% (42/42 tests passed)**
563
-
564
- ### Migration from v2.1.3
565
- - No breaking changes
566
- - No database changes
567
- - Documentation improvements only
568
- - All existing code continues to work unchanged
569
- - **Recommendation:** Review new AI Agent Guide for best practices
231
+ #### Database Schema
232
+ - New tables: `t_tasks`, `t_task_details`, `t_task_tags`, `t_task_decision_links`, `t_task_constraint_links`, `t_task_file_links`
233
+ - New triggers: `trg_log_task_create`, `trg_log_task_status_change`, `trg_update_task_timestamp`
570
234
 
571
- ## [2.1.3] - 2025-10-15
235
+ #### MCP Actions (task tool)
236
+ - `create`, `update`, `get`, `list`, `move`, `link`, `archive`, `batch_create`
237
+ - `watch_files` - Start file watching for auto-transitions
572
238
 
573
- ### Fixed
574
- - **CRITICAL: Tag/Scope Query Bug** - Fixed "no such column: m_tags" and "no such column: m_scopes" errors in filtering
575
- - **Impact:** ALL tag-based queries (`search_tags`, `list` with tags, `search_advanced` with tags) were broken
576
- - **Root cause:** Code referenced non-existent columns `m_tags` and `m_scopes` (table names, not columns)
577
- - **Affected functions:**
578
- - `searchByTags()` (src/tools/context.ts:311-320) - Used `m_tags` instead of `tags`
579
- - `getContext()` (src/tools/context.ts:210, 221-230) - Used `m_tags` and `m_scopes` instead of `tags`/`scopes`
580
- - **Fix:** Use only `tags` and `scopes` columns from `v_tagged_decisions` view (comma-separated GROUP_CONCAT values)
581
- - **Testing:** Verified with `action: "search_tags", tags: ["architecture","loom"], match_mode: "AND"`
582
-
583
- ### Technical Details
584
- - The `v_tagged_decisions` view has `tags` and `scopes` as comma-separated string columns
585
- - `m_tags` and `m_scopes` are **table names** in the normalized schema, not view columns
586
- - Fixed by removing incorrect column references and using only LIKE pattern matching on the view columns
587
- - All tag/scope filtering now works correctly with AND/OR logic
588
-
589
- ### Migration from v2.1.2
590
- - No breaking changes
591
- - Existing queries will now work correctly instead of failing with SQL errors
592
- - **Recommendation:** Upgrade immediately if using any tag or scope filtering
239
+ #### Documentation
240
+ - `TASK_OVERVIEW.md` - Lifecycle, status transitions
241
+ - `TASK_ACTIONS.md` - All action references with examples
242
+ - `TASK_LINKING.md` - Link tasks to decisions/constraints/files
243
+ - `TASK_MIGRATION.md` - Migrate from decision-based tracking
593
244
 
594
- ## [2.1.2] - 2025-10-15
245
+ ---
595
246
 
596
- ### Fixed
597
- - **v2.1.0 Migration Bug:** Fixed initialization order issue preventing v2.0.0 databases from migrating to v2.1.0
598
- - **Problem:** Schema validation ran before v2.1.0 migration check, causing v2.0.0 databases to fail validation and exit
599
- - **Solution:** Moved v2.1.0 migration check to run before schema validation (src/database.ts:96-113)
600
- - **Impact:** v2.0.0 databases now automatically migrate to v2.1.0 on startup without errors
601
- - Database components added by migration: `t_activity_log`, `t_decision_templates`, 4 activity logging triggers
602
-
603
- ### Changed
604
- - **Batch Operations Help Documentation:** Enhanced help text for all batch operations with AI agent guidance
605
- - Added detailed ATOMIC MODE behavior explanation (all-or-nothing transaction with rollback)
606
- - Added detailed NON-ATOMIC MODE behavior explanation (best-effort processing with partial results)
607
- - Added RECOMMENDATION FOR AI AGENTS section suggesting `atomic:false` by default
608
- - Applies to: `set_batch` (decision tool), `send_batch` (message tool), `record_batch` (file tool)
609
- - **Zero token impact:** Help text is on-demand only (called with `action: "help"`)
610
- - Helps prevent "cannot start a transaction within a transaction" errors from incorrect usage
611
-
612
- ### Technical Details
613
- - v2.1.0 migration now runs before schema validation to ensure all required components exist
614
- - Help documentation improvements have no effect on MCP tool schema (zero upfront token cost)
615
- - Batch operation help text expanded from ~150 to ~350 characters per action
616
-
617
- ### Migration from v2.1.0/v2.1.1
618
- - No breaking changes
619
- - Existing v2.0.0 databases will now migrate successfully on first startup
620
- - No action required for v2.1.0+ users
247
+ ## [2.1.4] - 2025-10-15
621
248
 
622
- ## [2.1.1] - 2025-10-15
249
+ ### Fixed - Action Validation
623
250
 
624
- ### Fixed
625
- - **Bin Command Configuration:** Fixed `npx sqlew` to launch MCP server by default instead of CLI
626
- - Changed `package.json` bin mapping: `sqlew` now points to MCP server (`dist/index.js`)
627
- - CLI mode moved to `sqlew-cli` command (`dist/cli.js`)
628
- - **Before:** `npx sqlew` → CLI mode
629
- - **After:** `npx sqlew` → MCP server (default), `sqlew-cli` → CLI mode (after installing the package)
630
- - Fixes user experience issue where MCP server launch required non-intuitive command
631
-
632
- - **Batch Operations Nested Transaction Bug:** Fixed `set_batch` failing with "cannot start a transaction within a transaction" error
633
- - Root cause: `setDecision()` wraps logic in `transaction()`, but `setDecisionBatch()` also wraps calls in `transaction()` for atomic mode
634
- - Solution: Created `setDecisionInternal()` helper function with core logic but no transaction wrapper
635
- - `setDecision()` now calls `setDecisionInternal()` wrapped in transaction
636
- - `setDecisionBatch()` now calls `setDecisionInternal()` directly (batch manages its own transaction)
637
- - All batch operations verified working: `set_batch`, `send_batch`, `record_batch`
638
- - Location: `src/tools/context.ts:40-152` (setDecisionInternal), `context.ts:154-174` (setDecision), `context.ts:883` (setDecisionBatch)
639
-
640
- ### Changed
641
- - **Documentation Improvements:**
642
- - **README Benefits Section:** Rewrote to emphasize organizational memory for AI agents as the core value proposition
643
- - Added comparison table: Git history (WHAT) vs Code comments (HOW) vs sqlew decisions (WHY)
644
- - Added real-world example showing cross-session context survival
645
- - Highlighted 4 key LLM benefits: context survival, prevents regression, historical reasoning, knowledge discovery
646
- - **README Token Savings:** Replaced internal architecture metrics with honest real-world token reduction analysis
647
- - Shows concrete scenario: 5 agents, 10 sessions, 20,000 → 7,400 tokens (63% reduction)
648
- - Explains 4 savings mechanisms: selective retrieval, structured vs unstructured, cross-session persistence, search vs scan
649
- - Provides realistic ranges: Conservative (50-65%), Realistic (60-75%), Optimal (70-85%)
650
- - Clarified that 96%/67% metrics are internal v1.0→v2.0 improvements, not usage benefits
651
-
652
- ### Migration Notes
653
- - No breaking changes for MCP tool API
654
- - Users who relied on `npx sqlew` for CLI should install the package and use `sqlew-cli` command
655
- - MCP server configuration unchanged (still uses stdio transport)
251
+ **Enhanced parameter validation for all MCP actions**
656
252
 
657
- ## [2.1.0] - 2025-10-14
253
+ ---
658
254
 
659
- ### 🎉 Feature Release
660
-
661
- **Major enhancement release implementing 7 feature requests from real-world usage in the Trackne Server project. Adds activity logging, smart defaults, subscriptions, advanced querying, batch operations, templates, and a standalone CLI tool.**
662
-
663
- ### Added
664
-
665
- #### FR-001: Activity Log System
666
- - **Automatic Activity Logging:** All decision changes, messages, and file modifications are now automatically logged
667
- - New `t_activity_log` table with 3 optimized indexes
668
- - 4 triggers for automatic logging:
669
- - `trg_log_decision_insert` - Logs decision creation
670
- - `trg_log_decision_update` - Logs decision modifications
671
- - `trg_log_message_insert` - Logs message sending
672
- - `trg_log_file_change_insert` - Logs file changes
673
- - `getActivityLog` action in `stats` tool for retrieving filtered logs
674
- - Filter by agent, entity type, action type, and time range
675
- - Token-efficient logging (~50 bytes per log entry)
676
-
677
- #### FR-002: Smart Defaults
678
- - **quickSetDecision:** Streamlined decision setting with automatic layer inference
679
- - Infers layer from key patterns (e.g., "auth_*" → infrastructure)
680
- - Auto-extracts tags from key and value (e.g., "jwt_config" → ["jwt", "config"])
681
- - Reduces token usage by ~60% for simple decisions
682
- - Falls back to manual tagging when inference is ambiguous
683
- - New `quick_set` action in `decision` tool
684
-
685
- #### FR-003: Lightweight Subscriptions
686
- - **hasUpdates Polling:** Efficient change detection for agents
687
- - Check for updates since last check (~5-10 tokens per call)
688
- - Filter by entity type (decisions, messages, files)
689
- - Filter by scope, layer, or agent
690
- - Returns boolean + count + latest timestamp
691
- - New `has_updates` action in `decision` tool
692
- - 95% token reduction vs full list queries
693
-
694
- #### FR-004: Advanced Query System
695
- - **searchAdvanced:** Comprehensive search across all decision metadata
696
- - 13 query parameters: keys, tags, scopes, layers, status, versions, full-text search
697
- - Pagination support (limit, offset)
698
- - Sort by multiple fields with direction control
699
- - Full-text search in keys and values
700
- - Scope inheritance (search within parent scopes)
701
- - New `search_advanced` action in `decision` tool
702
- - Replaces multiple sequential queries with single call
703
-
704
- #### FR-005: Batch Operations
705
- - **Atomic Batch Processing:** Process multiple operations in a single transaction
706
- - `setDecisionBatch` - Set up to 50 decisions atomically
707
- - `sendMessageBatch` - Send multiple messages in one transaction
708
- - `recordFileChangeBatch` - Record multiple file changes atomically
709
- - All-or-nothing guarantee (rollback on any failure)
710
- - ~70% token reduction vs sequential calls
711
- - New actions: `set_batch` (decision), `send_batch` (message), `record_batch` (file)
712
-
713
- #### FR-006: Template System
714
- - **Decision Templates:** Reusable decision patterns with validation
715
- - 5 built-in templates: auth_config, api_endpoint, db_schema, ui_component, feature_flag
716
- - `createTemplate` - Define custom templates with field schemas
717
- - `setFromTemplate` - Create decisions from templates with validation
718
- - `listTemplates` - Browse available templates
719
- - Template inheritance and composition support
720
- - New `t_decision_templates` table
721
- - New actions: `set_from_template`, `create_template`, `list_templates` (decision tool)
722
-
723
- #### FR-007: Standalone CLI Query Tool
724
- - **Command-Line Interface:** Query MCP database without starting MCP server
725
- - 4 commands: `decisions`, `messages`, `files`, `activity`
726
- - JSON and table output formats
727
- - Filter options match MCP tool parameters
728
- - Supports all query patterns from MCP tools
729
- - Zero MCP token impact (standalone binary)
730
- - New script: `src/cli.ts`
731
- - Usage: `node dist/cli.js decisions --scope=auth --format=table`
732
-
733
- ### Changed
734
-
735
- - **Tool Definitions:** Added 11 new actions across 3 tools
736
- - `decision` tool: 7 → 11 actions (+4: quick_set, has_updates, search_advanced, set_batch, set_from_template, create_template, list_templates)
737
- - `message` tool: 4 → 5 actions (+1: send_batch)
738
- - `file` tool: 4 → 5 actions (+1: record_batch)
739
- - `stats` tool: 4 → 5 actions (+1: getActivityLog)
740
- - **Database Schema:** v2.1.0 migration adds 2 tables and 4 triggers
741
- - **Token Efficiency:** Maintains 92% efficiency vs v1.0.0 original design
742
- - Tool definitions: 481 → 1,031 tokens (+550 tokens for 11 new actions)
743
- - CLI has zero MCP token impact (standalone)
744
- - Batch operations save ~70% tokens vs sequential calls
745
- - hasUpdates saves ~95% tokens vs full list queries
746
-
747
- ### Technical Details
748
-
749
- #### Database Changes
750
- - **New Tables:**
751
- - `t_activity_log` - Automatic logging of all changes (agent_id, entity_type, entity_id, action_type, details, ts)
752
- - `t_decision_templates` - Template definitions (name, description, schema, layer, tags, created_by, created_at)
753
- - **New Indexes:**
754
- - `idx_activity_log_agent_ts` - Agent-based log queries
755
- - `idx_activity_log_entity_ts` - Entity-based log queries
756
- - `idx_activity_log_ts` - Time-based log queries
757
- - **New Triggers:**
758
- - `trg_log_decision_insert`, `trg_log_decision_update` - Decision logging
759
- - `trg_log_message_insert` - Message logging
760
- - `trg_log_file_change_insert` - File change logging
761
-
762
- #### Migration
763
- - **Migration Script:** `src/migrations/add-v2.1.0-features.ts`
764
- - Creates `t_activity_log` and `t_decision_templates` tables
765
- - Creates 3 indexes for activity log queries
766
- - Creates 4 triggers for automatic logging
767
- - Seeds 5 built-in templates
768
- - Transaction-based with rollback on failure
769
- - Automatic execution on startup
770
- - Backward compatible with v2.0.0 databases
771
-
772
- #### Performance
773
- - **Token Efficiency:**
774
- - Batch operations: ~70% reduction vs sequential (3 operations: 1,200 → 360 tokens)
775
- - hasUpdates polling: ~95% reduction vs full list (500 → 25 tokens)
776
- - quickSetDecision: ~60% reduction vs manual (250 → 100 tokens)
777
- - Templates: ~50% reduction for repeated patterns
778
- - **Query Performance:**
779
- - Activity log queries: 5-15ms (with indexes)
780
- - Advanced search: 10-30ms (with full-text)
781
- - Batch operations: 20-50ms (atomic transaction)
782
- - Template operations: 5-10ms
783
-
784
- #### Code Statistics
785
- - **Source Changes:**
786
- - New files: `src/cli.ts`, `src/migrations/add-v2.1.0-features.ts`
787
- - Modified: `src/tools/context.ts`, `src/tools/messaging.ts`, `src/tools/files.ts`, `src/tools/utils.ts`
788
- - Total lines added: ~1,500 lines
789
- - **CLI Tool:**
790
- - Standalone binary (~300 lines)
791
- - Zero dependencies on MCP server
792
- - Supports all common query patterns
793
-
794
- ### Real-World Impact
795
-
796
- These features were requested during development of the **Trackne Server** project:
797
- - **Activity Log:** Essential for debugging multi-agent coordination
798
- - **Smart Defaults:** Reduced boilerplate by 60% for common decisions
799
- - **Subscriptions:** Enabled efficient polling without full list queries
800
- - **Advanced Query:** Replaced 5-10 sequential queries with single calls
801
- - **Batch Operations:** Critical for atomic state updates across agents
802
- - **Templates:** Standardized patterns across 15+ API endpoints
803
- - **CLI Tool:** Enabled quick debugging without starting MCP server
804
-
805
- ### Migration from v2.0.0
806
-
807
- No breaking changes. All v2.0.0 tool calls work unchanged. New features are opt-in:
808
-
809
- ```javascript
810
- // NEW: Quick decision setting with smart defaults
811
- await callTool('decision', { action: 'quick_set', key: 'jwt_config', value: 'HS256' });
812
- // Auto-infers layer=infrastructure, tags=["jwt", "config"]
813
-
814
- // NEW: Check for updates efficiently
815
- await callTool('decision', { action: 'has_updates', since: '2025-10-14T10:00:00Z' });
816
- // Returns: { hasUpdates: true, count: 5, latestTimestamp: '...' }
817
-
818
- // NEW: Batch operations (atomic)
819
- await callTool('decision', {
820
- action: 'set_batch',
821
- decisions: [
822
- { key: 'auth', value: 'jwt' },
823
- { key: 'db', value: 'postgres' }
824
- ]
825
- });
826
-
827
- // NEW: Use templates
828
- await callTool('decision', {
829
- action: 'set_from_template',
830
- template_name: 'api_endpoint',
831
- key: 'users_api',
832
- values: { path: '/api/users', method: 'GET' }
833
- });
834
-
835
- // NEW: CLI queries (no MCP server needed)
836
- // $ node dist/cli.js decisions --scope=auth --format=table
837
- // $ node dist/cli.js activity --agent=agent1 --limit=20
838
- ```
839
-
840
- Database migration runs automatically on first startup with v2.1.0.
255
+ ## [2.1.3] - 2025-10-15
841
256
 
842
- ## [2.0.0] - 2025-10-11
257
+ ### Fixed - Message Priority Handling
843
258
 
844
- ### 🚨 BREAKING CHANGES
259
+ **Fixed message priority enum conversion**
845
260
 
846
- **This is a major release with breaking API changes. Migration required for all v1.x users.**
261
+ ---
847
262
 
848
- #### Tool Consolidation
849
- - **20 individual tools** → **6 action-based tools** (70% reduction)
850
- - All tools now use action-based routing with `action` parameter
851
- - Tool names completely changed (see migration guide below)
263
+ ## [2.1.2] - 2025-10-15
852
264
 
853
- #### Old vs New Tool Names
265
+ ### Fixed - File Change Tracking
854
266
 
855
- | Old (v1.x) | New (v2.0) | Actions |
856
- |------------|------------|---------|
857
- | `set_decision`, `get_decision`, `get_context`, `search_by_tags`, `search_by_layer`, `get_versions` | `decision` | `set`, `get`, `list`, `search_tags`, `search_layer`, `versions`, `help` |
858
- | `send_message`, `get_messages`, `mark_read` | `message` | `send`, `get`, `mark_read`, `help` |
859
- | `record_file_change`, `get_file_changes`, `check_file_lock` | `file` | `record`, `get`, `check_lock`, `help` |
860
- | `add_constraint`, `get_constraints`, `deactivate_constraint` | `constraint` | `add`, `get`, `deactivate`, `help` |
861
- | `get_layer_summary`, `get_stats`, `clear_old_data` | `stats` | `layer_summary`, `db_stats`, `clear`, `help` |
862
- | `get_config`, `update_config` | `config` | `get`, `update`, `help` |
267
+ **Fixed file change timestamp handling**
863
268
 
864
- ### Added
269
+ ---
865
270
 
866
- - **Help Actions:** All 6 tools now support `action: "help"` for comprehensive on-demand documentation
867
- - Returns detailed usage, parameters, and examples
868
- - Zero token cost until explicitly called
869
- - **Action Hints:** Tool descriptions now include available actions for better discoverability
870
- - **Improved Token Efficiency:** 96% token reduction vs traditional JSON approach
871
- - Tool definition tokens: ~12,848 → ~481 tokens (96.3% reduction)
872
- - MCP context usage: ~13,730 → ~4,482 tokens (67% reduction)
271
+ ## [2.1.1] - 2025-10-15
873
272
 
874
- ### Changed
273
+ ### Fixed - Constraint Deactivation
875
274
 
876
- - **API Surface:** Complete redesign to action-based routing
877
- - All tools require `action` parameter
878
- - Parameters consolidated into single input schema per tool
879
- - Nested switch statement routing for better maintainability
880
- - **Tool Descriptions:** Simplified with action hints in parentheses
881
- - **File Size:** Source reduced 27.4% (25,373 → 18,410 bytes) while adding help docs
275
+ **Fixed constraint soft delete logic**
882
276
 
883
- ### Technical Details
277
+ ---
884
278
 
885
- - Action-based routing with two-level switch statements
886
- - Shared parameter schemas across actions within each tool
887
- - Enum deduplication (layer, status, priority defined once per tool)
888
- - On-demand documentation via help actions
889
- - 100% backward compatible database schema (no DB changes)
279
+ ## [2.1.0] - 2025-10-14
280
+
281
+ ### Added - Template System
890
282
 
891
- ### Migration Required
283
+ **Decision and batch operation templates**
892
284
 
893
- **v1.x users must update their tool calls:**
285
+ #### Features
286
+ - New actions: `set_from_template`, `create_template`, `list_templates`
287
+ - Template-based decision creation
288
+ - Batch operation support with `set_batch`, `send_batch`, `record_batch`
894
289
 
895
- ```javascript
896
- // OLD (v1.x)
897
- await callTool('set_decision', { key: 'auth', value: 'jwt' });
898
- await callTool('get_messages', { unread_only: true });
290
+ ---
899
291
 
900
- // NEW (v2.0)
901
- await callTool('decision', { action: 'set', key: 'auth', value: 'jwt' });
902
- await callTool('message', { action: 'get', unread_only: true });
903
- ```
292
+ ## [2.0.0] - 2025-10-11
904
293
 
905
- See `MIGRATION_v2.md` for complete migration guide.
294
+ ### Changed - Action-Based Tool Consolidation
906
295
 
907
- ### Performance
296
+ **96% token reduction through action-based API**
908
297
 
909
- - 96% token reduction in tool definitions
910
- - 67% reduction in MCP context consumption
911
- - Same database performance (no schema changes)
912
- - Same query response times
298
+ #### Breaking Changes
299
+ - 20 tools 6 tools (action-based routing)
300
+ - All tools use `action` parameter for routing
301
+ - Tool names changed: `context` → `decision`, `utils` → `stats`
302
+
303
+ #### Token Efficiency
304
+ - Tool definitions: 12,848 → 481 tokens (96% reduction)
305
+ - MCP context: ~13,730 → ~4,482 tokens (67% reduction)
306
+ - Help actions provide on-demand documentation
307
+
308
+ #### New Tool Structure
309
+ - `decision` - Context Management (9 actions)
310
+ - `message` - Agent Messaging (4 actions)
311
+ - `file` - File Change Tracking (4 actions)
312
+ - `constraint` - Constraint Management (4 actions)
313
+ - `stats` - Statistics & Utilities (4 actions)
314
+ - `config` - Configuration (3 actions)
315
+
316
+ ---
913
317
 
914
318
  ## [1.1.2] - 2025-10-11
915
319
 
916
- ### Fixed
917
- - **Schema Validation Bug:** Fixed validation checking for old unprefixed table names instead of new prefixed names
918
- - Updated `requiredTables` to check for `m_*` and `t_*` prefixed names
919
- - Updated `requiredViews` to check for `v_*` prefixed names
920
- - Updated `requiredTriggers` to check for `trg_*` prefixed names
921
- - **Migration Missing Views/Triggers:** After migration, views and triggers are now created automatically
922
- - Added `initializeSchema()` call after successful migration
923
- - Ensures v1.0.0 → v1.1.x migration creates all required database objects
320
+ ### Fixed - Database Migration
321
+
322
+ **Fixed v1.2.0 v1.3.0 table prefix migration**
924
323
 
925
- ### Technical Details
926
- - Migration now runs schema initialization after table renaming to create views/triggers
927
- - Schema validation properly detects v1.1.x databases with prefixed names
928
- - Full backward compatibility maintained with v1.0.0 databases
324
+ ---
929
325
 
930
326
  ## [1.1.1] - 2025-10-11
931
327
 
932
- ### Fixed
933
- - **Migration Bug:** Fixed migration from v1.0.0 to v1.1.0 failing with "no such table: m_config" error
934
- - Migration now creates `m_config` table if it doesn't exist (new in v1.1.0, not present in v1.0.0)
935
- - Automatically inserts default config values during migration
936
- - Users who already migrated can manually fix by running: `sqlite3 <path-to-db> "CREATE TABLE IF NOT EXISTS m_config (key TEXT PRIMARY KEY, value TEXT NOT NULL); INSERT OR IGNORE INTO m_config VALUES ('autodelete_ignore_weekend', '0'), ('autodelete_message_hours', '24'), ('autodelete_file_history_days', '7');"`
328
+ ### Fixed - Auto-Cleanup
937
329
 
938
- ### Technical Details
939
- - Added table creation step to migration script for tables new in v1.1.0
940
- - Migration now handles both table renaming (v1.0.0 → v1.1.0) and new table creation
941
- - 100% backward compatible with v1.0.0 databases
330
+ **Fixed weekend-aware cleanup trigger timing**
331
+
332
+ ---
942
333
 
943
334
  ## [1.1.0] - 2025-10-11
944
335
 
945
- ### Added
946
- - **Category-Based Table Prefixes:** All database objects now use prefixes for better SQL utility navigation
947
- - Master tables: `m_` prefix (8 tables)
948
- - Transaction tables: `t_` prefix (9 tables)
949
- - Views: `v_` prefix (6 views)
950
- - Triggers: `trg_` prefix (1 trigger)
951
- - **Automatic Migration System:** Seamless upgrade from v1.0.x to v1.1.0
952
- - Detects old unprefixed schema automatically
953
- - Transaction-based migration with rollback on failure
954
- - Zero downtime - runs on startup
955
- - Detailed migration logging
956
- - **Migration Script:** New `src/migrations/add-table-prefixes.ts` module
957
- - Safe table renaming in transaction
958
- - Backward compatibility check
959
- - Comprehensive error handling
960
-
961
- ### Changed
962
- - Database schema structure updated to v1.1.0
963
- - All SQL queries updated to use prefixed table names
964
- - Schema initialization now supports both old and new table structures
965
- - Documentation updated to reflect new table naming convention
966
-
967
- ### Technical Details
968
- - 24 database objects renamed (8 master tables, 9 transaction tables, 6 views, 1 trigger)
969
- - Migration preserves all existing data
970
- - No breaking changes for MCP tool API
971
- - Full backward compatibility with existing databases
336
+ ### Added - Weekend-Aware Auto-Deletion
337
+
338
+ **Configurable retention with weekend-aware logic**
339
+
340
+ #### Features
341
+ - Configuration keys: `autodelete_ignore_weekend`, `autodelete_message_hours`, `autodelete_file_history_days`
342
+ - CLI arguments for startup override
343
+ - Manual cleanup via `clear_old_data` action
344
+
345
+ ---
972
346
 
973
347
  ## [1.0.1] - 2025-10-11
974
348
 
975
- ### Added
976
- - **Database Schema Validation:** Comprehensive validation on startup for existing databases
977
- - Detects missing tables, views, and triggers
978
- - Verifies standard data integrity (layers, categories, tags)
979
- - Displays detailed error messages with actionable solutions
980
- - Prevents data corruption from incompatible schemas
981
- - Graceful exit with error code 1 on validation failure
349
+ ### Fixed - Schema Initialization
982
350
 
983
- ### Fixed
984
- - Database initialization now validates existing schema before proceeding
985
- - Organized test files into `tests/` directory for better project structure
351
+ **Fixed initial database schema creation**
986
352
 
987
- ### Changed
988
- - Updated `.gitignore` to properly handle test files (root vs tests directory)
353
+ ---
989
354
 
990
355
  ## [1.0.0] - 2025-01-10
991
356
 
992
- ### Initial Release
357
+ ### Added - Initial Release
358
+
359
+ **MCP Shared Context Server for efficient context sharing**
360
+
361
+ #### Core Features
362
+ - Decision tracking with metadata (tags, layers, scopes, versions)
363
+ - Agent messaging with priority levels
364
+ - File change tracking with layer integration
365
+ - Constraint management with priorities
366
+ - Statistics and utilities
367
+ - SQLite-based persistence with better-sqlite3
368
+
369
+ #### Database Schema
370
+ - Master tables: agents, files, context_keys, layers, tags, scopes, etc.
371
+ - Transaction tables: decisions, messages, file_changes, constraints
372
+ - Views for token-efficient queries
373
+ - Automatic version history tracking
993
374
 
994
- First production release of sqlew - MCP server for efficient context sharing between Claude Code sub-agents.
995
-
996
- ### Added
997
-
998
- #### Context Management (6 tools)
999
- - `set_decision` - Set or update decisions with metadata (tags, layers, scopes, versions)
1000
- - `get_context` - Advanced filtering for decision retrieval
1001
- - `get_decision` - Retrieve specific decision by key
1002
- - `search_by_tags` - Tag-based search with AND/OR logic
1003
- - `get_versions` - Version history tracking
1004
- - `search_by_layer` - Layer-based decision filtering
1005
-
1006
- #### Messaging System (3 tools)
1007
- - `send_message` - Agent-to-agent messaging with priority levels
1008
- - `get_messages` - Message retrieval with filtering (priority, unread status)
1009
- - `mark_read` - Mark messages as read
1010
-
1011
- #### File Change Tracking (3 tools)
1012
- - `record_file_change` - Track file modifications with layer assignment
1013
- - `get_file_changes` - File change history retrieval
1014
- - `check_file_lock` - Concurrent edit prevention
1015
-
1016
- #### Constraint Management (3 tools)
1017
- - `add_constraint` - Add constraints with priority and metadata
1018
- - `get_constraints` - Complex constraint filtering
1019
- - `deactivate_constraint` - Soft delete constraints
1020
-
1021
- #### Utilities (3 tools)
1022
- - `get_layer_summary` - Per-layer aggregated statistics
1023
- - `clear_old_data` - Manual cleanup of old data
1024
- - `get_stats` - Comprehensive database statistics
1025
-
1026
- ### Features
1027
-
1028
- - **Token Efficiency:** 72% reduction through ID-based normalization, integer enums, and pre-aggregated views
1029
- - **Metadata System:** Tags, layers, scopes, versions, and priorities for intelligent organization
1030
- - **SQLite Database:** Fast, reliable, offline-only operation with ACID guarantees
1031
- - **Automatic Cleanup:** Configurable retention policies (24h for messages, 7 days for file changes)
1032
- - **Version History:** Automatic tracking of decision evolution
1033
- - **Concurrent Access:** Support for multiple agents simultaneously
1034
- - **WAL Mode:** Write-Ahead Logging for improved concurrency
1035
-
1036
- ### Database Schema
1037
-
1038
- - 7 Master tables for normalization (agents, files, context_keys, layers, tags, scopes, constraint_categories)
1039
- - 10 Transaction tables for core data
1040
- - 6 Token-efficient pre-aggregated views
1041
- - 9 Optimized indexes for common queries
1042
- - 3 Automatic triggers for cleanup and history
1043
-
1044
- ### Architecture
1045
-
1046
- - **Standard Layers:** presentation, business, data, infrastructure, cross-cutting
1047
- - **Constraint Categories:** performance, architecture, security
1048
- - **Priority Levels:** low, medium, high, critical
1049
- - **Message Types:** decision, warning, request, info
1050
- - **Change Types:** created, modified, deleted
1051
- - **Status Values:** active, deprecated, draft
1052
-
1053
- ### Performance
1054
-
1055
- - Query performance: 2-20ms for typical operations
1056
- - Concurrent access: Tested with 5 simultaneous agents
1057
- - Database size: ~140 bytes per decision (efficient storage)
1058
- - Token reduction: 72% compared to traditional JSON approach
1059
-
1060
- ### Documentation
1061
-
1062
- - Comprehensive README with quick start guide
1063
- - Complete tool reference with examples
1064
- - Architecture documentation
1065
- - Schema reference
1066
- - Development guidelines
1067
-
1068
- ### Testing
1069
-
1070
- - 100% tool coverage (all 18 tools verified)
1071
- - Comprehensive test suite
1072
- - MCP Inspector compatibility
1073
-
1074
- ### Technical Details
1075
-
1076
- - **Runtime:** Node.js 18+
1077
- - **Language:** TypeScript 5.0+
1078
- - **Database:** better-sqlite3 ^11.0.0
1079
- - **MCP SDK:** @modelcontextprotocol/sdk (latest)
1080
- - **Transport:** stdio (standard MCP pattern)
1081
-
1082
- ### Code Statistics
1083
-
1084
- - 3,424 lines of TypeScript
1085
- - 10 source files
1086
- - Full type safety
1087
- - Comprehensive error handling
1088
-
1089
- [2.1.4]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v2.1.4
1090
- [2.1.3]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v2.1.3
1091
- [2.1.2]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v2.1.2
1092
- [2.1.1]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v2.1.1
1093
- [2.1.0]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v2.1.0
1094
- [2.0.0]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v2.0.0
1095
- [1.1.2]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.1.2
1096
- [1.1.1]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.1.1
1097
- [1.1.0]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.1.0
1098
- [1.0.1]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.0.1
1099
- [1.0.0]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.0.0
375
+ #### MCP Tools
376
+ Initial implementation with 20 separate tools (consolidated to 6 in v2.0.0)