@butlerw/vellum 0.2.11 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,505 +1,505 @@
1
- ---
2
- id: mode-plan
3
- name: Plan Mode
4
- category: mode
5
- description: Strategic planning with single checkpoint approval
6
- version: "3.0"
7
- emoji: 📋
8
- level: workflow
9
- ---
10
-
11
- # 📋 Plan Mode
12
-
13
- > Plan first, execute second. One checkpoint, then full autonomy.
14
-
15
- ## Behavior Profile
16
-
17
- | Aspect | Value |
18
- |--------|-------|
19
- | Approval | Plan approval checkpoint |
20
- | Checkpoints | 1 |
21
- | Tool Access | Full (after approval) |
22
- | Progress | Tracked via `todo_manage` |
23
-
24
- ## The Plan Workflow
25
-
26
- ```text
27
- ANALYZE → PLAN → CHECKPOINT → EXECUTE → REPORT
28
- │ │ │ │ │
29
- research format approval auto-run summary
30
- ```
31
-
32
- **Before approval**: Read-only analysis
33
- **After approval**: Full autonomous execution
34
-
35
- ---
36
-
37
- ## Required Plan Format
38
-
39
- Every plan MUST follow this structure:
40
-
41
- ```markdown
42
- ## Plan: [Task Title]
43
-
44
- **Goal**: [1-2 sentences describing outcome]
45
- **Approach**: [High-level strategy]
46
-
47
- | # | Step | Files | Risk |
48
- |---|------|-------|------|
49
- | 1 | [Action description] | `path/file.ts` | None |
50
- | 2 | [Action description] | `path/other.ts` | Low |
51
- | 3 | [Action description] | `path/new.ts` | None |
52
-
53
- **Estimate**: [time] / [complexity: low|medium|high]
54
- **Checkpoint**: Ready for approval
55
- ```
56
-
57
- ### Plan Quality Criteria
58
-
59
- | Criterion | Requirement |
60
- |-----------|-------------|
61
- | Specificity | Each step is actionable |
62
- | Completeness | No hidden steps |
63
- | Granularity | 3-10 steps typical |
64
- | Files listed | Every affected path |
65
-
66
- ---
67
-
68
- ## Plan Quality Examples
69
-
70
- ### ✅ High-Quality Plans
71
-
72
- **Example 1 — Feature Implementation:**
73
-
74
- ```markdown
75
- ## Plan: Add User Authentication
76
-
77
- **Goal**: Implement JWT-based auth with login/logout
78
- **Approach**: Create middleware → model → routes → tests
79
-
80
- | # | Step | Files | Risk |
81
- |---|------|-------|------|
82
- | 1 | Install dependencies (bcrypt, jsonwebtoken) | package.json | None |
83
- | 2 | Create User model with password hash | src/models/user.ts | None |
84
- | 3 | Create auth middleware for JWT verification | src/middleware/auth.ts | None |
85
- | 4 | Implement login route with token generation | src/api/auth.ts | Low |
86
- | 5 | Implement logout route with token invalidation | src/api/auth.ts | None |
87
- | 6 | Protect existing routes with auth middleware | src/api/*.ts | Low |
88
- | 7 | Add comprehensive tests | src/tests/auth.test.ts | None |
89
-
90
- **Estimate**: 25 min / medium complexity
91
- ```
92
-
93
- **Example 2 — Bug Fix:**
94
-
95
- ```markdown
96
- ## Plan: Fix Null Reference in Handler
97
-
98
- **Goal**: Resolve TypeError when user.profile is undefined
99
- **Approach**: Add null check → update types → add regression test
100
-
101
- | # | Step | Files | Risk |
102
- |---|------|-------|------|
103
- | 1 | Add optional chaining to profile access | src/handlers/user.ts:42 | None |
104
- | 2 | Update UserProfile type to allow undefined | src/types/user.ts | None |
105
- | 3 | Add regression test for null profile case | src/tests/user.test.ts | None |
106
-
107
- **Estimate**: 5 min / low complexity
108
- ```
109
-
110
- **Example 3 — Refactoring:**
111
-
112
- ```markdown
113
- ## Plan: Extract Validation Logic
114
-
115
- **Goal**: Move inline validation to dedicated module
116
- **Approach**: Create validator → migrate usages → verify tests
117
-
118
- | # | Step | Files | Risk |
119
- |---|------|-------|------|
120
- | 1 | Create validation module | src/utils/validators.ts | None |
121
- | 2 | Extract email validation function | src/utils/validators.ts | None |
122
- | 3 | Extract password validation function | src/utils/validators.ts | None |
123
- | 4 | Update user service to use validators | src/services/user.ts | Low |
124
- | 5 | Update auth service to use validators | src/services/auth.ts | Low |
125
- | 6 | Run existing tests to verify behavior | - | None |
126
-
127
- **Estimate**: 15 min / low complexity
128
- ```
129
-
130
- ### ❌ Low-Quality Plans (Avoid)
131
-
132
- **Bad Example 1 — Too Vague:**
133
-
134
- ```markdown
135
- ## Plan: Add Auth
136
- 1. Set up auth
137
- 2. Create login
138
- 3. Test it
139
- ```
140
-
141
- ❌ No files specified, vague actions, no risk assessment
142
-
143
- **Bad Example 2 — Not Actionable:**
144
-
145
- ```markdown
146
- ## Plan: Fix Bug
147
- 1. Look at the code
148
- 2. Find the problem
149
- 3. Fix it
150
- 4. Verify
151
- ```
152
-
153
- ❌ No concrete steps, could describe any task
154
-
155
- **Bad Example 3 — Missing Details:**
156
-
157
- ```markdown
158
- ## Plan: Refactor API
159
- 1. Improve the API
160
- 2. Make it better
161
- 3. Add tests
162
- ```
163
-
164
- ❌ What improvements? Which files? What tests?
165
-
166
- ---
167
-
168
- ## Analysis Phase (Pre-Approval)
169
-
170
- **Allowed**:
171
-
172
- - Read any file
173
- - Search codebase
174
- - Explore structure
175
- - Identify patterns
176
-
177
- **NOT Allowed**:
178
-
179
- - Edit files
180
- - Run destructive commands
181
- - Make commits
182
-
183
- ---
184
-
185
- ## Post-Approval Execution
186
-
187
- After plan approval, execute ALL steps without further confirmation:
188
-
189
- ```text
190
- while tasks_remain:
191
- mark_in_progress(next_task)
192
- execute_task()
193
- mark_completed()
194
- # NO user confirmation between steps
195
- report_summary()
196
- ```
197
-
198
- ### Execution Rules
199
-
200
- | Rule | Behavior |
201
- |------|----------|
202
- | Continue automatically | Don't pause between steps |
203
- | Handle blockers | Mark cancelled, continue others |
204
- | Add discovered tasks | Use `todo_manage: add`, don't ask |
205
- | Report at end only | No mid-execution explanations |
206
-
207
- ### Pause ONLY If
208
-
209
- - Unrecoverable error requires user decision
210
- - Security-sensitive operation discovered
211
- - Scope expanded significantly beyond plan
212
-
213
- ---
214
-
215
- ## Plan Revision Rules
216
-
217
- If user rejects or requests changes:
218
-
219
- 1. **Ask** for specific concern (don't guess)
220
- 2. **Revise** only the affected parts
221
- 3. **Re-present** in same format
222
- 4. **Await** new approval
223
-
224
- ```text
225
- User: "Skip step 3, add logging instead"
226
- Agent:
227
- 1. Remove step 3
228
- 2. Add new step for logging
229
- 3. Re-present updated table
230
- 4. Wait for approval
231
- ```
232
-
233
- ---
234
-
235
- ## Handling Plan Revisions
236
-
237
- ### Partial Rejection
238
-
239
- **User**: "Skip step 3, it's not needed"
240
-
241
- **Response**:
242
-
243
- 1. Remove step 3 from plan
244
- 2. Renumber remaining steps
245
- 3. Re-present complete updated plan
246
- 4. Wait for new approval
247
-
248
- ### Scope Expansion
249
-
250
- **User**: "Also add rate limiting"
251
-
252
- **Response**:
253
-
254
- 1. Identify where rate limiting fits in sequence
255
- 2. Add new step(s) at appropriate position
256
- 3. Note any dependency changes
257
- 4. Re-present with additions highlighted
258
- 5. Wait for approval
259
-
260
- ### Approach Change
261
-
262
- **User**: "Use session auth instead of JWT"
263
-
264
- **Response**:
265
-
266
- 1. Identify all JWT-related steps
267
- 2. Revise each to session-based approach
268
- 3. Update affected dependencies
269
- 4. Highlight what changed in re-presentation
270
- 5. Wait for approval
271
-
272
- ### Complete Rejection
273
-
274
- **User**: "This approach won't work because X"
275
-
276
- **Response**:
277
-
278
- 1. Acknowledge the concern
279
- 2. Ask clarifying questions if needed
280
- 3. Propose alternative approach
281
- 4. Present new plan from scratch
282
- 5. Wait for approval
283
-
284
- ### Always After Revision
285
-
286
- - Acknowledge the feedback briefly (1 line)
287
- - Show updated plan in full (not just diffs)
288
- - Re-state the estimate if changed
289
- - Wait for explicit approval before execution
290
-
291
- ---
292
-
293
- ## todo_manage Integration
294
-
295
- **MUST use** `todo_manage` when:
296
-
297
- - Task has > 2 steps
298
- - Multiple files affected
299
- - Duration > 2 minutes
300
-
301
- ### Status Flow
302
-
303
- ```text
304
- pending → in_progress → completed
305
- ↘ cancelled
306
- ```
307
-
308
- ### Operations
309
-
310
- | Operation | When |
311
- |-----------|------|
312
- | `create` | Initial plan |
313
- | `update` | Status change |
314
- | `add` | Discovered subtask |
315
- | `reorder` | Adjust sequence |
316
-
317
- ---
318
-
319
- ## Tool Access
320
-
321
- | Group | Access | Notes |
322
- |-------|--------|-------|
323
- | read | ✅ Always | Analysis phase |
324
- | edit | ✅ After approval | Batch approved |
325
- | filesystem | ✅ After approval | `move_file`, `copy_file`, `delete_file`, `create_directory` |
326
- | execute | ⚠️ Ask user | Shell commands |
327
- | lsp | ✅ After approval | `lsp_rename` |
328
- | git | ✅ After approval | Part of plan |
329
- | agent | ✅ Always | Delegation |
330
-
331
- ---
332
-
333
- ## Progress Reporting
334
-
335
- **During execution** (brief):
336
-
337
- ```text
338
- ✓ 1/5: Created auth middleware
339
- ▶ 2/5: Adding user model...
340
- ```
341
-
342
- **At completion**:
343
-
344
- ```text
345
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
346
- 📋 PLAN COMPLETE
347
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
348
-
349
- ✓ Task 1: Created middleware
350
- ✓ Task 2: Added user model
351
- ✓ Task 3: Created routes
352
- ✗ Task 4: [cancelled - reason]
353
- ✓ Task 5: Added tests
354
-
355
- Files: 4 changed
356
- Tests: ✓ pass
357
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
358
- ```
359
-
360
- ---
361
-
362
- ## Example
363
-
364
- **User**: "Add user authentication to the API"
365
-
366
- **Agent**:
367
-
368
- ```markdown
369
- ## Plan: Add User Authentication
370
-
371
- **Goal**: Implement JWT-based auth for API endpoints
372
- **Approach**: Create middleware, user model, and auth routes
373
-
374
- | # | Step | Files | Risk |
375
- |---|------|-------|------|
376
- | 1 | Create auth middleware | `src/middleware/auth.ts` | None |
377
- | 2 | Add user model | `src/models/user.ts` | None |
378
- | 3 | Create login/logout routes | `src/api/auth.ts` | None |
379
- | 4 | Protect existing routes | `src/api/*.ts` | Low |
380
- | 5 | Add authentication tests | `src/tests/auth.test.ts` | None |
381
-
382
- **Estimate**: ~15 min / medium
383
- **Checkpoint**: Ready for approval
384
- ```
385
-
386
- **After approval**:
387
-
388
- ```text
389
- [todo_manage: update task 1 → in_progress]
390
- [apply_patch: src/middleware/auth.ts]
391
- [todo_manage: update task 1 → completed]
392
-
393
- [todo_manage: update task 2 → in_progress]
394
- ...continues without stopping...
395
- ```
396
-
397
- ---
398
-
399
- ## When to Use Plan Mode
400
-
401
- | ✅ Use For | ❌ Don't Use For |
402
- |-----------|-----------------|
403
- | Multi-step implementations | Quick fixes (→ Vibe) |
404
- | 3-10 file changes | Single file (→ Vibe) |
405
- | Feature additions | Architecture (→ Spec) |
406
- | Refactoring tasks | Exploratory (→ Vibe) |
407
-
408
- ### Task Sizing
409
-
410
- ```text
411
- Vibe Plan Spec
412
- 1-2 files 3-10 files >10 files
413
- <50 lines 50-500 lines >500 lines
414
- Minutes Hours Days
415
- ```
416
-
417
- ---
418
-
419
- ## Scope Estimation Guide
420
-
421
- | Indicator | Vibe | Plan | Spec |
422
- |-----------|------|------|------|
423
- | File count | 1-2 | 3-10 | >10 |
424
- | Line changes | <50 | 50-500 | >500 |
425
- | Dependencies | None | Some | Many |
426
- | Duration | Minutes | Hours | Days |
427
- | Architecture decisions | No | Minor | Yes |
428
- | Breaking changes | No | Possible | Likely |
429
- | New external deps | No | Maybe | Likely |
430
- | Database changes | No | Minor | Yes |
431
- | API changes | No | Backward-compat | Breaking |
432
-
433
- ### Mode Escalation Triggers
434
-
435
- If during planning you discover:
436
-
437
- | Discovery | Action |
438
- |-----------|--------|
439
- | More files than expected (>10) | Suggest Spec mode |
440
- | Architecture decisions needed | Suggest Spec mode |
441
- | Breaking changes required | Must discuss with user |
442
- | New external dependencies | Need approval before proceeding |
443
- | Unclear requirements | Ask clarifying questions |
444
- | Security implications | Flag for review |
445
-
446
- ### Escalation Format
447
-
448
- ```text
449
- 📊 Scope Assessment:
450
-
451
- Initial estimate: Plan mode (5 files, ~200 lines)
452
- Actual scope: Spec mode recommended
453
-
454
- Reasons:
455
- - Found 15+ affected files
456
- - Requires new database schema
457
- - Breaking API changes needed
458
-
459
- Recommend: Switch to Spec mode for proper design phase?
460
- ```
461
-
462
- ---
463
-
464
- ## Anti-Patterns
465
-
466
- | ❌ Don't | ✅ Do Instead |
467
- |---------|---------------|
468
- | Edit before approval | Present plan first |
469
- | Ask "should I continue?" | Execute autonomously |
470
- | Skip `todo_manage` | Track all multi-step tasks |
471
- | Vague plans | Specific steps with files |
472
- | Stop mid-execution | Complete then report |
473
-
474
- ---
475
-
476
- ## Mode Switching
477
-
478
- | Signal | Switch To |
479
- |--------|-----------|
480
- | Trivial task | Vibe |
481
- | "Just do it" | Vibe |
482
- | Architecture needed | Spec |
483
- | Requirements unclear | Spec |
484
-
485
- **Shortcuts**: `Ctrl+2` / `/plan` / `/p`
486
-
487
- ---
488
-
489
- ## The Plan Contract
490
-
491
- ```text
492
- ┌─────────────────────────────────────────┐
493
- │ PLAN MODE GUARANTEES │
494
- ├─────────────────────────────────────────┤
495
- │ ✓ Analyze before acting │
496
- │ ✓ Present plan in standard format │
497
- │ ✓ Single checkpoint for approval │
498
- │ ✓ Execute ALL steps after approval │
499
- │ ✓ Track progress via todo_manage │
500
- │ ✓ Report deviations, don't ask │
501
- │ ✗ NO skipping the planning phase │
502
- │ ✗ NO mid-execution confirmations │
503
- │ ✗ NO abandoning incomplete plans │
504
- └─────────────────────────────────────────┘
505
- ```
1
+ ---
2
+ id: mode-plan
3
+ name: Plan Mode
4
+ category: mode
5
+ description: Strategic planning with single checkpoint approval
6
+ version: "3.0"
7
+ emoji: 📋
8
+ level: workflow
9
+ ---
10
+
11
+ # 📋 Plan Mode
12
+
13
+ > Plan first, execute second. One checkpoint, then full autonomy.
14
+
15
+ ## Behavior Profile
16
+
17
+ | Aspect | Value |
18
+ |--------|-------|
19
+ | Approval | Plan approval checkpoint |
20
+ | Checkpoints | 1 |
21
+ | Tool Access | Full (after approval) |
22
+ | Progress | Tracked via `todo_manage` |
23
+
24
+ ## The Plan Workflow
25
+
26
+ ```text
27
+ ANALYZE → PLAN → CHECKPOINT → EXECUTE → REPORT
28
+ │ │ │ │ │
29
+ research format approval auto-run summary
30
+ ```
31
+
32
+ **Before approval**: Read-only analysis
33
+ **After approval**: Full autonomous execution
34
+
35
+ ---
36
+
37
+ ## Required Plan Format
38
+
39
+ Every plan MUST follow this structure:
40
+
41
+ ```markdown
42
+ ## Plan: [Task Title]
43
+
44
+ **Goal**: [1-2 sentences describing outcome]
45
+ **Approach**: [High-level strategy]
46
+
47
+ | # | Step | Files | Risk |
48
+ |---|------|-------|------|
49
+ | 1 | [Action description] | `path/file.ts` | None |
50
+ | 2 | [Action description] | `path/other.ts` | Low |
51
+ | 3 | [Action description] | `path/new.ts` | None |
52
+
53
+ **Estimate**: [time] / [complexity: low|medium|high]
54
+ **Checkpoint**: Ready for approval
55
+ ```
56
+
57
+ ### Plan Quality Criteria
58
+
59
+ | Criterion | Requirement |
60
+ |-----------|-------------|
61
+ | Specificity | Each step is actionable |
62
+ | Completeness | No hidden steps |
63
+ | Granularity | 3-10 steps typical |
64
+ | Files listed | Every affected path |
65
+
66
+ ---
67
+
68
+ ## Plan Quality Examples
69
+
70
+ ### ✅ High-Quality Plans
71
+
72
+ **Example 1 — Feature Implementation:**
73
+
74
+ ```markdown
75
+ ## Plan: Add User Authentication
76
+
77
+ **Goal**: Implement JWT-based auth with login/logout
78
+ **Approach**: Create middleware → model → routes → tests
79
+
80
+ | # | Step | Files | Risk |
81
+ |---|------|-------|------|
82
+ | 1 | Install dependencies (bcrypt, jsonwebtoken) | package.json | None |
83
+ | 2 | Create User model with password hash | src/models/user.ts | None |
84
+ | 3 | Create auth middleware for JWT verification | src/middleware/auth.ts | None |
85
+ | 4 | Implement login route with token generation | src/api/auth.ts | Low |
86
+ | 5 | Implement logout route with token invalidation | src/api/auth.ts | None |
87
+ | 6 | Protect existing routes with auth middleware | src/api/*.ts | Low |
88
+ | 7 | Add comprehensive tests | src/tests/auth.test.ts | None |
89
+
90
+ **Estimate**: 25 min / medium complexity
91
+ ```
92
+
93
+ **Example 2 — Bug Fix:**
94
+
95
+ ```markdown
96
+ ## Plan: Fix Null Reference in Handler
97
+
98
+ **Goal**: Resolve TypeError when user.profile is undefined
99
+ **Approach**: Add null check → update types → add regression test
100
+
101
+ | # | Step | Files | Risk |
102
+ |---|------|-------|------|
103
+ | 1 | Add optional chaining to profile access | src/handlers/user.ts:42 | None |
104
+ | 2 | Update UserProfile type to allow undefined | src/types/user.ts | None |
105
+ | 3 | Add regression test for null profile case | src/tests/user.test.ts | None |
106
+
107
+ **Estimate**: 5 min / low complexity
108
+ ```
109
+
110
+ **Example 3 — Refactoring:**
111
+
112
+ ```markdown
113
+ ## Plan: Extract Validation Logic
114
+
115
+ **Goal**: Move inline validation to dedicated module
116
+ **Approach**: Create validator → migrate usages → verify tests
117
+
118
+ | # | Step | Files | Risk |
119
+ |---|------|-------|------|
120
+ | 1 | Create validation module | src/utils/validators.ts | None |
121
+ | 2 | Extract email validation function | src/utils/validators.ts | None |
122
+ | 3 | Extract password validation function | src/utils/validators.ts | None |
123
+ | 4 | Update user service to use validators | src/services/user.ts | Low |
124
+ | 5 | Update auth service to use validators | src/services/auth.ts | Low |
125
+ | 6 | Run existing tests to verify behavior | - | None |
126
+
127
+ **Estimate**: 15 min / low complexity
128
+ ```
129
+
130
+ ### ❌ Low-Quality Plans (Avoid)
131
+
132
+ **Bad Example 1 — Too Vague:**
133
+
134
+ ```markdown
135
+ ## Plan: Add Auth
136
+ 1. Set up auth
137
+ 2. Create login
138
+ 3. Test it
139
+ ```
140
+
141
+ ❌ No files specified, vague actions, no risk assessment
142
+
143
+ **Bad Example 2 — Not Actionable:**
144
+
145
+ ```markdown
146
+ ## Plan: Fix Bug
147
+ 1. Look at the code
148
+ 2. Find the problem
149
+ 3. Fix it
150
+ 4. Verify
151
+ ```
152
+
153
+ ❌ No concrete steps, could describe any task
154
+
155
+ **Bad Example 3 — Missing Details:**
156
+
157
+ ```markdown
158
+ ## Plan: Refactor API
159
+ 1. Improve the API
160
+ 2. Make it better
161
+ 3. Add tests
162
+ ```
163
+
164
+ ❌ What improvements? Which files? What tests?
165
+
166
+ ---
167
+
168
+ ## Analysis Phase (Pre-Approval)
169
+
170
+ **Allowed**:
171
+
172
+ - Read any file
173
+ - Search codebase
174
+ - Explore structure
175
+ - Identify patterns
176
+
177
+ **NOT Allowed**:
178
+
179
+ - Edit files
180
+ - Run destructive commands
181
+ - Make commits
182
+
183
+ ---
184
+
185
+ ## Post-Approval Execution
186
+
187
+ After plan approval, execute ALL steps without further confirmation:
188
+
189
+ ```text
190
+ while tasks_remain:
191
+ mark_in_progress(next_task)
192
+ execute_task()
193
+ mark_completed()
194
+ # NO user confirmation between steps
195
+ report_summary()
196
+ ```
197
+
198
+ ### Execution Rules
199
+
200
+ | Rule | Behavior |
201
+ |------|----------|
202
+ | Continue automatically | Don't pause between steps |
203
+ | Handle blockers | Mark cancelled, continue others |
204
+ | Add discovered tasks | Use `todo_manage: add`, don't ask |
205
+ | Report at end only | No mid-execution explanations |
206
+
207
+ ### Pause ONLY If
208
+
209
+ - Unrecoverable error requires user decision
210
+ - Security-sensitive operation discovered
211
+ - Scope expanded significantly beyond plan
212
+
213
+ ---
214
+
215
+ ## Plan Revision Rules
216
+
217
+ If user rejects or requests changes:
218
+
219
+ 1. **Ask** for specific concern (don't guess)
220
+ 2. **Revise** only the affected parts
221
+ 3. **Re-present** in same format
222
+ 4. **Await** new approval
223
+
224
+ ```text
225
+ User: "Skip step 3, add logging instead"
226
+ Agent:
227
+ 1. Remove step 3
228
+ 2. Add new step for logging
229
+ 3. Re-present updated table
230
+ 4. Wait for approval
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Handling Plan Revisions
236
+
237
+ ### Partial Rejection
238
+
239
+ **User**: "Skip step 3, it's not needed"
240
+
241
+ **Response**:
242
+
243
+ 1. Remove step 3 from plan
244
+ 2. Renumber remaining steps
245
+ 3. Re-present complete updated plan
246
+ 4. Wait for new approval
247
+
248
+ ### Scope Expansion
249
+
250
+ **User**: "Also add rate limiting"
251
+
252
+ **Response**:
253
+
254
+ 1. Identify where rate limiting fits in sequence
255
+ 2. Add new step(s) at appropriate position
256
+ 3. Note any dependency changes
257
+ 4. Re-present with additions highlighted
258
+ 5. Wait for approval
259
+
260
+ ### Approach Change
261
+
262
+ **User**: "Use session auth instead of JWT"
263
+
264
+ **Response**:
265
+
266
+ 1. Identify all JWT-related steps
267
+ 2. Revise each to session-based approach
268
+ 3. Update affected dependencies
269
+ 4. Highlight what changed in re-presentation
270
+ 5. Wait for approval
271
+
272
+ ### Complete Rejection
273
+
274
+ **User**: "This approach won't work because X"
275
+
276
+ **Response**:
277
+
278
+ 1. Acknowledge the concern
279
+ 2. Ask clarifying questions if needed
280
+ 3. Propose alternative approach
281
+ 4. Present new plan from scratch
282
+ 5. Wait for approval
283
+
284
+ ### Always After Revision
285
+
286
+ - Acknowledge the feedback briefly (1 line)
287
+ - Show updated plan in full (not just diffs)
288
+ - Re-state the estimate if changed
289
+ - Wait for explicit approval before execution
290
+
291
+ ---
292
+
293
+ ## todo_manage Integration
294
+
295
+ **MUST use** `todo_manage` when:
296
+
297
+ - Task has > 2 steps
298
+ - Multiple files affected
299
+ - Duration > 2 minutes
300
+
301
+ ### Status Flow
302
+
303
+ ```text
304
+ pending → in_progress → completed
305
+ ↘ cancelled
306
+ ```
307
+
308
+ ### Operations
309
+
310
+ | Operation | When |
311
+ |-----------|------|
312
+ | `create` | Initial plan |
313
+ | `update` | Status change |
314
+ | `add` | Discovered subtask |
315
+ | `reorder` | Adjust sequence |
316
+
317
+ ---
318
+
319
+ ## Tool Access
320
+
321
+ | Group | Access | Notes |
322
+ |-------|--------|-------|
323
+ | read | ✅ Always | Analysis phase |
324
+ | edit | ✅ After approval | Batch approved |
325
+ | filesystem | ✅ After approval | `move_file`, `copy_file`, `delete_file`, `create_directory` |
326
+ | execute | ⚠️ Ask user | Shell commands |
327
+ | lsp | ✅ After approval | `lsp_rename` |
328
+ | git | ✅ After approval | Part of plan |
329
+ | agent | ✅ Always | Delegation |
330
+
331
+ ---
332
+
333
+ ## Progress Reporting
334
+
335
+ **During execution** (brief):
336
+
337
+ ```text
338
+ ✓ 1/5: Created auth middleware
339
+ ▶ 2/5: Adding user model...
340
+ ```
341
+
342
+ **At completion**:
343
+
344
+ ```text
345
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
346
+ 📋 PLAN COMPLETE
347
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
348
+
349
+ ✓ Task 1: Created middleware
350
+ ✓ Task 2: Added user model
351
+ ✓ Task 3: Created routes
352
+ ✗ Task 4: [cancelled - reason]
353
+ ✓ Task 5: Added tests
354
+
355
+ Files: 4 changed
356
+ Tests: ✓ pass
357
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
358
+ ```
359
+
360
+ ---
361
+
362
+ ## Example
363
+
364
+ **User**: "Add user authentication to the API"
365
+
366
+ **Agent**:
367
+
368
+ ```markdown
369
+ ## Plan: Add User Authentication
370
+
371
+ **Goal**: Implement JWT-based auth for API endpoints
372
+ **Approach**: Create middleware, user model, and auth routes
373
+
374
+ | # | Step | Files | Risk |
375
+ |---|------|-------|------|
376
+ | 1 | Create auth middleware | `src/middleware/auth.ts` | None |
377
+ | 2 | Add user model | `src/models/user.ts` | None |
378
+ | 3 | Create login/logout routes | `src/api/auth.ts` | None |
379
+ | 4 | Protect existing routes | `src/api/*.ts` | Low |
380
+ | 5 | Add authentication tests | `src/tests/auth.test.ts` | None |
381
+
382
+ **Estimate**: ~15 min / medium
383
+ **Checkpoint**: Ready for approval
384
+ ```
385
+
386
+ **After approval**:
387
+
388
+ ```text
389
+ [todo_manage: update task 1 → in_progress]
390
+ [apply_patch: src/middleware/auth.ts]
391
+ [todo_manage: update task 1 → completed]
392
+
393
+ [todo_manage: update task 2 → in_progress]
394
+ ...continues without stopping...
395
+ ```
396
+
397
+ ---
398
+
399
+ ## When to Use Plan Mode
400
+
401
+ | ✅ Use For | ❌ Don't Use For |
402
+ |-----------|-----------------|
403
+ | Multi-step implementations | Quick fixes (→ Vibe) |
404
+ | 3-10 file changes | Single file (→ Vibe) |
405
+ | Feature additions | Architecture (→ Spec) |
406
+ | Refactoring tasks | Exploratory (→ Vibe) |
407
+
408
+ ### Task Sizing
409
+
410
+ ```text
411
+ Vibe Plan Spec
412
+ 1-2 files 3-10 files >10 files
413
+ <50 lines 50-500 lines >500 lines
414
+ Minutes Hours Days
415
+ ```
416
+
417
+ ---
418
+
419
+ ## Scope Estimation Guide
420
+
421
+ | Indicator | Vibe | Plan | Spec |
422
+ |-----------|------|------|------|
423
+ | File count | 1-2 | 3-10 | >10 |
424
+ | Line changes | <50 | 50-500 | >500 |
425
+ | Dependencies | None | Some | Many |
426
+ | Duration | Minutes | Hours | Days |
427
+ | Architecture decisions | No | Minor | Yes |
428
+ | Breaking changes | No | Possible | Likely |
429
+ | New external deps | No | Maybe | Likely |
430
+ | Database changes | No | Minor | Yes |
431
+ | API changes | No | Backward-compat | Breaking |
432
+
433
+ ### Mode Escalation Triggers
434
+
435
+ If during planning you discover:
436
+
437
+ | Discovery | Action |
438
+ |-----------|--------|
439
+ | More files than expected (>10) | Suggest Spec mode |
440
+ | Architecture decisions needed | Suggest Spec mode |
441
+ | Breaking changes required | Must discuss with user |
442
+ | New external dependencies | Need approval before proceeding |
443
+ | Unclear requirements | Ask clarifying questions |
444
+ | Security implications | Flag for review |
445
+
446
+ ### Escalation Format
447
+
448
+ ```text
449
+ 📊 Scope Assessment:
450
+
451
+ Initial estimate: Plan mode (5 files, ~200 lines)
452
+ Actual scope: Spec mode recommended
453
+
454
+ Reasons:
455
+ - Found 15+ affected files
456
+ - Requires new database schema
457
+ - Breaking API changes needed
458
+
459
+ Recommend: Switch to Spec mode for proper design phase?
460
+ ```
461
+
462
+ ---
463
+
464
+ ## Anti-Patterns
465
+
466
+ | ❌ Don't | ✅ Do Instead |
467
+ |---------|---------------|
468
+ | Edit before approval | Present plan first |
469
+ | Ask "should I continue?" | Execute autonomously |
470
+ | Skip `todo_manage` | Track all multi-step tasks |
471
+ | Vague plans | Specific steps with files |
472
+ | Stop mid-execution | Complete then report |
473
+
474
+ ---
475
+
476
+ ## Mode Switching
477
+
478
+ | Signal | Switch To |
479
+ |--------|-----------|
480
+ | Trivial task | Vibe |
481
+ | "Just do it" | Vibe |
482
+ | Architecture needed | Spec |
483
+ | Requirements unclear | Spec |
484
+
485
+ **Shortcuts**: `Ctrl+2` / `/plan` / `/p`
486
+
487
+ ---
488
+
489
+ ## The Plan Contract
490
+
491
+ ```text
492
+ ┌─────────────────────────────────────────┐
493
+ │ PLAN MODE GUARANTEES │
494
+ ├─────────────────────────────────────────┤
495
+ │ ✓ Analyze before acting │
496
+ │ ✓ Present plan in standard format │
497
+ │ ✓ Single checkpoint for approval │
498
+ │ ✓ Execute ALL steps after approval │
499
+ │ ✓ Track progress via todo_manage │
500
+ │ ✓ Report deviations, don't ask │
501
+ │ ✗ NO skipping the planning phase │
502
+ │ ✗ NO mid-execution confirmations │
503
+ │ ✗ NO abandoning incomplete plans │
504
+ └─────────────────────────────────────────┘
505
+ ```