intent-engine 0.5.2

A command-line database service for tracking strategic intent, tasks, and events
Documentation
# Intent-Engine: Claude Integration Guide

**Version**: 0.5
**Target**: Claude Code, Claude Desktop, and AI assistants via MCP

---

## πŸ“– Authoritative Specification

> **IMPORTANT**: This guide is a practical summary derived from the authoritative specification.
>
> **Single Source of Truth**: `docs/spec-03-interface-current.md`
>
> The spec-03-interface-current.md document is the **foundational blueprint** that defines:
> - βœ… All CLI command signatures and behaviors
> - βœ… All MCP tool definitions and interfaces
> - βœ… Data models and their exact field names
> - βœ… Atomic operation semantics
> - βœ… Output format specifications
> - βœ… Interface stability guarantees (SemVer)
>
> **In case of any conflict or ambiguity**, the spec-03-interface-current.md takes precedence.
>
> This CLAUDE.md guide provides practical usage patterns and integration tips,
> but should always align with the authoritative specification.

---

## πŸ€– What is Intent-Engine?

Intent-Engine is your **external long-term memory** for strategic task management. Think of it as:

- **Your Task Brain**: Persistent, hierarchical task tracking across sessions
- **Context Keeper**: Full history of decisions, blockers, and milestones
- **Smart Assistant**: Recommends next tasks based on focus and priority

---

## 🎯 Core Concept: Focus-Driven Workflow

> **Technical details**: See [AGENT.md]AGENT.md#focus-driven-operations for data models and atomic operation semantics

Intent-Engine works like your brain - **one focused task at a time**:

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Workspace State                     β”‚
β”‚  current_task_id: 42                 β”‚  ← "What am I working on?"
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Task 42   β”‚  ← The Focused Task
    β”‚  "Impl auth"β”‚
    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”¬β”€β”€β”€β”˜
         β”‚   β”‚
    β”Œβ”€β”€β”€β”€β–Όβ” β”Œβ–Όβ”€β”€β”€β”€β”
    β”‚T43  β”‚ β”‚T44  β”‚  ← Subtasks (depth-first priority)
    β”‚JWT  β”‚ β”‚OAuthβ”‚
    β””β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”˜
```

---

## πŸ› οΈ Essential MCP Tools

> **For detailed technical specifications**, see [AGENT.md]AGENT.md#essential-commands

### Core Workflow Tools

| Tool | Purpose | Key Parameters |
|------|---------|----------------|
| `task_add` | Create strategic task | `name`, `spec`, `priority` |
| `task_start` | Begin working (sets focus) | `task_id`, `with_events` |
| `task_done` | Complete current task | (no parameters) |
| `task_spawn_subtask` | Create and switch to subtask | `name`, `spec` |
| `task_switch` | Change focus to another task | `task_id` |
| `task_pick_next` | Get smart recommendation | (no parameters) |
| `task_list` | Filter by status/parent | `status`, `parent` |
| `task_add_dependency` | Define task dependencies | `blocked_task_id`, `blocking_task_id` |

### Search and Discovery

| Tool | Purpose | Key Parameters |
|------|---------|----------------|
| `unified_search` | Search tasks AND events | `query`, `include_tasks`, `include_events` |

**Search capabilities**:
- Supports FTS5 syntax: `AND`, `OR`, `NOT`, `"phrases"`
- Returns mixed results with task ancestry for events
- Example: `unified_search(query: "JWT AND authentication")`

### Event Tracking

| Tool | Purpose | Key Parameters |
|------|---------|----------------|
| `event_add` | Record decision/blocker/note | `type`, `data`, `task_id?` |
| `event_list` | Query events with filters | `task_id?`, `type?`, `since?`, `limit?` |

**Event types**: `decision`, `blocker`, `milestone`, `note`

**Filtering** (new in v0.2):
- By type: `event_list(type: "decision")`
- By time: `event_list(since: "7d")`
- Combined: `event_list(type: "blocker", since: "24h")`

### Workspace and Reporting

| Tool | Purpose | Key Parameters |
|------|---------|----------------|
| `current_task_get` | Get focused task | (no parameters) |
| `report_generate` | Generate summary report | `since`, `summary_only` |

### New Features (v0.2+)

**Priority Levels**: Tasks support `critical`, `high`, `medium`, `low`
**Dependencies**: Use `task_add_dependency` to model prerequisites
**Event Filtering**: Filter by type, time range, or both
**Unified Search**: Search across both tasks and events

---

## 🎨 Typical Usage Patterns

### Pattern 1: Starting Fresh
```
User: "Help me implement user authentication"

You:
1. task_add(name: "Implement user authentication", spec: "...")
2. task_start(task_id: 42, with_events: true)
3. Review the context and begin work
```

### Pattern 2: Breaking Down Work
```
User: "Let's add authentication"

You:
1. task_start(task_id: 42)
2. Analyze the spec
3. task_spawn_subtask(name: "Design JWT schema")
   β†’ Now subtask is focused
4. Work on subtask
5. task_done() when subtask complete
6. task_pick_next() β†’ Recommends next subtask
```

### Pattern 3: Recording Decisions
```
While implementing JWT:

You: "I chose HS256 algorithm because..."
     event_add(type: "decision", data: "Chose HS256 because...")
```

### Pattern 4: Resuming Work
```
User: "Let's continue with authentication"

You:
1. unified_search(query: "authentication")
   β†’ Find task ID 42 and related events
2. task_start(task_id: 42, with_events: true)
   β†’ Get full context with decision history
3. Review events_summary
4. Continue from where you left off
```

### Pattern 5: Switching Context
```
User: "Let's pause auth and fix that bug"

You:
1. event_add(type: "note", data: "Pausing to handle bug #123")
2. task_switch(task_id: 67)  # Bug fix task
   β†’ Pauses auth, starts bug fix
3. Fix the bug
4. task_done()
5. task_switch(task_id: 42)  # Back to auth
```

### Pattern 6: Working with Dependencies (new in v0.2)
```
User: "Implement the API client, but it depends on authentication being done first"

You:
1. task_list(status: "doing")
   β†’ Find current auth task (ID 42)
2. task_add(name: "Implement API client", priority: "high")
   β†’ Creates task ID 50
3. task_add_dependency(blocked_task_id: 50, blocking_task_id: 42)
   β†’ API client now depends on auth completion
4. Continue working on task 42 (auth)
5. When task 42 is done, task_pick_next() will recommend task 50
```

### Pattern 7: Smart Event Filtering (new in v0.2)
```
User: "What decisions did we make on the authentication task?"

You:
1. unified_search(query: "authentication")
   β†’ Find task ID 42 and decision events
2. event_list(task_id: 42, type: "decision")
   β†’ Get only decision events (efficient!)
3. Review and summarize the decisions

Alternative - Recent blockers:
event_list(task_id: 42, type: "blocker", since: "7d")
β†’ Get blockers from last week only
```

---

## πŸ’‘ Best Practices

### 1. Always Start Tasks
```
❌ DON'T: task_done() without starting
βœ… DO:    task_start(42) then task_done()
```

### 2. Use Hierarchical Decomposition
```
❌ DON'T: Flat list of 10 implementation steps
βœ… DO:    Parent task with 3-4 logical subtasks
```

### 3. Record Important Decisions
```
❌ DON'T: Just implement without context
βœ… DO:    event_add() for key design choices
```

### 4. Leverage with_events
```
❌ DON'T: Start task without history
βœ… DO:    task_start(task_id, with_events: true)
```

### 5. Let pick-next Guide You
```
❌ DON'T: Manually search for next task
βœ… DO:    task_pick_next() for smart recommendation
```

---

## ⚠️ Common Mistakes

### Mistake 1: Passing ID to task_done
```
❌ task_done(task_id: 42)  # WRONG - no parameters

βœ… task_start(42)           # Set focus first
   task_done()              # Then complete
```

### Mistake 2: Using list for text search
```
❌ task_list(status: "JWT")  # WRONG - list is metadata only (status, parent)

βœ… unified_search(query: "JWT")  # Correct - searches tasks and events
```

### Mistake 3: Not checking current task
```
❌ Assume no task is focused
   task_done()  # ERROR

βœ… current_task_get()  # Check first
   If focused: task_done()
   If not: task_start() first
```

### Mistake 4: Trying to complete parent with incomplete children
```
❌ task_start(42)        # Parent
   task_done()           # ERROR: has incomplete subtasks

βœ… task_start(42)        # Parent
   task_spawn_subtask()  # Child 1
   task_done()           # Complete child 1
   task_spawn_subtask()  # Child 2
   task_done()           # Complete child 2
   task_switch(42)       # Back to parent
   task_done()           # Now works - all children done
```

---

## 🎯 When to Use Intent-Engine

### βœ… GOOD Use Cases

1. **Multi-session work**
   - "Let's implement authentication" (will take multiple conversations)
   - Complex features that span days

2. **Hierarchical problems**
   - "Design and implement API endpoints" (has multiple sub-steps)
   - Need to break down large tasks

3. **Decision tracking**
   - "Why did we choose approach X?" (record decisions)
   - Project retrospectives

4. **Context recovery**
   - "What were we working on?" (resume after break)
   - "What decisions have we made?" (review history)

### ❌ NOT Ideal For

1. **Single-step tasks**
   - "Fix this typo" (too trivial)
   - Quick one-liners

2. **Exploratory questions**
   - "What is JWT?" (informational only)
   - No actual work being tracked

3. **Temporary context**
   - Current conversation already has context
   - Won't need this information later

---

## πŸ”„ Integration Workflow

### With Claude Code

When user says:
- "Help me implement X" β†’ Create task, track work
- "What's next?" β†’ Use pick-next
- "Why did we...?" β†’ Check events
- "Continue authentication" β†’ Start task, load context

### Task Lifecycle

```
User Request
    β”‚
    β–Ό
task_add ──────────────┐
    β”‚                  β”‚ (strategic planning)
    β–Ό                  β”‚
task_start ──────────────
    β”‚                  β”‚ (active work)
    β”œβ”€β”€ event_add      β”‚
    β”œβ”€β”€ task_spawn_subtask
    β”‚                  β”‚
    β–Ό                  β”‚
task_done β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## 🧠 Mental Model

Think of Intent-Engine as:

1. **Your Notebook** - Persistent task list across sessions
2. **Your Focus Ring** - One task at a time (current_task_id)
3. **Your Memory** - Decision history in events
4. **Your Guide** - Smart recommendations (pick-next)
5. **Your Tree** - Hierarchical problem breakdown

---

## πŸ“š Key References

- **Interface Spec** (authoritative): `docs/spec-03-interface-current.md`
- **AI Agent Guide** (technical details): `AGENT.md`
- **MCP Schema**: `mcp-server.json`
- **Setup Guide**: `docs/*/integration/mcp-server.md`

> For data models, output formats, and command specifications, see [AGENT.md]AGENT.md

---

## πŸŽ“ Philosophy

Intent-Engine is designed for **strategic intent tracking**, not tactical todo lists:

- **What + Why** over "How"
- **Persistent context** over ephemeral notes
- **Hierarchical thinking** over flat lists
- **Decision history** over task status
- **Focus** over multitasking

---

**Last Updated**: 2025-11-16
**Spec Version**: 0.5
**MCP Tools**: 14 available (unified_search replaces task_search)
**Status**: Experimental (Pre-1.0)