@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
@@ -0,0 +1,375 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/skill-scripts/validate-plan-blueprint.ts
31
+ var validate_plan_blueprint_exports = {};
32
+ __export(validate_plan_blueprint_exports, {
33
+ main: () => main
34
+ });
35
+ module.exports = __toCommonJS(validate_plan_blueprint_exports);
36
+ var fs4 = __toESM(require("fs"));
37
+ var path4 = __toESM(require("path"));
38
+
39
+ // src/skill-scripts/shared/root.ts
40
+ var fs = __toESM(require("fs"));
41
+ var path = __toESM(require("path"));
42
+ var EXPECTED_SCHEMA = true ? 1 : 1;
43
+ var isValidTaskManagerRoot = (taskManagerPath) => {
44
+ try {
45
+ if (!fs.existsSync(taskManagerPath)) return false;
46
+ if (!fs.lstatSync(taskManagerPath).isDirectory()) return false;
47
+ const metadataPath = path.join(taskManagerPath, ".init-metadata.json");
48
+ if (!fs.existsSync(metadataPath)) return false;
49
+ const metadata = JSON.parse(fs.readFileSync(metadataPath, "utf8"));
50
+ return metadata && typeof metadata === "object" && "version" in metadata;
51
+ } catch (_err) {
52
+ return false;
53
+ }
54
+ };
55
+ var getTaskManagerAt = (directory) => {
56
+ const taskManagerPath = path.join(directory, ".ai", "task-manager");
57
+ return isValidTaskManagerRoot(taskManagerPath) ? taskManagerPath : null;
58
+ };
59
+ var getParentPaths = (currentPath, acc = []) => {
60
+ const absolutePath = path.resolve(currentPath);
61
+ const nextAcc = [...acc, absolutePath];
62
+ const parentPath = path.dirname(absolutePath);
63
+ if (parentPath === absolutePath) return nextAcc;
64
+ return getParentPaths(parentPath, nextAcc);
65
+ };
66
+ var checkWorkspaceSchema = (metadataPath) => {
67
+ let metadata;
68
+ try {
69
+ metadata = JSON.parse(fs.readFileSync(metadataPath, "utf8"));
70
+ } catch {
71
+ return;
72
+ }
73
+ const actual = typeof metadata.workspaceSchemaVersion === "number" ? metadata.workspaceSchemaVersion : 1;
74
+ if (actual === EXPECTED_SCHEMA) return;
75
+ if (actual < EXPECTED_SCHEMA) {
76
+ process.stderr.write(
77
+ `Workspace schema v${actual} is older than this skill requires (v${EXPECTED_SCHEMA}). Re-run \`npx @e0ipso/ai-task-manager init\` with the latest CLI to update.
78
+ `
79
+ );
80
+ } else {
81
+ process.stderr.write(
82
+ `This skill (built for workspace schema v${EXPECTED_SCHEMA}) is older than the workspace (v${actual}). Re-run \`npx skills add e0ipso/ai-task-manager\` to update skills.
83
+ `
84
+ );
85
+ }
86
+ process.exit(1);
87
+ };
88
+ var findTaskManagerRoot = (startPath = process.cwd()) => {
89
+ const paths = getParentPaths(startPath);
90
+ const found = paths.find((p) => getTaskManagerAt(p));
91
+ if (!found) return null;
92
+ const root = getTaskManagerAt(found);
93
+ if (root) checkWorkspaceSchema(path.join(root, ".init-metadata.json"));
94
+ return root;
95
+ };
96
+
97
+ // src/skill-scripts/shared/plan-scan.ts
98
+ var fs2 = __toESM(require("fs"));
99
+ var path2 = __toESM(require("path"));
100
+
101
+ // src/skill-scripts/shared/frontmatter.ts
102
+ var ID_PATTERNS = [
103
+ /^\s*["']?id["']?\s*:\s*["']?([+-]?\d+)["']?\s*(?:#.*)?$/im,
104
+ /^\s*id\s*:\s*([+-]?\d+)\s*(?:#.*)?$/im,
105
+ /^\s*["']?id["']?\s*:\s*"([+-]?\d+)"\s*(?:#.*)?$/im,
106
+ /^\s*["']?id["']?\s*:\s*'([+-]?\d+)'\s*(?:#.*)?$/im,
107
+ /^\s*["']id["']\s*:\s*([+-]?\d+)\s*(?:#.*)?$/im,
108
+ /^\s*id\s*:\s*[|>]\s*([+-]?\d+)\s*$/im
109
+ ];
110
+ var validateId = (rawId) => {
111
+ const id = parseInt(rawId, 10);
112
+ if (Number.isNaN(id) || id < 0 || id > Number.MAX_SAFE_INTEGER) return null;
113
+ return id;
114
+ };
115
+ var extractIdFromMarkdown = (content) => {
116
+ const frontmatterMatch = content.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
117
+ if (!frontmatterMatch || !frontmatterMatch[1]) return null;
118
+ const block = frontmatterMatch[1];
119
+ for (const pattern of ID_PATTERNS) {
120
+ const match = block.match(pattern);
121
+ if (match && match[1]) {
122
+ const id = validateId(match[1]);
123
+ if (id !== null) return id;
124
+ }
125
+ }
126
+ return null;
127
+ };
128
+ var extractIdFromHtml = (content) => {
129
+ const headMatch = content.match(/<head[^>]*>([\s\S]*?)<\/head>/i);
130
+ const scope = headMatch && headMatch[1] ? headMatch[1] : content;
131
+ const metaPatterns = [
132
+ /<meta\s+[^>]*name\s*=\s*["']id["'][^>]*content\s*=\s*["']([+-]?\d+)["'][^>]*\/?>/i,
133
+ /<meta\s+[^>]*content\s*=\s*["']([+-]?\d+)["'][^>]*name\s*=\s*["']id["'][^>]*\/?>/i
134
+ ];
135
+ for (const pattern of metaPatterns) {
136
+ const match = scope.match(pattern);
137
+ if (match && match[1]) {
138
+ const id = validateId(match[1]);
139
+ if (id !== null) return id;
140
+ }
141
+ }
142
+ return null;
143
+ };
144
+ var extractPlanId = (content, filePath) => {
145
+ if (filePath.toLowerCase().endsWith(".html")) return extractIdFromHtml(content);
146
+ return extractIdFromMarkdown(content);
147
+ };
148
+
149
+ // src/skill-scripts/shared/plan-scan.ts
150
+ var PLAN_EXTENSIONS = [".md", ".html"];
151
+ var scanPlanDir = (planDirPath, dirName, isArchive) => {
152
+ let entries;
153
+ try {
154
+ entries = fs2.readdirSync(planDirPath, { withFileTypes: true });
155
+ } catch (_err) {
156
+ return [];
157
+ }
158
+ return entries.filter((e) => e.isFile() && PLAN_EXTENSIONS.some((ext) => e.name.endsWith(ext))).flatMap((e) => {
159
+ const filePath = path2.join(planDirPath, e.name);
160
+ try {
161
+ const content = fs2.readFileSync(filePath, "utf8");
162
+ const id = extractPlanId(content, filePath);
163
+ if (id === null) return [];
164
+ return [{ id, file: filePath, dir: planDirPath, isArchive, name: dirName }];
165
+ } catch (_err) {
166
+ return [];
167
+ }
168
+ });
169
+ };
170
+ var getAllPlans = (taskManagerRoot) => {
171
+ const sources = [
172
+ { dir: path2.join(taskManagerRoot, "plans"), isArchive: false },
173
+ { dir: path2.join(taskManagerRoot, "archive"), isArchive: true }
174
+ ];
175
+ return sources.flatMap(({ dir, isArchive }) => {
176
+ if (!fs2.existsSync(dir)) return [];
177
+ let entries;
178
+ try {
179
+ entries = fs2.readdirSync(dir, { withFileTypes: true });
180
+ } catch (_err) {
181
+ return [];
182
+ }
183
+ return entries.filter((e) => e.isDirectory()).flatMap((e) => scanPlanDir(path2.join(dir, e.name), e.name, isArchive));
184
+ });
185
+ };
186
+
187
+ // src/skill-scripts/shared/plan-resolve.ts
188
+ var fs3 = __toESM(require("fs"));
189
+ var path3 = __toESM(require("path"));
190
+ var isValidRootDir = (taskManagerPath) => {
191
+ try {
192
+ if (!fs3.existsSync(taskManagerPath)) return false;
193
+ if (!fs3.lstatSync(taskManagerPath).isDirectory()) return false;
194
+ const metadataPath = path3.join(taskManagerPath, ".init-metadata.json");
195
+ if (!fs3.existsSync(metadataPath)) return false;
196
+ const metadata = JSON.parse(fs3.readFileSync(metadataPath, "utf8"));
197
+ return metadata && typeof metadata === "object" && "version" in metadata;
198
+ } catch (_err) {
199
+ return false;
200
+ }
201
+ };
202
+ var checkStandardRootShortcut = (filePath) => {
203
+ const planDir = path3.dirname(filePath);
204
+ const parentDir = path3.dirname(planDir);
205
+ const possibleRoot = path3.dirname(parentDir);
206
+ const parentBase = path3.basename(parentDir);
207
+ if (parentBase !== "plans" && parentBase !== "archive") return null;
208
+ if (path3.basename(possibleRoot) !== "task-manager") return null;
209
+ const dotAiDir = path3.dirname(possibleRoot);
210
+ if (path3.basename(dotAiDir) !== ".ai") return null;
211
+ return isValidRootDir(possibleRoot) ? possibleRoot : null;
212
+ };
213
+ var resolveByPath = (absolutePath) => {
214
+ let content;
215
+ try {
216
+ content = fs3.readFileSync(absolutePath, "utf8");
217
+ } catch (_err) {
218
+ return null;
219
+ }
220
+ const planId = extractPlanId(content, absolutePath);
221
+ if (planId === null) return null;
222
+ const tmRoot = checkStandardRootShortcut(absolutePath) || findTaskManagerRoot(path3.dirname(absolutePath));
223
+ if (!tmRoot) return null;
224
+ return {
225
+ planFile: absolutePath,
226
+ planDir: path3.dirname(absolutePath),
227
+ taskManagerRoot: tmRoot,
228
+ planId
229
+ };
230
+ };
231
+ var resolveByIdInAncestry = (planId, startPath, searched = /* @__PURE__ */ new Set()) => {
232
+ const tmRoot = findTaskManagerRoot(startPath);
233
+ if (!tmRoot) return null;
234
+ const normalized = path3.normalize(tmRoot);
235
+ if (searched.has(normalized)) return null;
236
+ searched.add(normalized);
237
+ const plans = getAllPlans(tmRoot);
238
+ const match = plans.find((p) => p.id === planId);
239
+ if (match) {
240
+ return {
241
+ planFile: match.file,
242
+ planDir: match.dir,
243
+ taskManagerRoot: tmRoot,
244
+ planId
245
+ };
246
+ }
247
+ const parentOfRoot = path3.dirname(path3.dirname(tmRoot));
248
+ if (parentOfRoot === tmRoot) return null;
249
+ return resolveByIdInAncestry(planId, parentOfRoot, searched);
250
+ };
251
+ var resolvePlan = (input, startPath = process.cwd()) => {
252
+ if (input === null || input === void 0 || input === "") return null;
253
+ const inputStr = String(input);
254
+ if (inputStr.startsWith("/")) {
255
+ return resolveByPath(inputStr);
256
+ }
257
+ const planId = parseInt(inputStr, 10);
258
+ if (Number.isNaN(planId)) return null;
259
+ return resolveByIdInAncestry(planId, startPath);
260
+ };
261
+
262
+ // src/skill-scripts/validate-plan-blueprint.ts
263
+ var VALID_FIELDS = [
264
+ "planFile",
265
+ "planDir",
266
+ "taskCount",
267
+ "blueprintExists",
268
+ "taskManagerRoot",
269
+ "planId"
270
+ ];
271
+ var countTasks = (planDir) => {
272
+ const tasksDir = path4.join(planDir, "tasks");
273
+ if (!fs4.existsSync(tasksDir)) return 0;
274
+ try {
275
+ const stat = fs4.lstatSync(tasksDir);
276
+ if (!stat.isDirectory()) return 0;
277
+ return fs4.readdirSync(tasksDir).filter((f) => f.endsWith(".md")).length;
278
+ } catch (_err) {
279
+ return 0;
280
+ }
281
+ };
282
+ var checkBlueprintExists = (planFile) => {
283
+ try {
284
+ const content = fs4.readFileSync(planFile, "utf8");
285
+ return /^## Execution Blueprint/m.test(content);
286
+ } catch (_err) {
287
+ return false;
288
+ }
289
+ };
290
+ var usage = () => {
291
+ const lines = [
292
+ "Plan ID or absolute path is required",
293
+ "",
294
+ "Usage: node validate-plan-blueprint.cjs <plan-id-or-path> [field-name]",
295
+ "",
296
+ "Examples:",
297
+ " node validate-plan-blueprint.cjs 47",
298
+ " node validate-plan-blueprint.cjs /path/to/plan.md",
299
+ " node validate-plan-blueprint.cjs 47 planFile",
300
+ " node validate-plan-blueprint.cjs 47 blueprintExists"
301
+ ];
302
+ lines.forEach((l) => process.stderr.write(`[ERROR] ${l}
303
+ `));
304
+ };
305
+ var listAvailablePlans = (startPath) => {
306
+ const tmRoot = findTaskManagerRoot(startPath);
307
+ if (!tmRoot) return [];
308
+ const plans = getAllPlans(tmRoot);
309
+ return plans.map((p) => p.name).sort((a, b) => {
310
+ const aMatch = a.match(/^(\d+)--/);
311
+ const bMatch = b.match(/^(\d+)--/);
312
+ if (!aMatch || !bMatch || !aMatch[1] || !bMatch[1]) return 0;
313
+ return parseInt(aMatch[1], 10) - parseInt(bMatch[1], 10);
314
+ });
315
+ };
316
+ var main = () => {
317
+ const inputId = process.argv[2];
318
+ const fieldName = process.argv[3];
319
+ if (!inputId) {
320
+ usage();
321
+ process.exit(1);
322
+ }
323
+ const numericInput = parseInt(inputId, 10);
324
+ const isNumeric = !Number.isNaN(numericInput);
325
+ const isAbsolutePath = inputId.startsWith("/");
326
+ if (!isNumeric && !isAbsolutePath) {
327
+ process.stderr.write(`[ERROR] Invalid plan ID: "${inputId}" is not a valid number
328
+ `);
329
+ process.exit(1);
330
+ }
331
+ const resolved = resolvePlan(inputId);
332
+ if (!resolved) {
333
+ process.stderr.write(`[ERROR] Plan ID ${inputId} not found or invalid
334
+ `);
335
+ process.stderr.write("[ERROR] \n");
336
+ const available = listAvailablePlans(process.cwd());
337
+ if (available.length > 0) {
338
+ process.stderr.write("[ERROR] Available plans:\n");
339
+ available.forEach((name) => process.stderr.write(`[ERROR] ${name}
340
+ `));
341
+ }
342
+ process.exit(1);
343
+ }
344
+ const result = {
345
+ planFile: resolved.planFile,
346
+ planDir: resolved.planDir,
347
+ taskManagerRoot: resolved.taskManagerRoot,
348
+ planId: resolved.planId,
349
+ taskCount: countTasks(resolved.planDir),
350
+ blueprintExists: checkBlueprintExists(resolved.planFile) ? "yes" : "no"
351
+ };
352
+ if (fieldName) {
353
+ if (!VALID_FIELDS.includes(fieldName)) {
354
+ process.stderr.write(`[ERROR] Invalid field name: ${fieldName}
355
+ `);
356
+ process.stderr.write(`[ERROR] Valid fields: ${VALID_FIELDS.join(", ")}
357
+ `);
358
+ process.exit(1);
359
+ }
360
+ const value = result[fieldName];
361
+ process.stdout.write(`${String(value)}
362
+ `);
363
+ } else {
364
+ process.stdout.write(`${JSON.stringify(result, null, 2)}
365
+ `);
366
+ }
367
+ process.exit(0);
368
+ };
369
+ if (require.main === module) {
370
+ main();
371
+ }
372
+ // Annotate the CommonJS export names for ESM import in node:
373
+ 0 && (module.exports = {
374
+ main
375
+ });
@@ -0,0 +1,244 @@
1
+ ---
2
+ name: task-generate-tasks
3
+ description: Generate atomic Markdown tasks for an existing AI Task Manager plan in this repository. Use when the user asks to decompose a specific plan ID into tasks — discovers the local .ai/task-manager root, resolves the plan, runs the project's task-generation hooks, allocates sequential task IDs, and writes one task file per atomic unit conforming to TASK_TEMPLATE.md. Do not use for generic project planning or work outside the AI Task Manager.
4
+ ---
5
+
6
+ # task-generate-tasks
7
+
8
+ Drive the end-to-end decomposition of an existing AI Task Manager plan into
9
+ atomic Markdown task files. The skill is assistant-agnostic and self-contained:
10
+ every script it invokes lives under this skill's `scripts/` directory and is
11
+ referenced by relative path.
12
+
13
+ ## Inputs
14
+
15
+ The user supplies the numeric plan ID conversationally. Treat it as the only
16
+ authoritative source of intent. Do not invent answers to clarifying questions —
17
+ prompt the user instead.
18
+
19
+ ## Operating Procedure
20
+
21
+ ### 1. Locate the task-manager root
22
+
23
+ Run `scripts/find-task-manager-root.cjs` from the user's working directory.
24
+ The script walks up looking for `.ai/task-manager/.init-metadata.json` and
25
+ prints the absolute path of the resolved root on success.
26
+
27
+ If the script exits non-zero, the working directory is not inside an
28
+ initialized task-manager workspace. Stop and ask the user to run the project
29
+ initializer (e.g. `npx @e0ipso/ai-task-manager init`) before continuing. Do
30
+ not attempt to generate tasks outside of a valid root.
31
+
32
+ For every subsequent step, treat the path printed by this script as `<root>`.
33
+
34
+ ### 2. Resolve the plan
35
+
36
+ Run `scripts/validate-plan-blueprint.cjs <plan-id> planFile` to obtain the
37
+ absolute path of the plan file. The same script also accepts these field
38
+ names (single-field output mode) and exposes them on demand:
39
+
40
+ - `planDir` — absolute path of the plan directory
41
+ - `taskCount` — number of existing task files in that plan's `tasks/`
42
+ - `blueprintExists` — `yes` or `no`
43
+ - `taskManagerRoot` — absolute path of `<root>`
44
+ - `planId` — the resolved numeric plan ID
45
+
46
+ If the script exits non-zero, stop and ask the user to confirm the plan ID.
47
+ Do not guess a different ID.
48
+
49
+ ### 3. Load project context
50
+
51
+ Read these files, in order:
52
+
53
+ - `<root>/config/TASK_MANAGER.md` — directory conventions for plans, tasks,
54
+ and the archive layout.
55
+ - The plan body at the path returned by step 2 — this is the contract for
56
+ what tasks must exist.
57
+ - `<root>/config/templates/TASK_TEMPLATE.md` — every task file you emit must
58
+ conform to this template's frontmatter schema and section structure.
59
+
60
+ ### 4. Analyze and decompose the plan
61
+
62
+ Read the entire plan. Identify all concrete deliverables **explicitly stated**.
63
+ Decompose each deliverable into atomic tasks only when genuinely needed.
64
+
65
+ **Task minimization (mandatory):**
66
+
67
+ - Create only the minimum number of tasks necessary. Target a 20–30%
68
+ reduction from comprehensive lists by questioning the necessity of each
69
+ candidate.
70
+ - **Direct Implementation Only**: a task corresponds to an explicit
71
+ requirement, not a "nice-to-have".
72
+ - **DRY Task Principle**: each task has a unique, non-overlapping purpose.
73
+ - **Question Everything**: for each task, ask "Is this absolutely necessary
74
+ to meet the plan objectives?"
75
+ - **Avoid Gold-plating**: resist comprehensive features the plan does not
76
+ require.
77
+
78
+ **Antipatterns to avoid:**
79
+
80
+ - Separating "error handling" from the main implementation when it can be
81
+ inline.
82
+ - Splitting trivially small operations into multiple tasks (e.g. "validate
83
+ input" + "process input" as separate units).
84
+ - Adding tasks for "future extensibility" or "best practices" the plan does
85
+ not mention.
86
+ - Comprehensive test suites for trivial functionality.
87
+
88
+ ### 5. Apply granularity and skill rules
89
+
90
+ Each task must be:
91
+
92
+ - **Single-purpose** — one clear deliverable.
93
+ - **Atomic** — cannot be meaningfully split further.
94
+ - **Skill-specific** — executable by an agent with 1–2 technical skills.
95
+ - **Verifiable** — has explicit acceptance criteria.
96
+
97
+ Skill assignment (kebab-case, automatically inferred from the task's
98
+ technical requirements):
99
+
100
+ - 1 skill — single-domain task (e.g. `["css"]`, `["jest"]`).
101
+ - 2 skills — complementary domains (e.g. `["api-endpoints", "database"]`,
102
+ `["react-components", "jest"]`).
103
+ - 3+ skills indicates the task should be broken down further.
104
+
105
+ ### 6. Test philosophy: "write a few tests, mostly integration"
106
+
107
+ When generating test tasks, keep this constraint:
108
+
109
+ **Definition.** Meaningful tests verify custom business logic, critical paths,
110
+ and edge cases specific to this application. Test *your* code, not the
111
+ framework or library.
112
+
113
+ **When TO write tests:**
114
+
115
+ - Custom business logic and algorithms.
116
+ - Critical user workflows and data transformations.
117
+ - Edge cases and error conditions for core functionality.
118
+ - Integration points between components.
119
+ - Complex validation logic or calculations.
120
+
121
+ **When NOT to write tests:**
122
+
123
+ - Third-party library functionality.
124
+ - Framework features.
125
+ - Simple CRUD operations without custom logic.
126
+ - Trivial getters/setters or static configuration.
127
+ - Obvious functionality that would break immediately if incorrect.
128
+
129
+ **Test task creation rules:**
130
+
131
+ - Combine related test scenarios into a single task (e.g. "Test user
132
+ authentication flow" not separate tasks for login, logout, validation).
133
+ - Favor integration and critical-path coverage over per-method unit tests.
134
+ - Avoid one test task per CRUD operation.
135
+ - Question whether simple functions need a dedicated test task.
136
+
137
+ If any test task is generated, restate this section verbatim or near-verbatim
138
+ in that task's "Implementation Notes" so the executing agent applies it.
139
+
140
+ ### 7. Dependency analysis
141
+
142
+ For each task, identify:
143
+
144
+ - **Hard dependencies**: tasks that MUST complete before this one can start.
145
+ - **Soft dependencies**: tasks that SHOULD complete for optimal execution.
146
+
147
+ A task B depends on A if B requires A's output or artifacts, modifies code
148
+ created by A, or tests functionality implemented by A. Validate that the
149
+ final dependency graph is acyclic.
150
+
151
+ ### 8. Allocate task IDs
152
+
153
+ Run `scripts/get-next-task-id.cjs <plan-id>` to obtain the first available
154
+ task ID. Allocate subsequent IDs by incrementing in-process; do not invoke
155
+ the script repeatedly. Use the unpadded integer in the task frontmatter `id`
156
+ field and the zero-padded form (`{padded-id}--{slug}`) for the filename.
157
+
158
+ The slug derives from a short task title: lowercase, alphanumeric and
159
+ hyphens only, collapsed, trimmed.
160
+
161
+ ### 9. Emit the task files
162
+
163
+ Write each task to:
164
+
165
+ ```
166
+ <root>/plans/<plan-dir-name>/tasks/{padded-id}--{slug}.md
167
+ ```
168
+
169
+ Each file must conform to `<root>/config/templates/TASK_TEMPLATE.md`,
170
+ including required frontmatter fields:
171
+
172
+ - `id` (integer)
173
+ - `group` (string)
174
+ - `dependencies` (array of task IDs, possibly empty)
175
+ - `status` — `pending` for new tasks
176
+ - `created` (YYYY-MM-DD)
177
+ - `skills` (array of 1–2 kebab-case skills)
178
+
179
+ Optional frontmatter for high-complexity or decomposed tasks:
180
+
181
+ - `complexity_score` (number, 1–10, include only if >4 or for decomposed
182
+ tasks)
183
+ - `complexity_notes` (string)
184
+
185
+ The body sections (Objective, Skills Required, Acceptance Criteria, Technical
186
+ Requirements, Input Dependencies, Output Artifacts, Implementation Notes)
187
+ must be filled with task-specific content. Place detailed implementation
188
+ guidance inside a `<details>` block under "Implementation Notes" — write it
189
+ so a non-thinking LLM could execute the task from that section alone.
190
+
191
+ ### 10. Validation checklist
192
+
193
+ Before declaring task generation complete, verify:
194
+
195
+ - Each task has 1–2 appropriate technical skills assigned and inferred from
196
+ its objectives.
197
+ - Dependencies form an acyclic graph; no orphan or circular references.
198
+ - Task IDs are unique, sequential, and start from the value returned by
199
+ `get-next-task-id.cjs`.
200
+ - Groups are consistent and meaningful.
201
+ - Every **explicitly stated** deliverable in the plan is covered.
202
+ - No redundant or overlapping tasks.
203
+ - Minimization applied (20–30% reduction target).
204
+ - Test tasks focus on business logic, not framework functionality.
205
+ - No gold-plating: only plan requirements are addressed.
206
+
207
+ ### 11. Run the POST_TASK_GENERATION_ALL hook
208
+
209
+ Read `<root>/config/hooks/POST_TASK_GENERATION_ALL.md` and follow its
210
+ instructions. This typically requires:
211
+
212
+ - Sanity-checking complexity (3+ technologies/skills → split; vague criteria
213
+ → sharpen; trivially small → merge).
214
+ - Appending an Execution Blueprint section to the plan document, including a
215
+ Mermaid dependency diagram and explicit phase groupings (Phase 1 contains
216
+ zero-dependency tasks; each subsequent phase contains tasks whose
217
+ dependencies all live in earlier phases). Use
218
+ `<root>/config/templates/BLUEPRINT_TEMPLATE.md` for structure.
219
+
220
+ ### 12. Emit the structured summary
221
+
222
+ Conclude with exactly this block as the final output:
223
+
224
+ ```
225
+ ---
226
+ Task Generation Summary:
227
+ - Plan ID: [numeric-id]
228
+ - Tasks: [count]
229
+ - Status: Ready for execution
230
+ ```
231
+
232
+ The summary is consumed by downstream automation; keep the format exact.
233
+
234
+ ## Failure Modes
235
+
236
+ - **No task-manager root found.** Stop, instruct the user to initialize the
237
+ project. Do not write any files.
238
+ - **Plan ID does not resolve.** Stop and surface the script's stderr to the
239
+ user. Do not guess a different ID and do not write any files.
240
+ - **User declines to clarify a blocking ambiguity.** Mark the affected tasks
241
+ with `status: "needs-clarification"` and document the open question in the
242
+ task's "Implementation Notes". Do not invent answers.
243
+ - **A helper script fails unexpectedly.** Surface stderr to the user and
244
+ stop — do not fall back to manual ID allocation or path discovery.