sqlew 2.1.3 → 3.0.2

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 (84) hide show
  1. package/CHANGELOG.md +891 -535
  2. package/README.md +302 -613
  3. package/assets/kanban-style.png +0 -0
  4. package/assets/schema.sql +531 -402
  5. package/dist/database.d.ts +9 -0
  6. package/dist/database.d.ts.map +1 -1
  7. package/dist/database.js +33 -34
  8. package/dist/database.js.map +1 -1
  9. package/dist/index.js +1024 -21
  10. package/dist/index.js.map +1 -1
  11. package/dist/migrations/add-task-tables.d.ts +47 -0
  12. package/dist/migrations/add-task-tables.d.ts.map +1 -0
  13. package/dist/migrations/add-task-tables.js +285 -0
  14. package/dist/migrations/add-task-tables.js.map +1 -0
  15. package/dist/migrations/index.d.ts +96 -0
  16. package/dist/migrations/index.d.ts.map +1 -0
  17. package/dist/migrations/index.js +239 -0
  18. package/dist/migrations/index.js.map +1 -0
  19. package/dist/migrations/migrate-decisions-to-tasks.d.ts +61 -0
  20. package/dist/migrations/migrate-decisions-to-tasks.d.ts.map +1 -0
  21. package/dist/migrations/migrate-decisions-to-tasks.js +442 -0
  22. package/dist/migrations/migrate-decisions-to-tasks.js.map +1 -0
  23. package/dist/schema.d.ts.map +1 -1
  24. package/dist/schema.js +14 -3
  25. package/dist/schema.js.map +1 -1
  26. package/dist/tools/constraints.d.ts +4 -0
  27. package/dist/tools/constraints.d.ts.map +1 -1
  28. package/dist/tools/constraints.js +6 -27
  29. package/dist/tools/constraints.js.map +1 -1
  30. package/dist/tools/context.d.ts +17 -1
  31. package/dist/tools/context.d.ts.map +1 -1
  32. package/dist/tools/context.js +195 -190
  33. package/dist/tools/context.js.map +1 -1
  34. package/dist/tools/files.d.ts.map +1 -1
  35. package/dist/tools/files.js +113 -166
  36. package/dist/tools/files.js.map +1 -1
  37. package/dist/tools/messaging.d.ts +2 -9
  38. package/dist/tools/messaging.d.ts.map +1 -1
  39. package/dist/tools/messaging.js +67 -126
  40. package/dist/tools/messaging.js.map +1 -1
  41. package/dist/tools/tasks.d.ts +90 -0
  42. package/dist/tools/tasks.d.ts.map +1 -0
  43. package/dist/tools/tasks.js +732 -0
  44. package/dist/tools/tasks.js.map +1 -0
  45. package/dist/tools/utils.d.ts +8 -1
  46. package/dist/tools/utils.d.ts.map +1 -1
  47. package/dist/tools/utils.js +50 -21
  48. package/dist/tools/utils.js.map +1 -1
  49. package/dist/types.d.ts +14 -0
  50. package/dist/types.d.ts.map +1 -1
  51. package/dist/utils/batch.d.ts +69 -0
  52. package/dist/utils/batch.d.ts.map +1 -0
  53. package/dist/utils/batch.js +148 -0
  54. package/dist/utils/batch.js.map +1 -0
  55. package/dist/utils/query-builder.d.ts +68 -0
  56. package/dist/utils/query-builder.d.ts.map +1 -0
  57. package/dist/utils/query-builder.js +116 -0
  58. package/dist/utils/query-builder.js.map +1 -0
  59. package/dist/utils/task-stale-detection.d.ts +28 -0
  60. package/dist/utils/task-stale-detection.d.ts.map +1 -0
  61. package/dist/utils/task-stale-detection.js +92 -0
  62. package/dist/utils/task-stale-detection.js.map +1 -0
  63. package/dist/utils/validators.d.ts +57 -0
  64. package/dist/utils/validators.d.ts.map +1 -0
  65. package/dist/utils/validators.js +117 -0
  66. package/dist/utils/validators.js.map +1 -0
  67. package/docs/AI_AGENT_GUIDE.md +1471 -0
  68. package/{ARCHITECTURE.md → docs/ARCHITECTURE.md} +636 -636
  69. package/docs/BEST_PRACTICES.md +481 -0
  70. package/docs/DECISION_TO_TASK_MIGRATION_GUIDE.md +457 -0
  71. package/docs/MIGRATION_CHAIN.md +280 -0
  72. package/{MIGRATION_v2.md → docs/MIGRATION_v2.md} +538 -538
  73. package/docs/SHARED_CONCEPTS.md +339 -0
  74. package/docs/TASK_ACTIONS.md +854 -0
  75. package/docs/TASK_LINKING.md +729 -0
  76. package/docs/TASK_MIGRATION.md +701 -0
  77. package/docs/TASK_OVERVIEW.md +363 -0
  78. package/docs/TASK_SYSTEM.md +1244 -0
  79. package/docs/TOOL_REFERENCE.md +471 -0
  80. package/docs/TOOL_SELECTION.md +279 -0
  81. package/docs/WORKFLOWS.md +602 -0
  82. package/docs/refactoring-summary-2025-10-17.md +365 -0
  83. package/docs/requirement-2025-10-17.md +508 -0
  84. package/package.json +64 -63
@@ -0,0 +1,854 @@
1
+ # Task Actions Reference
2
+
3
+ **Version:** 3.0.0
4
+ **Last Updated:** 2025-10-17
5
+
6
+ ## Table of Contents
7
+
8
+ 1. [Overview](#overview)
9
+ 2. [Action: create](#action-create)
10
+ 3. [Action: update](#action-update)
11
+ 4. [Action: get](#action-get)
12
+ 5. [Action: list](#action-list)
13
+ 6. [Action: move](#action-move)
14
+ 7. [Action: link](#action-link)
15
+ 8. [Action: archive](#action-archive)
16
+ 9. [Action: batch_create](#action-batch_create)
17
+ 10. [Action: help](#action-help)
18
+ 11. [Best Practices](#best-practices)
19
+ 12. [Common Errors](#common-errors)
20
+ 13. [Related Documentation](#related-documentation)
21
+
22
+ ## Overview
23
+
24
+ The `task` MCP tool provides 9 actions for managing tasks in the Kanban Task Watcher system. All actions require the `action` parameter.
25
+
26
+ **Action-Based API Pattern:**
27
+ ```javascript
28
+ {
29
+ action: "create", // Required: specifies which action to execute
30
+ // ... action-specific parameters
31
+ }
32
+ ```
33
+
34
+ ## Action: create
35
+
36
+ Create a new task.
37
+
38
+ ### Parameters
39
+
40
+ **Required:**
41
+ - `action`: "create"
42
+ - `title`: Task title (string)
43
+
44
+ **Optional:**
45
+ - `description`: Full task description (string)
46
+ - `status`: Initial status (string: "todo", "in_progress", "waiting_review", "blocked", "done", "archived") - default: "todo"
47
+ - `priority`: Priority level (string: "low", "medium", "high", "critical")
48
+ - `assignee`: Agent or user assigned (string)
49
+ - `tags`: Array of tags (string[])
50
+ - `layer`: Architecture layer (string: "presentation", "business", "data", "infrastructure", "cross-cutting")
51
+
52
+ ### Examples
53
+
54
+ **Minimal Task:**
55
+ ```javascript
56
+ {
57
+ action: "create",
58
+ title: "Implement JWT authentication"
59
+ }
60
+ ```
61
+
62
+ **Complete Task:**
63
+ ```javascript
64
+ {
65
+ action: "create",
66
+ title: "Implement JWT authentication",
67
+ description: "Add JWT-based authentication with refresh tokens",
68
+ status: "todo",
69
+ priority: "high",
70
+ assignee: "auth-agent",
71
+ tags: ["security", "authentication"],
72
+ layer: "business"
73
+ }
74
+ ```
75
+
76
+ **Task with Multiple Tags:**
77
+ ```javascript
78
+ {
79
+ action: "create",
80
+ title: "Optimize database queries",
81
+ description: "Improve query performance for user listings",
82
+ priority: "medium",
83
+ tags: ["performance", "database", "optimization"],
84
+ layer: "data"
85
+ }
86
+ ```
87
+
88
+ ### Response
89
+
90
+ ```javascript
91
+ {
92
+ task_id: 1,
93
+ message: "Task created successfully"
94
+ }
95
+ ```
96
+
97
+ ## Action: update
98
+
99
+ Update existing task fields.
100
+
101
+ ### Parameters
102
+
103
+ **Required:**
104
+ - `action`: "update"
105
+ - `task_id`: Task ID (number)
106
+
107
+ **Optional (at least one required):**
108
+ - `title`: New title (string)
109
+ - `status`: New status (string) - bypasses validation, use `move` instead
110
+ - `description`: New description (string)
111
+ - `priority`: New priority (string)
112
+ - `assignee`: New assignee (string)
113
+ - `tags`: New tags array (string[]) - replaces existing tags
114
+ - `layer`: New layer (string)
115
+
116
+ ### Examples
117
+
118
+ **Update Description:**
119
+ ```javascript
120
+ {
121
+ action: "update",
122
+ task_id: 1,
123
+ description: "Updated requirements: Add OAuth2 support"
124
+ }
125
+ ```
126
+
127
+ **Update Priority:**
128
+ ```javascript
129
+ {
130
+ action: "update",
131
+ task_id: 1,
132
+ priority: "critical"
133
+ }
134
+ ```
135
+
136
+ **Update Multiple Fields:**
137
+ ```javascript
138
+ {
139
+ action: "update",
140
+ task_id: 1,
141
+ description: "Add OAuth2 and SAML support",
142
+ priority: "critical",
143
+ tags: ["security", "authentication", "oauth2", "saml"]
144
+ }
145
+ ```
146
+
147
+ **Reassign Task:**
148
+ ```javascript
149
+ {
150
+ action: "update",
151
+ task_id: 1,
152
+ assignee: "senior-auth-agent",
153
+ priority: "high"
154
+ }
155
+ ```
156
+
157
+ ### Response
158
+
159
+ ```javascript
160
+ {
161
+ success: true,
162
+ message: "Task updated successfully"
163
+ }
164
+ ```
165
+
166
+ ### Important Notes
167
+
168
+ - Use `move` action for status changes (validates transitions)
169
+ - `update` bypasses state machine validation
170
+ - Updating `tags` replaces all existing tags (not append)
171
+
172
+ ## Action: get
173
+
174
+ Get single task with full details.
175
+
176
+ ### Parameters
177
+
178
+ **Required:**
179
+ - `action`: "get"
180
+ - `task_id`: Task ID (number)
181
+
182
+ ### Example
183
+
184
+ ```javascript
185
+ {
186
+ action: "get",
187
+ task_id: 1
188
+ }
189
+ ```
190
+
191
+ ### Response
192
+
193
+ ```javascript
194
+ {
195
+ task_id: 1,
196
+ title: "Implement JWT authentication",
197
+ description: "Add JWT-based authentication with refresh tokens",
198
+ status: "in_progress",
199
+ priority: "high",
200
+ assignee: "auth-agent",
201
+ layer: "business",
202
+ tags: ["security", "authentication"],
203
+ created_ts: 1697545200,
204
+ updated_ts: 1697545800,
205
+ decision_links: ["auth_method", "jwt_secret"],
206
+ constraint_links: [5],
207
+ file_links: ["/src/auth/jwt.ts", "/src/auth/middleware.ts"]
208
+ }
209
+ ```
210
+
211
+ ### Token Efficiency
212
+
213
+ - **~332 bytes/task** (includes description and links)
214
+ - Use `list` for browsing, `get` only when details needed
215
+
216
+ ## Action: list
217
+
218
+ List tasks with filtering (metadata only, no descriptions).
219
+
220
+ ### Parameters
221
+
222
+ **Required:**
223
+ - `action`: "list"
224
+
225
+ **Optional:**
226
+ - `status`: Filter by status (string)
227
+ - `priority`: Filter by priority (string)
228
+ - `assignee`: Filter by assignee (string)
229
+ - `tags`: Filter by tags (string[])
230
+ - `layer`: Filter by layer (string)
231
+ - `limit`: Maximum results (number) - default: 100
232
+
233
+ ### Examples
234
+
235
+ **List All Tasks:**
236
+ ```javascript
237
+ {
238
+ action: "list"
239
+ }
240
+ ```
241
+
242
+ **Filter by Status:**
243
+ ```javascript
244
+ {
245
+ action: "list",
246
+ status: "in_progress"
247
+ }
248
+ ```
249
+
250
+ **Filter by Assignee:**
251
+ ```javascript
252
+ {
253
+ action: "list",
254
+ assignee: "auth-agent"
255
+ }
256
+ ```
257
+
258
+ **Multiple Filters:**
259
+ ```javascript
260
+ {
261
+ action: "list",
262
+ status: "in_progress",
263
+ assignee: "auth-agent",
264
+ tags: ["security"],
265
+ priority: "high"
266
+ }
267
+ ```
268
+
269
+ **Limit Results:**
270
+ ```javascript
271
+ {
272
+ action: "list",
273
+ status: "todo",
274
+ limit: 20
275
+ }
276
+ ```
277
+
278
+ ### Response
279
+
280
+ ```javascript
281
+ {
282
+ tasks: [
283
+ {
284
+ task_id: 1,
285
+ title: "Implement JWT authentication",
286
+ status_name: "in_progress",
287
+ priority_name: "high",
288
+ assignee: "auth-agent",
289
+ layer_name: "business",
290
+ tags: "security,authentication",
291
+ created_ts: 1697545200,
292
+ updated_ts: 1697545800
293
+ },
294
+ {
295
+ task_id: 2,
296
+ title: "Setup OAuth2 provider",
297
+ status_name: "in_progress",
298
+ priority_name: "high",
299
+ assignee: "auth-agent",
300
+ layer_name: "business",
301
+ tags: "security,oauth2",
302
+ created_ts: 1697545300,
303
+ updated_ts: 1697545900
304
+ }
305
+ ],
306
+ count: 2,
307
+ stale_tasks_transitioned: 0
308
+ }
309
+ ```
310
+
311
+ ### Token Efficiency
312
+
313
+ - **~100 bytes/task** (metadata only)
314
+ - **70% reduction** vs full task with description
315
+ - Auto-stale detection runs before list
316
+ - Returns `stale_tasks_transitioned` count
317
+
318
+ ## Action: move
319
+
320
+ Move task to new status with validation.
321
+
322
+ ### Parameters
323
+
324
+ **Required:**
325
+ - `action`: "move"
326
+ - `task_id`: Task ID (number)
327
+ - `new_status`: Target status (string: "todo", "in_progress", "waiting_review", "blocked", "done", "archived")
328
+
329
+ ### Examples
330
+
331
+ **Move to Waiting Review:**
332
+ ```javascript
333
+ {
334
+ action: "move",
335
+ task_id: 1,
336
+ new_status: "waiting_review"
337
+ }
338
+ ```
339
+
340
+ **Move to Blocked:**
341
+ ```javascript
342
+ {
343
+ action: "move",
344
+ task_id: 1,
345
+ new_status: "blocked"
346
+ }
347
+ ```
348
+
349
+ **Move to Done:**
350
+ ```javascript
351
+ {
352
+ action: "move",
353
+ task_id: 1,
354
+ new_status: "done"
355
+ }
356
+ ```
357
+
358
+ ### Response (Success)
359
+
360
+ ```javascript
361
+ {
362
+ success: true,
363
+ message: "Task moved from in_progress to waiting_review"
364
+ }
365
+ ```
366
+
367
+ ### Response (Invalid Transition)
368
+
369
+ ```javascript
370
+ {
371
+ error: "Invalid status transition from in_progress to archived. Valid transitions: waiting_review, blocked, done"
372
+ }
373
+ ```
374
+
375
+ ### State Machine Validation
376
+
377
+ **Valid Transitions:**
378
+
379
+ | From Status | To Status(es) |
380
+ |-------------|--------------|
381
+ | `todo` | `in_progress`, `blocked` |
382
+ | `in_progress` | `waiting_review`, `blocked`, `done` |
383
+ | `waiting_review` | `in_progress`, `todo`, `done` |
384
+ | `blocked` | `todo`, `in_progress` |
385
+ | `done` | `archived` |
386
+ | `archived` | *(terminal state)* |
387
+
388
+ **Auto-Stale Detection:**
389
+ - Runs before move operation
390
+ - Returns `stale_tasks_transitioned` count
391
+
392
+ ## Action: link
393
+
394
+ Link task to decision, constraint, or file.
395
+
396
+ ### Parameters
397
+
398
+ **Required:**
399
+ - `action`: "link"
400
+ - `task_id`: Task ID (number)
401
+ - `link_type`: Link type (string: "decision", "constraint", "file")
402
+
403
+ **Type-Specific Required Parameters:**
404
+ - `link_type="decision"`: `link_key` (string) - Decision key
405
+ - `link_type="constraint"`: `link_id` (number) - Constraint ID
406
+ - `link_type="file"`: `link_path` (string) - File path
407
+
408
+ ### Examples
409
+
410
+ **Link to Decision:**
411
+ ```javascript
412
+ {
413
+ action: "link",
414
+ task_id: 1,
415
+ link_type: "decision",
416
+ link_key: "auth_method"
417
+ }
418
+ ```
419
+
420
+ **Link to Constraint:**
421
+ ```javascript
422
+ {
423
+ action: "link",
424
+ task_id: 1,
425
+ link_type: "constraint",
426
+ link_id: 5
427
+ }
428
+ ```
429
+
430
+ **Link to File:**
431
+ ```javascript
432
+ {
433
+ action: "link",
434
+ task_id: 1,
435
+ link_type: "file",
436
+ link_path: "/src/auth/jwt.ts"
437
+ }
438
+ ```
439
+
440
+ **Multiple Links:**
441
+ ```javascript
442
+ // Link to decision
443
+ {
444
+ action: "link",
445
+ task_id: 1,
446
+ link_type: "decision",
447
+ link_key: "auth_method"
448
+ }
449
+
450
+ // Link to constraint
451
+ {
452
+ action: "link",
453
+ task_id: 1,
454
+ link_type: "constraint",
455
+ link_id: 5
456
+ }
457
+
458
+ // Link to file
459
+ {
460
+ action: "link",
461
+ task_id: 1,
462
+ link_type: "file",
463
+ link_path: "/src/auth/jwt.ts"
464
+ }
465
+ ```
466
+
467
+ ### Response
468
+
469
+ ```javascript
470
+ {
471
+ success: true,
472
+ message: "Task linked to decision 'auth_method'"
473
+ }
474
+ ```
475
+
476
+ **See [TASK_LINKING.md](TASK_LINKING.md) for detailed linking strategies and use cases.**
477
+
478
+ ## Action: archive
479
+
480
+ Archive completed task (soft delete).
481
+
482
+ ### Parameters
483
+
484
+ **Required:**
485
+ - `action`: "archive"
486
+ - `task_id`: Task ID (number)
487
+
488
+ ### Example
489
+
490
+ ```javascript
491
+ {
492
+ action: "archive",
493
+ task_id: 1
494
+ }
495
+ ```
496
+
497
+ ### Response (Success)
498
+
499
+ ```javascript
500
+ {
501
+ success: true,
502
+ message: "Task archived successfully"
503
+ }
504
+ ```
505
+
506
+ ### Response (Error)
507
+
508
+ ```javascript
509
+ {
510
+ error: "Cannot archive task not in done status"
511
+ }
512
+ ```
513
+
514
+ ### Important Notes
515
+
516
+ - Only tasks with `status="done"` can be archived
517
+ - Archived tasks have `status="archived"` (terminal state)
518
+ - Use `move` to transition to `done` first if needed
519
+
520
+ **Workflow:**
521
+ ```javascript
522
+ // 1. Complete task
523
+ { action: "move", task_id: 1, new_status: "done" }
524
+
525
+ // 2. Archive task
526
+ { action: "archive", task_id: 1 }
527
+ ```
528
+
529
+ ## Action: batch_create
530
+
531
+ Create multiple tasks atomically or best-effort.
532
+
533
+ ### Parameters
534
+
535
+ **Required:**
536
+ - `action`: "batch_create"
537
+ - `tasks`: Array of task objects (max 50)
538
+
539
+ **Optional:**
540
+ - `atomic`: Boolean (default: true) - All-or-nothing vs best-effort mode
541
+
542
+ ### Examples
543
+
544
+ **Atomic Batch (All-or-Nothing):**
545
+ ```javascript
546
+ {
547
+ action: "batch_create",
548
+ tasks: [
549
+ {
550
+ title: "Setup database schema",
551
+ status: "todo",
552
+ priority: "high",
553
+ assignee: "db-agent"
554
+ },
555
+ {
556
+ title: "Implement API endpoints",
557
+ status: "todo",
558
+ priority: "medium",
559
+ assignee: "api-agent"
560
+ }
561
+ ],
562
+ atomic: true // All succeed or all fail
563
+ }
564
+ ```
565
+
566
+ **Best-Effort Batch (Recommended for AI):**
567
+ ```javascript
568
+ {
569
+ action: "batch_create",
570
+ tasks: [
571
+ {
572
+ title: "Setup database schema",
573
+ status: "todo",
574
+ priority: "high",
575
+ assignee: "db-agent",
576
+ tags: ["database", "setup"]
577
+ },
578
+ {
579
+ title: "Implement API endpoints",
580
+ status: "todo",
581
+ priority: "medium",
582
+ assignee: "api-agent",
583
+ tags: ["api", "development"]
584
+ },
585
+ {
586
+ title: "Write integration tests",
587
+ status: "todo",
588
+ priority: "low",
589
+ assignee: "test-agent",
590
+ tags: ["testing", "qa"]
591
+ }
592
+ ],
593
+ atomic: false // Allows partial success
594
+ }
595
+ ```
596
+
597
+ ### Response (Atomic=true, Success)
598
+
599
+ ```javascript
600
+ {
601
+ success: true,
602
+ created_count: 2,
603
+ task_ids: [1, 2]
604
+ }
605
+ ```
606
+
607
+ ### Response (Atomic=false, Partial Success)
608
+
609
+ ```javascript
610
+ {
611
+ success: true,
612
+ created_count: 2,
613
+ failed_count: 1,
614
+ task_ids: [1, 2],
615
+ errors: ["Task 3: Invalid priority 'ultra-high'"]
616
+ }
617
+ ```
618
+
619
+ ### Important Notes
620
+
621
+ - **Max 50 tasks** per batch
622
+ - **Atomic mode (true):** Transaction fails if any task fails
623
+ - **Best-effort mode (false):** Partial success allowed (recommended for AI)
624
+ - Each task follows same schema as `create` action
625
+
626
+ ## Action: help
627
+
628
+ Get comprehensive on-demand documentation.
629
+
630
+ ### Parameters
631
+
632
+ **Required:**
633
+ - `action`: "help"
634
+
635
+ ### Example
636
+
637
+ ```javascript
638
+ {
639
+ action: "help"
640
+ }
641
+ ```
642
+
643
+ ### Response
644
+
645
+ Returns complete tool documentation including:
646
+ - Parameter matrices for all actions
647
+ - Examples for each action
648
+ - Status transition rules
649
+ - Token efficiency tips
650
+ - Common errors and solutions
651
+
652
+ ## Best Practices
653
+
654
+ ### For AI Agents
655
+
656
+ **1. Always Use `action` Parameter**
657
+ ```javascript
658
+ // ❌ WRONG
659
+ { task_id: 1 }
660
+
661
+ // ✅ CORRECT
662
+ { action: "get", task_id: 1 }
663
+ ```
664
+
665
+ **2. Use `move` for Status Changes (Not `update`)**
666
+ ```javascript
667
+ // ❌ WRONG (bypasses validation)
668
+ { action: "update", task_id: 1, status: "archived" }
669
+
670
+ // ✅ CORRECT (validates transition)
671
+ { action: "move", task_id: 1, new_status: "waiting_review" }
672
+ ```
673
+
674
+ **3. Use `list` Before `get`**
675
+ ```javascript
676
+ // ❌ WRONG (loads all descriptions)
677
+ tasks.forEach(t => get({ action: "get", task_id: t.id }))
678
+
679
+ // ✅ CORRECT (metadata first, details on demand)
680
+ const tasks = list({ action: "list", status: "in_progress" });
681
+ const details = get({ action: "get", task_id: tasks.tasks[0].task_id });
682
+ ```
683
+
684
+ **4. Prefer Batch Operations**
685
+ ```javascript
686
+ // ❌ INEFFICIENT (multiple calls)
687
+ create({ action: "create", title: "Task 1" });
688
+ create({ action: "create", title: "Task 2" });
689
+ create({ action: "create", title: "Task 3" });
690
+
691
+ // ✅ EFFICIENT (one call)
692
+ batch_create({
693
+ action: "batch_create",
694
+ tasks: [
695
+ { title: "Task 1" },
696
+ { title: "Task 2" },
697
+ { title: "Task 3" }
698
+ ],
699
+ atomic: false
700
+ });
701
+ ```
702
+
703
+ **5. Link Tasks to Context**
704
+ ```javascript
705
+ // Create task
706
+ const task = create({ action: "create", title: "Implement auth" });
707
+
708
+ // Link to decision
709
+ link({
710
+ action: "link",
711
+ task_id: task.task_id,
712
+ link_type: "decision",
713
+ link_key: "auth_method"
714
+ });
715
+
716
+ // Link to file
717
+ link({
718
+ action: "link",
719
+ task_id: task.task_id,
720
+ link_type: "file",
721
+ link_path: "/src/auth/jwt.ts"
722
+ });
723
+ ```
724
+
725
+ ### For Multi-Agent Workflows
726
+
727
+ **1. Use Assignee for Coordination**
728
+ ```javascript
729
+ // Agent A creates task for Agent B
730
+ {
731
+ action: "create",
732
+ title: "Implement auth middleware",
733
+ assignee: "auth-agent",
734
+ tags: ["handoff"]
735
+ }
736
+
737
+ // Agent B lists assigned tasks
738
+ {
739
+ action: "list",
740
+ assignee: "auth-agent",
741
+ status: "todo"
742
+ }
743
+ ```
744
+
745
+ **2. Use Priority for Orchestration**
746
+ ```javascript
747
+ // Critical blocker
748
+ { action: "create", title: "Fix DB connection", priority: "critical" }
749
+
750
+ // High priority
751
+ { action: "create", title: "Implement API", priority: "high" }
752
+
753
+ // Background work
754
+ { action: "create", title: "Update docs", priority: "low" }
755
+ ```
756
+
757
+ **3. Track Dependencies with Links**
758
+ ```javascript
759
+ // Task depends on constraint
760
+ {
761
+ action: "link",
762
+ task_id: 5,
763
+ link_type: "constraint",
764
+ link_id: 3 // "DB schema must be finalized"
765
+ }
766
+ ```
767
+
768
+ ## Common Errors
769
+
770
+ ### Error: "Invalid status transition"
771
+
772
+ **Problem:**
773
+ ```javascript
774
+ // Trying to move from in_progress to archived
775
+ { action: "move", task_id: 1, new_status: "archived" }
776
+ ```
777
+
778
+ **Solution:**
779
+ ```javascript
780
+ // Move to done first
781
+ { action: "move", task_id: 1, new_status: "done" }
782
+ { action: "archive", task_id: 1 }
783
+ ```
784
+
785
+ ### Error: "Task not found"
786
+
787
+ **Problem:**
788
+ ```javascript
789
+ // Invalid task_id
790
+ { action: "get", task_id: 9999 }
791
+ ```
792
+
793
+ **Solution:**
794
+ ```javascript
795
+ // List tasks first to get valid IDs
796
+ { action: "list" }
797
+ ```
798
+
799
+ ### Error: "Invalid link type"
800
+
801
+ **Problem:**
802
+ ```javascript
803
+ // Typo in link_type
804
+ { action: "link", task_id: 1, link_type: "decisions" }
805
+ ```
806
+
807
+ **Solution:**
808
+ ```javascript
809
+ // Use exact link_type
810
+ { action: "link", task_id: 1, link_type: "decision", link_key: "..." }
811
+ ```
812
+
813
+ ### Error: "Cannot archive task not in done status"
814
+
815
+ **Problem:**
816
+ ```javascript
817
+ // Trying to archive incomplete task
818
+ { action: "archive", task_id: 1 } // Task is in_progress
819
+ ```
820
+
821
+ **Solution:**
822
+ ```javascript
823
+ // Complete task first
824
+ { action: "move", task_id: 1, new_status: "done" }
825
+ { action: "archive", task_id: 1 }
826
+ ```
827
+
828
+ ### Error: "Unknown action"
829
+
830
+ **Problem:**
831
+ ```javascript
832
+ // Missing action parameter
833
+ { task_id: 1 }
834
+ ```
835
+
836
+ **Solution:**
837
+ ```javascript
838
+ // Always include action
839
+ { action: "get", task_id: 1 }
840
+ ```
841
+
842
+ ## Related Documentation
843
+
844
+ - **[TASK_OVERVIEW.md](TASK_OVERVIEW.md)** - Task system overview and core concepts
845
+ - **[TASK_LINKING.md](TASK_LINKING.md)** - Linking tasks to decisions/constraints/files
846
+ - **[TASK_MIGRATION.md](TASK_MIGRATION.md)** - Migrating from decision-based task tracking
847
+ - **[TASK_SYSTEM.md](TASK_SYSTEM.md)** - Complete documentation (original)
848
+ - **[AI_AGENT_GUIDE.md](AI_AGENT_GUIDE.md)** - Comprehensive AI agent guide
849
+
850
+ ---
851
+
852
+ **Version:** 3.0.0
853
+ **Last Updated:** 2025-10-17
854
+ **Author:** sin5ddd