@e0ipso/ai-task-manager 1.36.1 → 1.38.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 (72) hide show
  1. package/README.md +26 -21
  2. package/dist/cli.js +1 -32
  3. package/dist/cli.js.map +1 -1
  4. package/dist/conflict-detector.d.ts.map +1 -1
  5. package/dist/conflict-detector.js +0 -4
  6. package/dist/conflict-detector.js.map +1 -1
  7. package/dist/index.d.ts +3 -16
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +50 -245
  10. package/dist/index.js.map +1 -1
  11. package/dist/metadata.d.ts +9 -0
  12. package/dist/metadata.d.ts.map +1 -1
  13. package/dist/metadata.js +14 -0
  14. package/dist/metadata.js.map +1 -1
  15. package/dist/types.d.ts +18 -18
  16. package/dist/types.d.ts.map +1 -1
  17. package/dist/utils.d.ts +27 -58
  18. package/dist/utils.d.ts.map +1 -1
  19. package/dist/utils.js +93 -219
  20. package/dist/utils.js.map +1 -1
  21. package/package.json +4 -2
  22. package/templates/ai-task-manager/config/TASK_MANAGER.md +3 -3
  23. package/templates/ai-task-manager/config/hooks/PRE_PHASE.md +6 -26
  24. package/templates/ai-task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md +6 -24
  25. package/templates/ai-task-manager/config/templates/PLAN_TEMPLATE.md +1 -1
  26. package/templates/{assistant → harness}/agents/plan-creator.md +2 -2
  27. package/templates/harness/skills/task-create-plan/SKILL.md +120 -0
  28. package/templates/harness/skills/task-create-plan/scripts/find-task-manager-root.cjs +116 -0
  29. package/templates/harness/skills/task-create-plan/scripts/get-next-plan-id.cjs +214 -0
  30. package/templates/harness/skills/task-execute-blueprint/SKILL.md +139 -0
  31. package/templates/harness/skills/task-execute-blueprint/scripts/create-feature-branch.cjs +376 -0
  32. package/templates/harness/skills/task-execute-blueprint/scripts/find-task-manager-root.cjs +116 -0
  33. package/templates/harness/skills/task-execute-blueprint/scripts/validate-plan-blueprint.cjs +375 -0
  34. package/templates/harness/skills/task-execute-task/SKILL.md +195 -0
  35. package/templates/harness/skills/task-execute-task/scripts/check-task-dependencies.cjs +437 -0
  36. package/templates/harness/skills/task-execute-task/scripts/find-task-manager-root.cjs +116 -0
  37. package/templates/harness/skills/task-execute-task/scripts/validate-plan-blueprint.cjs +375 -0
  38. package/templates/harness/skills/task-full-workflow/SKILL.md +378 -0
  39. package/templates/harness/skills/task-full-workflow/scripts/create-feature-branch.cjs +376 -0
  40. package/templates/harness/skills/task-full-workflow/scripts/find-task-manager-root.cjs +116 -0
  41. package/templates/harness/skills/task-full-workflow/scripts/get-next-plan-id.cjs +214 -0
  42. package/templates/harness/skills/task-full-workflow/scripts/get-next-task-id.cjs +312 -0
  43. package/templates/harness/skills/task-full-workflow/scripts/validate-plan-blueprint.cjs +375 -0
  44. package/templates/harness/skills/task-generate-tasks/SKILL.md +244 -0
  45. package/templates/harness/skills/task-generate-tasks/scripts/find-task-manager-root.cjs +116 -0
  46. package/templates/harness/skills/task-generate-tasks/scripts/get-next-task-id.cjs +312 -0
  47. package/templates/harness/skills/task-generate-tasks/scripts/validate-plan-blueprint.cjs +375 -0
  48. package/templates/harness/skills/task-refine-plan/SKILL.md +205 -0
  49. package/templates/harness/skills/task-refine-plan/scripts/find-task-manager-root.cjs +116 -0
  50. package/templates/harness/skills/task-refine-plan/scripts/validate-plan-blueprint.cjs +375 -0
  51. package/dist/exec.d.ts +0 -13
  52. package/dist/exec.d.ts.map +0 -1
  53. package/dist/exec.js +0 -261
  54. package/dist/exec.js.map +0 -1
  55. package/templates/ai-task-manager/config/scripts/check-task-dependencies.cjs +0 -240
  56. package/templates/ai-task-manager/config/scripts/compose-prompt.cjs +0 -234
  57. package/templates/ai-task-manager/config/scripts/create-feature-branch.cjs +0 -204
  58. package/templates/ai-task-manager/config/scripts/extract-task-skills.cjs +0 -84
  59. package/templates/ai-task-manager/config/scripts/find-root.cjs +0 -10
  60. package/templates/ai-task-manager/config/scripts/get-next-plan-id.cjs +0 -49
  61. package/templates/ai-task-manager/config/scripts/get-next-task-id.cjs +0 -81
  62. package/templates/ai-task-manager/config/scripts/shared-utils.cjs +0 -418
  63. package/templates/ai-task-manager/config/scripts/validate-plan-blueprint.cjs +0 -138
  64. package/templates/assistant/commands/tasks/create-plan-auto.md +0 -174
  65. package/templates/assistant/commands/tasks/create-plan.md +0 -175
  66. package/templates/assistant/commands/tasks/execute-blueprint.md +0 -233
  67. package/templates/assistant/commands/tasks/execute-task.md +0 -351
  68. package/templates/assistant/commands/tasks/fix-broken-tests.md +0 -44
  69. package/templates/assistant/commands/tasks/full-workflow.md +0 -849
  70. package/templates/assistant/commands/tasks/generate-tasks.md +0 -348
  71. package/templates/assistant/commands/tasks/refine-plan-auto.md +0 -172
  72. package/templates/assistant/commands/tasks/refine-plan.md +0 -163
@@ -1,348 +0,0 @@
1
- ---
2
- argument-hint: "[planId]"
3
- description: Generate tasks to implement the plan with the provided ID.
4
- ---
5
-
6
- # Comprehensive Task List Creation
7
-
8
- ---
9
-
10
- ## Find the AI Task Manager root
11
-
12
- ```bash
13
- if [ ! -f /tmp/find-ai-task-manager-root.js ]; then
14
- cat << 'EOF' > /tmp/find-ai-task-manager-root.js
15
- const fs = require('fs');
16
- const path = require('path');
17
-
18
- const findRoot = (currentDir) => {
19
- const taskManagerPath = path.join(currentDir, '.ai/task-manager');
20
- const metadataPath = path.join(taskManagerPath, '.init-metadata.json');
21
-
22
- try {
23
- if (fs.existsSync(metadataPath) && JSON.parse(fs.readFileSync(metadataPath, 'utf8')).version) {
24
- console.log(path.resolve(taskManagerPath));
25
- process.exit(0);
26
- }
27
- } catch (e) {
28
- // Continue searching
29
- }
30
-
31
- const parentDir = path.dirname(currentDir);
32
- if (parentDir.length < currentDir.length) {
33
- findRoot(parentDir);
34
- } else {
35
- process.exit(1);
36
- }
37
- };
38
-
39
- findRoot(process.cwd());
40
- EOF
41
- fi
42
-
43
- root=$(node /tmp/find-ai-task-manager-root.js)
44
-
45
- if [ -z "$root" ]; then
46
- echo "Error: Could not find task manager root directory (.ai/task-manager)"
47
- exit 1
48
- fi
49
- ```
50
-
51
- You are a comprehensive task planning assistant. Your role is to create detailed, actionable plans based on user input while ensuring you have all necessary context before proceeding.
52
-
53
- Include `$root/.ai/task-manager/config/TASK_MANAGER.md` for the directory structure of tasks.
54
-
55
- ## Instructions
56
-
57
- You will think hard to analyze the provided plan document and decompose it into atomic, actionable tasks with clear dependencies and groupings.
58
-
59
- Use your internal Todo task tool to track the following process:
60
-
61
- - [ ] Read and process plan $1
62
- - [ ] Use the Task Generation Process to create tasks according to the Task Creation Guidelines
63
- - [ ] Read and run the $root/.ai/task-manager/config/hooks/POST_TASK_GENERATION_ALL.md
64
-
65
- ### Input
66
-
67
- - A plan document. Extract it with the following command.
68
-
69
- ```bash
70
- # Extract validation results directly from script
71
- plan_file=$(node $root/config/scripts/validate-plan-blueprint.cjs $1 planFile)
72
- ```
73
-
74
- ### Input Error Handling
75
- If the plan does not exist. Stop immediately and show an error to the user.
76
-
77
- ### Task Creation Guidelines
78
-
79
- #### Task Minimization Principles
80
- **Core Constraint:** Create only the minimum number of tasks necessary to satisfy the plan requirements. Target a 20-30% reduction from comprehensive task lists by questioning the necessity of each component.
81
-
82
- **Minimization Rules:**
83
- - **Direct Implementation Only**: Create tasks for explicitly stated requirements, not "nice-to-have" features
84
- - **DRY Task Principle**: Each task should have a unique, non-overlapping purpose
85
- - **Question Everything**: For each task, ask "Is this absolutely necessary to meet the plan objectives?"
86
- - **Avoid Gold-plating**: Resist the urge to add comprehensive features not explicitly required
87
-
88
- **Antipatterns to Avoid:**
89
- - Creating separate tasks for "error handling" when it can be included in the main implementation
90
- - Breaking simple operations into multiple tasks (e.g., separate "validate input" and "process input" tasks)
91
- - Adding tasks for "future extensibility" or "best practices" not mentioned in the plan
92
- - Creating comprehensive test suites for trivial functionality
93
-
94
- #### Task Granularity
95
- Each task must be:
96
- - **Single-purpose**: One clear deliverable or outcome
97
- - **Atomic**: Cannot be meaningfully split further
98
- - **Skill-specific**: Executable by a single skill agent (examples below)
99
- - **Verifiable**: Has clear completion criteria
100
-
101
- #### Skill Selection and Technical Requirements
102
-
103
- **Core Principle**: Each task should require 1-2 specific technical skills that can be handled by specialized agents. Skills should be automatically inferred from the task's technical requirements and objectives.
104
-
105
- **Skill Selection Criteria**:
106
- 1. **Technical Specificity**: Choose skills that directly match the technical work required
107
- 2. **Agent Specialization**: Select skills that allow a single skilled agent to complete the task
108
- 3. **Minimal Overlap**: Avoid combining unrelated skill domains in a single task
109
- 4. **Creative Inference**: Derive skills from task objectives and implementation context
110
-
111
- **Inspirational Skill Examples** (use kebab-case format):
112
- - Frontend: `react-components`, `css`, `js`, `vue-components`, `html`
113
- - Backend: `api-endpoints`, `database`, `authentication`, `server-config`
114
- - Testing: `jest`, `playwright`, `unit-testing`, `e2e-testing`
115
- - DevOps: `docker`, `github-actions`, `deployment`, `ci-cd`
116
- - Languages: `typescript`, `python`, `php`, `bash`, `sql`
117
- - Frameworks: `nextjs`, `express`, `drupal-backend`, `wordpress-plugins`
118
-
119
- **Automatic Skill Inference Examples**:
120
- - "Create user login form" → `["react-components", "authentication"]`
121
- - "Build REST API for orders" → `["api-endpoints", "database"]`
122
- - "Add Docker deployment" → `["docker", "deployment"]`
123
- - "Write Jest tests for utils" → `["jest"]`
124
-
125
- **Assignment Guidelines**:
126
- - **1 skill**: Focused, single-domain tasks
127
- - **2 skills**: Tasks requiring complementary domains
128
- - **Split if 3+**: Indicates task should be broken down
129
-
130
- ```
131
- # Examples
132
- skills: ["css"] # Pure styling
133
- skills: ["api-endpoints", "database"] # API with persistence
134
- skills: ["react-components", "jest"] # Implementation + testing
135
- ```
136
-
137
- #### Meaningful Test Strategy Guidelines
138
-
139
- **IMPORTANT** Make sure to copy this _Meaningful Test Strategy Guidelines_ section into all the tasks focused on testing, and **also** keep them in mind when generating tasks.
140
-
141
- Your critical mantra for test generation is: "write a few tests, mostly integration".
142
-
143
- **Definition of "Meaningful Tests":**
144
- Tests that verify custom business logic, critical paths, and edge cases specific to the application. Focus on testing YOUR code, not the framework or library functionality.
145
-
146
- **When TO Write Tests:**
147
- - Custom business logic and algorithms
148
- - Critical user workflows and data transformations
149
- - Edge cases and error conditions for core functionality
150
- - Integration points between different system components
151
- - Complex validation logic or calculations
152
-
153
- **When NOT to Write Tests:**
154
- - Third-party library functionality (already tested upstream)
155
- - Framework features (React hooks, Express middleware, etc.)
156
- - Simple CRUD operations without custom logic
157
- - Getter/setter methods or basic property access
158
- - Configuration files or static data
159
- - Obvious functionality that would break immediately if incorrect
160
-
161
- **Test Task Creation Rules:**
162
- - Combine related test scenarios into single tasks (e.g., "Test user authentication flow" not separate tasks for login, logout, validation)
163
- - Focus on integration and critical path testing over unit test coverage
164
- - Avoid creating separate tasks for testing each CRUD operation individually
165
- - Question whether simple functions need dedicated test tasks
166
-
167
- ### Task Generation Process
168
-
169
- #### Step 1: Task Decomposition
170
- 1. Read through the entire plan
171
- 2. Identify all concrete deliverables **explicitly stated** in the plan
172
- 3. Apply minimization principles: question necessity of each potential task
173
- 4. Break each deliverable into atomic tasks (only if genuinely needed)
174
- 5. Ensure no task requires multiple skill sets
175
- 6. Verify each task has clear inputs and outputs
176
- 7. **Minimize test tasks**: Combine related testing scenarios, avoid testing framework functionality
177
- 8. Be very detailed with the "Implementation Notes". This should contain enough detail for a non-thinking LLM model to successfully complete the task. Put these instructions in a collapsible field `<details>`.
178
-
179
- #### Step 2: Dependency Analysis
180
- For each task, identify:
181
- - **Hard dependencies**: Tasks that MUST complete before this can start
182
- - **Soft dependencies**: Tasks that SHOULD complete for optimal execution
183
- - **No circular dependencies**: Validate the dependency graph is acyclic
184
-
185
- Dependency Rule: Task B depends on Task A if:
186
- - B requires output or artifacts from A
187
- - B modifies code created by A
188
- - B tests functionality implemented in A
189
-
190
- #### Step 3: Task Generation
191
-
192
- ##### Frontmatter Structure
193
-
194
- Example:
195
- ```yaml
196
- ---
197
- id: 1
198
- group: "user-authentication"
199
- dependencies: [] # List of task IDs, e.g., [2, 3]
200
- status: "pending" # pending | in-progress | completed | needs-clarification
201
- created: "2024-01-15"
202
- skills: ["react-components", "authentication"] # Technical skills required for this task
203
- # Optional: Include complexity scores for high-complexity tasks or decomposition tracking
204
- # complexity_score: 4.2 # Composite complexity score (only if >4 or decomposed)
205
- # complexity_notes: "Decomposed from original task due to high technical depth"
206
- ---
207
- ```
208
-
209
- The schema for this frontmatter is:
210
- ```json
211
- {
212
- "type": "object",
213
- "required": ["id", "group", "dependencies", "status", "created", "skills"],
214
- "properties": {
215
- "id": {
216
- "type": ["number"],
217
- "description": "Unique identifier for the task. An integer."
218
- },
219
- "group": {
220
- "type": "string",
221
- "description": "Group or category the task belongs to"
222
- },
223
- "dependencies": {
224
- "type": "array",
225
- "description": "List of task IDs this task depends on",
226
- "items": {
227
- "type": ["number"]
228
- }
229
- },
230
- "status": {
231
- "type": "string",
232
- "enum": ["pending", "in-progress", "completed", "needs-clarification"],
233
- "description": "Current status of the task"
234
- },
235
- "created": {
236
- "type": "string",
237
- "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
238
- "description": "Creation date in YYYY-MM-DD format"
239
- },
240
- "skills": {
241
- "type": "array",
242
- "description": "Technical skills required for this task (1-2 skills recommended)",
243
- "items": {
244
- "type": "string",
245
- "pattern": "^[a-z][a-z0-9-]*$"
246
- },
247
- "minItems": 1,
248
- "uniqueItems": true
249
- },
250
- "complexity_score": {
251
- "type": "number",
252
- "minimum": 1,
253
- "maximum": 10,
254
- "description": "Optional: Composite complexity score (include only if >4 or for decomposed tasks)"
255
- },
256
- "complexity_notes": {
257
- "type": "string",
258
- "description": "Optional: Rationale for complexity score or decomposition decisions"
259
- }
260
- },
261
- "additionalProperties": false
262
- }
263
- ```
264
-
265
- ##### Task Body Structure
266
-
267
- Use the task template in $root/.ai/task-manager/config/templates/TASK_TEMPLATE.md
268
-
269
- ##### Task ID Generation
270
-
271
- When creating tasks, you need to determine the next available task ID for the specified plan. Use this bash command to automatically generate the correct ID:
272
-
273
- ```bash
274
- node $root/config/scripts/get-next-task-id.cjs $1
275
- ```
276
-
277
- ### Validation Checklist
278
- Before finalizing, ensure:
279
-
280
- **Core Task Requirements:**
281
- - [ ] Each task has 1-2 appropriate technical skills assigned
282
- - [ ] Skills are automatically inferred from task objectives and technical requirements
283
- - [ ] All dependencies form an acyclic graph
284
- - [ ] Task IDs are unique and sequential
285
- - [ ] Groups are consistent and meaningful
286
- - [ ] Every **explicitly stated** task from the plan is covered
287
- - [ ] No redundant or overlapping tasks
288
-
289
- **Complexity Analysis & Controls:**
290
- - [ ] **Complexity Analysis Complete**: All tasks assessed using 5-dimension scoring
291
- - [ ] **Decomposition Applied**: Tasks with composite score ≥6 have been decomposed or justified
292
- - [ ] **Final Task Complexity**: All final tasks have composite score ≤5 (target ≤4)
293
- - [ ] **Iteration Limits Respected**: No task exceeded 3 decomposition rounds
294
- - [ ] **Minimum Viability**: No tasks decomposed below complexity threshold of 3
295
- - [ ] **Quality Gates Passed**: All decomposed tasks meet enhanced quality criteria
296
- - [ ] **Dependency Integrity**: No circular dependencies or orphaned tasks exist
297
- - [ ] **Error Handling Complete**: All edge cases resolved or escalated appropriately
298
-
299
- **Complexity Documentation Requirements:**
300
- - [ ] **Complexity Scores Documented**: Individual dimension scores recorded for complex tasks
301
- - [ ] **Decomposition History**: Iteration tracking included in `complexity_notes` for decomposed tasks
302
- - [ ] **Validation Status**: All tasks marked with appropriate validation outcomes
303
- - [ ] **Escalation Documentation**: High-complexity tasks have clear escalation notes
304
- - [ ] **Consistency Validated**: Complexity scores align with task descriptions and skills
305
-
306
- **Scope & Quality Control:**
307
- - [ ] **Minimization Applied**: Each task is absolutely necessary (20-30% reduction target)
308
- - [ ] **Test Tasks are Meaningful**: Focus on business logic, not framework functionality
309
- - [ ] **No Gold-plating**: Only plan requirements are addressed
310
- - [ ] **Total Task Count**: Represents minimum viable implementation
311
- - [ ] **Scope Preservation**: Decomposed tasks collectively match original requirements
312
-
313
- **System Reliability:**
314
- - [ ] **Error Conditions Resolved**: No unresolved error states remain
315
- - [ ] **Manual Intervention Flagged**: Complex edge cases properly escalated
316
- - [ ] **Quality Checkpoints**: All validation gates completed successfully
317
- - [ ] **Dependency Graph Validated**: Full dependency analysis confirms acyclic, logical relationships
318
-
319
- ### Error Handling
320
- If the plan lacks sufficient detail:
321
- - Note areas needing clarification
322
- - Create placeholder tasks marked with `status: "needs-clarification"`
323
- - Document assumptions made
324
-
325
- #### Step 4: POST_TASK_GENERATION_ALL hook
326
-
327
- Read and run the $root/.ai/task-manager/config/hooks/POST_TASK_GENERATION_ALL.md
328
-
329
- ### Output Requirements
330
-
331
- **Output Behavior:**
332
-
333
- Provide a concise completion message with task count and location:
334
- - Example: "Task generation complete. Created [count] tasks in `$root/.ai/task-manager/plans/[plan-id]--[name]/tasks/`"
335
-
336
- **CRITICAL - Structured Output for Command Coordination:**
337
-
338
- Always end your output with a standardized summary in this exact format:
339
-
340
- ```
341
- ---
342
- Task Generation Summary:
343
- - Plan ID: [numeric-id]
344
- - Tasks: [count]
345
- - Status: Ready for execution
346
- ```
347
-
348
- This structured output enables automated workflow coordination and must be included even when running standalone.
@@ -1,172 +0,0 @@
1
- <!-- Based on refine-plan.md — keep in sync with changes to the original. -->
2
- ---
3
- argument-hint: "[planId]"
4
- description: Review and refine a plan without user interaction, resolving ambiguities autonomously.
5
- ---
6
- # Plan Review and Refinement (Autonomous Mode)
7
-
8
- You are a strategic planning specialist who specializes in interrogating existing plans, uncovering blind spots, and
9
- refining the document so that task generators receive the clearest possible instructions. Treat the current plan as the
10
- work product of another assistant: your responsibility is to pressure test it, resolve any missing information
11
- autonomously, and update the plan with the refinements. Use the plan-creator sub-agent for this if it is available.
12
-
13
- **AUTONOMOUS MODE**: This command runs without user interaction. You must resolve all ambiguities by inspecting the
14
- codebase, documentation, and project context. Do NOT ask the user any questions or wait for user input at any point.
15
-
16
- ---
17
-
18
- Use tools for the plan refinement. You are encouraged to write your own specialized tools to research, analyze, and
19
- debug any plan refinement. You are not restricted to the stack of the current project to create your own specialized
20
- tools.
21
-
22
- ## Find the AI Task Manager root
23
-
24
- ```bash
25
- if [ ! -f /tmp/find-ai-task-manager-root.js ]; then
26
- cat << 'EOF' > /tmp/find-ai-task-manager-root.js
27
- const fs = require('fs');
28
- const path = require('path');
29
-
30
- const findRoot = (currentDir) => {
31
- const taskManagerPath = path.join(currentDir, '.ai/task-manager');
32
- const metadataPath = path.join(taskManagerPath, '.init-metadata.json');
33
-
34
- try {
35
- if (fs.existsSync(metadataPath) && JSON.parse(fs.readFileSync(metadataPath, 'utf8')).version) {
36
- console.log(path.resolve(taskManagerPath));
37
- process.exit(0);
38
- }
39
- } catch (e) {
40
- // Continue searching
41
- }
42
-
43
- const parentDir = path.dirname(currentDir);
44
- if (parentDir.length < currentDir.length) {
45
- findRoot(parentDir);
46
- } else {
47
- process.exit(1);
48
- }
49
- };
50
-
51
- findRoot(process.cwd());
52
- EOF
53
- fi
54
-
55
- root=$(node /tmp/find-ai-task-manager-root.js)
56
-
57
- if [ -z "$root" ]; then
58
- echo "Error: Could not find task manager root directory (.ai/task-manager)"
59
- exit 1
60
- fi
61
- ```
62
-
63
- Include `$root/.ai/task-manager/config/TASK_MANAGER.md` to understand the plan directory structure and naming conventions.
64
-
65
- ## Inputs
66
- - **Plan ID**: `$1` (required)
67
- - **Optional refinement notes**: Either provided as additional command arguments or in the conversation. Treat them as constraints that must be reflected in the refined plan.
68
-
69
- If the plan ID is missing, immediately stop and show an error explaining correct usage.
70
-
71
- ### Plan Discovery and Validation
72
-
73
- Obtain the plan using the plan ID:
74
-
75
- ```bash
76
- # Extract validation results directly from script
77
- plan_file=$(node $root/config/scripts/validate-plan-blueprint.cjs $1 planFile)
78
- ```
79
-
80
- ## Process Checklist
81
-
82
- Use your internal Todo tool to track the entire refinement workflow:
83
-
84
- - [ ] Load `$root/.ai/task-manager/config/hooks/PRE_PLAN.md`
85
- - [ ] Stage 1: Baseline Review
86
- - [ ] Stage 2: Autonomous Clarification
87
- - [ ] Stage 3: Refinement Implementation
88
- - [ ] Review the existing plan end-to-end (frontmatter, clarifications, architecture, risks, etc.)
89
- - [ ] Surface strengths, contradictions, and potential risks, without updating the plan
90
- - [ ] Use the "Autonomous Clarification Algorithm" to resolve gaps via codebase inspection
91
- - [ ] Apply refinements using `$root/.ai/task-manager/config/templates/PLAN_TEMPLATE.md` as the structural baseline
92
- - [ ] Update the "Plan Clarifications" table with findings and assumptions
93
- - [ ] Update the plan file (stored in `plan_file`) with the refinements from steps above
94
- - [ ] Re-run `$root/.ai/task-manager/config/hooks/POST_PLAN.md`
95
-
96
- ## Stage 1: Baseline Review
97
-
98
- 1. Capture key metadata (plan title, summary, creation date, related initiatives).
99
- 2. Provide a concise plan overview for the user and highlight the strongest sections.
100
-
101
- ## Stage 2: Autonomous Clarification
102
-
103
- - Use the "Autonomous Clarification Algorithm" below to resolve gaps without user input
104
- - Record findings in the "Plan Clarifications" section using the existing format (table with question/answer pairs), marking the source as "auto-resolved" or "assumption"
105
- - For truly unresolvable questions, record them as unresolved with mitigation notes so downstream assistants know the risk
106
-
107
- ### Autonomous Clarification Algorithm
108
-
109
- Think harder before flagging gaps—only document concrete uncertainties you can cite.
110
-
111
- 1. Ask yourself: **"Are there any aspects of the plan that could benefit from further clarification?"** Identify gaps using these lenses:
112
- - **Context gaps**: missing background, assumptions, competing priorities.
113
- - **Technical gaps**: underspecified architecture, unclear interfaces, missing diagrams.
114
- - **Risk gaps**: untracked risks, missing mitigations, hand-wavy success metrics.
115
- - **Scope issues**: gold-plating, ambiguous boundaries, requirements that contradict YAGNI.
116
- 2. Document each gap with `{section, issue, severity, proposed fix}` so you can reference it when refining the plan.
117
- 3. For each gap, attempt to resolve it by:
118
- - Inspecting the codebase, configuration files, and documentation
119
- - Analyzing existing patterns and conventions in the project
120
- - Reviewing assistant documents (CLAUDE.md, GEMINI.md, AGENTS.md) and README files
121
- - Making reasonable assumptions based on common practices and project context
122
- 4. Record all resolutions and assumptions in the Plan Clarifications table with clear rationale. Mark each entry's source as either "auto-resolved" (confirmed via codebase) or "assumption" (best-effort guess).
123
- 5. If no gaps remain (or all have been resolved/documented), proceed directly to Stage 3.
124
-
125
- CRITICAL: Do NOT ask the user any questions. Do NOT wait for user input. Resolve all ambiguity through codebase analysis and documented assumptions.
126
-
127
- ```mermaid
128
- flowchart TD
129
- A[Inspect current plan] --> B{Need more clarification?}
130
- B -- No --> C[End · proceed with refinement]
131
- B -- Yes --> D[Attempt to resolve via codebase inspection]
132
- D --> E{Resolved?}
133
- E -- Yes --> F[Record as auto-resolved]
134
- E -- No --> G[Record assumption with rationale]
135
- F --> B
136
- G --> B
137
- ```
138
-
139
- ## Stage 3: Refinement Implementation
140
-
141
- Once you have sufficient context (or have documented the missing context), refine the plan directly in-place:
142
-
143
- 1. **Maintain Identity**: Keep the existing `id` and directory. Do not create a new plan ID.
144
- 2. **Structure Compliance**: Ensure the plan still follows `$root/.ai/task-manager/config/templates/PLAN_TEMPLATE.md`. Add missing sections if necessary.
145
- 3. **Content Updates**:
146
- - Refresh the executive summary to reflect clarifications and new insights.
147
- - Update architectural sections, diagrams, and risk mitigations to resolve the identified gaps.
148
- - Trim any scope creep that is not explicitly required.
149
- - Clearly reference clarifications in the relevant plan sections (e.g., italicized notes that point back to the Q&A table).
150
- 4. **Net-New Sections**: If the plan needs a new subsection (e.g., Decision Log, Data Contracts), add it under `Notes` with a clearly labeled section so it remains discoverable.
151
- 5. **Change Log**: Append a bullet list in the `Notes` section that briefly states what changed in this refinement session (e.g., `- 2025-03-16: Clarified auth flow tokens and updated architecture diagram`).
152
- 6. **Validation Hooks**: Execute `$root/.ai/task-manager/config/hooks/POST_PLAN.md` to ensure the refined plan still meets quality bars.
153
-
154
- ## Output Requirements
155
-
156
- 1. Present a concise "Refinement Report" to the user containing:
157
- - Snapshot of the updated plan summary (title, summary line, plan path).
158
- - Key clarifications added (with links to sections if applicable).
159
- - Major improvements and remaining open questions (if any).
160
- 2. Ensure the plan file on disk is fully updated before finishing.
161
-
162
- ## Structured Output (MANDATORY)
163
-
164
- Always end with the standardized summary so orchestrators can chain commands:
165
-
166
- ```
167
- ---
168
-
169
- Plan Refinement Summary:
170
- - Plan ID: [numeric-id]
171
- - Plan File: [full-path-to-plan-file]
172
- ```
@@ -1,163 +0,0 @@
1
- ---
2
- argument-hint: "[planId]"
3
- description: Review the plan with the provided ID, gather clarifications, and refine it.
4
- ---
5
- # Plan Review and Refinement
6
-
7
- You are a strategic planning specialist who specializes in interrogating existing plans, uncovering blind spots, and
8
- refining the document so that task generators receive the clearest possible instructions. Treat the current plan as the
9
- work product of another assistant: your responsibility is to pressure test it, request any missing information from the
10
- user, and update the plan with the refinements. Use the plan-creator sub-agent for this if it is available.
11
-
12
- ---
13
-
14
- Use tools for the plan refinement. You are encouraged to write your own specialized tools to research, analyze, and
15
- debug any plan refinement. You are not restricted to the stack of the current project to create your own specialized
16
- tools.
17
-
18
- ## Find the AI Task Manager root
19
-
20
- ```bash
21
- if [ ! -f /tmp/find-ai-task-manager-root.js ]; then
22
- cat << 'EOF' > /tmp/find-ai-task-manager-root.js
23
- const fs = require('fs');
24
- const path = require('path');
25
-
26
- const findRoot = (currentDir) => {
27
- const taskManagerPath = path.join(currentDir, '.ai/task-manager');
28
- const metadataPath = path.join(taskManagerPath, '.init-metadata.json');
29
-
30
- try {
31
- if (fs.existsSync(metadataPath) && JSON.parse(fs.readFileSync(metadataPath, 'utf8')).version) {
32
- console.log(path.resolve(taskManagerPath));
33
- process.exit(0);
34
- }
35
- } catch (e) {
36
- // Continue searching
37
- }
38
-
39
- const parentDir = path.dirname(currentDir);
40
- if (parentDir.length < currentDir.length) {
41
- findRoot(parentDir);
42
- } else {
43
- process.exit(1);
44
- }
45
- };
46
-
47
- findRoot(process.cwd());
48
- EOF
49
- fi
50
-
51
- root=$(node /tmp/find-ai-task-manager-root.js)
52
-
53
- if [ -z "$root" ]; then
54
- echo "Error: Could not find task manager root directory (.ai/task-manager)"
55
- exit 1
56
- fi
57
- ```
58
-
59
- Include `$root/.ai/task-manager/config/TASK_MANAGER.md` to understand the plan directory structure and naming conventions.
60
-
61
- ## Inputs
62
- - **Plan ID**: `$1` (required)
63
- - **Optional refinement notes**: Either provided as additional command arguments or in the conversation. Treat them as constraints that must be reflected in the refined plan.
64
-
65
- If the plan ID is missing, immediately stop and show an error explaining correct usage.
66
-
67
- ### Plan Discovery and Validation
68
-
69
- Obtain the plan using the plan ID:
70
-
71
- ```bash
72
- # Extract validation results directly from script
73
- plan_file=$(node $root/config/scripts/validate-plan-blueprint.cjs $1 planFile)
74
- ```
75
-
76
- ## Process Checklist
77
-
78
- Use your internal Todo tool to track the entire refinement workflow:
79
-
80
- - [ ] Load `$root/.ai/task-manager/config/hooks/PRE_PLAN.md`
81
- - [ ] Stage 1: Baseline Review
82
- - [ ] Stage 2: Clarification Loop
83
- - [ ] Stage 3: Refinement Implementation
84
- - [ ] Review the existing plan end-to-end (frontmatter, clarifications, architecture, risks, etc.)
85
- - [ ] Surface strengths, contradictions, and potential risks, without updating the plan
86
- - [ ] Use the "Total Clarification Algorithm" to get the missing clarification from the user
87
- - [ ] Apply refinements using `$root/.ai/task-manager/config/templates/PLAN_TEMPLATE.md` as the structural baseline
88
- - [ ] Update the "Plan Clarifications" table with the latest Q&A
89
- - [ ] Update the plan file (stored in `plan_file`) with the refinements from steps above
90
- - [ ] Re-run `$root/.ai/task-manager/config/hooks/POST_PLAN.md`
91
-
92
- ## Stage 1: Baseline Review
93
-
94
- 1. Capture key metadata (plan title, summary, creation date, related initiatives).
95
- 2. Provide a concise plan overview for the user and highlight the strongest sections.
96
-
97
- ## Stage 2: Clarification Loop
98
-
99
- - Use the "Total Clarification Algorithm" to get the missing clarification from the user
100
- - After receiving answers, append them to the "Plan Clarifications" section in the plan Markdown using the existing format (table with question/answer pairs).
101
- - If the user cannot answer, record the unresolved questions along with mitigation notes so downstream assistants know the risk.
102
-
103
- ### Total Clarification Algorithm
104
-
105
- Think harder before interrupting the user—only trigger this loop when you can cite concrete uncertainties.
106
-
107
- 1. Ask yourself: **“Are there any aspects of the plan that could benefit from further clarification?”** Identify gaps using these lenses:
108
- - **Context gaps**: missing background, assumptions, competing priorities.
109
- - **Technical gaps**: underspecified architecture, unclear interfaces, missing diagrams.
110
- - **Risk gaps**: untracked risks, missing mitigations, hand-wavy success metrics.
111
- - **Scope issues**: gold-plating, ambiguous boundaries, requirements that contradict YAGNI.
112
- 2. Document each gap with `{section, issue, severity, proposed fix}` so you can reference it when refining the plan.
113
- 3. If the answer is **No**, stop here and continue refining the plan with the context already available.
114
- 4. If the answer is **Yes**:
115
- - Build a clarification packet grouped by theme.
116
- - Prefill each question with the most plausible answer so the user can confirm/deny quickly.
117
- - Always include an **“Other / open-ended”** option to capture nuances you did not anticipate.
118
- 5. **STOP AND ASK**: Present the clarification packet to the user. **You must halt execution here and await user input.** Do not simulate the user's response. Do not proceed to Stage 3 until you have received explicit answers.
119
-
120
- ```mermaid
121
- flowchart TD
122
- A[Inspect current plan] --> B{Need more clarification?}
123
- B -- No --> C[End · proceed with refinement]
124
- B -- Yes --> D[Construct Question Packet]
125
- D --> E[STOP · Ask User]
126
- E --> F[Receive Input]
127
- F --> B
128
- ```
129
-
130
- ## Stage 3: Refinement Implementation
131
-
132
- Once you have sufficient context (or have documented the missing context), refine the plan directly in-place:
133
-
134
- 1. **Maintain Identity**: Keep the existing `id` and directory. Do not create a new plan ID.
135
- 2. **Structure Compliance**: Ensure the plan still follows `$root/.ai/task-manager/config/templates/PLAN_TEMPLATE.md`. Add missing sections if necessary.
136
- 3. **Content Updates**:
137
- - Refresh the executive summary to reflect clarifications and new insights.
138
- - Update architectural sections, diagrams, and risk mitigations to resolve the identified gaps.
139
- - Trim any scope creep that is not explicitly required.
140
- - Clearly reference clarifications in the relevant plan sections (e.g., italicized notes that point back to the Q&A table).
141
- 4. **Net-New Sections**: If the plan needs a new subsection (e.g., Decision Log, Data Contracts), add it under `Notes` with a clearly labeled section so it remains discoverable.
142
- 5. **Change Log**: Append a bullet list in the `Notes` section that briefly states what changed in this refinement session (e.g., `- 2025-03-16: Clarified auth flow tokens and updated architecture diagram`).
143
- 6. **Validation Hooks**: Execute `$root/.ai/task-manager/config/hooks/POST_PLAN.md` to ensure the refined plan still meets quality bars.
144
-
145
- ## Output Requirements
146
-
147
- 1. Present a concise "Refinement Report" to the user containing:
148
- - Snapshot of the updated plan summary (title, summary line, plan path).
149
- - Key clarifications added (with links to sections if applicable).
150
- - Major improvements and remaining open questions (if any).
151
- 2. Ensure the plan file on disk is fully updated before finishing.
152
-
153
- ## Structured Output (MANDATORY)
154
-
155
- Always end with the standardized summary so orchestrators can chain commands:
156
-
157
- ```
158
- ---
159
-
160
- Plan Refinement Summary:
161
- - Plan ID: [numeric-id]
162
- - Plan File: [full-path-to-plan-file]
163
- ```