feat(CF-166): Add investigation workflow with auto-linking

Implements comprehensive investigation task management:

**Schema Changes (Migration 020):**
- Add 'investigation' task type to tasks table
- Add investigation_parent_id and auto_link_enabled columns to session_context
- Add auto_linked and linked_at columns to task_links for tracking
- Create indexes for efficient auto-linking queries

**Auto-Linking Logic:**
1. Investigation Parent Linking: Tasks auto-link to active investigation
2. Current Task Linking: Tasks link to current working task
3. Time-Based Linking: Tasks within 1 hour auto-link (fallback)

**New Tool:**
- task_investigate: Start investigation workflow, sets session context

**Documentation:**
- Add comprehensive investigation workflow guide to README
- Include examples and session context explanation

All checklist items completed:
✓ Investigation task type in schema
✓ Session context table enhancements
✓ Auto-linking implementation
✓ task_investigate command
✓ Documentation updates

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-19 19:15:25 +02:00
parent caf9356aad
commit 7be5878d35
6 changed files with 246 additions and 17 deletions

View File

@@ -39,12 +39,85 @@ Add to `~/.claude/settings.json` under `mcpServers`:
| `task_show` | Show task details including checklist and dependencies |
| `task_close` | Mark task as completed |
| `task_update` | Update task fields |
| `task_investigate` | Start investigation workflow (auto-links subsequent tasks) |
| `task_similar` | Find semantically similar tasks using pgvector |
| `task_context` | Get related tasks for current work context |
| `task_link` | Create dependency between tasks |
| `task_checklist_add` | Add checklist item to task |
| `task_checklist_toggle` | Toggle checklist item |
## Investigation Workflow (CF-166)
The investigation workflow helps organize multi-step problem analysis by automatically linking related tasks.
### Starting an Investigation
```typescript
// Start investigation
task_investigate({
title: "Investigate $4,746 Brave API cost overrun",
project: "CF",
priority: "P1",
description: "Determine why Brave API costs are 10x expected"
});
```
This creates an investigation task and sets it as the session's investigation parent. All subsequent tasks created in this session will automatically link to the investigation.
### Auto-Linking Behavior
When you create tasks during an active investigation:
1. **Investigation Parent Linking**: New tasks automatically link to the investigation task
2. **Current Task Linking**: Tasks also link to the current working task (if different from investigation)
3. **Time-Based Linking**: If no investigation is active, tasks created within 1 hour auto-link to recent tasks in the same session
### Task Types
- `task`: General work item (default)
- `bug`: Bug fix
- `feature`: New feature
- `debt`: Technical debt
- `investigation`: Multi-step problem analysis (use with `task_investigate`)
### Example Investigation Flow
```typescript
// 1. Start investigation
task_investigate({
title: "Investigate database performance degradation",
project: "CF"
});
// Creates CF-100 (investigation task)
// 2. Create subtasks - these auto-link to CF-100
task_add({
title: "Check slow query log",
project: "CF"
});
// Creates CF-101, auto-links to CF-100
task_add({
title: "Analyze connection pool metrics",
project: "CF"
});
// Creates CF-102, auto-links to CF-100
// 3. View investigation with all linked tasks
task_show({ id: "CF-100" });
// Shows investigation with all related subtasks
```
### Session Context
The MCP server tracks session context to enable smart auto-linking:
- **Current Task**: The task you're actively working on (set when status changes to `in_progress`)
- **Investigation Parent**: The investigation task all new tasks should link to
- **Auto-link Enabled**: Whether to automatically create task links (default: true)
Session context is stored per session and cleared when tasks are completed or sessions end.
## Build
```bash