sqlew 4.0.4 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/CHANGELOG.md +1805 -1762
  2. package/LICENSE +177 -39
  3. package/NOTICE +24 -0
  4. package/README.md +409 -390
  5. package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
  6. package/assets/config.example.toml +282 -284
  7. package/assets/sample-agents/README.md +36 -40
  8. package/assets/sample-agents/sqlew-architect.md +321 -322
  9. package/assets/sample-agents/sqlew-researcher.md +292 -293
  10. package/assets/sample-agents/sqlew-scrum-master.md +286 -287
  11. package/assets/sample-commands/README.md +56 -57
  12. package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
  13. package/dist/cli/hooks/check-completion.d.ts +19 -0
  14. package/dist/cli/hooks/check-completion.d.ts.map +1 -0
  15. package/dist/cli/hooks/check-completion.js +104 -0
  16. package/dist/cli/hooks/check-completion.js.map +1 -0
  17. package/dist/cli/hooks/init-hooks.d.ts +35 -0
  18. package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
  19. package/dist/cli/hooks/init-hooks.js +425 -0
  20. package/dist/cli/hooks/init-hooks.js.map +1 -0
  21. package/dist/cli/hooks/mark-done.d.ts +25 -0
  22. package/dist/cli/hooks/mark-done.d.ts.map +1 -0
  23. package/dist/cli/hooks/mark-done.js +128 -0
  24. package/dist/cli/hooks/mark-done.js.map +1 -0
  25. package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
  26. package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
  27. package/dist/cli/hooks/plan-id-utils.js +183 -0
  28. package/dist/cli/hooks/plan-id-utils.js.map +1 -0
  29. package/dist/cli/hooks/save.d.ts +23 -0
  30. package/dist/cli/hooks/save.d.ts.map +1 -0
  31. package/dist/cli/hooks/save.js +90 -0
  32. package/dist/cli/hooks/save.js.map +1 -0
  33. package/dist/cli/hooks/stdin-parser.d.ts +139 -0
  34. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
  35. package/dist/cli/hooks/stdin-parser.js +127 -0
  36. package/dist/cli/hooks/stdin-parser.js.map +1 -0
  37. package/dist/cli/hooks/suggest.d.ts +19 -0
  38. package/dist/cli/hooks/suggest.d.ts.map +1 -0
  39. package/dist/cli/hooks/suggest.js +157 -0
  40. package/dist/cli/hooks/suggest.js.map +1 -0
  41. package/dist/cli/hooks/track-plan.d.ts +36 -0
  42. package/dist/cli/hooks/track-plan.d.ts.map +1 -0
  43. package/dist/cli/hooks/track-plan.js +152 -0
  44. package/dist/cli/hooks/track-plan.js.map +1 -0
  45. package/dist/cli.d.ts.map +1 -1
  46. package/dist/cli.js +56 -16
  47. package/dist/cli.js.map +1 -1
  48. package/dist/config/global-config.d.ts +187 -0
  49. package/dist/config/global-config.d.ts.map +1 -0
  50. package/dist/config/global-config.js +206 -0
  51. package/dist/config/global-config.js.map +1 -0
  52. package/dist/config/loader.d.ts +42 -0
  53. package/dist/config/loader.d.ts.map +1 -1
  54. package/dist/config/loader.js +96 -0
  55. package/dist/config/loader.js.map +1 -1
  56. package/dist/constants.d.ts +4 -0
  57. package/dist/constants.d.ts.map +1 -1
  58. package/dist/constants.js +10 -0
  59. package/dist/constants.js.map +1 -1
  60. package/dist/database/operations/queries.d.ts.map +1 -1
  61. package/dist/database/operations/queries.js +11 -2
  62. package/dist/database/operations/queries.js.map +1 -1
  63. package/dist/index.js +5 -2
  64. package/dist/index.js.map +1 -1
  65. package/dist/init-agents.js +0 -1
  66. package/dist/init-agents.js.map +1 -1
  67. package/dist/init-skills.d.ts +4 -3
  68. package/dist/init-skills.d.ts.map +1 -1
  69. package/dist/init-skills.js +10 -3
  70. package/dist/init-skills.js.map +1 -1
  71. package/dist/server/setup.d.ts +8 -0
  72. package/dist/server/setup.d.ts.map +1 -1
  73. package/dist/server/setup.js +141 -21
  74. package/dist/server/setup.js.map +1 -1
  75. package/dist/sync-agents.d.ts.map +1 -1
  76. package/dist/sync-agents.js +48 -3
  77. package/dist/sync-agents.js.map +1 -1
  78. package/dist/sync-commands.d.ts.map +1 -1
  79. package/dist/sync-commands.js +43 -3
  80. package/dist/sync-commands.js.map +1 -1
  81. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  82. package/dist/tools/constraints/actions/get.js +5 -8
  83. package/dist/tools/constraints/actions/get.js.map +1 -1
  84. package/dist/tools/constraints/help/help.d.ts.map +1 -1
  85. package/dist/tools/constraints/help/help.js +1 -6
  86. package/dist/tools/constraints/help/help.js.map +1 -1
  87. package/dist/tools/context/actions/get.d.ts.map +1 -1
  88. package/dist/tools/context/actions/get.js.map +1 -1
  89. package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
  90. package/dist/tools/context/actions/search-layer.js +5 -3
  91. package/dist/tools/context/actions/search-layer.js.map +1 -1
  92. package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
  93. package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
  94. package/dist/tools/context/actions/set-from-policy.js.map +1 -1
  95. package/dist/tools/context/help/help.d.ts.map +1 -1
  96. package/dist/tools/context/help/help.js +1 -7
  97. package/dist/tools/context/help/help.js.map +1 -1
  98. package/dist/tools/context/internal/queries.d.ts.map +1 -1
  99. package/dist/tools/context/internal/queries.js +5 -2
  100. package/dist/tools/context/internal/queries.js.map +1 -1
  101. package/dist/tools/context/types.d.ts +1 -1
  102. package/dist/tools/context/types.d.ts.map +1 -1
  103. package/dist/tools/files/actions/get.d.ts.map +1 -1
  104. package/dist/tools/files/actions/get.js +4 -6
  105. package/dist/tools/files/actions/get.js.map +1 -1
  106. package/dist/tools/files/help/help.d.ts.map +1 -1
  107. package/dist/tools/files/help/help.js +1 -6
  108. package/dist/tools/files/help/help.js.map +1 -1
  109. package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
  110. package/dist/tools/suggest/help/constraint-help.js +0 -2
  111. package/dist/tools/suggest/help/constraint-help.js.map +1 -1
  112. package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
  113. package/dist/tools/suggest/internal/constraint-queries.js +12 -5
  114. package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
  115. package/dist/tools/suggest/internal/queries.js +2 -2
  116. package/dist/tools/suggest/internal/queries.js.map +1 -1
  117. package/dist/tools/tasks/help/help.d.ts.map +1 -1
  118. package/dist/tools/tasks/help/help.js +0 -6
  119. package/dist/tools/tasks/help/help.js.map +1 -1
  120. package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
  121. package/dist/tools/tasks/help/use-case.js +0 -1
  122. package/dist/tools/tasks/help/use-case.js.map +1 -1
  123. package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
  124. package/dist/tools/tasks/watcher/status.js +5 -1
  125. package/dist/tools/tasks/watcher/status.js.map +1 -1
  126. package/dist/types/decision/params.d.ts +7 -6
  127. package/dist/types/decision/params.d.ts.map +1 -1
  128. package/dist/types/decision/templates.d.ts +3 -2
  129. package/dist/types/decision/templates.d.ts.map +1 -1
  130. package/dist/types/view-entities.d.ts +2 -1
  131. package/dist/types/view-entities.d.ts.map +1 -1
  132. package/dist/types.d.ts +19 -11
  133. package/dist/types.d.ts.map +1 -1
  134. package/dist/types.js +4 -1
  135. package/dist/types.js.map +1 -1
  136. package/dist/utils/enum-converter.d.ts +72 -0
  137. package/dist/utils/enum-converter.d.ts.map +1 -0
  138. package/dist/utils/enum-converter.js +76 -0
  139. package/dist/utils/enum-converter.js.map +1 -0
  140. package/dist/utils/hook-queue.d.ts +81 -0
  141. package/dist/utils/hook-queue.d.ts.map +1 -0
  142. package/dist/utils/hook-queue.js +156 -0
  143. package/dist/utils/hook-queue.js.map +1 -0
  144. package/dist/utils/project-root.d.ts +9 -2
  145. package/dist/utils/project-root.d.ts.map +1 -1
  146. package/dist/utils/project-root.js +16 -2
  147. package/dist/utils/project-root.js.map +1 -1
  148. package/dist/utils/tag-parser.d.ts.map +1 -1
  149. package/dist/utils/tag-parser.js +6 -0
  150. package/dist/utils/tag-parser.js.map +1 -1
  151. package/dist/utils/validators.d.ts +1 -1
  152. package/dist/utils/validators.d.ts.map +1 -1
  153. package/dist/utils/validators.js +1 -1
  154. package/dist/utils/validators.js.map +1 -1
  155. package/dist/utils/vcs-adapter.d.ts +44 -0
  156. package/dist/utils/vcs-adapter.d.ts.map +1 -1
  157. package/dist/utils/vcs-adapter.js +88 -0
  158. package/dist/utils/vcs-adapter.js.map +1 -1
  159. package/dist/utils/view-queries.d.ts.map +1 -1
  160. package/dist/utils/view-queries.js +9 -19
  161. package/dist/utils/view-queries.js.map +1 -1
  162. package/dist/watcher/base-watcher.d.ts +69 -0
  163. package/dist/watcher/base-watcher.d.ts.map +1 -0
  164. package/dist/watcher/base-watcher.js +130 -0
  165. package/dist/watcher/base-watcher.js.map +1 -0
  166. package/dist/watcher/index.d.ts +3 -0
  167. package/dist/watcher/index.d.ts.map +1 -1
  168. package/dist/watcher/index.js +2 -0
  169. package/dist/watcher/index.js.map +1 -1
  170. package/dist/watcher/queue-watcher.d.ts +64 -0
  171. package/dist/watcher/queue-watcher.d.ts.map +1 -0
  172. package/dist/watcher/queue-watcher.js +187 -0
  173. package/dist/watcher/queue-watcher.js.map +1 -0
  174. package/docs/ADR_CONCEPTS.md +140 -0
  175. package/docs/CONFIGURATION.md +922 -925
  176. package/docs/CROSS_DATABASE.md +153 -0
  177. package/docs/DATABASE_AUTH.md +70 -356
  178. package/docs/HOOKS_GUIDE.md +159 -0
  179. package/docs/SLASH_COMMANDS.md +329 -337
  180. package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
  181. package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
  182. package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
  183. package/docs/cli/README.md +276 -277
  184. package/package.json +123 -119
  185. package/docs/ACCEPTANCE_CRITERIA.md +0 -625
  186. package/docs/AI_AGENT_GUIDE.md +0 -198
  187. package/docs/ARCHITECTURE.md +0 -167
  188. package/docs/AUTO_FILE_TRACKING.md +0 -841
  189. package/docs/BATCH_VALIDATION.md +0 -617
  190. package/docs/BEST_PRACTICES.md +0 -168
  191. package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
  192. package/docs/DECISION_CONTEXT.md +0 -675
  193. package/docs/DECISION_INTELLIGENCE.md +0 -605
  194. package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
  195. package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
  196. package/docs/SHARED_CONCEPTS.md +0 -225
  197. package/docs/SPECIALIZED_AGENTS.md +0 -126
  198. package/docs/TASK_ACTIONS.md +0 -1177
  199. package/docs/TASK_OVERVIEW.md +0 -452
  200. package/docs/TASK_PRUNING.md +0 -594
  201. package/docs/TOOL_REFERENCE.md +0 -1077
  202. package/docs/TOOL_SELECTION.md +0 -83
  203. package/docs/WORKFLOWS.md +0 -941
@@ -1,452 +0,0 @@
1
- # Task System Overview - Kanban Task Watcher
2
-
3
- **Version:** 4.0.0
4
- **Last Updated:** 2025-10-17
5
-
6
- ## Table of Contents
7
-
8
- 1. [Overview](#overview)
9
- 2. [Core Concepts](#core-concepts)
10
- 3. [Status Definitions](#status-definitions)
11
- 4. [State Machine Transitions](#state-machine-transitions)
12
- 5. [Auto-Stale Detection](#auto-stale-detection)
13
- 6. [Priority System](#priority-system)
14
- 7. [Quick Start](#quick-start)
15
- 8. [Related Documentation](#related-documentation)
16
-
17
- ## Overview
18
-
19
- The Kanban Task Watcher is an AI-optimized task management system designed to solve token waste from misuse of the `decision` tool for task/todo tracking.
20
-
21
- ### Problem Statement
22
-
23
- Real-world usage analysis revealed:
24
- - **204 task-like decisions** in 3-day production usage
25
- - **~825 tokens** to query 10 task-like decisions (332 bytes/decision average)
26
- - **No lifecycle management:** Tasks stuck in "in_progress" after interrupts or usage limits
27
- - **Inefficient queries:** Full text content loaded even for simple list operations
28
-
29
- ### Solution
30
-
31
- Dedicated Kanban task system with:
32
- - **70% token reduction** via metadata-only list queries
33
- - **Auto-stale detection** to handle interrupted sessions
34
- - **Status validation** with enforced state machine transitions
35
- - **Linking system** to connect tasks with decisions, constraints, files
36
- - **Flat hierarchy** for AI simplicity (no subtasks)
37
-
38
- ## Core Concepts
39
-
40
- ### Task Structure
41
-
42
- Every task has:
43
- - **Identity:** `task_id`, `title`
44
- - **Status:** Lifecycle stage (todo → in_progress → done → archived)
45
- - **Metadata:** `priority`, `assignee`, `tags`, `layer`
46
- - **Content:** Optional `description` (stored separately for token efficiency)
47
- - **Links:** Connections to decisions, constraints, files
48
- - **Timestamps:** `created_ts`, `updated_ts`
49
-
50
- ### Token Efficiency Strategy
51
-
52
- **Metadata-Only Queries:**
53
- - **`list` action:** Returns metadata only (~100 bytes/task)
54
- - **`get` action:** Returns full details with description (~332 bytes/task)
55
- - **70% reduction** compared to decision-based task tracking
56
-
57
- **Comparison Table:**
58
-
59
- | Query Type | Bytes/Task | 10 Tasks | Use Case |
60
- |------------|-----------|----------|----------|
61
- | `list` (metadata only) | ~100 | ~1,000 | Browse, filter, status check |
62
- | `get` (full details) | ~332 | ~3,320 | Read description, view links |
63
- | Old `decision` method | ~332 | ~3,320 | What AIs were doing before v3.0 |
64
-
65
- ### Flat Hierarchy
66
-
67
- **Design Decision:** No subtasks
68
- - Simpler for AI agents to manage
69
- - Clearer status tracking
70
- - Easier to query and filter
71
- - Use tags/links for relationships instead
72
-
73
- ## Status Definitions
74
-
75
- | Status | ID | Description | Use Case |
76
- |--------|----|-----------|----|
77
- | `todo` | 1 | Not yet started | Backlog, planned work |
78
- | `in_progress` | 2 | Actively being worked on | Current focus |
79
- | `waiting_review` | 3 | Awaiting feedback or approval | Code review, design review |
80
- | `blocked` | 4 | Cannot proceed due to blocker | Dependency, question, issue |
81
- | `done` | 5 | Completed | Finished work |
82
- | `archived` | 6 | Completed and archived | Historical reference |
83
-
84
- ### Status Best Practices
85
-
86
- **`todo`:**
87
- - Use for backlog items
88
- - No one actively working
89
- - Ready to be picked up
90
-
91
- **`in_progress`:**
92
- - Active work happening
93
- - Should have assignee
94
- - Auto-transitions to `waiting_review` via:
95
- - Smart quality gates (v3.4.1): All files modified, tests pass, TypeScript compiles, 3min idle (default)
96
- - Time-based stale detection: 18 hours idle (fallback, supports multi-day tasks)
97
-
98
- **`waiting_review`:**
99
- - Awaiting human/AI feedback or git commit
100
- - Code review needed
101
- - **Auto-transitions to `done` (v3.4.0 Git-aware):** When ALL watched files are committed to Git
102
- - Git commits = implicit review approval
103
- - Real-time: Detects commits via `.git/index` file watcher
104
- - Periodic: Checks on `task.list()` calls
105
-
106
- **`blocked`:**
107
- - Cannot proceed
108
- - Has explicit blocker (dependency, question, issue)
109
- - Should have comment explaining blocker
110
-
111
- **`done`:**
112
- - Work completed
113
- - Verified/tested
114
- - Can be archived
115
-
116
- **`archived`:**
117
- - Historical reference only
118
- - Completed tasks no longer active
119
- - Terminal state (no transitions out)
120
-
121
- **`rejected`:** (v4.1.0)
122
- - Cancelled or rejected tasks
123
- - Terminal state (no transitions out)
124
- - Accepts optional `rejection_reason` parameter
125
-
126
- ## State Machine Transitions (v4.1.0 - Relaxed Rules)
127
-
128
- ### Simplified Model
129
-
130
- ```
131
- v4.1.0 Relaxed Workflow:
132
-
133
- Non-terminal: todo, in_progress, waiting_review, blocked, done
134
- ↓ Can freely transition to any status (including terminal)
135
-
136
- Terminal: archived, rejected
137
- ↓ Cannot transition (final states)
138
- ```
139
-
140
- ### Valid Transitions
141
-
142
- | Status Type | Statuses | Can Transition To |
143
- |-------------|----------|-------------------|
144
- | **Non-terminal** | todo, in_progress, waiting_review, blocked, done | Any status |
145
- | **Terminal** | archived, rejected | None |
146
-
147
- ### Complete Transition Matrix
148
-
149
- | From ↓ / To → | todo | in_progress | waiting_review | blocked | done | archived | rejected |
150
- |---------------|------|-------------|----------------|---------|------|----------|----------|
151
- | **todo** | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
152
- | **in_progress** | ✅ | - | ✅ | ✅ | ✅ | ✅ | ✅ |
153
- | **waiting_review** | ✅ | ✅ | - | ✅ | ✅ | ✅ | ✅ |
154
- | **blocked** | ✅ | ✅ | ✅ | - | ✅ | ✅ | ✅ |
155
- | **done** | ✅ | ✅ | ✅ | ✅ | - | ✅ | ✅ |
156
- | **archived** | ❌ | ❌ | ❌ | ❌ | ❌ | - | ❌ |
157
- | **rejected** | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | - |
158
-
159
- ✅ = Valid transition
160
- ❌ = Invalid transition (terminal statuses)
161
- \- = Same status (no transition)
162
-
163
- ### Validation
164
-
165
- - Enforced by `move` action
166
- - Only terminal statuses (`archived`, `rejected`) cannot transition
167
- - `rejected` accepts optional `rejection_reason` parameter
168
-
169
- **Example - Moving to rejected:**
170
- ```javascript
171
- {
172
- action: "move",
173
- task_id: 1,
174
- status: "rejected",
175
- rejection_reason: "Requirements changed, task no longer needed"
176
- }
177
- ```
178
-
179
- ## Auto-Stale Detection
180
-
181
- ### Overview
182
-
183
- Auto-stale detection automatically transitions idle tasks to prevent them from getting stuck.
184
-
185
- **Why It's Needed:**
186
- - AI agents hit usage limits mid-task
187
- - Sessions get interrupted (network, timeout)
188
- - Code generation takes longer than expected
189
- - Reviews don't happen promptly
190
-
191
- ### Detection Rules
192
-
193
- **v3.4.1+: Smart Quality-Based Detection (Primary)**
194
-
195
- 1. **`in_progress` → `waiting_review`** (quality gates met)
196
- - All watched files modified at least once
197
- - TypeScript compiles without errors (if .ts files)
198
- - Tests pass (if test files exist)
199
- - 15 minutes idle (no file modifications)
200
- - Rationale: Work is complete and ready for review
201
- - Configuration: See `.sqlew/config.toml` review_* settings
202
-
203
- **Time-Based Stale Detection (Fallback)**
204
-
205
- 2. **`in_progress` → `waiting_review`** (>2 hours idle)
206
- - Rationale: Likely waiting for review or hit usage limit
207
- - Check: `updated_ts` older than 2 hours
208
-
209
- 3. **`waiting_review` → `todo`** (>24 hours idle)
210
- - Rationale: Review not happening, reset to backlog
211
- - Check: `updated_ts` older than 24 hours
212
-
213
- 4. **`done` → `archived`** (>48 hours idle) - **Auto-Archive (v3.4.1)**
214
- - Rationale: Completed tasks should be archived automatically
215
- - Check: `updated_ts` older than 48 hours (2 days)
216
- - Weekend-aware: Task done Friday → archives Tuesday (skips Sat/Sun)
217
-
218
- ### When It Runs
219
-
220
- Automatically runs before:
221
- 1. **`list` action** - Ensures stale tasks show correct status
222
- 2. **`move` action** - Prevents moving already-stale tasks
223
- 3. **Database startup** - Maintenance on initialization
224
-
225
- **Response includes:**
226
- - `stale_tasks_transitioned`: Count of auto-transitioned tasks
227
- - `archived_tasks`: Count of auto-archived done tasks (in list action)
228
-
229
- **Example Response:**
230
- ```javascript
231
- {
232
- tasks: [...],
233
- count: 5,
234
- stale_tasks_transitioned: 2, // 2 tasks auto-transitioned
235
- archived_tasks: 1 // 1 done task auto-archived
236
- }
237
- ```
238
-
239
- ### Configuration
240
-
241
- **Default Settings:**
242
- - `task_auto_stale_enabled`: '1' (enabled)
243
- - `task_stale_hours_in_progress`: '18' (18 hours - supports multi-day tasks and lunch breaks)
244
- - `task_stale_hours_waiting_review`: '24' (24 hours)
245
- - `auto_archive_done_days`: '2' (2 days / 48 hours)
246
- - `autodelete_ignore_weekend`: '0' (false) - Shared with messages/files cleanup
247
-
248
- **Via MCP Tool (config):**
249
- ```javascript
250
- // Update auto-archive threshold
251
- {
252
- action: "update",
253
- auto_archive_done_days: "3" // Archive after 3 days instead of 2
254
- }
255
-
256
- // Enable weekend-aware mode (affects auto-archive, messages, files)
257
- {
258
- action: "update",
259
- autodelete_ignore_weekend: "1"
260
- }
261
- ```
262
-
263
- **Via .sqlew/config.toml:**
264
- ```toml
265
- [tasks]
266
- auto_archive_done_days = 3 # Archive after 3 days
267
- stale_hours_in_progress = 4 # in_progress → waiting_review after 4 hours
268
- stale_hours_waiting_review = 48 # waiting_review → todo after 48 hours
269
- auto_stale_enabled = true
270
-
271
- [autodelete]
272
- ignore_weekend = true # Weekend-aware mode (shared setting)
273
- ```
274
-
275
- **Via SQL (Advanced):**
276
- ```sql
277
- -- Enable/Disable auto-stale
278
- UPDATE v4_config SET value = '1' WHERE key = 'task_auto_stale_enabled'; -- Enable
279
- UPDATE v4_config SET value = '0' WHERE key = 'task_auto_stale_enabled'; -- Disable
280
-
281
- -- Adjust auto-archive threshold
282
- UPDATE v4_config SET value = '3' WHERE key = 'auto_archive_done_days'; -- 3 days
283
-
284
- -- Adjust stale detection thresholds
285
- UPDATE v4_config SET value = '4' WHERE key = 'task_stale_hours_in_progress';
286
- UPDATE v4_config SET value = '48' WHERE key = 'task_stale_hours_waiting_review';
287
-
288
- -- Check current config
289
- SELECT key, value FROM v4_config WHERE key LIKE 'task_%' OR key LIKE 'auto_%';
290
- ```
291
-
292
- ### Monitoring
293
-
294
- Track transitions via `v4_activity_log` table:
295
-
296
- ```sql
297
- -- Recent auto-transitions (including auto-archive)
298
- SELECT * FROM v4_activity_log
299
- WHERE entity_type = 'task' AND action_type = 'status_change'
300
- ORDER BY ts DESC LIMIT 20;
301
-
302
- -- Frequently stale tasks (>2 auto-transitions)
303
- SELECT task_id, COUNT(*) as stale_count FROM v4_activity_log
304
- WHERE entity_type = 'task' AND json_extract(details, '$.new_status') = 3
305
- GROUP BY task_id HAVING stale_count > 2;
306
-
307
- -- Recently auto-archived tasks
308
- SELECT * FROM v4_activity_log
309
- WHERE entity_type = 'task'
310
- AND action_type = 'status_change'
311
- AND json_extract(details, '$.new_status') = 6 -- ARCHIVED status
312
- ORDER BY ts DESC LIMIT 20;
313
-
314
- -- Count of archived tasks per day
315
- SELECT date(ts, 'unixepoch') as day, COUNT(*) as archived_count
316
- FROM v4_activity_log
317
- WHERE entity_type = 'task'
318
- AND action_type = 'status_change'
319
- AND json_extract(details, '$.new_status') = 6
320
- GROUP BY day
321
- ORDER BY day DESC;
322
- ```
323
-
324
- ### Weekend-Aware Behavior
325
-
326
- When `autodelete_ignore_weekend` is enabled (via config.toml or MCP tool):
327
-
328
- **Example 1 - Task Completed on Friday:**
329
- - Task marked `done`: Friday 5:00 PM
330
- - Default 48 hours: Would archive Sunday 5:00 PM
331
- - **Weekend-aware**: Archives Tuesday 5:00 PM (skips Sat/Sun)
332
-
333
- **Example 2 - Task Completed on Wednesday:**
334
- - Task marked `done`: Wednesday 2:00 PM
335
- - Default 48 hours: Would archive Friday 2:00 PM
336
- - **Weekend-aware**: Archives Friday 2:00 PM (no weekend in between)
337
-
338
- **Why Weekend-Aware Mode?**
339
- - Teams/AI agents may not work on weekends
340
- - Prevents premature archiving during weekend breaks
341
- - Consistent with message/file retention behavior
342
- - Configurable: Disable if you work 7 days/week
343
-
344
- ## Priority System
345
-
346
- ### Priority Levels
347
-
348
- | Priority | ID | Description | Use Case |
349
- |----------|----|-----------|----|
350
- | `low` | 1 | Nice to have | Documentation, cleanup |
351
- | `medium` | 2 | Normal priority | Standard features |
352
- | `high` | 3 | Important work | Critical features |
353
- | `critical` | 4 | Urgent blocker | Production issues, blockers |
354
-
355
- ### Priority Usage
356
-
357
- **For AI Agents:**
358
- ```javascript
359
- // Critical blocker
360
- { action: "create", title: "Fix DB connection", priority: "critical" }
361
-
362
- // High priority feature
363
- { action: "create", title: "Implement API", priority: "high" }
364
-
365
- // Background work
366
- { action: "create", title: "Update docs", priority: "low" }
367
- ```
368
-
369
- **Filtering by Priority:**
370
- ```javascript
371
- // Get all critical tasks
372
- {
373
- action: "list",
374
- priority: "critical"
375
- }
376
- ```
377
-
378
- ## Quick Start
379
-
380
- ### Creating Your First Task
381
-
382
- ```javascript
383
- // Minimal task creation
384
- {
385
- action: "create",
386
- title: "Implement JWT authentication"
387
- }
388
- // Returns: { task_id: 1, message: "Task created successfully" }
389
-
390
- // Complete task creation with metadata
391
- {
392
- action: "create",
393
- title: "Implement JWT authentication",
394
- description: "Add JWT-based authentication to API endpoints with refresh token support",
395
- status: "todo",
396
- priority: "high",
397
- assignee: "auth-agent",
398
- tags: ["security", "authentication", "api"],
399
- layer: "business"
400
- }
401
- ```
402
-
403
- ### Listing Tasks
404
-
405
- ```javascript
406
- // List all tasks (metadata only - token efficient)
407
- {
408
- action: "list"
409
- }
410
-
411
- // List filtered tasks
412
- {
413
- action: "list",
414
- status: "in_progress",
415
- assignee: "auth-agent",
416
- tags: ["security"]
417
- }
418
- ```
419
-
420
- ### Getting Task Details
421
-
422
- ```javascript
423
- // Get full task with description
424
- {
425
- action: "get",
426
- task_id: 1
427
- }
428
- ```
429
-
430
- ### Moving Tasks
431
-
432
- ```javascript
433
- // Move task to next status (validated)
434
- {
435
- action: "move",
436
- task_id: 1,
437
- status: "waiting_review"
438
- }
439
- ```
440
-
441
- ## Related Documentation
442
-
443
- - **[TASK_ACTIONS.md](TASK_ACTIONS.md)** - Complete action reference with examples
444
- - **[TASK_PRUNING.md](TASK_PRUNING.md)** - Auto-pruning feature for watched files
445
- - **[AI_AGENT_GUIDE.md](AI_AGENT_GUIDE.md)** - Comprehensive AI agent guide
446
- - **[README.md](../README.md)** - Project overview
447
-
448
- ---
449
-
450
- **Version:** 4.0.0
451
- **Last Updated:** 2025-11-27
452
- **Author:** sin5ddd