@e0ipso/ai-task-manager 1.8.3 → 1.9.1

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.
package/README.md CHANGED
@@ -16,7 +16,7 @@ Unlike Plandex, Claude Task Master, and Conductor Tasks that require API keys wi
16
16
  ```bash
17
17
  # Initialize for your preferred AI assistant
18
18
  npx @e0ipso/ai-task-manager init --assistants claude
19
- npx @e0ipso/ai-task-manager init --assistants gemini
19
+ npx @e0ipso/ai-task-manager init --assistants gemini
20
20
  npx @e0ipso/ai-task-manager init --assistants opencode
21
21
 
22
22
  # Or configure multiple assistants
@@ -39,7 +39,7 @@ The documentation includes:
39
39
  ## 💡 Quick Workflow Preview
40
40
 
41
41
  1. **📝 Create a plan**: `/tasks:create-plan Create user authentication system`
42
- 2. **📋 Generate tasks**: `/tasks:generate-tasks 1`
42
+ 2. **📋 Generate tasks**: `/tasks:generate-tasks 1`
43
43
  3. **🚀 Execute blueprint**: `/tasks:execute-blueprint 1`
44
44
 
45
45
  ## 🤖 Supported Assistants
@@ -47,7 +47,7 @@ The documentation includes:
47
47
  | Assistant | Interface | Cost Model |
48
48
  |-----------|-----------|------------|
49
49
  | 🎭 **Claude** | [claude.ai/code](https://claude.ai/code) | Your existing subscription |
50
- | 💎 **Gemini** | Gemini CLI | Your existing subscription |
50
+ | 💎 **Gemini** | Gemini CLI | Your existing subscription |
51
51
  | 📝 **Open Code** | Open source | Free |
52
52
 
53
53
  ## 📄 License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e0ipso/ai-task-manager",
3
- "version": "1.8.3",
3
+ "version": "1.9.1",
4
4
  "description": "Task management for AI coding assistants",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,5 +1,24 @@
1
+ # POST_PHASE Hook
2
+
1
3
  Ensure that:
2
4
 
3
5
  - The code base is passing the linting requirements
4
- - All tests are run locally, and they are passing
5
6
  - A descriptive commit (using conventional commits with a subject and a description) for the phase was successfully created.
7
+
8
+ ### Execution Monitoring
9
+
10
+ #### Progress Tracking
11
+
12
+ Update the list of tasks from the plan document to add the status of each task
13
+ and phase. Once a phase has been completed and validated, and before you move to
14
+ the next phase, update the blueprint and add a ✅ emoji in front of its title.
15
+ Add ✔️ emoji in front of all the tasks in that phase, and update their status to
16
+ `completed`.
17
+
18
+ #### Task Status Updates
19
+ Valid status transitions:
20
+ - `pending` → `in-progress` (when agent starts)
21
+ - `in-progress` → `completed` (successful execution)
22
+ - `in-progress` → `failed` (execution error)
23
+ - `failed` → `in-progress` (retry attempt)
24
+
@@ -1,136 +1,3 @@
1
1
  # POST_PLAN Hook
2
2
 
3
3
  This hook provides validation and update procedures to execute after plan creation, ensuring comprehensive context analysis and proper plan document structuring with dependency visualization.
4
-
5
- ## Plan Validation and Clarification
6
-
7
- #### Step 1: Context Analysis
8
- Before creating any plan, analyze the user's request for:
9
- - **Objective**: What is the end goal?
10
- - **Scope**: What are the boundaries and constraints?
11
- - **Resources**: What tools, budget, or team are available?
12
- - **Success Criteria**: How will success be measured?
13
- - **Dependencies**: What prerequisites or blockers exist?
14
- - **Technical Requirements**: What technologies or skills are needed?
15
-
16
- #### Step 2: Clarification Phase
17
- If any critical context is missing:
18
- 1. Identify specific gaps in the information provided
19
- 2. Ask targeted follow-up questions grouped by category
20
- 3. Wait for user responses before proceeding to planning
21
- 4. Frame questions clearly with examples when helpful
22
- 5. Be extra cautious. Users miss important context very often. Don't hesitate to ask for clarifications.
23
-
24
- Example clarifying questions:
25
- - "Q: What is your primary goal with [specific aspect]?"
26
- - "Q: Do you have any existing [resources/code/infrastructure] I should consider?"
27
- - "Q: What is your timeline for completing this?"
28
- - "Q: Are there specific constraints I should account for?"
29
- - "Q: Do you want me to write tests for this?"
30
- - "Q: Are there other systems, projects, or modules that perform a similar task?"
31
-
32
- Try to answer your own questions first by inspecting the codebase, docs, and assistant documents like CLAUDE.md, GEMINI.md, AGENTS.md ...
33
-
34
- ## Update the plan document
35
-
36
- After creating all tasks with their dependencies, update the original plan document with two critical sections: a task dependency visualization and a phase-based execution blueprint.
37
-
38
- ### Section 1: Dependency Visualization
39
-
40
- If any tasks have dependencies, create a Mermaid diagram showing the dependency graph:
41
-
42
- ```mermaid
43
- graph TD
44
- 001[Task 001: Database Schema] --> 002[Task 002: API Endpoints]
45
- 001 --> 003[Task 003: Data Models]
46
- 002 --> 004[Task 004: Frontend Integration]
47
- 003 --> 004
48
- ```
49
-
50
- Note: Ensure the graph is acyclic (no circular dependencies).
51
-
52
- ### Section 2: Phase-Based Execution Blueprint
53
-
54
- #### Core Concept
55
- The execution blueprint organizes tasks into sequential phases where:
56
- - **Within a phase**: All tasks execute in parallel
57
- - **Between phases**: Execution is strictly sequential
58
- - **Phase progression**: Requires all tasks in current phase to complete AND validation gates to pass
59
-
60
- #### Phase Definition Rules
61
- 1. **Phase 1**: Contains all tasks with zero dependencies
62
- 2. **Phase N**: Contains tasks whose dependencies are ALL satisfied by tasks in phases 1 through N-1
63
- 3. **Parallelism Priority**: Maximize the number of tasks that can run simultaneously in each phase
64
- 4. **Completeness**: Every task must be assigned to exactly one phase
65
-
66
- #### Blueprint Structure
67
-
68
- ```markdown
69
- ## Execution Blueprint
70
-
71
- **Validation Gates:**
72
- - Reference: `@.ai/task-manager/config/hooks/POST_PHASE.md`
73
-
74
- ### Phase 1: [Descriptive Phase Name]
75
- **Parallel Tasks:**
76
- - Task 001: [Description]
77
- - Task 005: [Description]
78
- - Task 009: [Description]
79
-
80
- ### Phase 2: [Descriptive Phase Name]
81
- **Parallel Tasks:**
82
- - Task 002: [Description] (depends on: 001)
83
- - Task 003: [Description] (depends on: 001)
84
- - Task 006: [Description] (depends on: 005)
85
-
86
- [Continue for all phases...]
87
-
88
- ### Post-phase Actions
89
-
90
- ### Execution Summary
91
- - Total Phases: X
92
- - Total Tasks: Y
93
- - Maximum Parallelism: Z tasks (in Phase N)
94
- - Critical Path Length: X phases
95
- ```
96
-
97
- ### Validation Requirements
98
-
99
- #### Phase Transition Rules
100
- 1. All tasks in the current phase must have status: "completed"
101
- 2. All validation gates defined in `@.ai/task-manager/config/hooks/POST_PHASE.md` for the current phase must pass
102
- 3. No task in a future phase can begin until these conditions are met
103
-
104
- #### Blueprint Verification
105
- Before finalizing, ensure:
106
- - [ ] Every task appears in exactly one phase
107
- - [ ] No task appears in a phase before all its dependencies
108
- - [ ] Phase 1 contains only tasks with no dependencies
109
- - [ ] Each phase maximizes parallel execution opportunities
110
- - [ ] All phases reference their validation gates
111
- - [ ] The execution summary accurately reflects the blueprint
112
-
113
- ### Important Notes
114
-
115
- #### Parallel Execution
116
- - Tasks within a phase have no interdependencies and can run simultaneously
117
- - This enables efficient resource utilization and faster completion
118
- - AI agents can be assigned to multiple tasks within the same phase
119
-
120
- #### Sequential Phases
121
- - Phases execute in strict numerical order
122
- - Phase N+1 cannot begin until Phase N is fully complete and validated
123
- - This ensures dependency integrity and systematic progress
124
- -
125
-
126
- #### Validation Gates
127
- - Each phase has associated validation criteria defined externally
128
- - Gates ensure quality and correctness before progression
129
- - Failed validations require task remediation before phase completion
130
-
131
- ### Error Handling
132
-
133
- If dependency analysis reveals issues:
134
- - **Circular dependencies**: Document the cycle and mark affected tasks for review
135
- - **Orphaned tasks**: Tasks that cannot be scheduled due to missing dependencies
136
- - **Ambiguous dependencies**: Note assumptions made and flag for clarification
@@ -1,6 +1,11 @@
1
- [Post-task generation validation and refinement]
1
+ # POST_TASK_GENERATION_ALL Hook
2
2
 
3
- ## Step 3.1: Complexity Analysis & Refinement
3
+ After all tasks have been generated use your internal Todo task to execute:
4
+
5
+ - [ ] Complexity Analysis & Refinement
6
+ - [ ] Update plan document with Blueprint information
7
+
8
+ ## Complexity Analysis & Refinement
4
9
 
5
10
  ### Complexity Scoring Matrix (1-10 scale)
6
11
 
@@ -94,3 +99,64 @@ Original: 8.2 → Round 1 → [4.1, 3.8, 4.5] → PASSED
94
99
  - No unresolved errors
95
100
  - Iterations documented
96
101
  - Validation complete
102
+
103
+ ## Update plan document with Blueprint information
104
+
105
+ After creating all tasks with their dependencies, update the original plan document with two critical sections: a task dependency visualization and a phase-based execution blueprint.
106
+
107
+ ### Section 1: Dependency Visualization
108
+
109
+ If any tasks have dependencies, create a Mermaid diagram showing the dependency graph:
110
+
111
+ ```mermaid
112
+ graph TD
113
+ 001[Task 001: Database Schema] --> 002[Task 002: API Endpoints]
114
+ 001 --> 003[Task 003: Data Models]
115
+ 002 --> 004[Task 004: Frontend Integration]
116
+ 003 --> 004
117
+ ```
118
+
119
+ Note: Ensure the graph is acyclic (no circular dependencies).
120
+
121
+ ### Section 2: Phase-Based Execution Blueprint
122
+
123
+ #### Core Concept
124
+ The execution blueprint organizes tasks into sequential phases where:
125
+ - **Within a phase**: All tasks execute in parallel
126
+ - **Between phases**: Execution is strictly sequential
127
+ - **Phase progression**: Requires all tasks in current phase to complete AND validation gates to pass
128
+
129
+ #### Phase Definition Rules
130
+ 1. **Phase 1**: Contains all tasks with zero dependencies
131
+ 2. **Phase N**: Contains tasks whose dependencies are ALL satisfied by tasks in phases 1 through N-1
132
+ 3. **Parallelism Priority**: Maximize the number of tasks that can run simultaneously in each phase
133
+ 4. **Completeness**: Every task must be assigned to exactly one phase
134
+
135
+ #### Blueprint Structure
136
+
137
+ Use the template in .ai/task-manager/config/templates/BLUEPRINT_TEMPLATE.md for the execution blueprint structure.
138
+
139
+ ### Validation Requirements
140
+
141
+ #### Phase Transition Rules
142
+ 1. All tasks in the current phase must have status: "completed"
143
+ 2. All validation gates defined in `/config/hooks/POST_PHASE.md` for the current phase must pass
144
+ 3. No task in a future phase can begin until these conditions are met
145
+
146
+ #### Blueprint Verification
147
+ Before finalizing, ensure:
148
+ - [ ] Every task appears in exactly one phase
149
+ - [ ] No task appears in a phase before all its dependencies
150
+ - [ ] Phase 1 contains only tasks with no dependencies
151
+ - [ ] Each phase maximizes parallel execution opportunities
152
+ - [ ] All phases reference their validation gates
153
+ - [ ] The execution summary accurately reflects the blueprint
154
+
155
+ ### Important Notes
156
+
157
+ ### Error Handling
158
+
159
+ If dependency analysis reveals issues:
160
+ - **Circular dependencies**: Document the cycle and mark affected tasks for review
161
+ - **Orphaned tasks**: Tasks that cannot be scheduled due to missing dependencies
162
+ - **Ambiguous dependencies**: Note assumptions made and flag for clarification
@@ -17,7 +17,7 @@ If there are unstaged changes in the `main` branch, do not create a feature bran
17
17
  ```bash
18
18
  # For each task in current phase
19
19
  for TASK_ID in $PHASE_TASKS; do
20
- if ! node .ai/task-manager/config/scripts/check-task-dependencies.js "$1" "$TASK_ID"; then
20
+ if ! node .ai/task-manager/config/scripts/check-task-dependencies.cjs "$1" "$TASK_ID"; then
21
21
  echo "ERROR: Task $TASK_ID has unresolved dependencies - cannot proceed with phase execution"
22
22
  echo "Please resolve dependencies before continuing with blueprint execution"
23
23
  exit 1
@@ -0,0 +1,43 @@
1
+ # PRE_PLAN Hook
2
+
3
+ This hook provides pre-planning guidance to ensure scope control, simplicity principles, and proper validation requirements are established before comprehensive plan creation.
4
+
5
+ ## Scope Control Guidelines
6
+
7
+ **Critical: Implement ONLY what is explicitly requested**
8
+
9
+ - **Minimal Viable Implementation**: Build exactly what the user asked for, nothing more
10
+ - **Question Everything Extra**: If not directly mentioned by the user, don't add it
11
+ - **Avoid Feature Creep**: Resist the urge to add "helpful" features or "nice-to-have" additions
12
+ - **YAGNI Principle**: _You Aren't Gonna Need It_ - don't build for hypothetical future needs
13
+
14
+ **Common Scope Creep Anti-Patterns to Avoid:**
15
+ 1. Adding extra commands or features "for completeness"
16
+ 2. Creating infrastructure for future features that weren't requested
17
+ 3. Building abstractions or frameworks when simple solutions suffice
18
+ 4. Adding configuration options not specifically mentioned
19
+ 5. Implementing error handling beyond what's necessary for the core request
20
+ 6. Creating documentation or help systems unless explicitly requested
21
+
22
+ **When in doubt, ask**: "Is this feature explicitly mentioned in the user's request?"
23
+
24
+ ## Simplicity Principles
25
+
26
+ **Favor maintainability over cleverness**
27
+
28
+ - **Simple Solutions First**: Choose the most straightforward approach that meets requirements
29
+ - **Avoid Over-Engineering**: Don't create complex systems when simple ones work
30
+ - **Readable Code**: Write code that others can easily understand and modify
31
+ - **Standard Patterns**: Use established patterns rather than inventing new ones
32
+ - **Minimal Dependencies**: Add external dependencies only when essential, but do not re-invent the wheel
33
+ - **Clear Structure**: Organize code in obvious, predictable ways
34
+
35
+ **Remember**: A working simple solution is better than a complex "perfect" one.
36
+
37
+ ## Critical Notes
38
+
39
+ - Never generate a partial or assumed plan without adequate context
40
+ - Prioritize accuracy over speed
41
+ - Consider both technical and non-technical aspects
42
+ - Use the plan template in .ai/task-manager/config/templates/PLAN_TEMPLATE.md
43
+ - DO NOT create or list any tasks or phases during the plan creation. This will be done in a later step. Stick to writing the PRD (Project Requirements Document).
@@ -1,4 +1,4 @@
1
- # Pre-Task Assignment Hook
1
+ # PRE_TASK_ASSIGNMENT Hook
2
2
 
3
3
  This hook executes before task assignment to determine the most appropriate agent for each task based on skill requirements and available sub-agents.
4
4
 
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Script: check-task-dependencies.js
4
+ * Script: check-task-dependencies.cjs
5
5
  * Purpose: Check if a task has all of its dependencies resolved (completed)
6
- * Usage: node check-task-dependencies.js <plan-id> <task-id>
6
+ * Usage: node check-task-dependencies.cjs <plan-id> <task-id>
7
7
  * Returns: 0 if all dependencies are resolved, 1 if not
8
8
  */
9
9
 
@@ -17,7 +17,7 @@ let chalkInstance = null;
17
17
  // Initialize chalk instance dynamically
18
18
  async function initChalk() {
19
19
  if (chalkInstance) return chalkInstance;
20
-
20
+
21
21
  try {
22
22
  const { default: chalk } = await import('chalk');
23
23
  chalkInstance = chalk;
@@ -25,7 +25,7 @@ async function initChalk() {
25
25
  // Chalk not available, will fall back to plain console output
26
26
  chalkInstance = null;
27
27
  }
28
-
28
+
29
29
  return chalkInstance;
30
30
  }
31
31
 
@@ -65,7 +65,7 @@ const findPlanDirectory = (planId) => {
65
65
  // Function to find task file with padded/unpadded ID handling
66
66
  const findTaskFile = (planDir, taskId) => {
67
67
  const taskDir = path.join(planDir, 'tasks');
68
-
68
+
69
69
  if (!fs.existsSync(taskDir)) {
70
70
  return null;
71
71
  }
@@ -76,7 +76,7 @@ const findTaskFile = (planDir, taskId) => {
76
76
  const regex = new RegExp(`^${taskId}--.*\\.md$`);
77
77
  return regex.test(file);
78
78
  });
79
-
79
+
80
80
  if (files.length > 0) {
81
81
  return path.join(taskDir, files[0]);
82
82
  }
@@ -89,7 +89,7 @@ const findTaskFile = (planDir, taskId) => {
89
89
  const regex = new RegExp(`^${paddedTaskId}--.*\\.md$`);
90
90
  return regex.test(file);
91
91
  });
92
-
92
+
93
93
  if (files.length > 0) {
94
94
  return path.join(taskDir, files[0]);
95
95
  }
@@ -103,7 +103,7 @@ const findTaskFile = (planDir, taskId) => {
103
103
  const regex = new RegExp(`^${unpaddedTaskId}--.*\\.md$`);
104
104
  return regex.test(file);
105
105
  });
106
-
106
+
107
107
  if (files.length > 0) {
108
108
  return path.join(taskDir, files[0]);
109
109
  }
@@ -115,7 +115,7 @@ const findTaskFile = (planDir, taskId) => {
115
115
  const regex = new RegExp(`^${repaddedTaskId}--.*\\.md$`);
116
116
  return regex.test(file);
117
117
  });
118
-
118
+
119
119
  if (files.length > 0) {
120
120
  return path.join(taskDir, files[0]);
121
121
  }
@@ -143,7 +143,7 @@ const parseFrontmatter = (content) => {
143
143
  break;
144
144
  }
145
145
  }
146
-
146
+
147
147
  if (inFrontmatter && !frontmatterEnd) {
148
148
  frontmatterLines.push(line);
149
149
  }
@@ -160,11 +160,11 @@ const extractDependencies = (frontmatter) => {
160
160
 
161
161
  for (let i = 0; i < lines.length; i++) {
162
162
  const line = lines[i];
163
-
163
+
164
164
  // Check for dependencies line
165
165
  if (line.match(/^dependencies:/)) {
166
166
  inDependenciesSection = true;
167
-
167
+
168
168
  // Check if dependencies are on the same line (array syntax)
169
169
  const arrayMatch = line.match(/\[(.*)\]/);
170
170
  if (arrayMatch) {
@@ -198,13 +198,13 @@ const extractDependencies = (frontmatter) => {
198
198
  // Function to extract status from frontmatter
199
199
  const extractStatus = (frontmatter) => {
200
200
  const lines = frontmatter.split('\n');
201
-
201
+
202
202
  for (const line of lines) {
203
203
  if (line.match(/^status:/)) {
204
204
  return line.replace(/^status:[ \t]*/, '').replace(/^["']/, '').replace(/["']$/, '').trim();
205
205
  }
206
206
  }
207
-
207
+
208
208
  return null;
209
209
  };
210
210
 
@@ -212,12 +212,12 @@ const extractStatus = (frontmatter) => {
212
212
  const main = async () => {
213
213
  // Initialize chalk
214
214
  const chalk = await initChalk();
215
-
215
+
216
216
  // Check arguments
217
217
  if (process.argv.length !== 4) {
218
218
  printError('Invalid number of arguments', chalk);
219
- console.log('Usage: node check-task-dependencies.js <plan-id> <task-id>');
220
- console.log('Example: node check-task-dependencies.js 16 03');
219
+ console.log('Usage: node check-task-dependencies.cjs <plan-id> <task-id>');
220
+ console.log('Example: node check-task-dependencies.cjs 16 03');
221
221
  process.exit(1);
222
222
  }
223
223
 
@@ -226,7 +226,7 @@ const main = async () => {
226
226
 
227
227
  // Find the plan directory
228
228
  const planDir = findPlanDirectory(planId);
229
-
229
+
230
230
  if (!planDir) {
231
231
  printError(`Plan with ID ${planId} not found`, chalk);
232
232
  process.exit(1);
@@ -10,7 +10,7 @@ const path = require('path');
10
10
  function findTaskManagerRoot() {
11
11
  let currentPath = process.cwd();
12
12
  const root = path.parse(currentPath).root;
13
-
13
+
14
14
  while (currentPath !== root) {
15
15
  const taskManagerPath = path.join(currentPath, '.ai', 'task-manager', 'plans');
16
16
  if (fs.existsSync(taskManagerPath)) {
@@ -18,13 +18,13 @@ function findTaskManagerRoot() {
18
18
  }
19
19
  currentPath = path.dirname(currentPath);
20
20
  }
21
-
21
+
22
22
  // Check root directory as well
23
23
  const rootTaskManager = path.join(root, '.ai', 'task-manager', 'plans');
24
24
  if (fs.existsSync(rootTaskManager)) {
25
25
  return path.join(root, '.ai', 'task-manager');
26
26
  }
27
-
27
+
28
28
  return null;
29
29
  }
30
30
 
@@ -36,9 +36,9 @@ function findTaskManagerRoot() {
36
36
  function extractIdFromFrontmatter(content) {
37
37
  const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
38
38
  if (!frontmatterMatch) return null;
39
-
39
+
40
40
  const frontmatterText = frontmatterMatch[1];
41
-
41
+
42
42
  // Handle various YAML formats for id field using regex:
43
43
  // id: 5
44
44
  // id: "5"
@@ -52,7 +52,7 @@ function extractIdFromFrontmatter(content) {
52
52
  /^\s*id\s*:\s*"(\d+)"\s*$/m, // Double quoted
53
53
  /^\s*id\s*:\s*'(\d+)'\s*$/m, // Single quoted
54
54
  ];
55
-
55
+
56
56
  for (const pattern of patterns) {
57
57
  const match = frontmatterText.match(pattern);
58
58
  if (match) {
@@ -60,7 +60,7 @@ function extractIdFromFrontmatter(content) {
60
60
  if (!isNaN(id)) return id;
61
61
  }
62
62
  }
63
-
63
+
64
64
  return null;
65
65
  }
66
66
 
@@ -70,25 +70,25 @@ function extractIdFromFrontmatter(content) {
70
70
  */
71
71
  function getNextPlanId() {
72
72
  const taskManagerRoot = findTaskManagerRoot();
73
-
73
+
74
74
  if (!taskManagerRoot) {
75
75
  console.error('Error: No .ai/task-manager/plans directory found in current directory or any parent directory.');
76
76
  console.error('Please ensure you are in a project with task manager initialized.');
77
77
  process.exit(1);
78
78
  }
79
-
79
+
80
80
  const plansDir = path.join(taskManagerRoot, 'plans');
81
81
  const archiveDir = path.join(taskManagerRoot, 'archive');
82
-
82
+
83
83
  let maxId = 0;
84
-
84
+
85
85
  // Scan both plans and archive directories
86
86
  [plansDir, archiveDir].forEach(dir => {
87
87
  if (!fs.existsSync(dir)) return;
88
-
88
+
89
89
  try {
90
90
  const entries = fs.readdirSync(dir, { withFileTypes: true });
91
-
91
+
92
92
  entries.forEach(entry => {
93
93
  if (entry.isFile() && entry.name.match(/^plan-\d+--.*\.md$/)) {
94
94
  // Extract ID from filename as fallback
@@ -97,13 +97,13 @@ function getNextPlanId() {
97
97
  const id = parseInt(filenameMatch[1], 10);
98
98
  if (!isNaN(id) && id > maxId) maxId = id;
99
99
  }
100
-
100
+
101
101
  // Also check frontmatter for more reliable ID
102
102
  try {
103
103
  const filePath = path.join(dir, entry.name);
104
104
  const content = fs.readFileSync(filePath, 'utf8');
105
105
  const id = extractIdFromFrontmatter(content);
106
-
106
+
107
107
  if (id !== null && id > maxId) {
108
108
  maxId = id;
109
109
  }
@@ -116,7 +116,7 @@ function getNextPlanId() {
116
116
  // Skip directories that can't be read
117
117
  }
118
118
  });
119
-
119
+
120
120
  return maxId + 1;
121
121
  }
122
122
 
@@ -10,7 +10,7 @@ const path = require('path');
10
10
  function findTaskManagerRoot() {
11
11
  let currentPath = process.cwd();
12
12
  const root = path.parse(currentPath).root;
13
-
13
+
14
14
  while (currentPath !== root) {
15
15
  const taskManagerPath = path.join(currentPath, '.ai', 'task-manager', 'plans');
16
16
  if (fs.existsSync(taskManagerPath)) {
@@ -18,13 +18,13 @@ function findTaskManagerRoot() {
18
18
  }
19
19
  currentPath = path.dirname(currentPath);
20
20
  }
21
-
21
+
22
22
  // Check root directory as well
23
23
  const rootTaskManager = path.join(root, '.ai', 'task-manager', 'plans');
24
24
  if (fs.existsSync(rootTaskManager)) {
25
25
  return path.join(root, '.ai', 'task-manager');
26
26
  }
27
-
27
+
28
28
  return null;
29
29
  }
30
30
 
@@ -36,9 +36,9 @@ function findTaskManagerRoot() {
36
36
  function extractIdFromFrontmatter(content) {
37
37
  const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
38
38
  if (!frontmatterMatch) return null;
39
-
39
+
40
40
  const frontmatterText = frontmatterMatch[1];
41
-
41
+
42
42
  // Handle various YAML formats for id field using regex:
43
43
  // id: 5
44
44
  // id: "5"
@@ -52,7 +52,7 @@ function extractIdFromFrontmatter(content) {
52
52
  /^\s*id\s*:\s*"(\d+)"\s*$/m, // Double quoted
53
53
  /^\s*id\s*:\s*'(\d+)'\s*$/m, // Single quoted
54
54
  ];
55
-
55
+
56
56
  for (const pattern of patterns) {
57
57
  const match = frontmatterText.match(pattern);
58
58
  if (match) {
@@ -60,7 +60,7 @@ function extractIdFromFrontmatter(content) {
60
60
  if (!isNaN(id)) return id;
61
61
  }
62
62
  }
63
-
63
+
64
64
  return null;
65
65
  }
66
66
 
@@ -74,30 +74,30 @@ function getNextTaskId(planId) {
74
74
  console.error('Error: Plan ID is required');
75
75
  process.exit(1);
76
76
  }
77
-
77
+
78
78
  const taskManagerRoot = findTaskManagerRoot();
79
-
79
+
80
80
  if (!taskManagerRoot) {
81
81
  console.error('Error: No .ai/task-manager/plans directory found in current directory or any parent directory.');
82
82
  console.error('Please ensure you are in a project with task manager initialized.');
83
83
  process.exit(1);
84
84
  }
85
-
85
+
86
86
  const plansDir = path.join(taskManagerRoot, 'plans');
87
-
87
+
88
88
  // Find the plan directory (supports both padded and unpadded formats)
89
89
  const paddedPlanId = String(planId).padStart(2, '0');
90
-
90
+
91
91
  let planDir = null;
92
-
92
+
93
93
  // Optimization: 90% of the time there are no tasks, so check if plans directory exists first
94
94
  if (!fs.existsSync(plansDir)) {
95
95
  return 1; // No plans directory = no tasks = start with ID 1
96
96
  }
97
-
97
+
98
98
  try {
99
99
  const entries = fs.readdirSync(plansDir, { withFileTypes: true });
100
-
100
+
101
101
  // Look for directory matching the plan ID pattern
102
102
  for (const entry of entries) {
103
103
  if (entry.isDirectory()) {
@@ -117,29 +117,29 @@ function getNextTaskId(planId) {
117
117
  } catch (err) {
118
118
  // Directory doesn't exist or can't be read
119
119
  }
120
-
120
+
121
121
  // Optimization: If no tasks directory exists, return 1 immediately (90% case)
122
122
  if (!planDir) {
123
123
  return 1;
124
124
  }
125
-
125
+
126
126
  let maxId = 0;
127
-
127
+
128
128
  try {
129
129
  const entries = fs.readdirSync(planDir, { withFileTypes: true });
130
-
130
+
131
131
  // Another optimization: If directory is empty, return 1 immediately
132
132
  if (entries.length === 0) {
133
133
  return 1;
134
134
  }
135
-
135
+
136
136
  entries.forEach(entry => {
137
137
  if (entry.isFile() && entry.name.endsWith('.md')) {
138
138
  try {
139
139
  const filePath = path.join(planDir, entry.name);
140
140
  const content = fs.readFileSync(filePath, 'utf8');
141
141
  const id = extractIdFromFrontmatter(content);
142
-
142
+
143
143
  if (id !== null && id > maxId) {
144
144
  maxId = id;
145
145
  }
@@ -151,7 +151,7 @@ function getNextTaskId(planId) {
151
151
  } catch (err) {
152
152
  // Skip directories that can't be read
153
153
  }
154
-
154
+
155
155
  return maxId + 1;
156
156
  }
157
157
 
@@ -0,0 +1,26 @@
1
+ ## Execution Blueprint
2
+
3
+ **Validation Gates:**
4
+ - Reference: `/config/hooks/POST_PHASE.md`
5
+
6
+ ### Phase 1: [Descriptive Phase Name]
7
+ **Parallel Tasks:**
8
+ - Task 001: [Description]
9
+ - Task 005: [Description]
10
+ - Task 009: [Description]
11
+
12
+ ### Phase 2: [Descriptive Phase Name]
13
+ **Parallel Tasks:**
14
+ - Task 002: [Description] (depends on: 001)
15
+ - Task 003: [Description] (depends on: 001)
16
+ - Task 006: [Description] (depends on: 005)
17
+
18
+ [Continue for all phases...]
19
+
20
+ ### Post-phase Actions
21
+
22
+ ### Execution Summary
23
+ - Total Phases: X
24
+ - Total Tasks: Y
25
+ - Maximum Parallelism: Z tasks (in Phase N)
26
+ - Critical Path Length: X phases
@@ -0,0 +1,13 @@
1
+ ## Execution Summary
2
+
3
+ **Status**: ✅ Completed Successfully
4
+ **Completed Date**: [YYYY-MM-DD]
5
+
6
+ ### Results
7
+ [Brief summary of execution results and key deliverables]
8
+
9
+ ### Noteworthy Events
10
+ [Highlight any unexpected events, challenges overcome, or significant findings during execution. If none occurred, state "No significant issues encountered."]
11
+
12
+ ### Recommendations
13
+ [Any follow-up actions or optimizations identified]
@@ -21,7 +21,7 @@ skills: # Technical skills required for this task
21
21
  - [ ] Criterion 2
22
22
  - [ ] Criterion 3
23
23
 
24
- Use your internal TODO tool to track these and keep on track.
24
+ Use your internal Todo tool to track these and keep on track.
25
25
 
26
26
  ## Technical Requirements
27
27
  [Specific technical details, APIs, libraries, etc. - use this to infer appropriate skills]
@@ -6,7 +6,7 @@ description: Create a comprehensive plan to accomplish the request from the user
6
6
 
7
7
  You are a comprehensive task planning assistant. Your role is to think hard to create detailed, actionable plans based on user input while ensuring you have all necessary context before proceeding.
8
8
 
9
- Include @.ai/task-manager/config/TASK_MANAGER.md for the directory structure of tasks.
9
+ Include .ai/task-manager/config/TASK_MANAGER.md for the directory structure of tasks.
10
10
 
11
11
  ## Instructions
12
12
 
@@ -16,20 +16,47 @@ The user input is:
16
16
  $ARGUMENTS
17
17
  </user-input>
18
18
 
19
- If no user input is provided stop immediately and show an error message to the user:
19
+ If no user input is provided stop immediately and show an error message to the user.
20
20
 
21
21
  ### Process
22
22
 
23
- Use your internal Todo task tool to track the plan generation. Example:
23
+ Use your internal Todo task tool to track the plan generation:
24
24
 
25
+ - [ ] Read and execute .ai/task-manager/config/hooks/PRE_PLAN.md
25
26
  - [ ] User input and context analysis
26
27
  - [ ] Clarification questions
27
28
  - [ ] Plan generation: Executive Summary
28
29
  - [ ] Plan generation: Detailed Steps
29
30
  - [ ] Plan generation: Risk Considerations
30
31
  - [ ] Plan generation: Success Metrics
31
-
32
- Read and execute @.ai/task-manager/config/hooks/POST_PLAN.md
32
+ - [ ] Read and execute .ai/task-manager/config/hooks/POST_PLAN.md
33
+
34
+ #### Step 1: Context Analysis
35
+ Before creating any plan, analyze the user's request for:
36
+ - **Objective**: What is the end goal?
37
+ - **Scope**: What are the boundaries and constraints?
38
+ - **Resources**: What tools, budget, or team are available?
39
+ - **Success Criteria**: How will success be measured?
40
+ - **Dependencies**: What prerequisites or blockers exist?
41
+ - **Technical Requirements**: What technologies or skills are needed?
42
+
43
+ #### Step 2: Clarification Phase
44
+ If any critical context is missing:
45
+ 1. Identify specific gaps in the information provided
46
+ 2. Ask targeted follow-up questions grouped by category
47
+ 3. Wait for user responses before proceeding to planning
48
+ 4. Frame questions clearly with examples when helpful
49
+ 5. Be extra cautious. Users miss important context very often. Don't hesitate to ask for clarifications.
50
+
51
+ Example clarifying questions:
52
+ - "Q: What is your primary goal with [specific aspect]?"
53
+ - "Q: Do you have any existing [resources/code/infrastructure] I should consider?"
54
+ - "Q: What is your timeline for completing this?"
55
+ - "Q: Are there specific constraints I should account for?"
56
+ - "Q: Do you want me to write tests for this?"
57
+ - "Q: Are there other systems, projects, or modules that perform a similar task?"
58
+
59
+ Try to answer your own questions first by inspecting the codebase, docs, and assistant documents like CLAUDE.md, GEMINI.md, AGENTS.md ...
33
60
 
34
61
  #### Step 3: Plan Generation
35
62
  Only after confirming sufficient context, create a plan that includes:
@@ -40,36 +67,6 @@ Only after confirming sufficient context, create a plan that includes:
40
67
 
41
68
  Remember that a plan needs to be reviewed by a human. Be concise and to the point. Also, include mermaid diagrams to illustrate the plan.
42
69
 
43
- ##### Scope Control Guidelines
44
- **Critical: Implement ONLY what is explicitly requested**
45
-
46
- - **Minimal Viable Implementation**: Build exactly what the user asked for, nothing more
47
- - **Question Everything Extra**: If not directly mentioned by the user, don't add it
48
- - **Avoid Feature Creep**: Resist the urge to add "helpful" features or "nice-to-have" additions
49
- - **YAGNI Principle**: _You Aren't Gonna Need It_ - don't build for hypothetical future needs
50
-
51
- **Common Scope Creep Anti-Patterns to Avoid:**
52
- 1. Adding extra commands or features "for completeness"
53
- 2. Creating infrastructure for future features that weren't requested
54
- 3. Building abstractions or frameworks when simple solutions suffice
55
- 4. Adding configuration options not specifically mentioned
56
- 5. Implementing error handling beyond what's necessary for the core request
57
- 6. Creating documentation or help systems unless explicitly requested
58
-
59
- **When in doubt, ask**: "Is this feature explicitly mentioned in the user's request?"
60
-
61
- ##### Simplicity Principles
62
- **Favor maintainability over cleverness**
63
-
64
- - **Simple Solutions First**: Choose the most straightforward approach that meets requirements
65
- - **Avoid Over-Engineering**: Don't create complex systems when simple ones work
66
- - **Readable Code**: Write code that others can easily understand and modify
67
- - **Standard Patterns**: Use established patterns rather than inventing new ones
68
- - **Minimal Dependencies**: Add external dependencies only when essential, but do not re-invent the wheel
69
- - **Clear Structure**: Organize code in obvious, predictable ways
70
-
71
- **Remember**: A working simple solution is better than a complex "perfect" one.
72
-
73
70
  ##### Output Format
74
71
  Structure your response as follows:
75
72
  - If context is insufficient: List specific clarifying questions
@@ -79,7 +76,7 @@ Outside the plan document, be **extremely** concise. Just tell the user that you
79
76
 
80
77
  ###### Plan Template
81
78
 
82
- Use the template in @.ai/task-manager/config/templates/PLAN_TEMPLATE.md
79
+ Use the template in .ai/task-manager/config/templates/PLAN_TEMPLATE.md
83
80
 
84
81
  ###### Patterns to Avoid
85
82
  Do not include the following in your plan output.
@@ -121,18 +118,11 @@ The schema for this frontmatter is:
121
118
  }
122
119
  ```
123
120
 
124
- ### Critical Notes
125
- - Never generate a partial or assumed plan without adequate context
126
- - Prioritize accuracy over speed
127
- - Consider both technical and non-technical aspects
128
- - Use the plan template in .ai/task-manager/config/templates/PLAN_TEMPLATE.md
129
- - DO NOT create or list any tasks or phases during the plan creation. This will be done in a later step. Stick to writing the PRD (Project Requirements Document).
130
-
131
121
  ### Plan ID Generation
132
122
 
133
123
  **Auto-generate the next plan ID:**
134
124
  ```bash
135
- node .ai/task-manager/config/scripts/get-next-plan-id.js
125
+ node .ai/task-manager/config/scripts/get-next-plan-id.cjs
136
126
  ```
137
127
 
138
128
  **Key formatting:**
@@ -15,9 +15,9 @@ You are the orchestrator responsible for executing all tasks defined in the exec
15
15
  5. **Fail safely** - Better to halt and request help than corrupt the execution state
16
16
 
17
17
  ## Input Requirements
18
- - A plan document with an execution blueprint section. See @.ai/task-manager/TASK_MANAGER.md fo find the plan with ID $1
18
+ - A plan document with an execution blueprint section. See /TASK_MANAGER.md fo find the plan with ID $1
19
19
  - Task files with frontmatter metadata (id, group, dependencies, status)
20
- - Validation gates document: `@.ai/task-manager/config/hooks/POST_PHASE.md`
20
+ - Validation gates document: `/config/hooks/POST_PHASE.md`
21
21
 
22
22
  ### Input Error Handling
23
23
  If the plan does not exist, or the plan does not have an execution blueprint section. Stop immediately and show an error to the user.
@@ -27,17 +27,20 @@ If the plan does not exist, or the plan does not have an execution blueprint sec
27
27
  Use your internal Todo task tool to track the execution of all phases, and the final update of the plan with the summary. Example:
28
28
 
29
29
  - [ ] Create feature branch from the main branch.
30
+ - [ ] Execute .ai/task-manager/config/hooks/PRE_PHASE.md hook before Phase 1.
30
31
  - [ ] Phase 1: Execute 1 task(s) in parallel.
31
- - [ ] Execute POST_PHASE.md hook after Phase 1.
32
+ - [ ] Execute .ai/task-manager/config/hooks/POST_PHASE.md hook after Phase 1.
33
+ - [ ] Execute .ai/task-manager/config/hooks/PRE_PHASE.md hook before Phase 2.
32
34
  - [ ] Phase 2: Execute 3 task(s) in parallel.
33
- - [ ] Execute POST_PHASE.md hook after Phase 2.
35
+ - [ ] Execute .ai/task-manager/config/hooks/POST_PHASE.md hook after Phase 2.
36
+ - [ ] Execute .ai/task-manager/config/hooks/PRE_PHASE.md hook before Phase 3.
34
37
  - [ ] Phase 3: Execute 1 task(s) in parallel.
35
- - [ ] Execute POST_PHASE.md hook after Phase 3.
38
+ - [ ] Execute .ai/task-manager/config/hooks/POST_PHASE.md hook after Phase 3.
36
39
  - [ ] Update the Plan 7 with execution summary, and the archive it.
37
40
 
38
41
  ### Phase Pre-Execution
39
42
 
40
- Read and execute @.ai/task-manager/config/hooks/PRE_PHASE.md
43
+ Read and execute .ai/task-manager/config/hooks/PRE_PHASE.md
41
44
 
42
45
  ### Phase Execution Workflow
43
46
 
@@ -46,7 +49,7 @@ Read and execute @.ai/task-manager/config/hooks/PRE_PHASE.md
46
49
  - List all tasks scheduled for parallel execution in this phase
47
50
 
48
51
  2. **Agent Selection and Task Assignment**
49
- Read and execute @.ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
52
+ Read and execute .ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
50
53
 
51
54
  3. **Parallel Execution**
52
55
  - Deploy all selected agents simultaneously using your internal Task tool
@@ -59,38 +62,21 @@ Read and execute @.ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
59
62
  - Collect and review all task outputs
60
63
  - Document any issues or exceptions encountered
61
64
 
62
- 5. **Validation Gate Execution**
63
- - Reference validation criteria from `@.ai/task-manager/config/hooks/POST_PHASE.md`
64
- - Execute all validation gates for the current phase
65
- - Document validation results
66
- - Only proceed if ALL validations pass
65
+ ### Phase Post-Execution
67
66
 
68
- 6. **Phase Transition**
69
- - Update phase status to "completed"
70
- - Initialize next phase
71
- - Repeat process until all phases are complete
67
+ Read and execute .ai/task-manager/config/hooks/POST_PHASE.md
72
68
 
73
- ### Execution Monitoring
74
69
 
75
- #### Progress Tracking
70
+ ### Phase Transition
76
71
 
77
- Update the list of tasks from the plan document to add the status of each task
78
- and phase. Once a phase has been completed and validated, and before you move to
79
- the next phase, update the blueprint and add a ✅ emoji in front of its title.
80
- Add ✔️ emoji in front of all the tasks in that phase, and update their status to
81
- `completed`.
82
-
83
- #### Task Status Updates
84
- Valid status transitions:
85
- - `pending` → `in-progress` (when agent starts)
86
- - `in-progress` → `completed` (successful execution)
87
- - `in-progress` → `failed` (execution error)
88
- - `failed` → `in-progress` (retry attempt)
72
+ - Update phase status to "completed" in the Blueprint section of the plan $1 document.
73
+ - Initialize next phase
74
+ - Repeat process until all phases are complete
89
75
 
90
76
  ### Error Handling
91
77
 
92
78
  #### Validation Gate Failures
93
- Read and execute @.ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
79
+ Read and execute .ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
94
80
 
95
81
  ### Output Requirements
96
82
 
@@ -105,25 +91,12 @@ Read and execute @.ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
105
91
 
106
92
  Upon successful completion of all phases and validation gates, perform the following additional steps:
107
93
 
108
- ### 1. Execution Summary Generation
109
-
110
- Append an execution summary section to the plan document with the following format:
111
-
112
- ```markdown
113
- ## Execution Summary
94
+ - [ ] Execution Summary Generation
95
+ - [ ] Plan Archival
114
96
 
115
- **Status**: Completed Successfully
116
- **Completed Date**: [YYYY-MM-DD]
117
-
118
- ### Results
119
- [Brief summary of execution results and key deliverables]
120
-
121
- ### Noteworthy Events
122
- [Highlight any unexpected events, challenges overcome, or significant findings during execution. If none occurred, state "No significant issues encountered."]
97
+ ### 1. Execution Summary Generation
123
98
 
124
- ### Recommendations
125
- [Any follow-up actions or optimizations identified]
126
- ```
99
+ Append an execution summary section to the plan document with the format described in .ai/task-manager/config/templates/[EXECUTION_SUMMARY_TEMPLATE.md
127
100
 
128
101
  ### 2. Plan Archival
129
102
 
@@ -26,8 +26,8 @@ Use your internal Todo task tool to track the execution of all parts of the task
26
26
  ## Input Requirements
27
27
  - Plan ID: $1 (required)
28
28
  - Task ID: $2 (required)
29
- - Task management directory structure: `@.ai/task-manager/`
30
- - Dependency checking script: `.ai/task-manager/config/scripts/check-task-dependencies.js`
29
+ - Task management directory structure: `/`
30
+ - Dependency checking script: `.ai/task-manager/config/scripts/check-task-dependencies.cjs`
31
31
 
32
32
  ### Input Validation
33
33
 
@@ -134,7 +134,7 @@ Use the dependency checking script to validate all dependencies:
134
134
 
135
135
  ```bash
136
136
  # Call the dependency checking script
137
- if ! node .ai/task-manager/config/scripts/check-task-dependencies.js "$PLAN_ID" "$TASK_ID"; then
137
+ if ! node .ai/task-manager/config/scripts/check-task-dependencies.cjs "$PLAN_ID" "$TASK_ID"; then
138
138
  echo ""
139
139
  echo "Task execution blocked by unresolved dependencies."
140
140
  echo "Please complete the required dependencies first."
@@ -149,9 +149,7 @@ echo "✓ All dependencies resolved - proceeding with execution"
149
149
 
150
150
  Read task skills and select appropriate task-specific agent:
151
151
 
152
- ```bash
153
- Read and execute @.ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
154
- ```
152
+ Read and execute .ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
155
153
 
156
154
  ### 6. Status Update to In-Progress
157
155
 
@@ -234,7 +232,7 @@ echo "You can now execute dependent tasks or continue with the full blueprint ex
234
232
 
235
233
  ## Error Handling
236
234
 
237
- Read and execute @.ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
235
+ Read and execute .ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
238
236
 
239
237
  ## Usage Examples
240
238
 
@@ -5,14 +5,20 @@ description: Generate tasks to implement the plan with the provided ID.
5
5
  # Comprehensive Task List Creation
6
6
  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.
7
7
 
8
- Include @.ai/task-manager/TASK_MANAGER.md for the directory structure of tasks.
8
+ Include /TASK_MANAGER.md for the directory structure of tasks.
9
9
 
10
10
  ## Instructions
11
11
 
12
12
  You will think hard to analyze the provided plan document and decompose it into atomic, actionable tasks with clear dependencies and groupings.
13
13
 
14
+ Use your internal Todo task tool to track the following process:
15
+
16
+ - [ ] Read and process plan $1
17
+ - [ ] Use the Task Generation Process to create tasks according to the Task Creation Guidelines
18
+ - [ ] Read and run the .ai/task-manager/config/hooks/POST_TASK_GENERATION_ALL.md
19
+
14
20
  ### Input
15
- - A plan document. See @.ai/task-manager/TASK_MANAGER.md fo find the plan with ID $1
21
+ - A plan document. See .ai/task-manager/config/TASK_MANAGER.md fo find the plan with ID $1
16
22
  - The plan contains high-level objectives and implementation steps
17
23
 
18
24
  ### Input Error Handling
@@ -108,7 +114,7 @@ Tests that verify custom business logic, critical paths, and edge cases specific
108
114
  - Avoid creating separate tasks for testing each CRUD operation individually
109
115
  - Question whether simple functions need dedicated test tasks
110
116
 
111
- ### Process
117
+ ### Task Generation Process
112
118
 
113
119
  #### Step 1: Task Decomposition
114
120
  1. Read through the entire plan
@@ -131,11 +137,7 @@ Dependency Rule: Task B depends on Task A if:
131
137
  - B modifies code created by A
132
138
  - B tests functionality implemented in A
133
139
 
134
- #### Step 3: POST_TASK_GENERATION_ALL hook
135
-
136
- Read and run the @.ai/task-manager/config/hooks/POST_TASK_GENERATION_ALL.md
137
-
138
- #### Step 4: Output Generation
140
+ #### Step 3: Task Generation
139
141
 
140
142
  ##### Frontmatter Structure
141
143
 
@@ -212,96 +214,16 @@ The schema for this frontmatter is:
212
214
 
213
215
  ##### Task Body Structure
214
216
 
215
- Use the task template in @.ai/task-manager/config/templates/TASK_TEMPLATE.md
217
+ Use the task template in .ai/task-manager/config/templates/TASK_TEMPLATE.md
216
218
 
217
- ### Task ID Generation
219
+ ##### Task ID Generation
218
220
 
219
221
  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:
220
222
 
221
- #### Command
222
223
  ```bash
223
- node .ai/task-manager/config/scripts/get-next-task-id.js $1
224
+ node .ai/task-manager/config/scripts/get-next-task-id.cjs $1
224
225
  ```
225
226
 
226
- #### How It Works
227
- 1. **Finds the plan directory** using pattern matching for plan ID directories
228
- 2. **Scans task files** in the plan's tasks directory for `.md` files
229
- 3. **Validates frontmatter IDs** by parsing YAML frontmatter and extracting numeric ID values
230
- 4. **Finds maximum ID** by comparing all valid task IDs numerically
231
- 5. **Handles edge cases** by gracefully handling missing directories, corrupted files, and parsing errors
232
- 6. **Returns next ID** by incrementing the maximum found ID by 1
233
-
234
- This Node.js script provides robust error handling and reliable ID generation.
235
-
236
- #### Parameter Usage
237
- - `$1` is the plan ID parameter passed to this template
238
- - The command accepts the raw plan ID (e.g., `6` for plan `06`)
239
- - It automatically handles zero-padding for directory lookup
240
-
241
- #### Front-matter vs Filename Format
242
- **IMPORTANT:** There is a distinction between numeric and zero-padded formats:
243
-
244
- - **Front-matter ID**: Use numeric values: `id: 3` (not `id: "03"`)
245
- - **Filename**: Use zero-padded format: `03--task-name.md`
246
-
247
- #### Usage Examples
248
-
249
- **Example 1: Plan 6 with existing tasks**
250
- ```bash
251
- # Command execution (plan ID = 6)
252
- node .ai/task-manager/config/scripts/get-next-task-id.js 6
253
- # Output: 5 (if highest valid numeric task front-matter has id: 4)
254
-
255
- # Front-matter usage:
256
- ---
257
- id: 4
258
- group: "implementation"
259
- dependencies: [1, 2]
260
- status: "pending"
261
- created: "2024-01-15"
262
- skills: ["api-endpoints", "database"]
263
- ---
264
- ```
265
-
266
- **Example 2: Plan 1 with no existing tasks**
267
- ```bash
268
- # Command execution (plan ID = 1)
269
- node .ai/task-manager/config/scripts/get-next-task-id.js 1
270
- # Output: 1 (empty tasks directory, no valid front-matter to read)
271
-
272
- # Front-matter usage:
273
- ---
274
- id: 1
275
- group: "setup"
276
- dependencies: []
277
- status: "pending"
278
- created: "2024-01-15"
279
- skills: ["docker", "ci-cd"]
280
- ---
281
- ```
282
-
283
- #### Edge Case Handling
284
- The command handles several edge cases automatically:
285
- - **Empty tasks directory**: Returns `1` as the first task ID
286
- - **Non-sequential task IDs**: Returns the maximum existing ID + 1
287
- - **Missing plan directory**: Returns `1` (graceful fallback)
288
- - **Mixed numbering**: Correctly finds the highest numeric ID regardless of gaps
289
- - **Malformed frontmatter**: Skips files with non-numeric, string, or missing ID fields
290
- - **Whitespace variations**: Handles extra spaces around ID values (e.g., `id: 5 `)
291
-
292
- #### Command Execution Context
293
- - Run this command from the repository root directory
294
- - The command works with the current file system state
295
- - It searches within the plan directory structure: `.ai/task-manager/plans/##--plan-name/tasks/`
296
-
297
- #### Manual Fallback
298
- If the command fails or returns unexpected results:
299
- 1. Navigate to `.ai/task-manager/plans/##--plan-name/tasks/`
300
- 2. List existing task files: `ls -1 *.md 2>/dev/null | sort`
301
- 3. Identify the highest numbered task file
302
- 4. Add 1 to get the next ID
303
- 5. Use numeric format in front-matter, zero-padded format for filename
304
-
305
227
  ### Validation Checklist
306
228
  Before finalizing, ensure:
307
229
 
@@ -350,4 +272,6 @@ If the plan lacks sufficient detail:
350
272
  - Create placeholder tasks marked with `status: "needs-clarification"`
351
273
  - Document assumptions made
352
274
 
353
- Read and execute @.ai/task-manager/config/hooks/POST_PLAN.md
275
+ #### Step 4: POST_TASK_GENERATION_ALL hook
276
+
277
+ Read and run the .ai/task-manager/config/hooks/POST_TASK_GENERATION_ALL.md