@tea-agent/loop-agent 0.2.0 → 0.3.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 (77) hide show
  1. package/AGENTS.md +43 -24
  2. package/CHANGELOG.md +72 -44
  3. package/README.md +177 -164
  4. package/bin/loop-agent.js +21 -21
  5. package/dist/application/dag/args.js +6 -0
  6. package/dist/application/dag/generate-task-dag.js +5 -3
  7. package/dist/application/dag/run-dag.js +17 -1
  8. package/dist/application/dag/validate-dag.js +41 -0
  9. package/dist/cli/command-definitions.js +2 -2
  10. package/dist/cli/program.js +24 -4
  11. package/dist/commands/init.js +1036 -461
  12. package/dist/workflows/dag/dynamic-runtime/loop-until.js +2 -1
  13. package/dist/workflows/dag/dynamic-runtime/map.js +1 -0
  14. package/dist/workflows/dag/failure-routing.js +82 -0
  15. package/dist/workflows/dag/init-hybrid.js +3 -3
  16. package/dist/workflows/dag/lifecycle.js +95 -3
  17. package/dist/workflows/dag/report.js +73 -1
  18. package/dist/workflows/dag/skills.js +3 -3
  19. package/dist/workflows/dag/types.js +2 -0
  20. package/dist/workflows/dynamic/compile.js +11 -0
  21. package/dist/workflows/dynamic/spec.js +1 -0
  22. package/docs/README.md +50 -45
  23. package/docs/agent-dag-recovery-playbook.md +32 -6
  24. package/docs/agent-dag-runner.md +19 -17
  25. package/docs/architecture/runtime-boundaries.md +1 -1
  26. package/docs/cursor-executor-usage.md +5 -5
  27. package/docs/decisions/README.md +2 -2
  28. package/docs/design/README.md +24 -24
  29. package/docs/development-principles.md +50 -50
  30. package/docs/dynamic-workflow-dag-engine-roadmap.md +6 -6
  31. package/docs/exec-plans/README.md +4 -4
  32. package/docs/exec-plans/active/README.md +7 -9
  33. package/docs/exec-plans/completed/README.md +10 -8
  34. package/docs/feature-workflow.md +111 -109
  35. package/docs/harness-methodology-verification.md +18 -18
  36. package/docs/init-surface.manifest.json +175 -0
  37. package/docs/loop-agent-harness.md +36 -36
  38. package/docs/production-readiness.md +96 -0
  39. package/docs/progress/README.md +2 -2
  40. package/docs/reports/README.md +4 -2
  41. package/docs/skills/README.md +6 -0
  42. package/docs/skills/vetted-skill-registry.md +26 -0
  43. package/docs/templates/agent-dag-decision-gate-dogfood-report.md +1 -1
  44. package/docs/templates/agent-dag-process-supervisor.prompt.md +2 -2
  45. package/docs/templates/agent-dag-report.schema.json +33 -2
  46. package/docs/templates/agent-dag-review-verdict.prompt.md +1 -1
  47. package/docs/templates/agent-dag.base.json +195 -195
  48. package/docs/templates/agent-dag.final-verification.json +190 -190
  49. package/docs/templates/agent-dag.schema.json +17 -17
  50. package/docs/templates/agent-dag.supervised-implementation.json +500 -500
  51. package/docs/templates/hybrid-dag.json +193 -193
  52. package/docs/templates/init-evolution-review.md +33 -0
  53. package/docs/templates/production-readiness-checklist.md +57 -0
  54. package/docs/templates/progress-log.md +7 -7
  55. package/docs/templates/project-start-checklist.md +8 -8
  56. package/docs/templates/qa-report.md +17 -11
  57. package/docs/templates/sprint-contract.md +19 -19
  58. package/docs/verification-matrix.md +37 -26
  59. package/examples/example-dag.json +51 -51
  60. package/examples/hybrid-loop-agent-dag.json +194 -194
  61. package/harness.json +10 -8
  62. package/package.json +60 -58
  63. package/skills/code-review-core/SKILL.md +20 -0
  64. package/skills/codebase-scout/SKILL.md +19 -0
  65. package/skills/init-capability-evolution/SKILL.md +69 -0
  66. package/skills/loop-agent/SKILL.md +35 -35
  67. package/skills/loop-agent/references/command-reference.md +125 -65
  68. package/skills/loop-agent/references/harness-policy.md +30 -30
  69. package/skills/loop-agent/references/hybrid-dag.md +30 -30
  70. package/skills/loop-agent/references/model-routing.md +1 -1
  71. package/skills/loop-agent/references/orchestrator-and-interventions.md +1 -1
  72. package/skills/loop-agent/references/pi-prompt.md +9 -9
  73. package/skills/loop-agent/references/post-implementation-and-patterns.md +7 -7
  74. package/skills/loop-agent/references/task-workflow.md +19 -19
  75. package/skills/loop-agent/references/verification-and-failure-handling.md +36 -0
  76. package/skills/test-driven-development/SKILL.md +20 -0
  77. package/skills/webapp-testing/SKILL.md +19 -0
@@ -0,0 +1,96 @@
1
+ # Production Readiness v0.1
2
+
3
+ 本文档冻结 2026-07-06 至 2026-07-12 hardening sprint 的单任务 production readiness 标准。
4
+
5
+ `loop-agent` production readiness v0.1 指:低/中风险的仓库本地 DAG 任务能以稳定、可解释、可验证、可恢复的方式运行。这不是组织级平台 readiness 声明。
6
+
7
+ ## 支持范围
8
+
9
+ - 单仓库
10
+ - 单任务或小范围有边界任务
11
+ - 低/中风险的代码与文档变更
12
+ - 显式 task source
13
+ - 显式 `allowedPaths`、`forbiddenPaths`、`writeSet`
14
+ - shell 验证命令
15
+ - 通过 `dag report`、`dag doctor`、`promote-run`、`closeout` 交接
16
+
17
+ ## 非目标
18
+
19
+ - 自动 merge
20
+ - 自动 release
21
+ - 生产 secrets
22
+ - 生产数据库访问
23
+ - 高风险 migration
24
+ - 在线 Worker Pool
25
+ - 多仓库 feature 编排
26
+ - 可写的 Dynamic Workflow sharded migration
27
+ - DAG runtime 之外的第二套 runner
28
+
29
+ ## 必需证据
30
+
31
+ 每个 production-ready v0.1 任务必须保留或产出以下证据:
32
+
33
+ | 证据 | 要求 |
34
+ |---|---|
35
+ | DAG spec path | 生成的 DAG JSON 路径记录在 CLI 输出、report 或 task artifacts 中 |
36
+ | DAG validation result | `dag validate --strict-models --strict-governance` 有新鲜输出 |
37
+ | Run id | `run-dag` 打印或记录 run id |
38
+ | Shell verification output | 完成声明引用新鲜命令输出,而非 model 自报 |
39
+ | Failure category | 失败 run 在可用时具备 raw、normalized、product-line 与 recommended follow-up 字段 |
40
+ | Closeout 或 failure handoff | 成功 run 可 promote 并 closeout;失败 run 产出 failure handoff 证据而非成功 closeout |
41
+
42
+ ## 必需命令
43
+
44
+ 标准任务路径:
45
+
46
+ ```bash
47
+ loop-agent new-task <task-id> "Task title"
48
+ loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
49
+ loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
50
+ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
51
+ loop-agent dag report --run-id <run-id> --markdown
52
+ loop-agent dag doctor --run-id <run-id>
53
+ loop-agent promote-run <task-id> --run-id <run-id>
54
+ loop-agent closeout task <task-id>
55
+ ```
56
+
57
+ `<temp-dir>` 使用平台原生临时目录。
58
+
59
+ ## 必需标准
60
+
61
+ | ID | 标准 | 验收 |
62
+ |---|---|---|
63
+ | PRD-01 | 新任务仅推荐 DAG 路径 | README、docs、website、skills 不把已移除的 Level 1 顺序命令当作 fallback |
64
+ | PRD-02 | 写任务有显式边界 | strict DAG governance 在需要时拒绝缺失 `allowedPaths`、`forbiddenPaths` 或 `writeSet` |
65
+ | PRD-03 | 每次 DAG run 有可读 report | `loop-agent dag report --latest --markdown` 显示 status、failure summary 与 next step |
66
+ | PRD-04 | 失败 run 可诊断 | `loop-agent dag doctor` 报告 category 与 recommended follow-up |
67
+ | PRD-05 | Shell 验证是完成权威 | closeout 不接受 model 自报替代新鲜命令输出 |
68
+ | PRD-06 | Failure category 覆盖失败 fixture | validation、write guard、shell、timeout、auth、unknown fixture 均有映射 |
69
+ | PRD-07 | 已完成 DAG facts 不可变 | completed facts guard 仍由测试覆盖 |
70
+ | PRD-08 | CLI 主路径输出指引下一步 | `dag run-task`、`dag validate`、`run-dag`、`dag report` 打印 operator next commands |
71
+ | PRD-09 | 文档面一致 | doc 更新后 `bash scripts/check-repo.sh` 与 `npm run docs:build` 通过 |
72
+ | PRD-10 | sprint 完成前完整本地门禁通过 | 最终 hardening closeout 时 `bash scripts/ci.sh` 通过 |
73
+
74
+ ## Failure Routing
75
+
76
+ Failure category 是路由字段,不是主任务状态。保留 raw DAG facts,仅在 report、doctor 输出、closeout draft、task artifacts 或后续 Task Pool 记录中追加派生字段。
77
+
78
+ 四层结构:
79
+
80
+ ```text
81
+ raw_failure_category
82
+ dag_normalized_failure_category
83
+ product_line_failure_category
84
+ recommended_follow_up
85
+ ```
86
+
87
+ Product-line category 事实源:`docs/design/state-and-failure-taxonomy.md`。
88
+
89
+ ## Sprint Gate
90
+
91
+ 2026-07-06 sprint 仅在 active execution plan 记录以下内容时视为完成:
92
+
93
+ - M1–M4 最终状态
94
+ - 必需验证门禁的命令输出
95
+ - 成功、write-guard、shell-failure 场景的 dogfood 证据
96
+ - 剩余风险与后续工作
@@ -1,3 +1,3 @@
1
- # Progress Logs
1
+ # 进度日志
2
2
 
3
- Use this directory for concise handoff logs that should survive chat context.
3
+ 本目录存放应超越聊天上下文的简洁 handoff 日志。
@@ -1,3 +1,5 @@
1
- # Reports
1
+ # 报告
2
2
 
3
- Use this directory for verification, audit, benchmark, and closeout reports.
3
+ 本目录存放验证、审计、benchmark closeout 报告。
4
+
5
+ - [`2026-07-12-production-readiness-hardening.md`](2026-07-12-production-readiness-hardening.md)
@@ -0,0 +1,6 @@
1
+ # Skill Registry
2
+
3
+ This directory records repo-local skill wrappers and vetting notes used by Agent DAG role mapping.
4
+
5
+ - `vetted-skill-registry.md` — supported roles, source inspiration, risk notes, and default/optional usage.
6
+
@@ -0,0 +1,26 @@
1
+ # Vetted Skill Registry
2
+
3
+ This registry records repo-local skills that may be referenced by default DAG role mapping or task/profile-specific `skills`.
4
+
5
+ The entries below are local wrappers or existing local skills. They are not wholesale vendored copies of third-party skill repositories.
6
+
7
+ | Skill | Source / Inspiration | Local Path | Supported Roles | Default Use | Risk Notes |
8
+ |---|---|---|---|---|---|
9
+ | `ai-engineering-context` | local existing | `skills/ai-engineering-context/SKILL.md` | scout, default context | default/scout | Read-only engineering context; not a private platform memory skill. |
10
+ | `loop-agent` | local existing | `skills/loop-agent/SKILL.md` | planner, supervisor, closeout | planner/closeout | Long references may be resolved by strict audit with expanded budget; executor behavior unchanged. |
11
+ | `verification-before-completion` | local wrapper inspired by verification discipline | `skills/verification-before-completion/SKILL.md` | implementer, verifier, closeout | implementer/verifier/closeout | Requires shell evidence before completion claims. |
12
+ | `systematic-debugging` | local wrapper inspired by systematic debugging discipline | `skills/systematic-debugging/SKILL.md` | implementer, verifier | verifier | Advisory prompt guidance only; does not run tools by itself. |
13
+ | `requesting-code-review` | local existing | `skills/requesting-code-review/SKILL.md` | reviewer | reviewer | Review prompt guidance only. |
14
+ | `test-driven-development` | local wrapper inspired by TDD practice | `skills/test-driven-development/SKILL.md` | implementer | implementer | Does not force tests in mechanical-only docs changes; implementer still follows task contract. |
15
+ | `code-review-core` | local wrapper inspired by code review practice | `skills/code-review-core/SKILL.md` | reviewer | reviewer | No external tools or network by default. |
16
+ | `codebase-scout` | local wrapper | `skills/codebase-scout/SKILL.md` | scout | scout | Read-only reconnaissance guidance. |
17
+ | `init-capability-evolution` | local wrapper | `skills/init-capability-evolution/SKILL.md` | supervisor, maintenance | optional | Used only when changes may affect target-project initialization, package surface, or init projection rules. |
18
+ | `webapp-testing` | local wrapper inspired by frontend/browser testing practice | `skills/webapp-testing/SKILL.md` | verifier, reviewer | optional | Only applies when task explicitly involves browser-rendered behavior; no default Playwright/Semgrep execution. |
19
+
20
+ ## Vetting Rules
21
+
22
+ - Default role mappings may reference only repo-local skills that resolve cleanly under `dag validate --strict-skills`.
23
+ - Optional/security/web skills remain task- or profile-specific until their tool, network, credential, and write behavior is reviewed.
24
+ - This registry records source inspiration, not license clearance for vendored third-party content. Vendoring requires a separate license/security review.
25
+ - `SKILL.md` is the entry point. References must be declared in frontmatter and stay within the skill directory.
26
+
@@ -8,7 +8,7 @@
8
8
  |---|---|
9
9
  | Date | YYYY-MM-DD |
10
10
  | Topic | |
11
- | DAG input | `<temp-dir>/<topic>-decision-gate-dag.json` |
11
+ | DAG input | `<temp-dir>/<topic>-decision-gate-dag.json` |
12
12
  | Run ID | |
13
13
  | Run facts | `.harness/dag-runs/completed/<run-id>/` |
14
14
  | Gate type | `acceptance-gate` |
@@ -11,7 +11,7 @@ Do **not** create `executor: supervisor`. Supervisor is a **role** on `executor:
11
11
  ```json
12
12
  {
13
13
  "id": "process-supervisor-pi",
14
- "depends_on": ["soft-verify-shell", "implement-pi"],
14
+ "depends_on": ["soft-verify-shell", "implement-pi"],
15
15
  "complexity": "HIGH",
16
16
  "executor": "pi",
17
17
  "role": "supervisor",
@@ -80,7 +80,7 @@ Rules:
80
80
 
81
81
  - `verdict` must match the first line.
82
82
  - `failureClass` must be one of `syntax`, `runtime`, `logic`, `boundary`, `environment`, `governance`, `unknown`.
83
- - For `request-revision`, `fixScope` must name the smallest repair paths/components and stay inside the downstream `repair-pi` writeSet/allowedPaths.
83
+ - For `request-revision`, `fixScope` must name the smallest repair paths/components and stay inside the downstream `repair-pi` writeSet/allowedPaths.
84
84
  - For `pass`, `fixScope` must be an empty array.
85
85
  - `invariant` must state the behavior or contract the repair must preserve.
86
86
  - `evidenceRefs` must name node ids or relative artifact paths consulted.
@@ -58,6 +58,21 @@
58
58
  "commandHint": { "type": "string" }
59
59
  }
60
60
  },
61
+ "dagProductLineFailureCategory": {
62
+ "type": "string",
63
+ "enum": [
64
+ "SpecUnclear",
65
+ "ContractMismatch",
66
+ "ProductBug",
67
+ "TestBug",
68
+ "EnvFailure",
69
+ "FlakyTest",
70
+ "RiskyChange",
71
+ "DependencyFailure",
72
+ "NeedsHuman",
73
+ "Unknown"
74
+ ]
75
+ },
61
76
  "dagReportPrimaryFailure": {
62
77
  "type": "object",
63
78
  "additionalProperties": false,
@@ -87,7 +102,11 @@
87
102
  "skipped",
88
103
  "unknown"
89
104
  ]
90
- }
105
+ },
106
+ "productLineFailureCategory": {
107
+ "$ref": "#/$defs/dagProductLineFailureCategory"
108
+ },
109
+ "recommendedFollowUp": { "type": "string" }
91
110
  }
92
111
  },
93
112
  "dagReportPrimaryRecovery": {
@@ -117,7 +136,11 @@
117
136
  "skipped",
118
137
  "unknown"
119
138
  ]
120
- }
139
+ },
140
+ "productLineFailureCategory": {
141
+ "$ref": "#/$defs/dagProductLineFailureCategory"
142
+ },
143
+ "recommendedFollowUp": { "type": "string" }
121
144
  }
122
145
  },
123
146
  "dagNodeDecisionEnvelope": {
@@ -333,6 +356,10 @@
333
356
  "unknown"
334
357
  ]
335
358
  },
359
+ "productLineFailureCategory": {
360
+ "$ref": "#/$defs/dagProductLineFailureCategory"
361
+ },
362
+ "recommendedFollowUp": { "type": "string" },
336
363
  "recoveryRecommendation": {
337
364
  "$ref": "#/$defs/dagRecoveryRecommendation"
338
365
  },
@@ -400,6 +427,10 @@
400
427
  "unknown"
401
428
  ]
402
429
  },
430
+ "productLineFailureCategory": {
431
+ "$ref": "#/$defs/dagProductLineFailureCategory"
432
+ },
433
+ "recommendedFollowUp": { "type": "string" },
403
434
  "recoveryRecommendation": {
404
435
  "$ref": "#/$defs/dagRecoveryRecommendation"
405
436
  },
@@ -9,7 +9,7 @@ Use this prompt for a read-only **review verdict** node after hard verification:
9
9
  ```json
10
10
  {
11
11
  "id": "review-pi",
12
- "depends_on": ["hard-verify-shell", "repair-pi"],
12
+ "depends_on": ["hard-verify-shell", "repair-pi"],
13
13
  "complexity": "HIGH",
14
14
  "executor": "pi",
15
15
  "role": "reviewer",
@@ -1,195 +1,195 @@
1
- {
2
- "$schema": "./agent-dag.schema.json",
3
- "version": 2,
4
- "title": "Agent DAG base template",
5
- "objective": "Replace with the concrete objective for this DAG run.",
6
- "successCriteria": [
7
- "Each node returns output matching its outputContract.",
8
- "Same-rank read-only scouts run in parallel when their outputs are independent.",
9
- "Only Pi nodes with toolProfile=write or explicitly enabled Cursor implementer nodes may write files, and only inside declared writeSet.",
10
- "Pi nodes remain read-only unless toolProfile=write is explicitly selected for a bounded writer node.",
11
- "Read-only nodes must not write root artifacts/**; root artifacts/ is not a per-node scratchpad."
12
- ],
13
- "globalConstraints": [
14
- "Replace every REPLACE/WITH/... placeholder with concrete repo paths before execution; do not leave template placeholders in production DAG JSON.",
15
- "Do not commit runtime traces under .harness/dag-runs/.",
16
- "Do not write generated DAG input specs into .harness/dag-runs/active/.",
17
- "Use a platform-native temp path such as <temp-dir>/<topic>-dag.json for one-off DAG specs; commit reusable templates under examples/ or docs/templates/.",
18
- "Actual file operation paths must be macOS/Windows compatible; use / only for stable repo refs, JSON/Markdown evidence refs, and glob conventions.",
19
- "Every task must explicitly declare executor; defaults.executor is schema-only and not a runtime fallback.",
20
- "Prefer same-rank parallel read-only scouts over serial chains when outputs are independent.",
21
- "Add depends_on only when a child truly needs upstream output; challenge single-chain topologies during review.",
22
- "Same-rank exclusive writeSet entries must be disjoint.",
23
- "Do not add provider fields to DAG JSON; provider routing is executor-owned.",
24
- "Use executorModels for model routing; do not add defaults.model or legacy top-level models.",
25
- "Every task must declare outputContract describing the expected Markdown/output shape.",
26
- "exclusive implementer nodes must use narrow, concrete writeSet and allowedPaths; never keep broad write permissions such as ** or repo root.",
27
- "Cursor is optional; no-Cursor environments should use Pi read-only scouts and Pi writer nodes with toolProfile=write."
28
- ],
29
- "defaults": {
30
- "executor": "pi",
31
- "contextProfile": "slim",
32
- "skills": [
33
- "ai-engineering-context"
34
- ],
35
- "writePolicy": "read-only"
36
- },
37
- "skillsByRole": {
38
- "planner": [
39
- "loop-agent"
40
- ],
41
- "scout": [
42
- "ai-engineering-context"
43
- ],
44
- "implementer": [
45
- "verification-before-completion"
46
- ],
47
- "reviewer": [
48
- "requesting-code-review"
49
- ],
50
- "verifier": [
51
- "verification-before-completion",
52
- "systematic-debugging"
53
- ],
54
- "closeout": [
55
- "loop-agent",
56
- "verification-before-completion"
57
- ]
58
- },
59
- "executorModels": {
60
- "cursor": {
61
- "LOW": "composer-2.5",
62
- "MED": "composer-2.5",
63
- "HIGH": "composer-2.5"
64
- },
65
- "pi": {
66
- "LOW": "gpt-5.3-codex-spark",
67
- "MED": "glm-5.2",
68
- "HIGH": "gpt-5.5"
69
- }
70
- },
71
- "tasks": [
72
- {
73
- "id": "contract-pi",
74
- "depends_on": [],
75
- "complexity": "MED",
76
- "executor": "pi",
77
- "role": "planner",
78
- "writePolicy": "read-only",
79
- "allowedPaths": [
80
- "**"
81
- ],
82
- "forbiddenPaths": [
83
- ".harness/**",
84
- "artifacts/**"
85
- ],
86
- "outputContract": "Plain Markdown implementation contract; no file writes.",
87
- "subtask_prompt": "Read the task inputs and return a concise implementation contract: scope, risks, narrow write boundaries, parallel scout opportunities, and verification expectations. Do not edit files."
88
- },
89
- {
90
- "id": "scout-src",
91
- "depends_on": [
92
- "contract-pi"
93
- ],
94
- "complexity": "LOW",
95
- "executor": "pi",
96
- "role": "scout",
97
- "writePolicy": "read-only",
98
- "allowedPaths": [
99
- "REPLACE/WITH/SOURCE/PATH/**"
100
- ],
101
- "forbiddenPaths": [
102
- ".harness/**",
103
- "artifacts/**"
104
- ],
105
- "outputContract": "Plain Markdown source reconnaissance summary; no file writes.",
106
- "subtask_prompt": "Perform read-only source reconnaissance. List relevant source files, existing patterns, and risks. Do not edit files."
107
- },
108
- {
109
- "id": "scout-tests",
110
- "depends_on": [
111
- "contract-pi"
112
- ],
113
- "complexity": "LOW",
114
- "executor": "pi",
115
- "role": "scout",
116
- "writePolicy": "read-only",
117
- "allowedPaths": [
118
- "REPLACE/WITH/TEST/PATH/**"
119
- ],
120
- "forbiddenPaths": [
121
- ".harness/**",
122
- "artifacts/**"
123
- ],
124
- "outputContract": "Plain Markdown test coverage reconnaissance summary; no file writes.",
125
- "subtask_prompt": "Perform read-only test reconnaissance. List relevant tests, coverage gaps, and verification commands. Do not edit files."
126
- },
127
- {
128
- "id": "implement-pi",
129
- "depends_on": [
130
- "scout-src",
131
- "scout-tests"
132
- ],
133
- "complexity": "HIGH",
134
- "executor": "pi",
135
- "role": "implementer",
136
- "writePolicy": "exclusive",
137
- "writeSet": [
138
- "REPLACE/WITH/ALLOWED/PATH/**"
139
- ],
140
- "allowedPaths": [
141
- "REPLACE/WITH/ALLOWED/PATH/**"
142
- ],
143
- "forbiddenPaths": [
144
- ".harness/**",
145
- "artifacts/**"
146
- ],
147
- "outputContract": "Implementation summary with changed files, tests run, and risks.",
148
- "subtask_prompt": "Implement the approved change within writeSet only. Keep the change minimal and update relevant tests/docs inside allowedPaths.",
149
- "toolProfile": "write"
150
- },
151
- {
152
- "id": "review-pi",
153
- "depends_on": [
154
- "implement-pi"
155
- ],
156
- "complexity": "MED",
157
- "executor": "pi",
158
- "role": "reviewer",
159
- "writePolicy": "read-only",
160
- "allowedPaths": [
161
- "**"
162
- ],
163
- "forbiddenPaths": [
164
- ".harness/**",
165
- "artifacts/**"
166
- ],
167
- "outputContract": "Plain Markdown review summary; no file writes.",
168
- "subtask_prompt": "Review upstream implementation output against the contract. Identify drift, missing tests, and residual risks. Do not edit files."
169
- },
170
- {
171
- "id": "verify-shell",
172
- "depends_on": [
173
- "implement-pi"
174
- ],
175
- "complexity": "LOW",
176
- "executor": "shell",
177
- "role": "verifier",
178
- "writePolicy": "read-only",
179
- "allowedPaths": [
180
- "./**"
181
- ],
182
- "forbiddenPaths": [
183
- ".harness/**",
184
- "artifacts/**"
185
- ],
186
- "outputContract": "Archived shell command stdout/stderr with exit codes; no worktree writes.",
187
- "subtask_prompt": "Run deterministic loop-agent verification commands and archive outputs.",
188
- "shell": {
189
- "preset": "loop-agent-standard-verify",
190
- "cwd": ".",
191
- "timeoutMs": 300000
192
- }
193
- }
194
- ]
195
- }
1
+ {
2
+ "$schema": "./agent-dag.schema.json",
3
+ "version": 2,
4
+ "title": "Agent DAG base template",
5
+ "objective": "Replace with the concrete objective for this DAG run.",
6
+ "successCriteria": [
7
+ "Each node returns output matching its outputContract.",
8
+ "Same-rank read-only scouts run in parallel when their outputs are independent.",
9
+ "Only Pi nodes with toolProfile=write or explicitly enabled Cursor implementer nodes may write files, and only inside declared writeSet.",
10
+ "Pi nodes remain read-only unless toolProfile=write is explicitly selected for a bounded writer node.",
11
+ "Read-only nodes must not write root artifacts/**; root artifacts/ is not a per-node scratchpad."
12
+ ],
13
+ "globalConstraints": [
14
+ "Replace every REPLACE/WITH/... placeholder with concrete repo paths before execution; do not leave template placeholders in production DAG JSON.",
15
+ "Do not commit runtime traces under .harness/dag-runs/.",
16
+ "Do not write generated DAG input specs into .harness/dag-runs/active/.",
17
+ "Use a platform-native temp path such as <temp-dir>/<topic>-dag.json for one-off DAG specs; commit reusable templates under examples/ or docs/templates/.",
18
+ "Actual file operation paths must be macOS/Windows compatible; use / only for stable repo refs, JSON/Markdown evidence refs, and glob conventions.",
19
+ "Every task must explicitly declare executor; defaults.executor is schema-only and not a runtime fallback.",
20
+ "Prefer same-rank parallel read-only scouts over serial chains when outputs are independent.",
21
+ "Add depends_on only when a child truly needs upstream output; challenge single-chain topologies during review.",
22
+ "Same-rank exclusive writeSet entries must be disjoint.",
23
+ "Do not add provider fields to DAG JSON; provider routing is executor-owned.",
24
+ "Use executorModels for model routing; do not add defaults.model or legacy top-level models.",
25
+ "Every task must declare outputContract describing the expected Markdown/output shape.",
26
+ "exclusive implementer nodes must use narrow, concrete writeSet and allowedPaths; never keep broad write permissions such as ** or repo root.",
27
+ "Cursor is optional; no-Cursor environments should use Pi read-only scouts and Pi writer nodes with toolProfile=write."
28
+ ],
29
+ "defaults": {
30
+ "executor": "pi",
31
+ "contextProfile": "slim",
32
+ "skills": [
33
+ "ai-engineering-context"
34
+ ],
35
+ "writePolicy": "read-only"
36
+ },
37
+ "skillsByRole": {
38
+ "planner": [
39
+ "loop-agent"
40
+ ],
41
+ "scout": [
42
+ "ai-engineering-context"
43
+ ],
44
+ "implementer": [
45
+ "verification-before-completion"
46
+ ],
47
+ "reviewer": [
48
+ "requesting-code-review"
49
+ ],
50
+ "verifier": [
51
+ "verification-before-completion",
52
+ "systematic-debugging"
53
+ ],
54
+ "closeout": [
55
+ "loop-agent",
56
+ "verification-before-completion"
57
+ ]
58
+ },
59
+ "executorModels": {
60
+ "cursor": {
61
+ "LOW": "composer-2.5",
62
+ "MED": "composer-2.5",
63
+ "HIGH": "composer-2.5"
64
+ },
65
+ "pi": {
66
+ "LOW": "gpt-5.3-codex-spark",
67
+ "MED": "glm-5.2",
68
+ "HIGH": "gpt-5.5"
69
+ }
70
+ },
71
+ "tasks": [
72
+ {
73
+ "id": "contract-pi",
74
+ "depends_on": [],
75
+ "complexity": "MED",
76
+ "executor": "pi",
77
+ "role": "planner",
78
+ "writePolicy": "read-only",
79
+ "allowedPaths": [
80
+ "**"
81
+ ],
82
+ "forbiddenPaths": [
83
+ ".harness/**",
84
+ "artifacts/**"
85
+ ],
86
+ "outputContract": "Plain Markdown implementation contract; no file writes.",
87
+ "subtask_prompt": "Read the task inputs and return a concise implementation contract: scope, risks, narrow write boundaries, parallel scout opportunities, and verification expectations. Do not edit files."
88
+ },
89
+ {
90
+ "id": "scout-src",
91
+ "depends_on": [
92
+ "contract-pi"
93
+ ],
94
+ "complexity": "LOW",
95
+ "executor": "pi",
96
+ "role": "scout",
97
+ "writePolicy": "read-only",
98
+ "allowedPaths": [
99
+ "REPLACE/WITH/SOURCE/PATH/**"
100
+ ],
101
+ "forbiddenPaths": [
102
+ ".harness/**",
103
+ "artifacts/**"
104
+ ],
105
+ "outputContract": "Plain Markdown source reconnaissance summary; no file writes.",
106
+ "subtask_prompt": "Perform read-only source reconnaissance. List relevant source files, existing patterns, and risks. Do not edit files."
107
+ },
108
+ {
109
+ "id": "scout-tests",
110
+ "depends_on": [
111
+ "contract-pi"
112
+ ],
113
+ "complexity": "LOW",
114
+ "executor": "pi",
115
+ "role": "scout",
116
+ "writePolicy": "read-only",
117
+ "allowedPaths": [
118
+ "REPLACE/WITH/TEST/PATH/**"
119
+ ],
120
+ "forbiddenPaths": [
121
+ ".harness/**",
122
+ "artifacts/**"
123
+ ],
124
+ "outputContract": "Plain Markdown test coverage reconnaissance summary; no file writes.",
125
+ "subtask_prompt": "Perform read-only test reconnaissance. List relevant tests, coverage gaps, and verification commands. Do not edit files."
126
+ },
127
+ {
128
+ "id": "implement-pi",
129
+ "depends_on": [
130
+ "scout-src",
131
+ "scout-tests"
132
+ ],
133
+ "complexity": "HIGH",
134
+ "executor": "pi",
135
+ "role": "implementer",
136
+ "writePolicy": "exclusive",
137
+ "writeSet": [
138
+ "REPLACE/WITH/ALLOWED/PATH/**"
139
+ ],
140
+ "allowedPaths": [
141
+ "REPLACE/WITH/ALLOWED/PATH/**"
142
+ ],
143
+ "forbiddenPaths": [
144
+ ".harness/**",
145
+ "artifacts/**"
146
+ ],
147
+ "outputContract": "Implementation summary with changed files, tests run, and risks.",
148
+ "subtask_prompt": "Implement the approved change within writeSet only. Keep the change minimal and update relevant tests/docs inside allowedPaths.",
149
+ "toolProfile": "write"
150
+ },
151
+ {
152
+ "id": "review-pi",
153
+ "depends_on": [
154
+ "implement-pi"
155
+ ],
156
+ "complexity": "MED",
157
+ "executor": "pi",
158
+ "role": "reviewer",
159
+ "writePolicy": "read-only",
160
+ "allowedPaths": [
161
+ "**"
162
+ ],
163
+ "forbiddenPaths": [
164
+ ".harness/**",
165
+ "artifacts/**"
166
+ ],
167
+ "outputContract": "Plain Markdown review summary; no file writes.",
168
+ "subtask_prompt": "Review upstream implementation output against the contract. Identify drift, missing tests, and residual risks. Do not edit files."
169
+ },
170
+ {
171
+ "id": "verify-shell",
172
+ "depends_on": [
173
+ "implement-pi"
174
+ ],
175
+ "complexity": "LOW",
176
+ "executor": "shell",
177
+ "role": "verifier",
178
+ "writePolicy": "read-only",
179
+ "allowedPaths": [
180
+ "./**"
181
+ ],
182
+ "forbiddenPaths": [
183
+ ".harness/**",
184
+ "artifacts/**"
185
+ ],
186
+ "outputContract": "Archived shell command stdout/stderr with exit codes; no worktree writes.",
187
+ "subtask_prompt": "Run deterministic loop-agent verification commands and archive outputs.",
188
+ "shell": {
189
+ "preset": "loop-agent-standard-verify",
190
+ "cwd": ".",
191
+ "timeoutMs": 300000
192
+ }
193
+ }
194
+ ]
195
+ }