@tea-agent/loop-agent 0.7.5 → 0.9.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 (133) hide show
  1. package/AGENTS.md +145 -142
  2. package/CHANGELOG.md +161 -158
  3. package/README.md +206 -204
  4. package/bin/agent-worker.js +22 -22
  5. package/bin/loop-agent.js +21 -21
  6. package/dist/application/dag/args.js +9 -2
  7. package/dist/commands/init.js +518 -488
  8. package/dist/commands/loop-benchmark.js +11 -11
  9. package/dist/commands/pi-reuse-benchmark.js +16 -16
  10. package/dist/executors/cursor-executor.js +1 -1
  11. package/dist/executors/shell-executor.js +74 -8
  12. package/dist/governance/manifest-types.js +1 -1
  13. package/dist/shared/reference-context.js +48 -22
  14. package/dist/task/config-types.js +1 -1
  15. package/dist/task/runtime.js +28 -28
  16. package/dist/worker/cli.js +3 -3
  17. package/dist/worker/loop-agent/loop-agent-client.js +51 -10
  18. package/dist/worker/observability/event-store.js +2 -1
  19. package/dist/worker/observability/read-model.js +13 -11
  20. package/dist/worker/observe/paths.js +2 -2
  21. package/dist/worker/observe/routes.js +82 -23
  22. package/dist/worker/observe/server.js +8 -6
  23. package/dist/worker/observe/static/app.js +1965 -1480
  24. package/dist/worker/observe/static/dag-layout.d.ts +31 -31
  25. package/dist/worker/observe/static/dag-layout.js +83 -83
  26. package/dist/worker/observe/static/index.html +88 -63
  27. package/dist/worker/observe/static/styles.css +598 -722
  28. package/dist/worker/pool/run-store.js +7 -8
  29. package/dist/worker/run-task/run-task.js +11 -2
  30. package/dist/worker/runner/run-ready.js +1 -1
  31. package/dist/workflows/dag/canvas-observer.js +275 -275
  32. package/docs/README.md +84 -79
  33. package/docs/agent-dag-recovery-playbook.md +184 -184
  34. package/docs/agent-dag-runner.md +42 -42
  35. package/docs/architecture/runtime-boundaries.md +162 -162
  36. package/docs/cursor-executor-usage.md +25 -25
  37. package/docs/decisions/README.md +3 -3
  38. package/docs/design/README.md +49 -49
  39. package/docs/development-principles.md +73 -73
  40. package/docs/dynamic-workflow-dag-engine-roadmap.md +1749 -1749
  41. package/docs/exec-plans/README.md +6 -6
  42. package/docs/exec-plans/active/README.md +11 -11
  43. package/docs/exec-plans/completed/README.md +43 -34
  44. package/docs/feature-workflow.md +187 -187
  45. package/docs/harness-methodology-debugging.md +153 -153
  46. package/docs/harness-methodology-tdd.md +130 -130
  47. package/docs/harness-methodology-verification.md +27 -27
  48. package/docs/init-surface.manifest.json +245 -241
  49. package/docs/loop-agent-harness.md +63 -55
  50. package/docs/production-readiness.md +96 -96
  51. package/docs/progress/README.md +3 -3
  52. package/docs/reports/README.md +12 -9
  53. package/docs/skills/README.md +6 -6
  54. package/docs/skills/vetted-skill-registry.md +26 -26
  55. package/docs/templates/adr.md +60 -60
  56. package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
  57. package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
  58. package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -117
  59. package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
  60. package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
  61. package/docs/templates/agent-dag-report.schema.json +454 -454
  62. package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
  63. package/docs/templates/agent-dag.base.json +195 -195
  64. package/docs/templates/agent-dag.final-verification.json +190 -190
  65. package/docs/templates/agent-dag.schema.json +316 -316
  66. package/docs/templates/agent-dag.supervised-implementation.json +500 -500
  67. package/docs/templates/exec-plan.md +64 -64
  68. package/docs/templates/feature-spec.md +53 -53
  69. package/docs/templates/harness.schema.json +218 -0
  70. package/docs/templates/hybrid-dag.json +193 -193
  71. package/docs/templates/init-evolution-review.md +33 -33
  72. package/docs/templates/interactive-ui-round2-experiment.md +66 -66
  73. package/docs/templates/product-line/AGENTS.md +8 -8
  74. package/docs/templates/product-line/README.md +9 -9
  75. package/docs/templates/product-line/acceptance.yaml +14 -14
  76. package/docs/templates/product-line/closeout.yaml +9 -9
  77. package/docs/templates/product-line/design.md +13 -13
  78. package/docs/templates/product-line/links.md +10 -10
  79. package/docs/templates/product-line/requirement.md +17 -17
  80. package/docs/templates/product-line/task-graph.yaml +15 -15
  81. package/docs/templates/product-line/task.yaml +65 -65
  82. package/docs/templates/product-line/test-plan.md +7 -7
  83. package/docs/templates/production-readiness-checklist.md +57 -57
  84. package/docs/templates/progress-log.md +17 -17
  85. package/docs/templates/project-start-checklist.md +9 -9
  86. package/docs/templates/qa-report.md +48 -48
  87. package/docs/templates/sprint-contract.md +29 -29
  88. package/docs/templates/worker-dogfood-evidence.md +52 -52
  89. package/docs/templates/worker-dogfood-setup.md +48 -48
  90. package/docs/verification-matrix.md +49 -49
  91. package/examples/decision-gate-agent-dag.json +123 -123
  92. package/examples/example-dag.json +51 -51
  93. package/examples/hybrid-loop-agent-dag.json +194 -194
  94. package/harness.json +73 -71
  95. package/package.json +68 -67
  96. package/scripts/check-product-line-docs.sh +22 -22
  97. package/scripts/check-task-pool-root.sh +32 -0
  98. package/skills/ai-engineering-context/SKILL.md +48 -48
  99. package/skills/code-review-core/SKILL.md +20 -20
  100. package/skills/codebase-scout/SKILL.md +19 -19
  101. package/skills/init-capability-evolution/SKILL.md +69 -69
  102. package/skills/loop-agent/SKILL.md +149 -149
  103. package/skills/loop-agent/references/README.md +67 -67
  104. package/skills/loop-agent/references/command-reference.md +432 -412
  105. package/skills/loop-agent/references/harness-policy.md +263 -263
  106. package/skills/loop-agent/references/hybrid-dag.md +216 -216
  107. package/skills/loop-agent/references/learned/README.md +21 -21
  108. package/skills/loop-agent/references/long-running-loop.md +59 -59
  109. package/skills/loop-agent/references/model-routing.md +36 -36
  110. package/skills/loop-agent/references/multi-worktree.md +54 -54
  111. package/skills/loop-agent/references/one-shot-runs.md +85 -85
  112. package/skills/loop-agent/references/orchestrator-and-interventions.md +169 -169
  113. package/skills/loop-agent/references/pi-prompt.md +23 -23
  114. package/skills/loop-agent/references/pi-subagent-assisted-mode.md +81 -81
  115. package/skills/loop-agent/references/post-implementation-and-patterns.md +44 -44
  116. package/skills/loop-agent/references/task-workflow.md +89 -89
  117. package/skills/loop-agent/references/verification-and-failure-handling.md +133 -128
  118. package/skills/requesting-code-review/SKILL.md +101 -101
  119. package/skills/requesting-code-review/code-reviewer.md +168 -168
  120. package/skills/systematic-debugging/CREATION-LOG.md +119 -119
  121. package/skills/systematic-debugging/SKILL.md +296 -296
  122. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
  123. package/skills/systematic-debugging/condition-based-waiting.md +115 -115
  124. package/skills/systematic-debugging/defense-in-depth.md +122 -122
  125. package/skills/systematic-debugging/find-polluter.sh +63 -63
  126. package/skills/systematic-debugging/root-cause-tracing.md +169 -169
  127. package/skills/systematic-debugging/test-academic.md +14 -14
  128. package/skills/systematic-debugging/test-pressure-1.md +58 -58
  129. package/skills/systematic-debugging/test-pressure-2.md +68 -68
  130. package/skills/systematic-debugging/test-pressure-3.md +69 -69
  131. package/skills/test-driven-development/SKILL.md +20 -20
  132. package/skills/verification-before-completion/SKILL.md +154 -154
  133. package/skills/webapp-testing/SKILL.md +19 -19
package/docs/README.md CHANGED
@@ -1,79 +1,84 @@
1
- # 文档索引
2
-
3
- `docs/` 是 loop-agent 的治理根目录,包含工作流规则、方法论、验证规则、执行计划、报告、进度日志、决策记录和可复用模板。
4
-
5
- 顶层 `AGENTS.md` 是操作地图。长期知识应落在此处:决策、契约、计划、验证证据、调试笔记和可复用流程规则应记录在 `docs/` 下,而不是只留在聊天里。
6
-
7
- ## 核心文档
8
-
9
- - `development-principles.md` — 仓库开发原则
10
- - `architecture/runtime-boundaries.md` — runtime 层边界与依赖方向
11
- - `feature-workflow.md` — 有边界的功能工作流
12
- - `verification-matrix.md` — 验证命令选择
13
- - `production-readiness.md` — Production Readiness v0.1 范围、证据与 DAG hardening 标准
14
- - `loop-agent-harness.md` — runtime 与 command surface 概览
15
- - `agent-dag-runner.md` — Agent DAG runner 指南
16
- - `cursor-executor-usage.md` — Cursor executor 用法
17
- - `dynamic-workflow-dag-engine-roadmap.md` — Dynamic Workflow DAG Engine 路线图与适配分析
18
- - `init-surface.manifest.json` — npm 包范围、目标项目初始化投影与 `init check-update` surface 分类的机器校验契约
19
-
20
- ## 设计思想来源
21
-
22
- - `../website/docs/practices/` — Anthropic 长时运行 agent harness、OpenAI Codex harness engineering、腾讯端到端 Harness Engineering 与社区 agent harness 实践资料。当前仓库的“人类掌舵、智能体执行”、仓库即记录系统、小步增量、结构化 handoff 和 shell verification 纪律均受这些实践启发;权威执行规则仍以本目录治理文档、根目录 AGENTS.md、harness.json、skills 目录和脚本检查为准。
23
-
24
- ## 方法论
25
-
26
- - `harness-methodology-tdd.md` — 行为变更与 bug 修复的 TDD 纪律
27
- - `harness-methodology-verification.md` — 完成声明前的验证纪律
28
- - `harness-methodology-debugging.md` — 修复前的系统化调试工作流
29
-
30
- ## 产物目录
31
-
32
- - `design/README.md` — 设计草稿与实现契约
33
- - `exec-plans/active/README.md` — 进行中的执行计划
34
- - `exec-plans/completed/README.md` — 已完成的执行计划
35
- - `progress/README.md` — 进度交接日志
36
- - `reports/README.md` — 验证与审计报告
37
- - `reports/2026-07-11-round3-worker-expansion.md` — Round 3 Worker 扩量、0.7.4 FE green、QA review blocker 与第二轮 owner decision
38
- - `reports/2026-07-11-observe-dag-visualization.md` — Observe DAG edges、SVG 图形化、交互与真实 Chrome smoke 验证证据
39
- - `reports/2026-07-11-0.7.5-init-evolution-review.md` — 0.7.5 package/version 变化对目标项目初始化 surface 的影响审查
40
- - `decisions/README.md` — 架构决策
41
- - `skills/README.md` — repo-local skill registry and vetting notes
42
- - `templates/`可复用的规划、报告与 DAG 模板
43
-
44
- ## 仓库 Skills
45
-
46
- - `../skills/loop-agent/` — loop-agent 自身的 skill 指令与参考资料
47
- - 每个额外 skill 在仓库根 `../skills/` 下使用独立子目录;这些本地副本由 DAG 模板引用,维护不依赖外部 agent skill 目录
48
-
49
- ## 模板
50
-
51
- - `templates/project-start-checklist.md` 开工前检查清单
52
- - `templates/feature-spec.md` — 有边界的功能规格
53
- - `templates/sprint-contract.md` — 实现契约与验收标准
54
- - `templates/exec-plan.md` — 非平凡工作的执行计划
55
- - `templates/progress-log.md` — 进度与交接日志
56
- - `templates/qa-report.md` — 验证与 QA 证据
57
- - `templates/worker-dogfood-setup.md` — 发布控制器下的真实 Worker sample setup 与 retry 纪律
58
- - `templates/worker-dogfood-evidence.md` — BE/FE/QA sample、Observe、morning report 与 coverage evidence 模板
59
- - `templates/interactive-ui-round2-experiment.md` — interactive UI prompt/model A/B/C 对照实验与统一指标模板
60
- - `templates/product-line/`可投影的 Feature/Task/QA/Links 产品线包;配合 `agent-worker task validate-feature` 做 docs CI
61
- - `templates/production-readiness-checklist.md` — 低/中风险单仓库 DAG readiness 检查清单
62
- - `templates/init-evolution-review.md` — 初始化能力演化审查报告模板
63
- - `templates/adr.md` — 架构决策记录(ADR)
64
-
65
- ## 维护
66
-
67
- 文档变更后运行:
68
-
69
- ```bash
70
- bash scripts/check-repo.sh
71
- ```
72
-
73
- Windows 上通过 Git Bash 或已配置的兼容 Bash 运行脚本。实际文件操作使用平台原生路径;`/` 仅用于 repo 引用、JSON/Markdown 证据引用和 glob 约定。
74
-
75
- 完整本地门禁:
76
-
77
- ```bash
78
- bash scripts/ci.sh
79
- ```
1
+ # 文档索引
2
+
3
+ `docs/` 是 loop-agent 的治理根目录,包含工作流规则、方法论、验证规则、执行计划、报告、进度日志、决策记录和可复用模板。
4
+
5
+ 顶层 `AGENTS.md` 是操作地图。长期知识应落在此处:决策、契约、计划、验证证据、调试笔记和可复用流程规则应记录在 `docs/` 下,而不是只留在聊天里。
6
+
7
+ ## 核心文档
8
+
9
+ - `development-principles.md` — 仓库开发原则
10
+ - `architecture/runtime-boundaries.md` — runtime 层边界与依赖方向
11
+ - `feature-workflow.md` — 有边界的功能工作流
12
+ - `verification-matrix.md` — 验证命令选择
13
+ - `production-readiness.md` — Production Readiness v0.1 范围、证据与 DAG hardening 标准
14
+ - `loop-agent-harness.md` — runtime 与 command surface 概览
15
+ - `agent-dag-runner.md` — Agent DAG runner 指南
16
+ - `cursor-executor-usage.md` — Cursor executor 用法
17
+ - `dynamic-workflow-dag-engine-roadmap.md` — Dynamic Workflow DAG Engine 路线图与适配分析
18
+ - `init-surface.manifest.json` — npm 包范围、目标项目初始化投影与 `init check-update` surface 分类的机器校验契约
19
+
20
+ ## 设计思想来源
21
+
22
+ - `../website/docs/practices/` — Anthropic 长时运行 agent harness、OpenAI Codex harness engineering、腾讯端到端 Harness Engineering 与社区 agent harness 实践资料。当前仓库的“人类掌舵、智能体执行”、仓库即记录系统、小步增量、结构化 handoff 和 shell verification 纪律均受这些实践启发;权威执行规则仍以本目录治理文档、根目录 AGENTS.md、harness.json、skills 目录和脚本检查为准。
23
+
24
+ ## 方法论
25
+
26
+ - `harness-methodology-tdd.md` — 行为变更与 bug 修复的 TDD 纪律
27
+ - `harness-methodology-verification.md` — 完成声明前的验证纪律
28
+ - `harness-methodology-debugging.md` — 修复前的系统化调试工作流
29
+
30
+ ## 产物目录
31
+
32
+ - `design/README.md` — 设计草稿与实现契约
33
+ - `exec-plans/active/README.md` — 进行中的执行计划
34
+ - `exec-plans/completed/README.md` — 已完成的执行计划
35
+ - `progress/README.md` — 进度交接日志
36
+ - `reports/README.md` — 验证与审计报告
37
+ - `reports/2026-07-11-round3-worker-expansion.md` — Round 3 Worker 扩量、0.7.4 FE green、QA review blocker 与第二轮 owner decision
38
+ - `reports/2026-07-11-observe-dag-visualization.md` — Observe DAG edges、SVG 图形化、交互与真实 Chrome smoke 验证证据
39
+ - `reports/2026-07-11-0.7.5-init-evolution-review.md` — 0.7.5 package/version 变化对目标项目初始化 surface 的影响审查
40
+ - `reports/2026-07-11-command-performance-audit.md` — 命令并发、验证、Observe 和子进程输出的性能审计
41
+ - `reports/2026-07-11-command-performance-followups.md` — Observe 快照复用、输出缓冲和 reference index 遍历优化的验证记录
42
+ - `reports/2026-07-11-observe-terminal-dag-kpi.md`终态 DAG 被误计为活跃数的修复记录
43
+ - `reports/2026-07-12-observe-warm-console-redesign.md` — 暖白运行控制台视觉重构与桌面验证记录
44
+ - `decisions/README.md` — 架构决策
45
+ - `skills/README.md` — repo-local skill registry and vetting notes
46
+ - `templates/` — 可复用的规划、报告与 DAG 模板
47
+
48
+ ## 仓库 Skills
49
+
50
+ - `../skills/loop-agent/` — loop-agent 自身的 skill 指令与参考资料
51
+ - 每个额外 skill 在仓库根 `../skills/` 下使用独立子目录;这些本地副本由 DAG 模板引用,维护不依赖外部 agent skill 目录
52
+
53
+ ## 模板
54
+
55
+ - `templates/project-start-checklist.md` — 开工前检查清单
56
+ - `templates/feature-spec.md` — 有边界的功能规格
57
+ - `templates/sprint-contract.md` — 实现契约与验收标准
58
+ - `templates/exec-plan.md` — 非平凡工作的执行计划
59
+ - `templates/progress-log.md` — 进度与交接日志
60
+ - `templates/qa-report.md`验证与 QA 证据
61
+ - `templates/worker-dogfood-setup.md` — 发布控制器下的真实 Worker sample setup 与 retry 纪律
62
+ - `templates/worker-dogfood-evidence.md` — BE/FE/QA sample、Observe、morning report 与 coverage evidence 模板
63
+ - `templates/harness.schema.json` — `harness.json` 的 IDE JSON Schema,随初始化投影到目标项目
64
+ - `templates/interactive-ui-round2-experiment.md` — interactive UI prompt/model A/B/C 对照实验与统一指标模板
65
+ - `templates/product-line/` — 可投影的 Feature/Task/QA/Links 产品线包;配合 `agent-worker task validate-feature` 做 docs CI
66
+ - `templates/production-readiness-checklist.md` — 低/中风险单仓库 DAG readiness 检查清单
67
+ - `templates/init-evolution-review.md` — 初始化能力演化审查报告模板
68
+ - `templates/adr.md` — 架构决策记录(ADR)
69
+
70
+ ## 维护
71
+
72
+ 文档变更后运行:
73
+
74
+ ```bash
75
+ bash scripts/check-repo.sh
76
+ ```
77
+
78
+ Windows 上通过 Git Bash 或已配置的兼容 Bash 运行脚本。实际文件操作使用平台原生路径;`/` 仅用于 repo 引用、JSON/Markdown 证据引用和 glob 约定。
79
+
80
+ 完整本地门禁:
81
+
82
+ ```bash
83
+ bash scripts/ci.sh
84
+ ```
@@ -1,184 +1,184 @@
1
- # Agent DAG Recovery Playbook(恢复手册)
2
-
3
- > **关联**:[`agent-dag-runner.md`](agent-dag-runner.md)(CLI 与 run 语义)· [`templates/agent-dag-decision-gate.prompt.md`](templates/agent-dag-decision-gate.prompt.md)(Decision Gate 消费 recovery 证据)
4
-
5
- ## 定位
6
-
7
- Agent DAG **recovery planning 是只读、派生、advisory** 的。`dag report` 与 `buildDagDecisionGateEvidence()` 从 `.harness/dag-runs/` 的 canonical facts 聚合 `normalizedFailureCategory` → `recoveryRecommendation`,供人工或 Decision Gate prompt 消费。
8
-
9
- Production Readiness v0.1 在 normalized DAG category 之上增加 product-line routing。Report 与 doctor 输出应保留 raw DAG fact 并派生,不重写已完成 facts:
10
-
11
- ```text
12
- raw_failure_category
13
- dag_normalized_failure_category
14
- product_line_failure_category
15
- recommended_follow_up
16
- ```
17
-
18
- Product-line taxonomy 定义见 `design/state-and-failure-taxonomy.md`。
19
-
20
- **非目标(本 playbook 不覆盖、runner 不实现):**
21
-
22
- - 自动 retry / resume 节点执行
23
- - 修改 `completed/` 或 `paused/` 下的历史 run facts
24
- - 把 `autoRetryEligible` 当作 runtime 触发器
25
- - 仅凭 recovery 派生字段自动 approve Decision Gate
26
-
27
- ## 快速命令
28
-
29
- ```bash
30
- cd .
31
-
32
- # 全局 runtime 健康(active/paused/completed 摘要 + healthIssues;advisoryOnly)
33
- npm run dev -- dag doctor
34
-
35
- # 单 run 生命周期(approvalFlow、hasHumanApproval、nextRecommendedAction)
36
- npm run dev -- dag status --run-id <run-id>
37
-
38
- # 聚焦最新 paused run(--paused-latest ≡ --lifecycle paused --latest)
39
- npm run dev -- dag report --paused-latest [--json|--markdown]
40
-
41
- # 默认 compact Markdown 表格
42
- npm run dev -- dag report --run-id <run-id>
43
-
44
- # 机器可读 JSON(含 primaryFailure / primaryRecovery / downstreamSkippedNodes)
45
- npm run dev -- dag report --run-id <run-id> --json
46
-
47
- # 人类交接 Recovery Plan(四段结构化 Markdown)
48
- npm run dev -- dag report --run-id <run-id> --markdown
49
-
50
- # 过滤器
51
- npm run dev -- dag report --failed-only # 仅失败/需恢复
52
- npm run dev -- dag report --latest --failed-only # 最新一条需恢复 run
53
- npm run dev -- dag report --action retry-node # 按 primaryRecovery.action 筛选
54
- npm run dev -- dag report --lifecycle paused --action resume-or-reject
55
-
56
- # Decision Gate envelope dry-run(不 resume/retry;validate 无效时 exit 1)
57
- npm run dev -- dag decision inspect --run-id <run-id> [--node-id <node-id>]
58
- npm run dev -- dag decision validate --run-id <run-id> [--node-id <node-id>]
59
- ```
60
-
61
- ### Paused run operator 路径
62
-
63
- 1. `dag report --paused-latest --json` 或 `dag doctor` — 定位最新 paused run 与 `primaryRecovery`
64
- 2. `dag status --run-id <id>` — 读 `approvalFlow`、`escalationArtifactPath`、`pendingNodes`
65
- 3. (可选)`dag decision validate --run-id <id>` — envelope preflight
66
- 4. `dag approve --run-id <id> --option <option-id>` → `dag resume --run-id <id>`;或 `dag reject --run-id <id> --reason "..."`
67
-
68
- 精确 approval 顺序见 [`agent-dag-runner.md`](agent-dag-runner.md) §Paused lifecycle。
69
-
70
- Decision Gate prompt 侧:`buildDagDecisionGateEvidence()`(`./src/core/dag-decision-evidence.ts`)从 `DagRunReportEntry` 生成 prompt-friendly 摘要,字段与 JSON report 对齐,**不**写回 run state。
71
-
72
- ## `dag report --json` schema 锁定
73
-
74
- - **Schema 文件**:`docs/templates/agent-dag-report.schema.json`
75
- - **Envelope**:`{ schemaVersion: 1, runs: DagRunReportEntry[] }`
76
- - **稳定消费字段**(Decision Gate / tooling 应依赖):`primaryFailure`、`primaryRecovery`、`downstreamSkippedNodes`、`recoveryRecommendation`、`normalizedFailureCategory`;node 级 `decisionEnvelope`、`artifacts`;paused 级 `pausedByNodeId`、`pauseReason`
77
- - **测试**:`./test/dag-report.test.ts` §`dag report JSON schema contract` 对 fixture run 做 schema 校验
78
- - **变更策略**:breaking 字段变更须 bump `schemaVersion` 并同步 schema 文件与测试
79
-
80
- ## Recovery Action 枚举
81
-
82
- | Action | 含义 | 典型触发 |
83
- |--------|------|----------|
84
- | `none` | 无需恢复 | 成功完成 |
85
- | `monitor` | 进行中,等待结束 | `PENDING` / `RUNNING` |
86
- | `retry-node` | 修复瞬态条件后可重跑节点 | timeout;executor 瞬态(network/quota/rate-limit/unavailable) |
87
- | `rerun-after-fix` | 先修根因再重跑 | auth、validation、shell-command、static-error、非瞬态 executor |
88
- | `resume-or-reject` | 人工审批后继续或拒绝 | paused + decision-envelope / human-required |
89
- | `manual-review` | 人工审查后再定路径 | write-guard、human-rejected、unknown、非 paused 的 decision-envelope |
90
- | `inspect-upstream` | 先查上游失败 | SKIPPED 下游节点 |
91
- | `unknown` | 未映射类别(不应出现在正常派生路径) | 内部兜底 |
92
-
93
- ## Product-Line Routing v0.1
94
-
95
- | Product-line category | Default follow-up |
96
- |---|---|
97
- | `SpecUnclear` | `spec-clarification` |
98
- | `ContractMismatch` | `architecture-contract-fix` |
99
- | `ProductBug` | `dev-fix` |
100
- | `TestBug` | `qa-fix-test` |
101
- | `EnvFailure` | `env-fix` 或 retry verify |
102
- | `FlakyTest` | `flaky-test-analysis` |
103
- | `RiskyChange` | `human-review` / `architecture-review` |
104
- | `DependencyFailure` | unblock dependency |
105
- | `NeedsHuman` | `human-review` |
106
- | `Unknown` | human triage |
107
-
108
- ## 类别 → 动作 → operator 指引
109
-
110
- | Normalized category | Recovery action | Operator guidance | Anti-patterns |
111
- |---------------------|-----------------|-------------------|---------------|
112
- | `success` | `none` | 归档验收;按需 review artifacts | 对成功 run 发起 retry |
113
- | `timeout` | `retry-node` | 查日志/artifacts 确认瞬态;人工重跑节点 | 未查根因就循环重试;指望 runner 自动 retry |
114
- | `executor`(network/quota/rate-limit/unavailable) | `retry-node` | 等后端/配额恢复后重跑 | 把 auth/validation 误判为瞬态 executor |
115
- | `executor`(其他 raw) | `rerun-after-fix` | 查 executor.jsonl、node result | 盲目 retry 非瞬态 backend 错误 |
116
- | `auth` | `rerun-after-fix` | 更新 API key/凭证后重跑 | 在凭证未修复时 retry |
117
- | `write-guard` | `manual-review` | 审 writeSet/writePolicy、prompt、result.summary | read-only 节点写根 `artifacts/`;扩大 writeSet 掩盖违规 |
118
- | `validation` | `rerun-after-fix` | 修 schema/output/test 后再跑 | 跳过验证直接 approve |
119
- | `shell-command` | `rerun-after-fix` | 读 stdout/stderr、修命令或 repo 状态 | 只重跑 shell 不改命令 |
120
- | `static-error` | `rerun-after-fix` | 查 static config 与 emitted markdown | 当 LLM 节点 retry |
121
- | `decision-envelope`(paused) | `resume-or-reject` | `dag approve --run-id <id> --option <option-id>` / `dag reject --run-id <id> --reason "..."` → `dag resume --run-id <id>` | 未读 envelope 就 approve;用 recovery 字段单独 auto-approve |
122
- | `decision-envelope`(非 paused) | `manual-review` | 读 decision.envelope.json / validation artifact | 绕过 Decision Gate schema |
123
- | `human-required`(paused) | `resume-or-reject` | 提供人工输入 → approve/resume | 在 escalation 未解决时 resume |
124
- | `human-required`(非 paused) | `manual-review` | 读 human-escalation artifacts | 忽略 `requiresHuman` |
125
- | `human-rejected` | `manual-review` | 修订 contract/source;**新 run** | 对同一 contract 自动 retry |
126
- | `skipped` | `inspect-upstream` | 修上游 ERROR/SKIPPED 再考虑下游 | 直接 retry SKIPPED 节点 |
127
- | `unknown` | `manual-review` | 读 state.json、executor.jsonl、node artifacts | 假设 `autoRetryEligible` 会触发执行 |
128
-
129
- ## Handoff Recovery Plan 结构
130
-
131
- `dag report --markdown` 的 **Recovery Plan** 含四段(与 JSON 稳定字段一一对应):
132
-
133
- 1. **Primary Failure** — `primaryFailure`(node 或 run scope)
134
- 2. **Recovery Action** — `primaryRecovery`(action、summary、reason、flags、commandHint)
135
- 3. **Blocked Downstream / Skipped Nodes** — `downstreamSkippedNodes`
136
- 4. **Recommended Operator Action** — 面向 operator 的步骤摘要
137
-
138
- 保存 handoff 时重定向到平台临时目录或 `docs/reports/`,不要写入 `.harness/dag-runs/`。
139
-
140
- ## Decision Gate 消费约定
141
-
142
- 1. 优先 `dag report --json` 或 `buildDagDecisionGateEvidence()` 的 **verified** 派生摘要。
143
- 2. 映射到 `decision` / `nextAction` 须保守;recovery 证据是 **advisory only, not an execution directive**。
144
- 3. `autoRetryEligible: true` 仅表示「规划上可人工重试」,**不**触发 runner。
145
- 4. paused run 的人类路径仍是 M5 CLI:`dag approve --run-id <id> --option <option-id>` / `dag reject --run-id <id> --reason "..."` / `dag resume --run-id <id>`(见 [`agent-dag-runner.md`](agent-dag-runner.md) §Decision Gate)。
146
- 5. Envelope 干跑:`dag decision inspect|validate` 重解析 run facts;`validate` 无效时 exit 1;**不**写 artifact、**不** resume。
147
-
148
- ## Active stale run recovery(advisory detection)
149
-
150
- `dag doctor` 与 `dag status` 通过 `detectDagRunHealthIssues()` 检测 lifecycle 不一致,**不** mutate run facts。
151
-
152
- | Code | 典型场景 | operator 指引 |
153
- |------|----------|------------|
154
- | `terminal-in-active` | run 已完成但 `active/<run-id>/` 残留 | 对照 `completed/` canonical facts;手动 archive 或删除 stale 目录 |
155
- | `paused-in-active` | pause 后目录未迁至 `paused/` | `dag doctor` 诊断;修复 facts 后再 approve/resume |
156
- | `lifecycle-status-mismatch` | `paused/` 下 status 非 paused | 同上 |
157
- | `missing-approval-artifact` | approve 后 artifact 缺失 | 勿 resume;re-approve 或 restore artifact |
158
- | `non-terminal-in-completed` | completed 目录 status 异常 | manual-review only |
159
- | `run-id-mismatch` / `missing-state-json` | 目录损坏或命名错误 | Inspect;勿 auto-mutate completed facts |
160
-
161
- **Deferred runtime**:无 `dag recover apply` 或自动 cleanup;未来可能增加只读 `dag recover plan`(设计占位,未实现)。
162
-
163
- ## 事实源与边界
164
-
165
- | 类型 | 位置 | 规则 |
166
- |------|------|------|
167
- | Canonical run facts | `.harness/dag-runs/{active\|paused\|completed}/<run-id>/` | **只读**;report 不写回 |
168
- | 派生 report | stdout / 重定向文件 | 可随时再生 |
169
- | 工作块摘要 | 根 `artifacts/` | 非 per-run 历史;read-only DAG 节点不得写 |
170
-
171
- ## 验证
172
-
173
- ```bash
174
- cd . && npx vitest run \
175
- test/dag-report.test.ts \
176
- test/dag-recovery-recommendation.test.ts \
177
- test/dag-decision-gate-recovery-dogfood.test.ts \
178
- test/dag-decision-evidence.test.ts \
179
- test/dag-decision-envelope.test.ts \
180
- test/dag-approve-resume.test.ts \
181
- test/cli-contract.test.ts
182
- ```
183
-
184
- 实现细节与映射逻辑:`./src/core/dag-recovery-recommendation.ts`、`dag-report.ts`、`dag-decision-evidence.ts`。
1
+ # Agent DAG Recovery Playbook(恢复手册)
2
+
3
+ > **关联**:[`agent-dag-runner.md`](agent-dag-runner.md)(CLI 与 run 语义)· [`templates/agent-dag-decision-gate.prompt.md`](templates/agent-dag-decision-gate.prompt.md)(Decision Gate 消费 recovery 证据)
4
+
5
+ ## 定位
6
+
7
+ Agent DAG **recovery planning 是只读、派生、advisory** 的。`dag report` 与 `buildDagDecisionGateEvidence()` 从 `.harness/dag-runs/` 的 canonical facts 聚合 `normalizedFailureCategory` → `recoveryRecommendation`,供人工或 Decision Gate prompt 消费。
8
+
9
+ Production Readiness v0.1 在 normalized DAG category 之上增加 product-line routing。Report 与 doctor 输出应保留 raw DAG fact 并派生,不重写已完成 facts:
10
+
11
+ ```text
12
+ raw_failure_category
13
+ dag_normalized_failure_category
14
+ product_line_failure_category
15
+ recommended_follow_up
16
+ ```
17
+
18
+ Product-line taxonomy 定义见 `design/state-and-failure-taxonomy.md`。
19
+
20
+ **非目标(本 playbook 不覆盖、runner 不实现):**
21
+
22
+ - 自动 retry / resume 节点执行
23
+ - 修改 `completed/` 或 `paused/` 下的历史 run facts
24
+ - 把 `autoRetryEligible` 当作 runtime 触发器
25
+ - 仅凭 recovery 派生字段自动 approve Decision Gate
26
+
27
+ ## 快速命令
28
+
29
+ ```bash
30
+ cd .
31
+
32
+ # 全局 runtime 健康(active/paused/completed 摘要 + healthIssues;advisoryOnly)
33
+ npm run dev -- dag doctor
34
+
35
+ # 单 run 生命周期(approvalFlow、hasHumanApproval、nextRecommendedAction)
36
+ npm run dev -- dag status --run-id <run-id>
37
+
38
+ # 聚焦最新 paused run(--paused-latest ≡ --lifecycle paused --latest)
39
+ npm run dev -- dag report --paused-latest [--json|--markdown]
40
+
41
+ # 默认 compact Markdown 表格
42
+ npm run dev -- dag report --run-id <run-id>
43
+
44
+ # 机器可读 JSON(含 primaryFailure / primaryRecovery / downstreamSkippedNodes)
45
+ npm run dev -- dag report --run-id <run-id> --json
46
+
47
+ # 人类交接 Recovery Plan(四段结构化 Markdown)
48
+ npm run dev -- dag report --run-id <run-id> --markdown
49
+
50
+ # 过滤器
51
+ npm run dev -- dag report --failed-only # 仅失败/需恢复
52
+ npm run dev -- dag report --latest --failed-only # 最新一条需恢复 run
53
+ npm run dev -- dag report --action retry-node # 按 primaryRecovery.action 筛选
54
+ npm run dev -- dag report --lifecycle paused --action resume-or-reject
55
+
56
+ # Decision Gate envelope dry-run(不 resume/retry;validate 无效时 exit 1)
57
+ npm run dev -- dag decision inspect --run-id <run-id> [--node-id <node-id>]
58
+ npm run dev -- dag decision validate --run-id <run-id> [--node-id <node-id>]
59
+ ```
60
+
61
+ ### Paused run operator 路径
62
+
63
+ 1. `dag report --paused-latest --json` 或 `dag doctor` — 定位最新 paused run 与 `primaryRecovery`
64
+ 2. `dag status --run-id <id>` — 读 `approvalFlow`、`escalationArtifactPath`、`pendingNodes`
65
+ 3. (可选)`dag decision validate --run-id <id>` — envelope preflight
66
+ 4. `dag approve --run-id <id> --option <option-id>` → `dag resume --run-id <id>`;或 `dag reject --run-id <id> --reason "..."`
67
+
68
+ 精确 approval 顺序见 [`agent-dag-runner.md`](agent-dag-runner.md) §Paused lifecycle。
69
+
70
+ Decision Gate prompt 侧:`buildDagDecisionGateEvidence()`(`./src/core/dag-decision-evidence.ts`)从 `DagRunReportEntry` 生成 prompt-friendly 摘要,字段与 JSON report 对齐,**不**写回 run state。
71
+
72
+ ## `dag report --json` schema 锁定
73
+
74
+ - **Schema 文件**:`docs/templates/agent-dag-report.schema.json`
75
+ - **Envelope**:`{ schemaVersion: 1, runs: DagRunReportEntry[] }`
76
+ - **稳定消费字段**(Decision Gate / tooling 应依赖):`primaryFailure`、`primaryRecovery`、`downstreamSkippedNodes`、`recoveryRecommendation`、`normalizedFailureCategory`;node 级 `decisionEnvelope`、`artifacts`;paused 级 `pausedByNodeId`、`pauseReason`
77
+ - **测试**:`./test/dag-report.test.ts` §`dag report JSON schema contract` 对 fixture run 做 schema 校验
78
+ - **变更策略**:breaking 字段变更须 bump `schemaVersion` 并同步 schema 文件与测试
79
+
80
+ ## Recovery Action 枚举
81
+
82
+ | Action | 含义 | 典型触发 |
83
+ |--------|------|----------|
84
+ | `none` | 无需恢复 | 成功完成 |
85
+ | `monitor` | 进行中,等待结束 | `PENDING` / `RUNNING` |
86
+ | `retry-node` | 修复瞬态条件后可重跑节点 | timeout;executor 瞬态(network/quota/rate-limit/unavailable) |
87
+ | `rerun-after-fix` | 先修根因再重跑 | auth、validation、shell-command、static-error、非瞬态 executor |
88
+ | `resume-or-reject` | 人工审批后继续或拒绝 | paused + decision-envelope / human-required |
89
+ | `manual-review` | 人工审查后再定路径 | write-guard、human-rejected、unknown、非 paused 的 decision-envelope |
90
+ | `inspect-upstream` | 先查上游失败 | SKIPPED 下游节点 |
91
+ | `unknown` | 未映射类别(不应出现在正常派生路径) | 内部兜底 |
92
+
93
+ ## Product-Line Routing v0.1
94
+
95
+ | Product-line category | Default follow-up |
96
+ |---|---|
97
+ | `SpecUnclear` | `spec-clarification` |
98
+ | `ContractMismatch` | `architecture-contract-fix` |
99
+ | `ProductBug` | `dev-fix` |
100
+ | `TestBug` | `qa-fix-test` |
101
+ | `EnvFailure` | `env-fix` 或 retry verify |
102
+ | `FlakyTest` | `flaky-test-analysis` |
103
+ | `RiskyChange` | `human-review` / `architecture-review` |
104
+ | `DependencyFailure` | unblock dependency |
105
+ | `NeedsHuman` | `human-review` |
106
+ | `Unknown` | human triage |
107
+
108
+ ## 类别 → 动作 → operator 指引
109
+
110
+ | Normalized category | Recovery action | Operator guidance | Anti-patterns |
111
+ |---------------------|-----------------|-------------------|---------------|
112
+ | `success` | `none` | 归档验收;按需 review artifacts | 对成功 run 发起 retry |
113
+ | `timeout` | `retry-node` | 查日志/artifacts 确认瞬态;人工重跑节点 | 未查根因就循环重试;指望 runner 自动 retry |
114
+ | `executor`(network/quota/rate-limit/unavailable) | `retry-node` | 等后端/配额恢复后重跑 | 把 auth/validation 误判为瞬态 executor |
115
+ | `executor`(其他 raw) | `rerun-after-fix` | 查 executor.jsonl、node result | 盲目 retry 非瞬态 backend 错误 |
116
+ | `auth` | `rerun-after-fix` | 更新 API key/凭证后重跑 | 在凭证未修复时 retry |
117
+ | `write-guard` | `manual-review` | 审 writeSet/writePolicy、prompt、result.summary | read-only 节点写根 `artifacts/`;扩大 writeSet 掩盖违规 |
118
+ | `validation` | `rerun-after-fix` | 修 schema/output/test 后再跑 | 跳过验证直接 approve |
119
+ | `shell-command` | `rerun-after-fix` | 读 stdout/stderr、修命令或 repo 状态 | 只重跑 shell 不改命令 |
120
+ | `static-error` | `rerun-after-fix` | 查 static config 与 emitted markdown | 当 LLM 节点 retry |
121
+ | `decision-envelope`(paused) | `resume-or-reject` | `dag approve --run-id <id> --option <option-id>` / `dag reject --run-id <id> --reason "..."` → `dag resume --run-id <id>` | 未读 envelope 就 approve;用 recovery 字段单独 auto-approve |
122
+ | `decision-envelope`(非 paused) | `manual-review` | 读 decision.envelope.json / validation artifact | 绕过 Decision Gate schema |
123
+ | `human-required`(paused) | `resume-or-reject` | 提供人工输入 → approve/resume | 在 escalation 未解决时 resume |
124
+ | `human-required`(非 paused) | `manual-review` | 读 human-escalation artifacts | 忽略 `requiresHuman` |
125
+ | `human-rejected` | `manual-review` | 修订 contract/source;**新 run** | 对同一 contract 自动 retry |
126
+ | `skipped` | `inspect-upstream` | 修上游 ERROR/SKIPPED 再考虑下游 | 直接 retry SKIPPED 节点 |
127
+ | `unknown` | `manual-review` | 读 state.json、executor.jsonl、node artifacts | 假设 `autoRetryEligible` 会触发执行 |
128
+
129
+ ## Handoff Recovery Plan 结构
130
+
131
+ `dag report --markdown` 的 **Recovery Plan** 含四段(与 JSON 稳定字段一一对应):
132
+
133
+ 1. **Primary Failure** — `primaryFailure`(node 或 run scope)
134
+ 2. **Recovery Action** — `primaryRecovery`(action、summary、reason、flags、commandHint)
135
+ 3. **Blocked Downstream / Skipped Nodes** — `downstreamSkippedNodes`
136
+ 4. **Recommended Operator Action** — 面向 operator 的步骤摘要
137
+
138
+ 保存 handoff 时重定向到平台临时目录或 `docs/reports/`,不要写入 `.harness/dag-runs/`。
139
+
140
+ ## Decision Gate 消费约定
141
+
142
+ 1. 优先 `dag report --json` 或 `buildDagDecisionGateEvidence()` 的 **verified** 派生摘要。
143
+ 2. 映射到 `decision` / `nextAction` 须保守;recovery 证据是 **advisory only, not an execution directive**。
144
+ 3. `autoRetryEligible: true` 仅表示「规划上可人工重试」,**不**触发 runner。
145
+ 4. paused run 的人类路径仍是 M5 CLI:`dag approve --run-id <id> --option <option-id>` / `dag reject --run-id <id> --reason "..."` / `dag resume --run-id <id>`(见 [`agent-dag-runner.md`](agent-dag-runner.md) §Decision Gate)。
146
+ 5. Envelope 干跑:`dag decision inspect|validate` 重解析 run facts;`validate` 无效时 exit 1;**不**写 artifact、**不** resume。
147
+
148
+ ## Active stale run recovery(advisory detection)
149
+
150
+ `dag doctor` 与 `dag status` 通过 `detectDagRunHealthIssues()` 检测 lifecycle 不一致,**不** mutate run facts。
151
+
152
+ | Code | 典型场景 | operator 指引 |
153
+ |------|----------|------------|
154
+ | `terminal-in-active` | run 已完成但 `active/<run-id>/` 残留 | 对照 `completed/` canonical facts;手动 archive 或删除 stale 目录 |
155
+ | `paused-in-active` | pause 后目录未迁至 `paused/` | `dag doctor` 诊断;修复 facts 后再 approve/resume |
156
+ | `lifecycle-status-mismatch` | `paused/` 下 status 非 paused | 同上 |
157
+ | `missing-approval-artifact` | approve 后 artifact 缺失 | 勿 resume;re-approve 或 restore artifact |
158
+ | `non-terminal-in-completed` | completed 目录 status 异常 | manual-review only |
159
+ | `run-id-mismatch` / `missing-state-json` | 目录损坏或命名错误 | Inspect;勿 auto-mutate completed facts |
160
+
161
+ **Deferred runtime**:无 `dag recover apply` 或自动 cleanup;未来可能增加只读 `dag recover plan`(设计占位,未实现)。
162
+
163
+ ## 事实源与边界
164
+
165
+ | 类型 | 位置 | 规则 |
166
+ |------|------|------|
167
+ | Canonical run facts | `.harness/dag-runs/{active\|paused\|completed}/<run-id>/` | **只读**;report 不写回 |
168
+ | 派生 report | stdout / 重定向文件 | 可随时再生 |
169
+ | 工作块摘要 | 根 `artifacts/` | 非 per-run 历史;read-only DAG 节点不得写 |
170
+
171
+ ## 验证
172
+
173
+ ```bash
174
+ cd . && npx vitest run \
175
+ test/dag-report.test.ts \
176
+ test/dag-recovery-recommendation.test.ts \
177
+ test/dag-decision-gate-recovery-dogfood.test.ts \
178
+ test/dag-decision-evidence.test.ts \
179
+ test/dag-decision-envelope.test.ts \
180
+ test/dag-approve-resume.test.ts \
181
+ test/cli-contract.test.ts
182
+ ```
183
+
184
+ 实现细节与映射逻辑:`./src/core/dag-recovery-recommendation.ts`、`dag-report.ts`、`dag-decision-evidence.ts`。
@@ -1,42 +1,42 @@
1
- # Agent DAG Runner
2
-
3
- Agent DAG 是 loop-agent 的声明式编排 runtime。DAG 将工作拆为节点、按序执行 eligible ranks、记录 artifacts,并用 gate 做 review 与验证。
4
-
5
- ## 基本用法
6
-
7
- ```bash
8
- loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
9
- loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
10
- loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
11
- ```
12
-
13
- `<temp-dir>` 为平台原生临时目录。Windows 上 `--output`、`--dag`、`--cwd` 的实际值用原生路径。
14
-
15
- ## Executors
16
-
17
- - `static`:确定性生成的 artifacts 或 notes
18
- - `shell`:验证与文件系统检查
19
- - `pi`:规划、review、诊断;节点设 `toolProfile: "write"` 时有界写入
20
- - `cursor`:显式启用时的可选有界写后端
21
-
22
- ## Skills
23
-
24
- DAG spec 可声明 `defaults.skills`、`skillsByRole` 与节点级 `skills`。Runner 从 `skills/<skill-name>/SKILL.md` 解析本地指令,并在各节点 `skills.json` artifact 中记录解析元数据。
25
-
26
- 执行前可用 `dag validate --strict-skills` 做 opt-in skill audit;该门禁会在 missing/error/truncated skill 或 unresolved reference 出现时失败。默认 role skill 应来自 `docs/skills/vetted-skill-registry.md` 中记录的 repo-local wrapper。
27
-
28
- `loop-agent` skill 位于 `skills/loop-agent/SKILL.md`。遗留根路径 `skill/SKILL.md` 仅为旧 worktree 保留兼容 fallback。
29
-
30
- ## Artifacts
31
-
32
- DAG artifacts 位于:
33
-
34
- ```text
35
- .harness/dag-runs/<state>/<run-id>/artifacts/<node-id>/
36
- ```
37
-
38
- 根目录 `artifacts/` 不是有效的默认 DAG artifact 位置。
39
-
40
- ## Shell Gates
41
-
42
- - `shell.verdictGate` 从注入的当前 run 目录读取 `$HARNESS_DAG_RUN_DIR/<fromNodeId>.json`;不应自行发现 active run paths。
1
+ # Agent DAG Runner
2
+
3
+ Agent DAG 是 loop-agent 的声明式编排 runtime。DAG 将工作拆为节点、按序执行 eligible ranks、记录 artifacts,并用 gate 做 review 与验证。
4
+
5
+ ## 基本用法
6
+
7
+ ```bash
8
+ loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
9
+ loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
10
+ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
11
+ ```
12
+
13
+ `<temp-dir>` 为平台原生临时目录。Windows 上 `--output`、`--dag`、`--cwd` 的实际值用原生路径。
14
+
15
+ ## Executors
16
+
17
+ - `static`:确定性生成的 artifacts 或 notes
18
+ - `shell`:验证与文件系统检查
19
+ - `pi`:规划、review、诊断;节点设 `toolProfile: "write"` 时有界写入
20
+ - `cursor`:显式启用时的可选有界写后端
21
+
22
+ ## Skills
23
+
24
+ DAG spec 可声明 `defaults.skills`、`skillsByRole` 与节点级 `skills`。Runner 从 `skills/<skill-name>/SKILL.md` 解析本地指令,并在各节点 `skills.json` artifact 中记录解析元数据。
25
+
26
+ 执行前可用 `dag validate --strict-skills` 做 opt-in skill audit;该门禁会在 missing/error/truncated skill 或 unresolved reference 出现时失败。默认 role skill 应来自 `docs/skills/vetted-skill-registry.md` 中记录的 repo-local wrapper。
27
+
28
+ `loop-agent` skill 位于 `skills/loop-agent/SKILL.md`。遗留根路径 `skill/SKILL.md` 仅为旧 worktree 保留兼容 fallback。
29
+
30
+ ## Artifacts
31
+
32
+ DAG artifacts 位于:
33
+
34
+ ```text
35
+ .harness/dag-runs/<state>/<run-id>/artifacts/<node-id>/
36
+ ```
37
+
38
+ 根目录 `artifacts/` 不是有效的默认 DAG artifact 位置。
39
+
40
+ ## Shell Gates
41
+
42
+ - `shell.verdictGate` 从注入的当前 run 目录读取 `$HARNESS_DAG_RUN_DIR/<fromNodeId>.json`;不应自行发现 active run paths。