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,458 @@
1
+ ---
2
+ name: bug/analyze
3
+ description: Systematically analyze bugs to identify root cause, reproduction status,
4
+ and fix plan
5
+ allowed-tools: Read, Edit, Write, Bash, Grep, Glob
6
+ argument-hint: ''
7
+ estimate: 1-2h
8
+ doc-type: workflow
9
+ purpose: analyze-bug workflow instruction
10
+ ace-docs:
11
+ last-updated: '2026-03-21'
12
+ ---
13
+
14
+ # Analyze Bug Workflow Instruction
15
+
16
+ ## Goal
17
+
18
+ Systematically analyze bug reports to identify root cause, verify reproduction, propose regression tests, and create a structured fix plan. This workflow focuses on analysis and planning - use the fix-bug workflow for execution.
19
+
20
+ ## Prerequisites
21
+
22
+ - Bug description, error logs, stack traces, or reproduction steps provided
23
+ - Access to the codebase where the bug exists
24
+ - Development environment set up correctly
25
+ - Understanding of the project's testing approach
26
+
27
+ ## Project Context Loading
28
+
29
+ - Read and follow: `ace-bundle wfi://bundle`
30
+
31
+ **Before starting bug analysis:**
32
+
33
+ 1. Check recent changes: `git log --oneline -10`
34
+ 2. Review related code areas mentioned in the bug report
35
+ 3. Understand testing framework: Check `Gemfile`, `package.json`, or `requirements.txt`
36
+ 4. For testing guidelines, use `ace-bundle guide://testing-philosophy` or `ace-bundle guide://mocking-patterns`
37
+
38
+ ## When to Use This Workflow
39
+
40
+ **Use this workflow for:**
41
+
42
+ - Bug reports with error logs, stack traces, or reproduction steps
43
+ - Unexpected behavior in the application
44
+ - Regressions after code changes
45
+ - Intermittent or race condition issues
46
+ - Environment-specific bugs
47
+
48
+ **NOT for:**
49
+
50
+ - Test failures (use fix-tests workflow instead)
51
+ - Feature development or new requirements
52
+ - Performance optimization (unless it's causing bugs)
53
+ - Code refactoring without specific bugs
54
+
55
+ ## Process Steps
56
+
57
+ ### 1. Gather Bug Information
58
+
59
+ **Collect all available bug context:**
60
+
61
+ - Error messages and stack traces
62
+ - Screenshots or screen recordings
63
+ - Reproduction steps
64
+ - Environment details (OS, browser, versions)
65
+ - When the bug started occurring
66
+ - Any recent changes that might be related
67
+
68
+ **If information is missing, ask the user for:**
69
+
70
+ - Exact error message or unexpected behavior
71
+ - Steps to reproduce the issue
72
+ - Expected vs actual behavior
73
+ - Environment where bug occurs
74
+
75
+ ### 2. Initial Analysis
76
+
77
+ **Analyze the bug report:**
78
+
79
+ 1. **Categorize the bug type:**
80
+ - Runtime error (null reference, type error, timeout)
81
+ - Logic error (incorrect calculation, wrong flow)
82
+ - Data error (invalid state, corruption)
83
+ - Integration error (API mismatch, protocol issue)
84
+ - Environment error (configuration, dependency)
85
+
86
+ 2. **Identify affected components:**
87
+ ```bash
88
+ # Search for related code based on error message
89
+ ace-search "[error message or key term]"
90
+
91
+ # Find files related to the component
92
+ ace-search "[component name]" --file
93
+ ```
94
+
95
+ 3. **Review recent changes to affected areas:**
96
+ ```bash
97
+ # Check recent commits for affected files
98
+ git log --oneline -20 -- path/to/affected/files
99
+
100
+ # View specific changes
101
+ git diff HEAD~10 -- path/to/affected/files
102
+ ```
103
+
104
+ ### 3. Reproduction Attempt
105
+
106
+ **Try to reproduce the bug:**
107
+
108
+ 1. **Set up reproduction environment:**
109
+ - Match reported environment as closely as possible
110
+ - Use same data/inputs from bug report
111
+ - Enable verbose logging if available
112
+
113
+ 2. **Execute reproduction steps:**
114
+ - Follow exact steps from bug report
115
+ - Document any deviations or additional context
116
+ - Capture logs and error output
117
+
118
+ 3. **Record reproduction status:**
119
+ - **Confirmed**: Bug reproduces consistently
120
+ - **Intermittent**: Bug reproduces sometimes (note frequency)
121
+ - **Not reproducible**: Bug does not reproduce (request more context)
122
+
123
+ **If bug cannot be reproduced:**
124
+
125
+ - Request additional environment details
126
+ - Ask for more specific reproduction steps
127
+ - Check if bug is environment-specific
128
+ - Look for timing or race conditions
129
+
130
+ ### 4. Root Cause Analysis
131
+
132
+ **Investigate the root cause:**
133
+
134
+ 1. **Trace the execution path:**
135
+ - Start from the error location
136
+ - Work backward through the call stack
137
+ - Identify where the unexpected behavior originates
138
+
139
+ 2. **Analyze the code:**
140
+ ```bash
141
+ # Read the file where error occurs
142
+ # Read related files for context
143
+ # Search for similar patterns in codebase
144
+ ace-search "[pattern from error]" --content
145
+ ```
146
+
147
+ 3. **Identify contributing factors:**
148
+ - Missing validation or error handling
149
+ - Incorrect assumptions about data
150
+ - Race conditions or timing issues
151
+ - External dependency changes
152
+ - Configuration mismatches
153
+
154
+ 4. **Document the root cause:**
155
+ - Primary cause (the direct source of the bug)
156
+ - Contributing factors (conditions that enable the bug)
157
+ - Impact scope (what else might be affected)
158
+
159
+ ### 5. Propose Regression Tests
160
+
161
+ **Design tests to catch this bug:**
162
+
163
+ 1. **Unit test for the specific case:**
164
+ - Test the exact scenario that causes the bug
165
+ - Include edge cases revealed by analysis
166
+ - Test error handling paths
167
+
168
+ 2. **Integration test for the flow:**
169
+ - Test the complete workflow where bug manifests
170
+ - Include related components in scope
171
+ - Verify correct behavior end-to-end
172
+
173
+ 3. **Test considerations:**
174
+ - Use project's existing test patterns
175
+ - Follow framework conventions (RSpec, Jest, pytest, etc.)
176
+ - Consider existing test coverage in the area
177
+
178
+ **Example test proposal format:**
179
+
180
+ ```markdown
181
+ ### Proposed Tests
182
+
183
+ **Unit Test: [test name]**
184
+ - Location: test/[layer]/[component]_test.rb
185
+ - Purpose: Verify [specific behavior] handles [edge case]
186
+ - Scenario: When [condition], expect [result]
187
+
188
+ **Integration Test: [test name]**
189
+ - Location: test/integration/[flow]_test.rb
190
+ - Purpose: Verify [workflow] completes correctly
191
+ - Scenario: Given [setup], when [action], then [verification]
192
+ ```
193
+
194
+ ### 6. Create Fix Plan
195
+
196
+ **Document the fix strategy:**
197
+
198
+ 1. **Files to modify:**
199
+ - List each file that needs changes
200
+ - Describe the type of change for each
201
+
202
+ 2. **Fix approach:**
203
+ - Describe the technical solution
204
+ - Explain why this approach was chosen
205
+ - Note any alternative approaches considered
206
+
207
+ 3. **Risks and side effects:**
208
+ - What else might be affected by the fix
209
+ - Potential regressions to watch for
210
+ - Backward compatibility considerations
211
+
212
+ 4. **Rollback plan:**
213
+ - How to revert if issues arise
214
+ - What to check after reverting
215
+
216
+ ### 7. Save Analysis Results
217
+
218
+ **Cache the analysis for fix-bug workflow:**
219
+
220
+ Create the cache directory and save analysis output:
221
+
222
+ ```bash
223
+ # Create session directory
224
+ mkdir -p .ace-local/task/bug-analysis/{session}
225
+ ```
226
+
227
+ ```yaml
228
+ # .ace-local/task/bug-analysis/{session}/analysis.yml
229
+ root_cause: "Description of root cause"
230
+ repro_status: confirmed | not_reproducible | intermittent
231
+ affected_files:
232
+ - path: path/to/file.rb
233
+ change_summary: "Description of what change is needed"
234
+ proposed_tests:
235
+ - description: "Test case description"
236
+ file: test/path_test.rb
237
+ type: unit | integration
238
+ fix_plan_id: "session-timestamp"
239
+ risks:
240
+ - "Potential side effect description"
241
+ rollback_plan: "How to revert if issues arise"
242
+ ```
243
+
244
+ ## Bug Type Decision Tree
245
+
246
+ **Error Type → Investigation Focus:**
247
+
248
+ - **NullReferenceError / nil** → Check data flow, missing validation
249
+ - **TypeError / ArgumentError** → Check type conversions, API contracts
250
+ - **Timeout / Deadlock** → Check loops, async operations, resource locks
251
+ - **Permission / Access Error** → Check authentication, authorization, file permissions
252
+ - **Network / API Error** → Check connectivity, API changes, error handling
253
+ - **Data Corruption** → Check concurrent access, transaction handling
254
+ - **Environment Error** → Check configuration, dependencies, versions
255
+
256
+ ## Common Bug Patterns
257
+
258
+ ### 1. Nil/Null Reference Bugs
259
+
260
+ **Symptoms**: NoMethodError, NullPointerException, undefined is not a function
261
+ **Investigation**:
262
+
263
+ - Trace where the nil value originates
264
+ - Check if data is optional but treated as required
265
+ - Look for missing initialization or loading
266
+
267
+ **Common fixes**:
268
+
269
+ - Add nil checks with early returns
270
+ - Use safe navigation operators
271
+ - Validate input at boundaries
272
+
273
+ ### 2. Race Condition Bugs
274
+
275
+ **Symptoms**: Intermittent failures, order-dependent results
276
+ **Investigation**:
277
+
278
+ - Identify shared mutable state
279
+ - Check async operation sequencing
280
+ - Look for missing synchronization
281
+
282
+ **Common fixes**:
283
+
284
+ - Add proper locking/synchronization
285
+ - Use immutable data structures
286
+ - Redesign to avoid shared state
287
+
288
+ ### 3. State Management Bugs
289
+
290
+ **Symptoms**: Incorrect values, stale data, unexpected state
291
+ **Investigation**:
292
+
293
+ - Map state transitions
294
+ - Check update propagation
295
+ - Look for side effects
296
+
297
+ **Common fixes**:
298
+
299
+ - Centralize state management
300
+ - Add state validation
301
+ - Implement proper cleanup
302
+
303
+ ### 4. Integration Bugs
304
+
305
+ **Symptoms**: API errors, protocol mismatches, format issues
306
+ **Investigation**:
307
+
308
+ - Compare expected vs actual API behavior
309
+ - Check for version mismatches
310
+ - Review error handling
311
+
312
+ **Common fixes**:
313
+
314
+ - Update API contracts
315
+ - Add compatibility layers
316
+ - Improve error handling
317
+
318
+ ## Output / Success Criteria
319
+
320
+ The analysis is complete when you have:
321
+
322
+ - [ ] **Root Cause Identified**: Clear explanation of why the bug occurs
323
+ - [ ] **Reproduction Status**: Confirmed, intermittent, or not reproducible with evidence
324
+ - [ ] **Affected Files Listed**: All files that may need changes
325
+ - [ ] **Tests Proposed**: Specific test cases that would catch this regression
326
+ - [ ] **Fix Plan Created**: Step-by-step plan for implementing the fix
327
+ - [ ] **Risks Documented**: Potential side effects and rollback strategy
328
+ - [ ] **Analysis Cached**: Results saved for fix-bug workflow
329
+
330
+ ## Analysis Report Template
331
+
332
+ Present the analysis to the user in this format:
333
+
334
+ ```markdown
335
+ ## Bug Analysis Report
336
+
337
+ ### Summary
338
+ [One-sentence description of the bug and root cause]
339
+
340
+ ### Reproduction Status
341
+ **Status**: [Confirmed | Intermittent | Not Reproducible]
342
+ **Evidence**: [Description of reproduction attempt]
343
+
344
+ ### Root Cause
345
+ [Detailed explanation of why the bug occurs]
346
+
347
+ **Primary Cause**: [Direct source of the bug]
348
+ **Contributing Factors**: [Conditions that enable the bug]
349
+
350
+ ### Affected Files
351
+ - `path/to/file1.rb` - [Type of change needed]
352
+ - `path/to/file2.rb` - [Type of change needed]
353
+
354
+ ### Proposed Tests
355
+ 1. **[Test Name]** (unit)
356
+ - File: `test/path_test.rb`
357
+ - Purpose: [What it validates]
358
+
359
+ 2. **[Test Name]** (integration)
360
+ - File: `test/integration/flow_test.rb`
361
+ - Purpose: [What it validates]
362
+
363
+ ### Fix Plan
364
+ 1. [Step 1 description]
365
+ 2. [Step 2 description]
366
+ 3. [Step 3 description]
367
+
368
+ ### Risks
369
+ - [Risk 1]
370
+ - [Risk 2]
371
+
372
+ ### Rollback Plan
373
+ [How to revert if issues arise]
374
+
375
+ ---
376
+ *Run `ace-bundle wfi://bug/fix` to execute this fix plan*
377
+ ```
378
+
379
+ ## Usage Example
380
+
381
+ > "I'm getting a NoMethodError on line 45 of user_service.rb when trying to fetch user preferences. Here's the stack trace: [stack trace]. It happens when the user hasn't set any preferences yet."
382
+
383
+ **Response Process:**
384
+
385
+ 1. Gather context from the error message and stack trace
386
+ 2. Read the affected file and understand the code
387
+ 3. Identify that nil preferences are not handled
388
+ 4. Propose a nil check fix and a test case
389
+ 5. Document the analysis and fix plan
390
+ 6. Cache results for fix-bug workflow
391
+
392
+ ---
393
+
394
+ This workflow provides systematic bug analysis that ensures proper investigation, clear documentation, and actionable fix plans.
395
+
396
+ <documents>
397
+ <template id="analysis-report">
398
+ ## Bug Analysis Report
399
+
400
+ ### Summary
401
+ [One-sentence description of the bug and root cause]
402
+
403
+ ### Reproduction Status
404
+ **Status**: [Confirmed | Intermittent | Not Reproducible]
405
+ **Evidence**: [Description of reproduction attempt]
406
+
407
+ ### Root Cause
408
+ [Detailed explanation of why the bug occurs]
409
+
410
+ **Primary Cause**: [Direct source of the bug]
411
+ **Contributing Factors**: [Conditions that enable the bug]
412
+
413
+ ### Affected Files
414
+ - `path/to/file1.rb` - [Type of change needed]
415
+ - `path/to/file2.rb` - [Type of change needed]
416
+
417
+ ### Proposed Tests
418
+ 1. **[Test Name]** (unit)
419
+ - File: `test/path_test.rb`
420
+ - Purpose: [What it validates]
421
+
422
+ 2. **[Test Name]** (integration)
423
+ - File: `test/integration/flow_test.rb`
424
+ - Purpose: [What it validates]
425
+
426
+ ### Fix Plan
427
+ 1. [Step 1 description]
428
+ 2. [Step 2 description]
429
+ 3. [Step 3 description]
430
+
431
+ ### Risks
432
+ - [Risk 1]
433
+ - [Risk 2]
434
+
435
+ ### Rollback Plan
436
+ [How to revert if issues arise]
437
+
438
+ ---
439
+ *Run `ace-bundle wfi://bug/fix` to execute this fix plan*
440
+ </template>
441
+
442
+ <template id="analysis-yml">
443
+ # .ace-local/task/bug-analysis/{session}/analysis.yml
444
+ root_cause: "Description of root cause"
445
+ repro_status: confirmed | not_reproducible | intermittent
446
+ affected_files:
447
+ - path: path/to/file.rb
448
+ change_summary: "Description of what change is needed"
449
+ proposed_tests:
450
+ - description: "Test case description"
451
+ file: test/path_test.rb
452
+ type: unit | integration
453
+ fix_plan_id: "session-timestamp"
454
+ risks:
455
+ - "Potential side effect description"
456
+ rollback_plan: "How to revert if issues arise"
457
+ </template>
458
+ </documents>