sqlew 2.1.4 → 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 -605
  2. package/README.md +302 -690
  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 -213
  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 -648
  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 -64
@@ -0,0 +1,701 @@
1
+ # Task Migration Guide - From Decisions to Tasks
2
+
3
+ **Version:** 3.0.0
4
+ **Last Updated:** 2025-10-17
5
+
6
+ ## Table of Contents
7
+
8
+ 1. [Overview](#overview)
9
+ 2. [When to Migrate](#when-to-migrate)
10
+ 3. [Migration Strategy](#migration-strategy)
11
+ 4. [Before and After Examples](#before-and-after-examples)
12
+ 5. [Automated Migration](#automated-migration)
13
+ 6. [Manual Migration](#manual-migration)
14
+ 7. [Best Practices](#best-practices)
15
+ 8. [Troubleshooting](#troubleshooting)
16
+ 9. [Related Documentation](#related-documentation)
17
+
18
+ ## Overview
19
+
20
+ Prior to v3.0, many users misused the `decision` tool for task/todo tracking, leading to:
21
+ - **Token waste:** ~332 bytes per task-like decision
22
+ - **No lifecycle management:** Tasks stuck in "in_progress" status
23
+ - **Poor queryability:** Full content loaded for simple status checks
24
+
25
+ The dedicated `task` tool (v3.0+) solves these issues with:
26
+ - **70% token reduction** via metadata-only queries
27
+ - **Auto-stale detection** for interrupted tasks
28
+ - **Status validation** with enforced state machine
29
+ - **Proper task lifecycle** management
30
+
31
+ This guide helps you migrate from decision-based task tracking to the dedicated task system.
32
+
33
+ ## When to Migrate
34
+
35
+ ### Decision-Based Task Indicators
36
+
37
+ Migrate if you're using decisions like this:
38
+
39
+ **Pattern 1: Status Prefix in Value**
40
+ ```javascript
41
+ {
42
+ action: "set",
43
+ key: "task_implement_auth",
44
+ value: "in_progress: Implementing JWT authentication",
45
+ tags: ["task", "in_progress"]
46
+ }
47
+ ```
48
+
49
+ **Pattern 2: Todo Tag Usage**
50
+ ```javascript
51
+ {
52
+ action: "set",
53
+ key: "implement_oauth",
54
+ value: "Add OAuth2 provider support",
55
+ tags: ["todo", "authentication"]
56
+ }
57
+ ```
58
+
59
+ **Pattern 3: Task-Like Keys**
60
+ ```javascript
61
+ {
62
+ action: "set",
63
+ key: "todo_refactor_api",
64
+ value: "Refactor API endpoints to GraphQL",
65
+ tags: ["task", "refactoring"]
66
+ }
67
+ ```
68
+
69
+ ### Benefits of Migration
70
+
71
+ | Metric | Decision-Based | Task Tool | Improvement |
72
+ |--------|---------------|-----------|-------------|
73
+ | Token usage (10 items) | ~3,320 bytes | ~1,000 bytes | 70% reduction |
74
+ | Lifecycle management | Manual | Automatic | Auto-stale detection |
75
+ | Status validation | None | Enforced | State machine |
76
+ | Query efficiency | Full content | Metadata only | Faster queries |
77
+
78
+ ## Migration Strategy
79
+
80
+ ### 5-Step Migration Process
81
+
82
+ 1. **Identify:** Find task-like decisions
83
+ 2. **Parse:** Extract status and description
84
+ 3. **Create:** Create proper tasks
85
+ 4. **Link:** Connect task to original decision (for context)
86
+ 5. **Deprecate:** Mark old decision as deprecated
87
+
88
+ ### Step-by-Step Example
89
+
90
+ **Step 1: Identify Task-Like Decision**
91
+ ```javascript
92
+ // Search for task-like decisions
93
+ {
94
+ action: "search_tags",
95
+ tags: ["task"],
96
+ tag_match: "AND"
97
+ }
98
+
99
+ // Or search by key pattern
100
+ {
101
+ action: "list",
102
+ limit: 100
103
+ }
104
+ // Filter results for keys starting with "task_" or "todo_"
105
+ ```
106
+
107
+ **Step 2: Parse Decision Content**
108
+ ```javascript
109
+ // Original decision:
110
+ {
111
+ key: "task_implement_auth",
112
+ value: "in_progress: Implementing JWT authentication with refresh tokens",
113
+ tags: ["task", "in_progress", "security"],
114
+ layer: "infrastructure"
115
+ }
116
+
117
+ // Parse:
118
+ // - Status: "in_progress"
119
+ // - Description: "Implementing JWT authentication with refresh tokens"
120
+ // - Tags: ["security"] (remove "task" and status tags)
121
+ ```
122
+
123
+ **Step 3: Create Task**
124
+ ```javascript
125
+ {
126
+ action: "create",
127
+ title: "Implement JWT authentication",
128
+ description: "Implementing JWT authentication with refresh tokens",
129
+ status: "in_progress",
130
+ priority: "high",
131
+ assignee: "auth-agent",
132
+ tags: ["security", "authentication"],
133
+ layer: "business" // Corrected from "infrastructure"
134
+ }
135
+ // Returns: { task_id: 1 }
136
+ ```
137
+
138
+ **Step 4: Link to Original Decision (Optional)**
139
+ ```javascript
140
+ // Link task to original decision for context
141
+ {
142
+ action: "link",
143
+ task_id: 1,
144
+ link_type: "decision",
145
+ link_key: "task_implement_auth"
146
+ }
147
+ ```
148
+
149
+ **Step 5: Deprecate Old Decision**
150
+ ```javascript
151
+ {
152
+ action: "set",
153
+ key: "task_implement_auth",
154
+ value: "MIGRATED TO TASK #1: Implementing JWT authentication with refresh tokens",
155
+ status: "deprecated",
156
+ tags: ["migrated", "security"],
157
+ layer: "infrastructure"
158
+ }
159
+ ```
160
+
161
+ ## Before and After Examples
162
+
163
+ ### Example 1: Simple Task
164
+
165
+ **Before (v2.x):**
166
+ ```javascript
167
+ {
168
+ action: "set",
169
+ key: "todo_add_logging",
170
+ value: "Add logging to API endpoints",
171
+ tags: ["todo", "logging"],
172
+ layer: "infrastructure"
173
+ }
174
+ ```
175
+
176
+ **After (v3.0):**
177
+ ```javascript
178
+ {
179
+ action: "create",
180
+ title: "Add logging to API endpoints",
181
+ status: "todo",
182
+ priority: "medium",
183
+ tags: ["logging", "api"],
184
+ layer: "cross-cutting"
185
+ }
186
+ ```
187
+
188
+ ### Example 2: In-Progress Task
189
+
190
+ **Before (v2.x):**
191
+ ```javascript
192
+ {
193
+ action: "set",
194
+ key: "task_refactor_db",
195
+ value: "in_progress: Refactoring database layer for better performance",
196
+ tags: ["task", "in_progress", "database", "performance"],
197
+ layer: "data"
198
+ }
199
+ ```
200
+
201
+ **After (v3.0):**
202
+ ```javascript
203
+ {
204
+ action: "create",
205
+ title: "Refactor database layer",
206
+ description: "Refactoring database layer for better performance",
207
+ status: "in_progress",
208
+ priority: "high",
209
+ assignee: "db-agent",
210
+ tags: ["database", "performance", "refactoring"],
211
+ layer: "data"
212
+ }
213
+ ```
214
+
215
+ ### Example 3: Completed Task
216
+
217
+ **Before (v2.x):**
218
+ ```javascript
219
+ {
220
+ action: "set",
221
+ key: "task_setup_ci",
222
+ value: "done: Setup CI/CD pipeline with GitHub Actions",
223
+ tags: ["task", "done", "devops"],
224
+ layer: "infrastructure"
225
+ }
226
+ ```
227
+
228
+ **After (v3.0):**
229
+ ```javascript
230
+ {
231
+ action: "create",
232
+ title: "Setup CI/CD pipeline",
233
+ description: "Setup CI/CD pipeline with GitHub Actions",
234
+ status: "done",
235
+ priority: "high",
236
+ tags: ["devops", "ci-cd"],
237
+ layer: "infrastructure"
238
+ }
239
+
240
+ // Optional: Archive immediately
241
+ {
242
+ action: "archive",
243
+ task_id: 3
244
+ }
245
+ ```
246
+
247
+ ### Example 4: Task with Links
248
+
249
+ **Before (v2.x):**
250
+ ```javascript
251
+ {
252
+ action: "set",
253
+ key: "task_implement_cache",
254
+ value: "in_progress: Implement Redis caching (relates to caching_strategy decision)",
255
+ tags: ["task", "in_progress", "caching", "performance"],
256
+ layer: "infrastructure"
257
+ }
258
+ ```
259
+
260
+ **After (v3.0):**
261
+ ```javascript
262
+ // Create task
263
+ {
264
+ action: "create",
265
+ title: "Implement Redis caching",
266
+ description: "Implement Redis caching for API responses",
267
+ status: "in_progress",
268
+ priority: "high",
269
+ assignee: "perf-agent",
270
+ tags: ["caching", "performance"],
271
+ layer: "infrastructure"
272
+ }
273
+ // Returns: { task_id: 4 }
274
+
275
+ // Link to decision
276
+ {
277
+ action: "link",
278
+ task_id: 4,
279
+ link_type: "decision",
280
+ link_key: "caching_strategy"
281
+ }
282
+
283
+ // Link to constraint
284
+ {
285
+ action: "link",
286
+ task_id: 4,
287
+ link_type: "constraint",
288
+ link_id: 5 // "API response time <100ms"
289
+ }
290
+
291
+ // Link to files
292
+ {
293
+ action: "link",
294
+ task_id: 4,
295
+ link_type: "file",
296
+ link_path: "/src/cache/redis.ts"
297
+ }
298
+ ```
299
+
300
+ ## Automated Migration
301
+
302
+ ### Migration Script Template
303
+
304
+ ```javascript
305
+ // Step 1: Get all task-like decisions
306
+ const taskDecisions = {
307
+ action: "search_tags",
308
+ tags: ["task"],
309
+ tag_match: "AND"
310
+ };
311
+ // Returns: { decisions: [...] }
312
+
313
+ // Step 2: Parse and migrate each decision
314
+ taskDecisions.decisions.forEach(decision => {
315
+ // Parse status from value
316
+ const statusMatch = decision.value.match(/^(todo|in_progress|done|blocked|waiting_review):\s*(.+)$/);
317
+ const status = statusMatch ? statusMatch[1] : "todo";
318
+ const description = statusMatch ? statusMatch[2] : decision.value;
319
+
320
+ // Extract title from key or description
321
+ const title = decision.key
322
+ .replace(/^(task_|todo_)/, '')
323
+ .replace(/_/g, ' ')
324
+ .replace(/\b\w/g, l => l.toUpperCase());
325
+
326
+ // Clean tags (remove status and "task" tags)
327
+ const cleanTags = decision.tags.filter(t =>
328
+ !['task', 'todo', 'done', 'in_progress', 'blocked', 'waiting_review'].includes(t)
329
+ );
330
+
331
+ // Create task
332
+ const newTask = {
333
+ action: "create",
334
+ title: title,
335
+ description: description,
336
+ status: status,
337
+ priority: "medium", // Default priority
338
+ tags: cleanTags,
339
+ layer: decision.layer
340
+ };
341
+ // Returns: { task_id: X }
342
+
343
+ // Link to original decision (optional)
344
+ {
345
+ action: "link",
346
+ task_id: newTask.task_id,
347
+ link_type: "decision",
348
+ link_key: decision.key
349
+ }
350
+
351
+ // Deprecate old decision
352
+ {
353
+ action: "set",
354
+ key: decision.key,
355
+ value: `MIGRATED TO TASK #${newTask.task_id}: ${description}`,
356
+ status: "deprecated",
357
+ tags: ["migrated", ...cleanTags],
358
+ layer: decision.layer
359
+ }
360
+ });
361
+ ```
362
+
363
+ ### Batch Migration
364
+
365
+ ```javascript
366
+ // Step 1: Collect task-like decisions
367
+ const decisions = [
368
+ {
369
+ key: "task_implement_auth",
370
+ value: "in_progress: Implementing JWT authentication",
371
+ tags: ["task", "in_progress", "security"],
372
+ layer: "infrastructure"
373
+ },
374
+ {
375
+ key: "todo_add_tests",
376
+ value: "Add unit tests for API endpoints",
377
+ tags: ["todo", "testing"],
378
+ layer: "business"
379
+ },
380
+ // ... more decisions
381
+ ];
382
+
383
+ // Step 2: Transform to task objects
384
+ const tasks = decisions.map(d => {
385
+ const statusMatch = d.value.match(/^(todo|in_progress|done):\s*(.+)$/);
386
+ return {
387
+ title: d.key.replace(/^(task_|todo_)/, '').replace(/_/g, ' '),
388
+ description: statusMatch ? statusMatch[2] : d.value,
389
+ status: statusMatch ? statusMatch[1] : "todo",
390
+ priority: "medium",
391
+ tags: d.tags.filter(t => !['task', 'todo'].includes(t)),
392
+ layer: d.layer
393
+ };
394
+ });
395
+
396
+ // Step 3: Batch create tasks
397
+ {
398
+ action: "batch_create",
399
+ tasks: tasks,
400
+ atomic: false // Allow partial success
401
+ }
402
+ ```
403
+
404
+ ## Manual Migration
405
+
406
+ ### For Individual Tasks
407
+
408
+ **Manual Process:**
409
+
410
+ 1. **Find Task-Like Decision:**
411
+ ```javascript
412
+ {
413
+ action: "get",
414
+ key: "task_implement_auth"
415
+ }
416
+ ```
417
+
418
+ 2. **Create Equivalent Task:**
419
+ ```javascript
420
+ {
421
+ action: "create",
422
+ title: "Implement JWT authentication",
423
+ description: "Implementing JWT authentication with refresh tokens",
424
+ status: "in_progress",
425
+ priority: "high",
426
+ tags: ["security", "authentication"],
427
+ layer: "business"
428
+ }
429
+ ```
430
+
431
+ 3. **Link to Original (Optional):**
432
+ ```javascript
433
+ {
434
+ action: "link",
435
+ task_id: 1,
436
+ link_type: "decision",
437
+ link_key: "task_implement_auth"
438
+ }
439
+ ```
440
+
441
+ 4. **Deprecate Old Decision:**
442
+ ```javascript
443
+ {
444
+ action: "set",
445
+ key: "task_implement_auth",
446
+ value: "MIGRATED TO TASK #1",
447
+ status: "deprecated",
448
+ tags: ["migrated"]
449
+ }
450
+ ```
451
+
452
+ ### For Small Sets
453
+
454
+ **Manual Checklist:**
455
+
456
+ - [ ] Identify all task-like decisions
457
+ - [ ] For each decision:
458
+ - [ ] Parse status and description
459
+ - [ ] Create task with proper metadata
460
+ - [ ] Link to original decision (if needed)
461
+ - [ ] Link to related constraints/files
462
+ - [ ] Deprecate old decision
463
+ - [ ] Verify all tasks created
464
+ - [ ] Verify no orphaned decisions
465
+
466
+ ## Best Practices
467
+
468
+ ### 1. Preserve Context with Links
469
+
470
+ ```javascript
471
+ // ✅ GOOD: Link to original decision for traceability
472
+ {
473
+ action: "link",
474
+ task_id: 1,
475
+ link_type: "decision",
476
+ link_key: "task_implement_auth"
477
+ }
478
+
479
+ // ❌ BAD: Lose connection to original context
480
+ // (no link created)
481
+ ```
482
+
483
+ ### 2. Clean Up Tags
484
+
485
+ ```javascript
486
+ // ✅ GOOD: Remove status tags, keep semantic tags
487
+ {
488
+ action: "create",
489
+ tags: ["security", "authentication"] // Clean, semantic tags
490
+ }
491
+
492
+ // ❌ BAD: Keep status tags (redundant with status field)
493
+ {
494
+ action: "create",
495
+ tags: ["task", "in_progress", "security"] // Redundant
496
+ }
497
+ ```
498
+
499
+ ### 3. Correct Layer Assignment
500
+
501
+ ```javascript
502
+ // ✅ GOOD: Use correct layer based on task nature
503
+ {
504
+ action: "create",
505
+ title: "Implement JWT auth",
506
+ layer: "business" // Auth logic = business layer
507
+ }
508
+
509
+ // ❌ BAD: Wrong layer from old decision
510
+ {
511
+ action: "create",
512
+ title: "Implement JWT auth",
513
+ layer: "infrastructure" // Wrong layer
514
+ }
515
+ ```
516
+
517
+ ### 4. Set Appropriate Priority
518
+
519
+ ```javascript
520
+ // ✅ GOOD: Assess priority during migration
521
+ {
522
+ action: "create",
523
+ title: "Fix security vulnerability",
524
+ priority: "critical" // Correctly prioritized
525
+ }
526
+
527
+ // ❌ BAD: Default priority for critical work
528
+ {
529
+ action: "create",
530
+ title: "Fix security vulnerability",
531
+ priority: "medium" // Should be critical
532
+ }
533
+ ```
534
+
535
+ ### 5. Migrate in Batches
536
+
537
+ ```javascript
538
+ // ✅ GOOD: Migrate in manageable batches
539
+ {
540
+ action: "batch_create",
541
+ tasks: first20Tasks,
542
+ atomic: false
543
+ }
544
+ // Then migrate next batch
545
+
546
+ // ❌ BAD: Try to migrate 200+ tasks at once
547
+ {
548
+ action: "batch_create",
549
+ tasks: all200Tasks, // Too large, may fail
550
+ atomic: true
551
+ }
552
+ ```
553
+
554
+ ### 6. Verify Migration
555
+
556
+ ```javascript
557
+ // After migration, verify:
558
+
559
+ // 1. Count migrated tasks
560
+ {
561
+ action: "list",
562
+ tags: ["security"]
563
+ }
564
+ // Should match old decision count
565
+
566
+ // 2. Check deprecated decisions
567
+ {
568
+ action: "list",
569
+ status: "deprecated",
570
+ tags: ["migrated"]
571
+ }
572
+ // Should show all old task-like decisions
573
+
574
+ // 3. Verify links
575
+ {
576
+ action: "get",
577
+ task_id: 1
578
+ }
579
+ // Should show decision_links to old decisions
580
+ ```
581
+
582
+ ## Troubleshooting
583
+
584
+ ### Issue: Migration Script Fails Midway
585
+
586
+ **Problem:**
587
+ ```javascript
588
+ // Batch create fails after 50 tasks
589
+ {
590
+ action: "batch_create",
591
+ tasks: [...100 tasks...],
592
+ atomic: true // All-or-nothing mode
593
+ }
594
+ // Error: Task 51 failed, entire batch rolled back
595
+ ```
596
+
597
+ **Solution:**
598
+ ```javascript
599
+ // Use best-effort mode
600
+ {
601
+ action: "batch_create",
602
+ tasks: [...100 tasks...],
603
+ atomic: false // Allow partial success
604
+ }
605
+ // 50 succeed, 50 fail with errors listed
606
+ // Fix failures and retry
607
+ ```
608
+
609
+ ### Issue: Can't Parse Status from Decision Value
610
+
611
+ **Problem:**
612
+ ```javascript
613
+ // Decision value doesn't follow pattern
614
+ {
615
+ key: "implement_auth",
616
+ value: "Working on JWT auth implementation"
617
+ // No "in_progress:" prefix
618
+ }
619
+ ```
620
+
621
+ **Solution:**
622
+ ```javascript
623
+ // Default to "todo" status, manual review later
624
+ {
625
+ action: "create",
626
+ title: "Implement JWT auth",
627
+ description: "Working on JWT auth implementation",
628
+ status: "todo", // Default, review later
629
+ tags: ["needs-review"]
630
+ }
631
+ ```
632
+
633
+ ### Issue: Lost Context After Migration
634
+
635
+ **Problem:**
636
+ ```javascript
637
+ // Migrated task missing important context
638
+ {
639
+ action: "get",
640
+ task_id: 1
641
+ }
642
+ // No links to decisions/constraints
643
+ ```
644
+
645
+ **Solution:**
646
+ ```javascript
647
+ // Link to original decision
648
+ {
649
+ action: "link",
650
+ task_id: 1,
651
+ link_type: "decision",
652
+ link_key: "task_implement_auth"
653
+ }
654
+
655
+ // Link to related constraints
656
+ {
657
+ action: "link",
658
+ task_id: 1,
659
+ link_type: "constraint",
660
+ link_id: 5
661
+ }
662
+ ```
663
+
664
+ ### Issue: Duplicate Tasks Created
665
+
666
+ **Problem:**
667
+ ```javascript
668
+ // Migration script runs twice, creates duplicates
669
+ ```
670
+
671
+ **Solution:**
672
+ ```javascript
673
+ // Before migration, check if already migrated
674
+ {
675
+ action: "get",
676
+ key: "task_implement_auth"
677
+ }
678
+ // If status="deprecated" and value contains "MIGRATED TO TASK", skip
679
+
680
+ // Or query tasks by title
681
+ {
682
+ action: "list",
683
+ limit: 100
684
+ }
685
+ // Filter by title to check if exists
686
+ ```
687
+
688
+ ## Related Documentation
689
+
690
+ - **[TASK_OVERVIEW.md](TASK_OVERVIEW.md)** - Task system overview and core concepts
691
+ - **[TASK_ACTIONS.md](TASK_ACTIONS.md)** - Complete action reference with examples
692
+ - **[TASK_LINKING.md](TASK_LINKING.md)** - Linking tasks to decisions/constraints/files
693
+ - **[TASK_SYSTEM.md](TASK_SYSTEM.md)** - Complete documentation (original)
694
+ - **[DECISION_TO_TASK_MIGRATION_GUIDE.md](DECISION_TO_TASK_MIGRATION_GUIDE.md)** - Original migration guide (if exists)
695
+ - **[AI_AGENT_GUIDE.md](AI_AGENT_GUIDE.md)** - Comprehensive AI agent guide
696
+
697
+ ---
698
+
699
+ **Version:** 3.0.0
700
+ **Last Updated:** 2025-10-17
701
+ **Author:** sin5ddd