ace-task 0.31.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.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.ace-defaults/nav/protocols/skill-sources/ace-task.yml +19 -0
  3. data/.ace-defaults/nav/protocols/wfi-sources/ace-task.yml +19 -0
  4. data/.ace-defaults/task/config.yml +25 -0
  5. data/CHANGELOG.md +518 -0
  6. data/README.md +52 -0
  7. data/Rakefile +12 -0
  8. data/exe/ace-task +22 -0
  9. data/handbook/guides/task-definition.g.md +156 -0
  10. data/handbook/skills/as-bug-analyze/SKILL.md +26 -0
  11. data/handbook/skills/as-bug-fix/SKILL.md +27 -0
  12. data/handbook/skills/as-task-document-unplanned/SKILL.md +27 -0
  13. data/handbook/skills/as-task-draft/SKILL.md +24 -0
  14. data/handbook/skills/as-task-finder/SKILL.md +27 -0
  15. data/handbook/skills/as-task-plan/SKILL.md +30 -0
  16. data/handbook/skills/as-task-review/SKILL.md +25 -0
  17. data/handbook/skills/as-task-review-questions/SKILL.md +25 -0
  18. data/handbook/skills/as-task-update/SKILL.md +21 -0
  19. data/handbook/skills/as-task-work/SKILL.md +41 -0
  20. data/handbook/templates/task/draft.template.md +166 -0
  21. data/handbook/templates/task/file-modification-checklist.template.md +26 -0
  22. data/handbook/templates/task/technical-approach.template.md +26 -0
  23. data/handbook/workflow-instructions/bug/analyze.wf.md +458 -0
  24. data/handbook/workflow-instructions/bug/fix.wf.md +512 -0
  25. data/handbook/workflow-instructions/task/document-unplanned.wf.md +222 -0
  26. data/handbook/workflow-instructions/task/draft.wf.md +552 -0
  27. data/handbook/workflow-instructions/task/finder.wf.md +22 -0
  28. data/handbook/workflow-instructions/task/plan.wf.md +489 -0
  29. data/handbook/workflow-instructions/task/review-plan.wf.md +144 -0
  30. data/handbook/workflow-instructions/task/review-questions.wf.md +411 -0
  31. data/handbook/workflow-instructions/task/review-work.wf.md +146 -0
  32. data/handbook/workflow-instructions/task/review.wf.md +351 -0
  33. data/handbook/workflow-instructions/task/update.wf.md +118 -0
  34. data/handbook/workflow-instructions/task/work.wf.md +106 -0
  35. data/lib/ace/task/atoms/task_file_pattern.rb +68 -0
  36. data/lib/ace/task/atoms/task_frontmatter_defaults.rb +46 -0
  37. data/lib/ace/task/atoms/task_id_formatter.rb +62 -0
  38. data/lib/ace/task/atoms/task_validation_rules.rb +51 -0
  39. data/lib/ace/task/cli/commands/create.rb +105 -0
  40. data/lib/ace/task/cli/commands/doctor.rb +206 -0
  41. data/lib/ace/task/cli/commands/list.rb +73 -0
  42. data/lib/ace/task/cli/commands/plan.rb +119 -0
  43. data/lib/ace/task/cli/commands/show.rb +58 -0
  44. data/lib/ace/task/cli/commands/status.rb +77 -0
  45. data/lib/ace/task/cli/commands/update.rb +183 -0
  46. data/lib/ace/task/cli.rb +83 -0
  47. data/lib/ace/task/models/task.rb +46 -0
  48. data/lib/ace/task/molecules/path_utils.rb +20 -0
  49. data/lib/ace/task/molecules/subtask_creator.rb +130 -0
  50. data/lib/ace/task/molecules/task_config_loader.rb +92 -0
  51. data/lib/ace/task/molecules/task_creator.rb +115 -0
  52. data/lib/ace/task/molecules/task_display_formatter.rb +221 -0
  53. data/lib/ace/task/molecules/task_doctor_fixer.rb +510 -0
  54. data/lib/ace/task/molecules/task_doctor_reporter.rb +264 -0
  55. data/lib/ace/task/molecules/task_frontmatter_validator.rb +138 -0
  56. data/lib/ace/task/molecules/task_loader.rb +119 -0
  57. data/lib/ace/task/molecules/task_plan_cache.rb +190 -0
  58. data/lib/ace/task/molecules/task_plan_generator.rb +141 -0
  59. data/lib/ace/task/molecules/task_plan_prompt_builder.rb +91 -0
  60. data/lib/ace/task/molecules/task_reparenter.rb +247 -0
  61. data/lib/ace/task/molecules/task_resolver.rb +115 -0
  62. data/lib/ace/task/molecules/task_scanner.rb +129 -0
  63. data/lib/ace/task/molecules/task_structure_validator.rb +154 -0
  64. data/lib/ace/task/organisms/task_doctor.rb +199 -0
  65. data/lib/ace/task/organisms/task_manager.rb +353 -0
  66. data/lib/ace/task/version.rb +7 -0
  67. data/lib/ace/task.rb +37 -0
  68. metadata +197 -0
@@ -0,0 +1,512 @@
1
+ ---
2
+ name: bug/fix
3
+ description: Execute bug fix plan, apply changes, create tests, and verify resolution
4
+ allowed-tools: Read, Edit, Write, Bash, Grep, Glob
5
+ argument-hint: ''
6
+ estimate: 1-2h
7
+ doc-type: workflow
8
+ purpose: fix-bug workflow instruction
9
+ ace-docs:
10
+ last-updated: '2026-03-21'
11
+ ---
12
+
13
+ # Fix Bug Workflow Instruction
14
+
15
+ ## Goal
16
+
17
+ Execute a bug fix based on analysis from the analyze-bug workflow (or user-provided fix plan), apply the necessary code changes, create/update regression tests, and verify that the bug is resolved.
18
+
19
+ ## Prerequisites
20
+
21
+ - Bug analysis completed (via analyze-bug workflow or manual analysis)
22
+ - Fix plan available (from analysis or user-provided)
23
+ - Access to the codebase where the bug exists
24
+ - Development environment set up correctly
25
+ - Tests can be executed locally
26
+
27
+ ## Project Context Loading
28
+
29
+ - Read and follow: `ace-bundle wfi://bundle`
30
+
31
+ **Before starting bug fix:**
32
+
33
+ 1. Check current branch status: `git status`
34
+ 2. Ensure you're on an appropriate branch for the fix
35
+ 3. Verify tests are passing before changes: `ace-test`
36
+ 4. Review the fix plan from analysis phase
37
+
38
+ ## When to Use This Workflow
39
+
40
+ **Use this workflow for:**
41
+
42
+ - Executing a fix plan from analyze-bug workflow
43
+ - Applying user-provided fix instructions
44
+ - Creating regression tests for bugs
45
+ - Verifying bug resolution
46
+
47
+ **NOT for:**
48
+
49
+ - Bug analysis (use analyze-bug workflow first)
50
+ - Test failures without a bug (use fix-tests workflow)
51
+ - Feature development or enhancements
52
+ - Refactoring without specific bugs
53
+
54
+ ## Process Steps
55
+
56
+ ### 1. Load Fix Plan
57
+
58
+ **Check for existing analysis:**
59
+
60
+ ```bash
61
+ # Check for cached analysis
62
+ ls .ace-local/task/bug-analysis/
63
+ ```
64
+
65
+ **If analysis exists:**
66
+
67
+ - Load the analysis.yml from the most recent session
68
+ - Review root cause, affected files, and proposed tests
69
+ - Confirm the fix plan with user if needed
70
+
71
+ **If no analysis exists:**
72
+
73
+ - Ask user for fix plan or run analyze-bug workflow first
74
+ - Gather: affected files, root cause, proposed solution
75
+ - Document the fix approach before proceeding
76
+
77
+ ### 2. Prepare for Fix
78
+
79
+ **Set up the fix branch:**
80
+
81
+ ```bash
82
+ # Check current status
83
+ git status
84
+
85
+ # If not on a fix branch, consider creating one
86
+ git checkout -b fix/[bug-description]
87
+ ```
88
+
89
+ **Verify baseline:**
90
+
91
+ - Run existing tests to ensure they pass
92
+ - Note any pre-existing failures (not related to this fix)
93
+ - Confirm the bug reproduces in current state
94
+
95
+ ### 3. Implement the Fix
96
+
97
+ **For each file in the fix plan:**
98
+
99
+ 1. **Read the file and understand context:**
100
+ - Review surrounding code
101
+ - Understand dependencies
102
+ - Check for similar patterns in codebase
103
+
104
+ 2. **Apply the fix:**
105
+ - Make minimal changes to fix the bug
106
+ - Follow existing code style and patterns
107
+ - Add appropriate error handling
108
+ - Include inline comments only if logic is non-obvious
109
+
110
+ 3. **Review the change:**
111
+ - Verify the fix addresses root cause
112
+ - Check for unintended side effects
113
+ - Ensure backward compatibility if needed
114
+
115
+ **Fix implementation guidelines:**
116
+
117
+ - Fix the root cause, not just symptoms
118
+ - Keep changes focused and minimal
119
+ - Don't refactor unrelated code
120
+ - Maintain existing patterns and style
121
+
122
+ ### 4. Create Regression Tests
123
+
124
+ **Implement proposed tests from analysis:**
125
+
126
+ 1. **Create unit test for the specific bug:**
127
+ ```ruby
128
+ # Example: test/atoms/component_test.rb
129
+ def test_handles_nil_preferences
130
+ # Arrange: Set up condition that caused the bug
131
+ user = User.new(preferences: nil)
132
+
133
+ # Act: Execute the code that was failing
134
+ result = @component.process(user)
135
+
136
+ # Assert: Verify correct behavior
137
+ assert_equal expected_default, result
138
+ end
139
+ ```
140
+
141
+ 2. **Create integration test if needed:**
142
+ ```ruby
143
+ # Example: test/integration/workflow_test.rb
144
+ def test_complete_flow_with_missing_data
145
+ # Test the full workflow that exhibited the bug
146
+ end
147
+ ```
148
+
149
+ **Test requirements:**
150
+
151
+ - **Fail before / pass after**: Verify that the new test fails without the fix applied, then passes after. This confirms the test actually catches the bug.
152
+ - Test must pass with the fix
153
+ - Follow project test patterns and conventions
154
+ - Place tests in appropriate directories per project structure
155
+
156
+ ### 5. Verify the Fix
157
+
158
+ **Run verification sequence:**
159
+
160
+ 1. **Run the specific new tests:**
161
+ ```bash
162
+ # Run just the new test file
163
+ ace-test test/path/to/new_test.rb
164
+ ```
165
+
166
+ 2. **Run related tests:**
167
+ ```bash
168
+ # Run tests for the affected component
169
+ ace-test test/[layer]/[component]_test.rb
170
+ ```
171
+
172
+ 3. **Run full test suite:**
173
+ ```bash
174
+ # Verify no regressions
175
+ ace-test
176
+ ```
177
+
178
+ 4. **Manual verification:**
179
+ - Execute the original reproduction steps
180
+ - Confirm the bug no longer occurs
181
+ - Check related functionality still works
182
+
183
+ **Verification checklist:**
184
+
185
+ - [ ] New tests pass
186
+ - [ ] Related tests pass
187
+ - [ ] Full test suite passes
188
+ - [ ] Bug no longer reproduces manually
189
+ - [ ] No new warnings or errors introduced
190
+
191
+ ### 6. Handle Verification Failures
192
+
193
+ **If new tests fail:**
194
+
195
+ - Review test implementation for correctness
196
+ - Verify fix is complete
197
+ - Check for missing edge cases
198
+
199
+ **If existing tests fail:**
200
+
201
+ - Analyze if failure is expected due to fix
202
+ - Update tests if behavior change is intentional
203
+ - Fix any unintended regressions
204
+
205
+ **If bug still reproduces:**
206
+
207
+ - Review fix implementation
208
+ - Check for multiple root causes
209
+ - Consider if analysis was incomplete
210
+ - Return to analysis phase if needed
211
+
212
+ ### 7. Document the Fix
213
+
214
+ **Update fix documentation:**
215
+
216
+ ```markdown
217
+ ## Fix Applied
218
+
219
+ ### Changes Made
220
+ - `path/to/file1.rb`: [Description of change]
221
+ - `path/to/file2.rb`: [Description of change]
222
+
223
+ ### Tests Added
224
+ - `test/path/test_file.rb`: [Test description]
225
+
226
+ ### Verification Results
227
+ - [ ] All new tests passing
228
+ - [ ] All existing tests passing
229
+ - [ ] Bug no longer reproduces
230
+ - [ ] Manual verification complete
231
+
232
+ ### Notes
233
+ [Any additional context about the fix]
234
+ ```
235
+
236
+ **Clean up analysis cache:**
237
+
238
+ ```bash
239
+ # Optionally archive the analysis
240
+ mv .ace-local/task/bug-analysis/{session} \
241
+ .ace-local/task/bug-analysis/archive/
242
+ ```
243
+
244
+ ## Common Fix Patterns
245
+
246
+ ### 1. Nil/Null Reference Fix
247
+
248
+ **Pattern**: Add nil checks with safe defaults
249
+
250
+ ```ruby
251
+ # Before (bug)
252
+ def get_preference(user)
253
+ user.preferences.theme
254
+ end
255
+
256
+ # After (fix)
257
+ def get_preference(user)
258
+ return DEFAULT_THEME unless user.preferences
259
+ user.preferences.theme || DEFAULT_THEME
260
+ end
261
+ ```
262
+
263
+ **Test**:
264
+ ```ruby
265
+ def test_handles_nil_preferences
266
+ user = User.new(preferences: nil)
267
+ assert_equal DEFAULT_THEME, get_preference(user)
268
+ end
269
+ ```
270
+
271
+ ### 2. Race Condition Fix
272
+
273
+ **Pattern**: Add synchronization or redesign
274
+
275
+ ```ruby
276
+ # Before (bug)
277
+ def update_counter
278
+ @counter += 1
279
+ end
280
+
281
+ # After (fix)
282
+ def update_counter
283
+ @mutex.synchronize { @counter += 1 }
284
+ end
285
+ ```
286
+
287
+ **Test**:
288
+ ```ruby
289
+ def test_concurrent_updates
290
+ threads = 10.times.map { Thread.new { update_counter } }
291
+ threads.each(&:join)
292
+ assert_equal 10, @counter
293
+ end
294
+ ```
295
+
296
+ ### 3. Validation Fix
297
+
298
+ **Pattern**: Add input validation at boundaries
299
+
300
+ ```ruby
301
+ # Before (bug)
302
+ def process(input)
303
+ input.split(',').map(&:to_i)
304
+ end
305
+
306
+ # After (fix)
307
+ def process(input)
308
+ raise ArgumentError, "Input required" if input.nil? || input.empty?
309
+ input.split(',').map(&:to_i)
310
+ end
311
+ ```
312
+
313
+ **Test**:
314
+ ```ruby
315
+ def test_rejects_nil_input
316
+ assert_raises(ArgumentError) { process(nil) }
317
+ end
318
+
319
+ def test_rejects_empty_input
320
+ assert_raises(ArgumentError) { process('') }
321
+ end
322
+ ```
323
+
324
+ ### 4. Error Handling Fix
325
+
326
+ **Pattern**: Add proper error handling and recovery
327
+
328
+ ```ruby
329
+ # Before (bug)
330
+ def fetch_data(url)
331
+ response = HTTP.get(url)
332
+ JSON.parse(response.body)
333
+ end
334
+
335
+ # After (fix)
336
+ def fetch_data(url)
337
+ response = HTTP.get(url)
338
+ raise FetchError, "Failed: #{response.status}" unless response.success?
339
+ JSON.parse(response.body)
340
+ rescue JSON::ParserError => e
341
+ raise FetchError, "Invalid response: #{e.message}"
342
+ end
343
+ ```
344
+
345
+ **Test**:
346
+ ```ruby
347
+ def test_handles_failed_response
348
+ stub_request(:get, url).to_return(status: 500)
349
+ assert_raises(FetchError) { fetch_data(url) }
350
+ end
351
+
352
+ def test_handles_invalid_json
353
+ stub_request(:get, url).to_return(body: "not json")
354
+ assert_raises(FetchError) { fetch_data(url) }
355
+ end
356
+ ```
357
+
358
+ ## Error Handling
359
+
360
+ ### Fix Implementation Issues
361
+
362
+ **Symptom**: Fix causes new test failures
363
+ **Resolution**:
364
+
365
+ 1. Identify which tests fail and why
366
+ 2. Determine if failures are expected behavior changes
367
+ 3. Update tests or adjust fix as needed
368
+ 4. Ensure fix doesn't break unrelated functionality
369
+
370
+ **Symptom**: Fix doesn't resolve the bug
371
+ **Resolution**:
372
+
373
+ 1. Verify the fix was applied correctly
374
+ 2. Check if there are multiple root causes
375
+ 3. Return to analysis phase for deeper investigation
376
+ 4. Consider if reproduction environment differs
377
+
378
+ **Symptom**: Can't create meaningful tests
379
+ **Resolution**:
380
+
381
+ 1. Break down the test into smaller units
382
+ 2. Use mocking/stubbing for external dependencies
383
+ 3. Focus on the specific condition that caused the bug
384
+ 4. Consider integration test if unit test is difficult
385
+
386
+ ### Recovery Procedures
387
+
388
+ If the fix introduces problems:
389
+
390
+ 1. **Revert the changes:**
391
+ ```bash
392
+ git checkout -- path/to/affected/files
393
+ # or
394
+ git reset HEAD~1 # if committed
395
+ ```
396
+
397
+ 2. **Return to analysis:**
398
+ - Review the original analysis
399
+ - Consider alternative fix approaches
400
+ - Gather more context if needed
401
+
402
+ 3. **Seek clarification:**
403
+ - Ask user about expected behavior
404
+ - Clarify edge cases
405
+ - Confirm fix approach before re-implementing
406
+
407
+ ## Output / Success Criteria
408
+
409
+ The fix is complete when:
410
+
411
+ - [ ] **Fix Applied**: All planned changes implemented
412
+ - [ ] **Tests Created**: Regression tests added and passing
413
+ - [ ] **Tests Passing**: Full test suite passes without regressions
414
+ - [ ] **Bug Resolved**: Original bug no longer reproduces
415
+ - [ ] **Documentation Updated**: Fix documented with verification results
416
+
417
+ ## Fix Summary Template
418
+
419
+ Present the fix summary to the user:
420
+
421
+ ```markdown
422
+ ## Bug Fix Complete
423
+
424
+ ### Summary
425
+ [One-sentence description of what was fixed]
426
+
427
+ ### Changes Applied
428
+ | File | Change |
429
+ |------|--------|
430
+ | `path/to/file1.rb` | [Description] |
431
+ | `path/to/file2.rb` | [Description] |
432
+
433
+ ### Tests Added
434
+ | Test | Purpose |
435
+ |------|---------|
436
+ | `test/path/component_test.rb` | [What it validates] |
437
+
438
+ ### Verification Results
439
+ - [x] New tests passing
440
+ - [x] Related tests passing
441
+ - [x] Full test suite passing
442
+ - [x] Bug no longer reproduces
443
+
444
+ ### Ready for Review
445
+ The fix is ready for code review and merge.
446
+ ```
447
+
448
+ ## Usage Example
449
+
450
+ > "I ran `ace-bundle wfi://bug/analyze` earlier and have a fix plan. Please apply the fix for the nil preferences bug."
451
+
452
+ **Response Process:**
453
+
454
+ 1. Load the cached analysis from `.ace-local/task/bug-analysis/`
455
+ 2. Review the fix plan and confirm with user
456
+ 3. Implement the fix in affected files
457
+ 4. Create regression tests as proposed
458
+ 5. Run verification sequence
459
+ 6. Present fix summary
460
+
461
+ ---
462
+
463
+ This workflow ensures bug fixes are properly implemented, tested, and verified to prevent regressions.
464
+
465
+ <documents>
466
+ <template id="fix-summary">
467
+ ## Bug Fix Complete
468
+
469
+ ### Summary
470
+ [One-sentence description of what was fixed]
471
+
472
+ ### Changes Applied
473
+ | File | Change |
474
+ |------|--------|
475
+ | `path/to/file1.rb` | [Description] |
476
+ | `path/to/file2.rb` | [Description] |
477
+
478
+ ### Tests Added
479
+ | Test | Purpose |
480
+ |------|---------|
481
+ | `test/path/component_test.rb` | [What it validates] |
482
+
483
+ ### Verification Results
484
+ - [x] New tests passing
485
+ - [x] Related tests passing
486
+ - [x] Full test suite passing
487
+ - [x] Bug no longer reproduces
488
+
489
+ ### Ready for Review
490
+ The fix is ready for code review and merge.
491
+ </template>
492
+
493
+ <template id="fix-documentation">
494
+ ## Fix Applied
495
+
496
+ ### Changes Made
497
+ - `path/to/file1.rb`: [Description of change]
498
+ - `path/to/file2.rb`: [Description of change]
499
+
500
+ ### Tests Added
501
+ - `test/path/test_file.rb`: [Test description]
502
+
503
+ ### Verification Results
504
+ - [ ] All new tests passing
505
+ - [ ] All existing tests passing
506
+ - [ ] Bug no longer reproduces
507
+ - [ ] Manual verification complete
508
+
509
+ ### Notes
510
+ [Any additional context about the fix]
511
+ </template>
512
+ </documents>
@@ -0,0 +1,222 @@
1
+ ---
2
+ doc-type: workflow
3
+ purpose: Document significant unplanned work
4
+ ace-docs:
5
+ last-updated: '2026-03-21'
6
+ ---
7
+
8
+ # Document Unplanned Work Workflow Instruction
9
+
10
+ ## Goal
11
+
12
+ Document significant work completed during a session that wasn't part of any planned task, creating proper task records for tracking and future reference.
13
+
14
+ ## Prerequisites
15
+
16
+ - Understanding of what constitutes "significant work" worthy of documentation
17
+ - Access to ace-task CLI tool for creating tasks
18
+ - Knowledge of current release cycle and task structure
19
+ - Ability to identify completed work that wasn't previously tracked
20
+
21
+ ## Project Context Loading
22
+
23
+ - Read and follow: `ace-bundle wfi://bundle`
24
+
25
+ ## High-Level Execution Plan
26
+
27
+ ### Planning Steps
28
+
29
+ - [ ] Review all work completed in the current session
30
+ - [ ] Identify changes that constitute "significant work"
31
+ - [ ] Determine if work relates to existing tasks or is completely unplanned
32
+ - [ ] Gather technical details, commit references, and file changes
33
+
34
+ ### Execution Steps
35
+
36
+ - [ ] Create task records for each piece of unplanned work
37
+ - [ ] Document the work as completed (past tense)
38
+ - [ ] Mark all created tasks as "done" status
39
+ - [ ] Include references to commits, issues, or discussions
40
+
41
+ ## Process Steps
42
+
43
+ 1. **Identify Unplanned Work:**
44
+ Review the session to identify work that:
45
+ - Fixed bugs or issues not tracked in tasks
46
+ - Implemented features or improvements ad-hoc
47
+ - Resolved technical debt or refactoring
48
+ - Updated documentation or configuration
49
+ - Made architectural or design decisions
50
+
51
+ **What Constitutes Significant Work:**
52
+ - Changes that affect system behavior or architecture
53
+ - Bug fixes that resolve user-facing issues
54
+ - Performance improvements or optimizations
55
+ - Security fixes or vulnerability patches
56
+ - Documentation updates that clarify important concepts
57
+ - Configuration changes that affect deployment or development
58
+
59
+ **What Doesn't Need Documentation:**
60
+ - Minor typo fixes (unless in critical documentation)
61
+ - Code formatting or style changes
62
+ - Temporary debugging code
63
+ - Experimental changes that were reverted
64
+
65
+ 2. **Create Task Record:**
66
+ For each piece of significant unplanned work:
67
+
68
+ ```bash
69
+ ace-task create --title "[Descriptive title of work completed]" --status done
70
+ ```
71
+
72
+ Example:
73
+ ```bash
74
+ ace-task create --title "Fix invalid Claude tool specifications in command metadata" --status done
75
+ ```
76
+
77
+ 3. **Document the Completed Work:**
78
+ Edit the created task file to document what was done:
79
+
80
+ **Update Status and Metadata:**
81
+ ```yaml
82
+ ---
83
+ id: v.X.X.X+task.NNN
84
+ status: done # Always "done" for completed work
85
+ priority: [high|medium|low] # Based on impact
86
+ estimate: [actual time spent]
87
+ dependencies: [list any related tasks]
88
+ ---
89
+ ```
90
+
91
+ **Structure for Documenting Completed Work:**
92
+
93
+ 4. **Include Technical Details:**
94
+ Document the work with sufficient detail for future reference:
95
+
96
+ - **Issue/Problem**: What prompted this work
97
+ - **Root Cause**: What was discovered during investigation
98
+ - **Solution**: What changes were made
99
+ - **Files Modified**: List of affected files
100
+ - **Testing**: How the fix was validated
101
+ - **References**: Links to commits, PRs, or discussions
102
+
103
+ 5. **Link Dependencies:**
104
+ If the unplanned work relates to other tasks:
105
+ - Add task IDs to the dependencies field
106
+ - Note if this work blocks or unblocks other tasks
107
+ - Reference any follow-up work needed
108
+
109
+ ## Success Criteria
110
+
111
+ - All significant unplanned work from the session is documented
112
+ - Each piece of work has a corresponding task marked as "done"
113
+ - Task documentation includes:
114
+ - Clear description of what was done
115
+ - Technical details and file changes
116
+ - Validation/testing performed
117
+ - References to commits or other artifacts
118
+ - Tasks follow the project's naming and numbering conventions
119
+ - Related tasks are properly linked through dependencies
120
+
121
+ ## Common Patterns
122
+
123
+ ### Bug Fix Documentation
124
+
125
+ When documenting an unplanned bug fix:
126
+ 1. Describe the bug symptoms
127
+ 2. Explain the root cause discovered
128
+ 3. Detail the fix implemented
129
+ 4. List files modified
130
+ 5. Include test commands or validation steps
131
+
132
+ ### Feature Addition Documentation
133
+
134
+ When documenting an unplanned feature:
135
+ 1. Explain why the feature was added
136
+ 2. Describe the implementation approach
137
+ 3. List new files created and existing files modified
138
+ 4. Include usage examples
139
+ 5. Note any documentation updates needed
140
+
141
+ ### Refactoring Documentation
142
+
143
+ When documenting unplanned refactoring:
144
+ 1. Explain what prompted the refactoring
145
+ 2. Describe the before and after structure
146
+ 3. List all files affected
147
+ 4. Note any API or behavior changes
148
+ 5. Include migration steps if applicable
149
+
150
+ ## Usage Example
151
+
152
+ > "We just finished a session where we fixed two issues with the Claude integration that weren't tracked in any tasks. Document this unplanned work."
153
+
154
+ The workflow would:
155
+ 1. Create two new tasks for the fixes
156
+ 2. Document each fix with technical details
157
+ 3. Mark both tasks as done
158
+ 4. Include references to the commits made
159
+
160
+ <documents>
161
+ <template path="dev-handbook/templates/completed-work-documentation.md">
162
+ ## Behavioral Context
163
+
164
+ **Issue**: [Describe the issue or need that prompted this work]
165
+
166
+ **Key Behavioral Requirements**:
167
+ - [What behavior needed to change or be fixed]
168
+ - [What the system should do after the fix]
169
+ - [Any constraints or considerations]
170
+
171
+ ## Objective
172
+
173
+ [One-sentence summary of what was accomplished]
174
+
175
+ ## Scope of Work
176
+
177
+ - [Bullet point summary of changes made]
178
+ - [Another change]
179
+ - [And another]
180
+
181
+ ### Deliverables
182
+
183
+ #### Create
184
+ - [New files created, if any]
185
+
186
+ #### Modify
187
+ - [Files that were modified]
188
+ - [With brief description of changes]
189
+
190
+ #### Delete
191
+ - [Files removed, if any]
192
+
193
+ ## Implementation Summary
194
+
195
+ ### What Was Done
196
+
197
+ - **Problem Identification**: [How the issue was discovered]
198
+ - **Investigation**: [Key findings during analysis]
199
+ - **Solution**: [The approach taken to fix it]
200
+ - **Validation**: [How the fix was tested]
201
+
202
+ ### Technical Details
203
+
204
+ [Include relevant code changes, configuration updates, or architectural decisions]
205
+
206
+ ### Testing/Validation
207
+
208
+ ```bash
209
+ # Commands used to test the fix
210
+ [test command]
211
+ ```
212
+
213
+ **Results**: [What the testing showed]
214
+
215
+ ## References
216
+
217
+ - Commits: [commit hashes and messages]
218
+ - Related issues: [if any]
219
+ - Documentation: [any docs updated]
220
+ - Follow-up needed: [if any]
221
+ </template>
222
+ </documents>