intent-engine 0.1.15

A command-line database service for tracking strategic intent, tasks, and events
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# Intent-Engine: Claude Integration Guide

**Version**: 0.1
**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/INTERFACE_SPEC.md`
>
> The INTERFACE_SPEC.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 INTERFACE_SPEC.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

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β”‚
    β””β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”˜
```

---

## πŸ› οΈ Available MCP Tools

### Task Management

#### `task_add` - Create Strategic Task
```json
{
  "name": "Implement user authentication",
  "spec": "Use JWT with 7-day expiry, refresh tokens, HS256 algorithm"
}
```

**When to use**:
- User gives you a complex requirement
- You need to track work across sessions
- The task has multiple steps or sub-problems

#### `task_start` - Begin Working
```json
{
  "task_id": 42,
  "with_events": true
}
```

**What it does** (atomic):
1. Sets task status to `doing`
2. Makes it the current focused task
3. Returns full context with decision history

**When to use**:
- Starting a new task
- Resuming work after a break
- User asks "what should I work on?"

#### `task_done` - Complete Current Task
```json
{
  // NO parameters - operates on current_task_id
}
```

**Prerequisites**:
- A task must be current/focused
- All subtasks must be done

**What it does** (atomic):
1. Verifies all children are done
2. Marks current task as done
3. Clears current_task_id (unfocuses)

**When to use**:
- Task is complete and verified
- All subtasks are finished
- Ready to move to next task

#### `task_spawn_subtask` - Decompose Problem
```json
{
  "name": "Configure JWT secret key",
  "spec": "Store in environment variables, use strong random value"
}
```

**What it does** (atomic):
1. Creates subtask under current task
2. Switches focus to new subtask
3. Sets new subtask as `doing`

**When to use**:
- Discover a sub-problem while working
- Need to break down current task
- Want to track detailed steps

#### `task_switch` - Change Focus
```json
{
  "task_id": 43
}
```

**What it does** (atomic):
1. Previous task: `doing` β†’ `todo` (pause)
2. New task: `todo` β†’ `doing` (resume)
3. Update focus to new task

**When to use**:
- Pause current work to handle something else
- Return to a previously started task
- User asks to switch context

#### `task_pick_next` - Get Recommendation
```json
{
  // No required parameters
}
```

**Smart algorithm** (depth-first):
1. **First priority**: Subtasks of current focused task
2. **Second priority**: Top-level todo tasks

**When to use**:
- User asks "what should I work on next?"
- Current task is done, need next step
- Starting a new work session

#### `task_find` - Filter by Metadata
```json
{
  "status": "doing",
  "parent": 42
}
```

**When to use**:
- Find all tasks in a specific status
- List subtasks of a parent
- Query structured properties

**NOT for text search** - use `task_search` instead

#### `task_search` - Full-Text Search
```json
{
  "query": "JWT AND authentication",
  "snippet": true
}
```

**Searches**: Both `name` and `spec` fields

**When to use**:
- Find tasks by content/keywords
- Search for specific technical terms
- Locate related work

### Event Recording

#### `event_add` - Record Decisions/Blockers
```json
{
  "type": "decision",  // or "blocker", "milestone", "note"
  "data": "Chose HS256 over RS256 because we don't need key rotation yet",
  "task_id": 42  // Optional - defaults to current task
}
```

**Two modes**:
1. **During work**: Omit `task_id` β†’ records for current task
2. **Retrospective**: Include `task_id` β†’ records for any task

**When to use**:
- Made an important design decision
- Hit a blocker that needs tracking
- Reached a milestone
- Quick note for future reference

### Reporting

#### `report_generate` - Generate Summary
```json
{
  "since": "7d",
  "summary_only": true
}
```

**When to use**:
- User asks "what have we accomplished?"
- Weekly/daily standup summary
- Project status report

#### `current_task_get` - Get Focused Task
```json
{
  // No parameters
}
```

**When to use**:
- Check what task is currently focused
- Understand current context
- Before performing focus-driven operations

---

## 🎨 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. task_search(query: "authentication")
   β†’ Find task ID 42
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
```

---

## πŸ’‘ 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 find for text search
```
❌ task_find(name_pattern: "JWT")  # WRONG - find is metadata only

βœ… task_search(query: "JWT")        # Correct
```

### 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 β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸ“Š Understanding Output

### TaskWithEvents Structure
```json
{
  "task": {
    "id": 42,
    "name": "Implement authentication",
    "status": "doing",
    "spec": "Use JWT...",
    "first_doing_at": "2024-11-09T10:00:00Z"
  },
  "events_summary": {
    "total_count": 5,
    "recent_events": [
      {
        "log_type": "decision",
        "discussion_data": "Chose HS256 algorithm",
        "timestamp": "2024-11-09T10:15:00Z"
      }
    ]
  }
}
```

**Use this to**:
- Understand current task state
- Review decision history
- Resume work with full context

### PickNextResult Structure
```json
{
  "recommended_task": {
    "id": 43,
    "name": "Configure JWT secret",
    "parent_id": 42
  },
  "reason": "subtask_of_current",
  "context": {
    "current_task_id": 42,
    "strategy": "depth_first"
  }
}
```

**Use this to**:
- Recommend next logical step
- Explain why this task is suggested
- Maintain focus on current work tree

---

## 🧠 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

- **Full Spec**: `docs/INTERFACE_SPEC.md`
- **Agent Guide**: `AGENT.md`
- **MCP Schema**: `mcp-server.json`
- **Setup**: `docs/*/integration/mcp-server.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**: 2024-11-09
**Spec Version**: 0.1
**MCP Tools**: 13 available
**Status**: Experimental (Pre-1.0)