- Migration 025: Add 'abandoned' status to sessions CHECK constraint (fixes blocking issue)
- Migration 026: Add recovery metadata columns (recovered_from, recovered_at) to track note recovery source
- Update sessionRecoverOrphaned to recover notes from temp files when marking sessions abandoned
- Update notes-parser to track recovery source and timestamp for analytics
These changes complete Priority 3, 5 and part of Priority 1 for CF-572 Session Notes Loss fix.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Fixes task project rename command by adding ON UPDATE CASCADE to all foreign key constraints that reference projects(key).
Updated 10 FK constraints: task_sequences, epic_sequences, versions, epics, tasks, project_locks, project_archives, sessions, session_sequences, project_documentation.
Migration drops old constraints and adds new ones with both ON DELETE CASCADE and ON UPDATE CASCADE (except sessions which uses ON DELETE SET NULL).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added 'done' status to task lifecycle for verification period before completion.
**Changes:**
- Added 'done' to task_status enum (pending, open, in_progress, testing, blocked, done, completed)
- Added auto_close_at timestamp column for scheduling auto-close
- Created index for efficient cron job queries
**Workflow:**
1. Task marked 'done' → auto_close_at = NOW() + 7 days
2. Cron job runs daily to check tasks past auto_close_at
3. If no related issues → auto-close to 'completed'
4. If related issues → keep as 'done' (prevents premature closure)
**Lifecycle:**
open → in_progress → done (7-day verification) → completed (auto-closed)
task:CF-454
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
New link types added:
- depends_on: Task depends on another task to complete first
- needs: Task needs another task (weaker dependency)
- implements: Task implements a feature/requirement
- fixes: Task fixes an issue identified in another task
- causes: Task causes/introduces issue in another task
- subtask_of: Task is a subtask of another (parent-child)
Preserves existing types: blocks, relates_to, duplicates
Changes:
- Migration 021 updates database constraint
- Updated TypeScript types and MCP tool schema
- Applied to production database
Implements CF-385
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Resolves MCP error when trying to set status="pending" on tasks.
Changes:
- Migration 019: Add 'pending' to tasks.status CHECK constraint
- Update task_update tool schema to accept 'pending' status
- Update task_list tool schema to filter by 'pending' status
Status meanings:
- pending: Created, awaiting approval or dependencies
- open: Approved and ready to start
- in_progress: Currently being worked on
- testing: Implementation complete, being tested
- blocked: Stuck waiting for something
- completed: Done
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>
Creates deployments and deployment_logs tables for tracking all
deployment types (Docker, MCP, iOS/macOS, services). Includes
deployment status, timing, git integration, and structured logging.
Also adds run-migration.mjs helper for running migrations against
PostgreSQL database.
Part of CF-290, completes CF-291.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Switch from external Gemini API (3072 dims, $0.15/1M tokens) to local
Ollama mxbai-embed-large (1024 dims, free) for cost savings and HNSW
index support.
Changes:
- Updated embeddings.ts: model 'mxbai-embed-large', API URL fixed
- Updated migration 015: vector(1024) with HNSW index
- Regenerated 268 tool_docs embeddings with new model
Benefits:
- Free embeddings (no API costs)
- HNSW index enabled (1024 < 2000 dim limit)
- Fast similarity search (O(log n) vs O(n))
- No external API dependency
Trade-offs:
- 5% quality loss (MTEB 64.68 vs ~70 Gemini)
- Uses local compute (1.2GB RAM, <1s per embedding)
Task: CF-251
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>
epic_close was failing with "column updated_at does not exist".
Migration adds the column with default NOW() and backfills
existing rows from created_at.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New MCP tools:
- project_lock: Lock a project for exclusive session access
- project_unlock: Release a project lock
- project_lock_status: Check lock status for project(s)
Features:
- Automatic lock expiration (default 2h)
- Session ownership verification
- Force unlock option for emergencies
- Lock extension on re-lock by same session
Migration 004: project_locks table with expiry tracking
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migration 003: enables semantic search for epics
- ALTER TABLE epics ADD COLUMN embedding vector(1024)
- HNSW index for similarity search
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Creates core tables for task-mcp:
- projects, task_sequences, epic_sequences
- tasks with vector(1024) embedding for semantic search
- epics, versions, task_checklist, task_links
- HNSW index for fast vector similarity search
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- task_delegations table for tracking delegation metadata per task
- task_learning_effectiveness table for per-task learning tracking
- Indexes for efficient querying by task_id, status, backend
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>