@tea-agent/loop-agent 0.1.0 → 0.2.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.
- package/CHANGELOG.md +17 -1
- package/README.md +127 -92
- package/dist/adapters/index.js +3 -2
- package/dist/adapters/loop-agent.js +44 -2
- package/dist/application/dag/args.js +420 -0
- package/dist/application/dag/generate-task-dag.js +280 -0
- package/dist/application/dag/report-dag.js +14 -0
- package/dist/application/dag/run-dag.js +93 -0
- package/dist/application/dag/validate-dag.js +101 -0
- package/dist/application/loop/run-action.js +23 -0
- package/dist/cli/catalog.js +2 -237
- package/dist/cli/command-definitions.js +571 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/program.js +65 -1
- package/dist/cli/router.js +13 -0
- package/dist/cli-governance/active-residue-check.js +38 -0
- package/dist/commands/dag-report.js +6 -107
- package/dist/commands/dag-run-task.js +8 -466
- package/dist/commands/dag-validate.js +7 -179
- package/dist/commands/examples.js +90 -0
- package/dist/commands/init.js +1495 -0
- package/dist/commands/loop.js +57 -31
- package/dist/commands/pi-prompt.js +2 -9
- package/dist/commands/run-dag.js +7 -180
- package/dist/executors/cursor-executor-artifacts.js +3 -4
- package/dist/executors/cursor-worker-client.js +13 -3
- package/dist/executors/dag-cursor-executor.js +2 -3
- package/dist/executors/dag-pi-executor.js +3 -4
- package/dist/executors/dag-static-executor.js +2 -5
- package/dist/executors/pi-defaults.js +9 -0
- package/dist/executors/shell-executor.js +12 -20
- package/dist/governance/manifest-types.js +1 -0
- package/dist/infrastructure/harness/active-residue-policy.js +73 -0
- package/dist/infrastructure/harness/artifact-store.js +72 -0
- package/dist/infrastructure/harness/atomic-write.js +49 -0
- package/dist/infrastructure/harness/completed-facts-guard.js +40 -0
- package/dist/infrastructure/harness/loop-action-store.js +23 -0
- package/dist/infrastructure/harness/loop-store.js +41 -0
- package/dist/infrastructure/harness/one-shot-run-store.js +94 -0
- package/dist/infrastructure/harness/task-store.js +77 -0
- package/dist/records/one-shot-runs.js +26 -61
- package/dist/records/promotion.js +3 -4
- package/dist/shared/artifacts-core.js +5 -5
- package/dist/shared/logger.js +9 -15
- package/dist/task/delegate.js +4 -4
- package/dist/task/runtime.js +5 -7
- package/dist/task/state.js +6 -20
- package/dist/workflows/dag/convergence/controller.js +277 -0
- package/dist/workflows/dag/dynamic-runtime/condition.js +48 -0
- package/dist/workflows/dag/dynamic-runtime/loop-until.js +156 -0
- package/dist/workflows/dag/dynamic-runtime/map.js +185 -0
- package/dist/workflows/dag/dynamic-runtime/reduction.js +72 -0
- package/dist/workflows/dag/dynamic-runtime/shared.js +133 -0
- package/dist/workflows/dag/lifecycle.js +6 -5
- package/dist/workflows/dag/node-execution.js +262 -0
- package/dist/workflows/dag/run-store.js +36 -0
- package/dist/workflows/dag/runner.js +82 -1341
- package/dist/workflows/dag/scheduler.js +84 -0
- package/dist/workflows/dag/upstream-artifacts.js +20 -18
- package/dist/workflows/loop/actions/cursor-fix.js +191 -0
- package/dist/workflows/loop/actions/dag-action.js +130 -0
- package/dist/workflows/loop/actions/pi-review.js +267 -0
- package/dist/workflows/loop/actions/shared.js +157 -0
- package/dist/workflows/loop/actions/shell-verify.js +82 -0
- package/dist/workflows/loop/actions/types.js +1 -0
- package/dist/workflows/loop/actions/workflow-action.js +255 -0
- package/dist/workflows/loop/actions.js +55 -1212
- package/dist/workflows/loop/closeout.js +5 -4
- package/dist/workflows/loop/context.js +2 -3
- package/dist/workflows/loop/events.js +3 -2
- package/dist/workflows/loop/policy/auto-policy.js +104 -0
- package/dist/workflows/loop/policy/cursor-fix-policy.js +31 -0
- package/dist/workflows/loop/rounds.js +3 -3
- package/dist/workflows/loop/signals.js +4 -7
- package/dist/workflows/loop/state.js +11 -11
- package/docs/README.md +3 -2
- package/docs/architecture/runtime-boundaries.md +147 -0
- package/docs/exec-plans/active/README.md +4 -0
- package/docs/exec-plans/completed/README.md +6 -2
- package/package.json +2 -1
- package/skills/ai-engineering-context/SKILL.md +21 -21
- package/skills/loop-agent/SKILL.md +73 -188
- package/skills/loop-agent/references/README.md +6 -2
- package/skills/loop-agent/references/harness-policy.md +113 -113
- package/skills/loop-agent/references/learned/README.md +13 -13
- package/skills/loop-agent/references/long-running-loop.md +59 -0
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +0 -2
- package/skills/loop-agent/references/verification-and-failure-handling.md +18 -0
- package/skills/requesting-code-review/SKILL.md +40 -40
- package/skills/requesting-code-review/code-reviewer.md +4 -4
- package/skills/systematic-debugging/CREATION-LOG.md +43 -43
- package/skills/systematic-debugging/SKILL.md +113 -113
- package/skills/systematic-debugging/condition-based-waiting.md +20 -20
- package/skills/systematic-debugging/defense-in-depth.md +27 -27
- package/skills/systematic-debugging/root-cause-tracing.md +38 -38
- package/skills/systematic-debugging/test-academic.md +6 -6
- package/skills/systematic-debugging/test-pressure-1.md +6 -6
- package/skills/systematic-debugging/test-pressure-2.md +2 -2
- package/skills/systematic-debugging/test-pressure-3.md +6 -6
- package/skills/verification-before-completion/SKILL.md +37 -37
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buildDagReport, serializeDagReportJson, } from "../../workflows/dag/report.js";
|
|
2
|
+
export async function reportDagUseCase(input) {
|
|
3
|
+
return buildDagReport({
|
|
4
|
+
repoRoot: input.repoRoot,
|
|
5
|
+
runId: input.runId,
|
|
6
|
+
lifecycle: input.lifecycle,
|
|
7
|
+
failedOnly: input.failedOnly,
|
|
8
|
+
latest: input.latest,
|
|
9
|
+
action: input.action,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function serializeReportDagJson(report) {
|
|
13
|
+
return serializeDagReportJson(report);
|
|
14
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { createDagCanvasObserver, resolveCanvasPath, } from "../../workflows/dag/canvas-observer.js";
|
|
3
|
+
import { loadDagSpecFromFile, runDag } from "../../workflows/dag/runner.js";
|
|
4
|
+
import { assertValidDagSpec, collectForbiddenExecutorIssues, } from "../../workflows/dag/validate.js";
|
|
5
|
+
async function loadRawTaskExecutorMap(dagPath) {
|
|
6
|
+
const raw = JSON.parse(await readFile(dagPath, "utf-8"));
|
|
7
|
+
const map = new Map();
|
|
8
|
+
for (const task of raw.tasks ?? []) {
|
|
9
|
+
if (typeof task.id === "string")
|
|
10
|
+
map.set(task.id, task.executor);
|
|
11
|
+
}
|
|
12
|
+
return map;
|
|
13
|
+
}
|
|
14
|
+
function assertNoCursorTasks(spec, rawTaskExecutors) {
|
|
15
|
+
const issues = collectForbiddenExecutorIssues(spec, ["cursor"]);
|
|
16
|
+
if (issues.length === 0)
|
|
17
|
+
return;
|
|
18
|
+
const details = issues
|
|
19
|
+
.map((issue) => {
|
|
20
|
+
const implicitDefault = rawTaskExecutors.get(issue.taskId) === undefined;
|
|
21
|
+
return `task=${issue.taskId}${implicitDefault ? " (implicit cursor default)" : ""}`;
|
|
22
|
+
})
|
|
23
|
+
.join("; ");
|
|
24
|
+
throw new Error(`--no-cursor forbids cursor executor tasks: ${details}`);
|
|
25
|
+
}
|
|
26
|
+
function getCanvasFlushErrorMessage(error) {
|
|
27
|
+
return error instanceof Error ? error.message : String(error);
|
|
28
|
+
}
|
|
29
|
+
async function flushCanvasSafely(canvas) {
|
|
30
|
+
if (!canvas)
|
|
31
|
+
return undefined;
|
|
32
|
+
try {
|
|
33
|
+
await canvas.flush();
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
// Canvas is a derived view; failed writes must not decide canonical DAG success.
|
|
38
|
+
return getCanvasFlushErrorMessage(error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function runDagUseCase(input) {
|
|
42
|
+
const spec = await loadDagSpecFromFile(input.dagPath);
|
|
43
|
+
if (input.noCursor) {
|
|
44
|
+
const rawTaskExecutors = await loadRawTaskExecutorMap(input.dagPath);
|
|
45
|
+
assertNoCursorTasks(spec, rawTaskExecutors);
|
|
46
|
+
}
|
|
47
|
+
assertValidDagSpec(spec);
|
|
48
|
+
const resolvedCanvasPath = resolveCanvasPath({
|
|
49
|
+
canvasPath: input.canvasPath,
|
|
50
|
+
canvasName: input.canvasName,
|
|
51
|
+
canvasesDir: input.canvasesDir,
|
|
52
|
+
cwd: input.cwd,
|
|
53
|
+
});
|
|
54
|
+
const canvas = resolvedCanvasPath
|
|
55
|
+
? createDagCanvasObserver({ canvasPath: resolvedCanvasPath, spec })
|
|
56
|
+
: undefined;
|
|
57
|
+
if (input.dryRun) {
|
|
58
|
+
const summary = await runDag(spec, {
|
|
59
|
+
cwd: input.cwd,
|
|
60
|
+
dryRun: true,
|
|
61
|
+
runId: input.runId,
|
|
62
|
+
observer: canvas?.observer,
|
|
63
|
+
});
|
|
64
|
+
const canvasError = await flushCanvasSafely(canvas);
|
|
65
|
+
return {
|
|
66
|
+
mode: "dry-run",
|
|
67
|
+
title: spec.title,
|
|
68
|
+
taskCount: spec.tasks.length,
|
|
69
|
+
ranks: summary.ranks,
|
|
70
|
+
runId: summary.runId,
|
|
71
|
+
runDir: summary.runDir,
|
|
72
|
+
...(resolvedCanvasPath ? { canvasPath: resolvedCanvasPath } : {}),
|
|
73
|
+
...(canvasError ? { canvasError } : {}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const summary = await runDag(spec, {
|
|
77
|
+
cwd: input.cwd,
|
|
78
|
+
initOnly: input.initOnly,
|
|
79
|
+
dryRun: false,
|
|
80
|
+
maxConcurrent: input.maxConcurrent,
|
|
81
|
+
runId: input.runId,
|
|
82
|
+
observer: canvas?.observer,
|
|
83
|
+
});
|
|
84
|
+
const canvasError = await flushCanvasSafely(canvas);
|
|
85
|
+
if (resolvedCanvasPath) {
|
|
86
|
+
return {
|
|
87
|
+
...summary,
|
|
88
|
+
canvasPath: resolvedCanvasPath,
|
|
89
|
+
...(canvasError ? { canvasError } : {}),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return summary;
|
|
93
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { loadDagSpecFromFile } from "../../workflows/dag/runner.js";
|
|
3
|
+
import { assertValidDagSpec, collectExecutorModelWarnings, collectForbiddenExecutorIssues, collectGovernanceWarnings, validateDagSpec, } from "../../workflows/dag/validate.js";
|
|
4
|
+
import { inferGovernanceProfile } from "../../workflows/dag/governance-profile.js";
|
|
5
|
+
import { topoSortToRanks } from "../../workflows/dag/topo.js";
|
|
6
|
+
import { runSpineAudit } from "../../governance/spine-audit.js";
|
|
7
|
+
function formatModelMatrixWarnings(warnings) {
|
|
8
|
+
return warnings.map((warning) => ({
|
|
9
|
+
executor: warning.executor,
|
|
10
|
+
complexity: warning.complexity,
|
|
11
|
+
expected: warning.expected,
|
|
12
|
+
actual: warning.actual,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
function formatGovernanceWarnings(warnings) {
|
|
16
|
+
return warnings.map((warning) => ({
|
|
17
|
+
type: warning.type,
|
|
18
|
+
message: warning.message,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function ensureStrictModelMatrix(warnings) {
|
|
22
|
+
if (warnings.length === 0) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const details = warnings
|
|
26
|
+
.map((entry) => `executor=${entry.executor}, complexity=${entry.complexity}, expected=${entry.expected}, actual=${entry.actual}`)
|
|
27
|
+
.join("; ");
|
|
28
|
+
throw new Error(`non-canonical executorModels overrides are blocked by --strict-models: ${details}`);
|
|
29
|
+
}
|
|
30
|
+
async function loadRawTaskExecutorMap(dagPath) {
|
|
31
|
+
const raw = JSON.parse(await readFile(dagPath, "utf-8"));
|
|
32
|
+
const map = new Map();
|
|
33
|
+
for (const task of raw.tasks ?? []) {
|
|
34
|
+
if (typeof task.id === "string")
|
|
35
|
+
map.set(task.id, task.executor);
|
|
36
|
+
}
|
|
37
|
+
return map;
|
|
38
|
+
}
|
|
39
|
+
function ensureNoForbiddenExecutors(spec, forbidExecutors, rawTaskExecutors) {
|
|
40
|
+
const supported = new Set(["cursor", "pi", "shell", "static"]);
|
|
41
|
+
const normalized = forbidExecutors.map((executor) => {
|
|
42
|
+
if (!supported.has(executor)) {
|
|
43
|
+
throw new Error(`unsupported executor for --forbid-executor: ${executor}`);
|
|
44
|
+
}
|
|
45
|
+
return executor;
|
|
46
|
+
});
|
|
47
|
+
const issues = collectForbiddenExecutorIssues(spec, normalized);
|
|
48
|
+
if (issues.length === 0)
|
|
49
|
+
return;
|
|
50
|
+
const details = issues
|
|
51
|
+
.map((issue) => {
|
|
52
|
+
const implicitDefault = rawTaskExecutors.get(issue.taskId) === undefined;
|
|
53
|
+
return `task=${issue.taskId}, executor=${issue.executor}${implicitDefault ? " (implicit default)" : ""}`;
|
|
54
|
+
})
|
|
55
|
+
.join("; ");
|
|
56
|
+
throw new Error(`forbidden executor present: ${details}`);
|
|
57
|
+
}
|
|
58
|
+
export async function validateDagUseCase(input) {
|
|
59
|
+
const spec = await loadDagSpecFromFile(input.dagPath);
|
|
60
|
+
const rawTaskExecutors = await loadRawTaskExecutorMap(input.dagPath);
|
|
61
|
+
ensureNoForbiddenExecutors(spec, input.forbidExecutors, rawTaskExecutors);
|
|
62
|
+
const validationIssues = validateDagSpec(spec);
|
|
63
|
+
const warnings = collectExecutorModelWarnings(spec);
|
|
64
|
+
const governanceWarnings = collectGovernanceWarnings(validationIssues);
|
|
65
|
+
if (input.strictModelMatrix) {
|
|
66
|
+
ensureStrictModelMatrix(warnings);
|
|
67
|
+
}
|
|
68
|
+
const spineAudit = input.spineTaskId
|
|
69
|
+
? await runSpineAudit(input.repoRoot, input.spineTaskId)
|
|
70
|
+
: undefined;
|
|
71
|
+
if (input.strictGovernance && spineAudit && !spineAudit.ok) {
|
|
72
|
+
throw new Error(`minimal spec spine audit failed for ${input.spineTaskId}: ${spineAudit.findings
|
|
73
|
+
.filter((finding) => finding.severity === "error")
|
|
74
|
+
.map((finding) => `${finding.type}: ${finding.message}`)
|
|
75
|
+
.join("; ")}`);
|
|
76
|
+
}
|
|
77
|
+
assertValidDagSpec(spec, {
|
|
78
|
+
issues: validationIssues,
|
|
79
|
+
strictGovernance: input.strictGovernance,
|
|
80
|
+
});
|
|
81
|
+
const { ranks } = topoSortToRanks(spec);
|
|
82
|
+
const governanceProfile = inferGovernanceProfile(spec);
|
|
83
|
+
return {
|
|
84
|
+
title: spec.title,
|
|
85
|
+
taskCount: spec.tasks.length,
|
|
86
|
+
ranks,
|
|
87
|
+
governanceProfile,
|
|
88
|
+
spineAudit: spineAudit
|
|
89
|
+
? {
|
|
90
|
+
ok: spineAudit.ok,
|
|
91
|
+
taskId: spineAudit.taskId,
|
|
92
|
+
findings: spineAudit.findings,
|
|
93
|
+
verifyCommandLabels: spineAudit.verifyCommandLabels,
|
|
94
|
+
}
|
|
95
|
+
: undefined,
|
|
96
|
+
warnings: [
|
|
97
|
+
...formatModelMatrixWarnings(warnings),
|
|
98
|
+
...formatGovernanceWarnings(governanceWarnings),
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { runLoopCursorFix } from "../../workflows/loop/actions/cursor-fix.js";
|
|
2
|
+
import { runLoopDagAction } from "../../workflows/loop/actions/dag-action.js";
|
|
3
|
+
import { runLoopPiReview } from "../../workflows/loop/actions/pi-review.js";
|
|
4
|
+
import { runLoopShellVerification, } from "../../workflows/loop/actions/shell-verify.js";
|
|
5
|
+
import { runLoopWorkflowAction, runLoopWorkflowGateSignalAction, } from "../../workflows/loop/actions/workflow-action.js";
|
|
6
|
+
export async function runLoopAction(input) {
|
|
7
|
+
if (input.action === "shell-verify") {
|
|
8
|
+
return runLoopShellVerification(input.repoRoot, input.taskId, input.options);
|
|
9
|
+
}
|
|
10
|
+
if (input.action === "pi-review") {
|
|
11
|
+
return runLoopPiReview(input.repoRoot, input.taskId, input.options);
|
|
12
|
+
}
|
|
13
|
+
if (input.action === "cursor-fix") {
|
|
14
|
+
return runLoopCursorFix(input.repoRoot, input.taskId, input.options);
|
|
15
|
+
}
|
|
16
|
+
if (input.action === "dag") {
|
|
17
|
+
return runLoopDagAction(input.repoRoot, input.taskId, input.options);
|
|
18
|
+
}
|
|
19
|
+
if (input.action === "workflow") {
|
|
20
|
+
return runLoopWorkflowAction(input.repoRoot, input.taskId, input.options);
|
|
21
|
+
}
|
|
22
|
+
return runLoopWorkflowGateSignalAction(input.repoRoot, input.taskId, input.options?.signals);
|
|
23
|
+
}
|
package/dist/cli/catalog.js
CHANGED
|
@@ -1,241 +1,6 @@
|
|
|
1
|
+
import { COMMAND_DEFINITIONS, toCommandManifestEntry, } from "./command-definitions.js";
|
|
1
2
|
/** Order remains stable for compatibility; tiers provide the selection signal. */
|
|
2
|
-
export const CODE_AGENT_COMMAND_MANIFEST =
|
|
3
|
-
{
|
|
4
|
-
name: "inspect",
|
|
5
|
-
adapter: "required",
|
|
6
|
-
tier: "operator",
|
|
7
|
-
intent: "Inspect the target repo harness manifest.",
|
|
8
|
-
usage: "inspect",
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
name: "doctor",
|
|
12
|
-
adapter: "required",
|
|
13
|
-
tier: "operator",
|
|
14
|
-
intent: "Check local loop-agent runtime health.",
|
|
15
|
-
usage: "doctor",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "docs",
|
|
19
|
-
adapter: "required",
|
|
20
|
-
tier: "operator",
|
|
21
|
-
intent: "Audit or archive repo governance documents.",
|
|
22
|
-
usage: "docs <audit|archive> ...",
|
|
23
|
-
subcommands: ["audit", "archive"],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "new-task",
|
|
27
|
-
adapter: "required",
|
|
28
|
-
tier: "primary",
|
|
29
|
-
intent: "Create a harness task before DAG autonomous work.",
|
|
30
|
-
usage: "new-task <task-id> [title]",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "status",
|
|
34
|
-
adapter: "required",
|
|
35
|
-
tier: "operator",
|
|
36
|
-
intent: "Inspect a task state and machine-readable action context.",
|
|
37
|
-
usage: "status <task-id> [--json]",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "instructions",
|
|
41
|
-
adapter: "required",
|
|
42
|
-
tier: "operator",
|
|
43
|
-
intent: "Resolve task artifact targets, dependencies, templates, and write policy.",
|
|
44
|
-
usage: "instructions <source|dag-draft|task-artifacts|promotion|closeout> --task <task-id> [--json]",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "promote-run",
|
|
48
|
-
adapter: "required",
|
|
49
|
-
tier: "operator",
|
|
50
|
-
intent: "Promote completed DAG or one-shot run evidence into task artifacts without mutating run facts.",
|
|
51
|
-
usage: "promote-run <task-id> --run-id <run-id>",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "closeout",
|
|
55
|
-
adapter: "required",
|
|
56
|
-
tier: "operator",
|
|
57
|
-
intent: "Create deterministic task closeout/progress records from promoted task artifacts.",
|
|
58
|
-
usage: "closeout task <task-id>",
|
|
59
|
-
subcommands: ["task"],
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "stats",
|
|
63
|
-
adapter: "required",
|
|
64
|
-
tier: "operator",
|
|
65
|
-
intent: "Inspect historical step duration statistics.",
|
|
66
|
-
usage: "stats",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "plan",
|
|
70
|
-
adapter: "required",
|
|
71
|
-
tier: "operator",
|
|
72
|
-
intent: "List repo execution plans.",
|
|
73
|
-
usage: "plan <list>",
|
|
74
|
-
subcommands: ["list"],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "spine",
|
|
78
|
-
adapter: "required",
|
|
79
|
-
tier: "operator",
|
|
80
|
-
intent: "Audit a task minimal spec spine: source, path ownership, requirements, and final verification coverage.",
|
|
81
|
-
usage: "spine audit <task-id> [--json|--markdown]",
|
|
82
|
-
subcommands: ["audit"],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "handoff",
|
|
86
|
-
adapter: "required",
|
|
87
|
-
tier: "operator",
|
|
88
|
-
intent: "Check task handoff completeness and requirement coverage.",
|
|
89
|
-
usage: "handoff <check|coverage> [taskId]",
|
|
90
|
-
subcommands: ["check", "coverage"],
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "goal",
|
|
94
|
-
adapter: "required",
|
|
95
|
-
tier: "compatibility",
|
|
96
|
-
compatibilityStatus: "deprecated-candidate",
|
|
97
|
-
intent: "Manage legacy task continuation goals (compatibility-only; prefer Agent DAG closeout).",
|
|
98
|
-
usage: "goal <set|get|pause|resume|clear> ...",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "reference",
|
|
102
|
-
adapter: "required",
|
|
103
|
-
tier: "compatibility",
|
|
104
|
-
compatibilityStatus: "compatibility-only",
|
|
105
|
-
intent: "Index external references for feature-study tasks (compatibility-only).",
|
|
106
|
-
usage: "reference <index> <task-id>",
|
|
107
|
-
subcommands: ["index"],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "study",
|
|
111
|
-
adapter: "required",
|
|
112
|
-
tier: "compatibility",
|
|
113
|
-
compatibilityStatus: "compatibility-only",
|
|
114
|
-
intent: "Initialize feature-study tasks (compatibility-only; prefer DAG work).",
|
|
115
|
-
usage: "study init <task-id> [title] ...",
|
|
116
|
-
subcommands: ["init"],
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: "worktree",
|
|
120
|
-
adapter: "required",
|
|
121
|
-
tier: "escape-hatch",
|
|
122
|
-
intent: "Manage delegated worktrees directly.",
|
|
123
|
-
usage: "worktree <create|list|remove> ...",
|
|
124
|
-
subcommands: ["create", "list", "remove"],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: "delegate",
|
|
128
|
-
adapter: "required",
|
|
129
|
-
tier: "escape-hatch",
|
|
130
|
-
intent: "Prepare or run isolated executor delegation outside the normal DAG path.",
|
|
131
|
-
usage: "delegate <task-id> [options]",
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: "harvest",
|
|
135
|
-
adapter: "required",
|
|
136
|
-
tier: "escape-hatch",
|
|
137
|
-
intent: "Merge and close isolated delegated work after completion.",
|
|
138
|
-
usage: "harvest <task-id> [options]",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: "cursor-worker",
|
|
142
|
-
adapter: "required",
|
|
143
|
-
tier: "escape-hatch",
|
|
144
|
-
intent: "Inspect or control the optional Cursor SDK worker process.",
|
|
145
|
-
usage: "cursor-worker <status|stop|ping>",
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "knowledge",
|
|
149
|
-
adapter: "required",
|
|
150
|
-
tier: "operator",
|
|
151
|
-
intent: "Curate completed convergence patterns into human-gated learned guidance proposals.",
|
|
152
|
-
usage: "knowledge curate [--json|--markdown] [--output <path>]",
|
|
153
|
-
subcommands: ["curate"],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: "dag",
|
|
157
|
-
adapter: "required",
|
|
158
|
-
tier: "primary",
|
|
159
|
-
intent: "Generate, validate, inspect, recover, close out Agent DAG runs, and use experimental dynamic workflow compile seams.",
|
|
160
|
-
usage: "dag <init-hybrid|run-task|validate|workflow-plan|workflow-validate|workflow-compile|approve|reject|resume|status|doctor|report|closeout-draft|reconcile-tasks|final-verification|decision> ...",
|
|
161
|
-
subcommands: [
|
|
162
|
-
"init-hybrid",
|
|
163
|
-
"run-task",
|
|
164
|
-
"validate",
|
|
165
|
-
"workflow-plan",
|
|
166
|
-
"workflow-validate",
|
|
167
|
-
"workflow-compile",
|
|
168
|
-
"approve",
|
|
169
|
-
"reject",
|
|
170
|
-
"resume",
|
|
171
|
-
"status",
|
|
172
|
-
"doctor",
|
|
173
|
-
"report",
|
|
174
|
-
"closeout-draft",
|
|
175
|
-
"reconcile-tasks",
|
|
176
|
-
"final-verification",
|
|
177
|
-
"decision",
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: "run-dag",
|
|
182
|
-
adapter: "required",
|
|
183
|
-
tier: "primary",
|
|
184
|
-
intent: "Execute a reviewed Agent DAG spec.",
|
|
185
|
-
usage: "run-dag --dag <path> [options]",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: "workflow",
|
|
189
|
-
adapter: "required",
|
|
190
|
-
tier: "experimental",
|
|
191
|
-
intent: "List, save, inspect, run, diff, and replay saved dynamic workflows.",
|
|
192
|
-
usage: "workflow <list|inspect|save|run|diff|replay> [name] [options]",
|
|
193
|
-
subcommands: ["list", "inspect", "save", "run", "diff", "replay"],
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: "loop",
|
|
197
|
-
adapter: "required",
|
|
198
|
-
tier: "experimental",
|
|
199
|
-
intent: "Manage durable long-running task loop state above Agent DAG rounds.",
|
|
200
|
-
usage: "loop <init|status|run|record-round|add-signal|closeout> <task-id> [options]",
|
|
201
|
-
subcommands: [
|
|
202
|
-
"init",
|
|
203
|
-
"status",
|
|
204
|
-
"run",
|
|
205
|
-
"record-round",
|
|
206
|
-
"add-signal",
|
|
207
|
-
"closeout",
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
name: "cursor-prompt",
|
|
212
|
-
adapter: "none",
|
|
213
|
-
tier: "escape-hatch",
|
|
214
|
-
intent: "Run one-shot Cursor diagnostics without harness state.",
|
|
215
|
-
usage: "cursor-prompt [options] [task]",
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: "pi-prompt",
|
|
219
|
-
adapter: "none",
|
|
220
|
-
tier: "escape-hatch",
|
|
221
|
-
intent: "Run one-shot Pi diagnostics without harness state.",
|
|
222
|
-
usage: "pi-prompt [options] [task]",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "pi-reuse-benchmark",
|
|
226
|
-
adapter: "required",
|
|
227
|
-
tier: "operator",
|
|
228
|
-
intent: "Read existing Pi runtime reuse benchmark evidence.",
|
|
229
|
-
usage: "pi-reuse-benchmark [--report <path>] [--approval <path>] [--off-executor|--off-task ...] [--on-executor|--on-task ...] [--json] [--markdown]",
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: "loop-benchmark",
|
|
233
|
-
adapter: "required",
|
|
234
|
-
tier: "operator",
|
|
235
|
-
intent: "Generate deterministic loop convergence benchmark baseline evidence.",
|
|
236
|
-
usage: "loop-benchmark [--json|--markdown] [--output <path>]",
|
|
237
|
-
},
|
|
238
|
-
];
|
|
3
|
+
export const CODE_AGENT_COMMAND_MANIFEST = COMMAND_DEFINITIONS.map(toCommandManifestEntry);
|
|
239
4
|
export const CODE_AGENT_TOP_LEVEL_COMMANDS = CODE_AGENT_COMMAND_MANIFEST.map((entry) => entry.name);
|
|
240
5
|
export function listCommandsByTier(tier, manifest = CODE_AGENT_COMMAND_MANIFEST) {
|
|
241
6
|
return manifest.filter((entry) => entry.tier === tier);
|