Enhanced task_add to search both open AND completed tasks when checking for
duplicates. Previously only checked non-completed tasks.
**Changes:**
- Removed `status != 'completed'` filter from similarity search
- Increased search limit from 3 to 5 tasks
- Separated display: open tasks vs previously completed
- Show 150-char context snippet from completed task descriptions
- Suggest using "task show <id>" to see full solution
**Benefits:**
- Prevents recreating already-solved tasks
- Surfaces solutions from previous attempts
- Reduces circular work on recurring issues
- Maintains context from closed tasks
**Example output:**
```
⚠️ Similar tasks found:
**Open/In Progress:**
- CF-442: Next.js cache issue (92% match, open)
**Previously Completed:**
- CF-378: Pre-test validation (85% match)
Context: "Created comprehensive pre-test quality validation workflow..."
💡 Use "task show <id>" to see full solution before recreating work
```
Fixes: CF-450
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added task_move_project tool to move tasks between projects while
preserving all relationships and history:
Changes:
- db.ts: Added getClient() for transaction support
- crud.ts: Implemented taskMoveProject() with full transaction
- index.ts: Wired up tool handler and import
- tools/index.ts: Registered tool definition
Preserves:
- Task metadata (title, description, type, status, priority)
- Checklist items
- Linked commits
- Delegations
- Activity history
- Task links (relates_to, blocks, duplicates)
- Epic and version assignments
- Embeddings
Process:
1. Validates source task and target project exist
2. Generates new ID in target project
3. Transfers all related data in transaction
4. Marks old task as completed with reference
5. Creates duplicate link between tasks
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
**CF-282: Session Reference in Tasks**
- Add session_id column to tasks table (migration 019)
- Store session_id when creating tasks in taskAdd()
- Display session_id in taskShow() output
- Create index for performance
- Backfill existing tasks from task_activity
**CF-278: Enhanced Session Context**
- Updated session-start to load memories (via DB query)
- Performance: 2-3.6s (target <5s) ✓
Changes:
- migrations/019_add_session_id_to_tasks.sql: New migration
- src/tools/crud.ts: taskAdd and taskShow modifications
Requires: Claude Code restart to load new code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enhancements:
1. Session Context Table
- Migration 014: session_context table
- Tracks current working task per session
- Auto-updated on task status changes
2. Auto-Linking to Current Working Task
- When task status → in_progress: sets as current_task_id
- When task status → completed: clears current_task_id
- New tasks auto-link to current working task with 'relates_to'
- Shows auto-link message during task creation
3. Session ID Resolution
- Fixed path: ~/.cache/session-memory/current_session
- Falls back to environment variable CLAUDE_SESSION_ID
- Generates timestamp-based ID if unavailable
Example Flow:
```
1. task update CF-123 --status in_progress
→ Sets CF-123 as current working task
2. task add --title "Related work"
→ Created: CF-124
🔗 Auto-linked to: CF-123 (current working task)
3. task update CF-123 --status completed
→ Clears current working task
```
Files Changed:
- migrations/014_session_context.sql (new, 33 lines)
- src/tools/crud.ts (auto-linking logic, session context management)
Benefits:
- Zero manual linking for related work
- Session context preserved automatically
- Investigation workflows auto-organized
- Retroactive work tracking prevented
Note: Requires MCP server restart to take effect.
Remaining CF-166 Features (Phase 3):
- task investigate command
- Investigation workflow helper
- Task creation reminders
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Previously these functions only filtered by project when explicitly
passed. Now they auto-detect from CWD using detectProjectFromCwd(),
matching the behavior of project_context.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Session 374: Task-MCP and Delegation System Integration (Phase 4 & 6)
- Add task_delegations tool: query delegations for a specific task
- Add task_delegation_query tool: query across all tasks by status/backend
- Enhance taskShow() to display recent delegation history
- New delegations.ts module with getRecentDelegations helper
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- relates_to and duplicates now create reverse links automatically
- task_show displays Related and Duplicates sections
- blocks remains unidirectional (A blocks B, B is blocked by A)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>