@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.
Files changed (100) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +127 -92
  3. package/dist/adapters/index.js +3 -2
  4. package/dist/adapters/loop-agent.js +44 -2
  5. package/dist/application/dag/args.js +420 -0
  6. package/dist/application/dag/generate-task-dag.js +280 -0
  7. package/dist/application/dag/report-dag.js +14 -0
  8. package/dist/application/dag/run-dag.js +93 -0
  9. package/dist/application/dag/validate-dag.js +101 -0
  10. package/dist/application/loop/run-action.js +23 -0
  11. package/dist/cli/catalog.js +2 -237
  12. package/dist/cli/command-definitions.js +571 -0
  13. package/dist/cli/index.js +2 -0
  14. package/dist/cli/program.js +65 -1
  15. package/dist/cli/router.js +13 -0
  16. package/dist/cli-governance/active-residue-check.js +38 -0
  17. package/dist/commands/dag-report.js +6 -107
  18. package/dist/commands/dag-run-task.js +8 -466
  19. package/dist/commands/dag-validate.js +7 -179
  20. package/dist/commands/examples.js +90 -0
  21. package/dist/commands/init.js +1495 -0
  22. package/dist/commands/loop.js +57 -31
  23. package/dist/commands/pi-prompt.js +2 -9
  24. package/dist/commands/run-dag.js +7 -180
  25. package/dist/executors/cursor-executor-artifacts.js +3 -4
  26. package/dist/executors/cursor-worker-client.js +13 -3
  27. package/dist/executors/dag-cursor-executor.js +2 -3
  28. package/dist/executors/dag-pi-executor.js +3 -4
  29. package/dist/executors/dag-static-executor.js +2 -5
  30. package/dist/executors/pi-defaults.js +9 -0
  31. package/dist/executors/shell-executor.js +12 -20
  32. package/dist/governance/manifest-types.js +1 -0
  33. package/dist/infrastructure/harness/active-residue-policy.js +73 -0
  34. package/dist/infrastructure/harness/artifact-store.js +72 -0
  35. package/dist/infrastructure/harness/atomic-write.js +49 -0
  36. package/dist/infrastructure/harness/completed-facts-guard.js +40 -0
  37. package/dist/infrastructure/harness/loop-action-store.js +23 -0
  38. package/dist/infrastructure/harness/loop-store.js +41 -0
  39. package/dist/infrastructure/harness/one-shot-run-store.js +94 -0
  40. package/dist/infrastructure/harness/task-store.js +77 -0
  41. package/dist/records/one-shot-runs.js +26 -61
  42. package/dist/records/promotion.js +3 -4
  43. package/dist/shared/artifacts-core.js +5 -5
  44. package/dist/shared/logger.js +9 -15
  45. package/dist/task/delegate.js +4 -4
  46. package/dist/task/runtime.js +5 -7
  47. package/dist/task/state.js +6 -20
  48. package/dist/workflows/dag/convergence/controller.js +277 -0
  49. package/dist/workflows/dag/dynamic-runtime/condition.js +48 -0
  50. package/dist/workflows/dag/dynamic-runtime/loop-until.js +156 -0
  51. package/dist/workflows/dag/dynamic-runtime/map.js +185 -0
  52. package/dist/workflows/dag/dynamic-runtime/reduction.js +72 -0
  53. package/dist/workflows/dag/dynamic-runtime/shared.js +133 -0
  54. package/dist/workflows/dag/lifecycle.js +6 -5
  55. package/dist/workflows/dag/node-execution.js +262 -0
  56. package/dist/workflows/dag/run-store.js +36 -0
  57. package/dist/workflows/dag/runner.js +82 -1341
  58. package/dist/workflows/dag/scheduler.js +84 -0
  59. package/dist/workflows/dag/upstream-artifacts.js +20 -18
  60. package/dist/workflows/loop/actions/cursor-fix.js +191 -0
  61. package/dist/workflows/loop/actions/dag-action.js +130 -0
  62. package/dist/workflows/loop/actions/pi-review.js +267 -0
  63. package/dist/workflows/loop/actions/shared.js +157 -0
  64. package/dist/workflows/loop/actions/shell-verify.js +82 -0
  65. package/dist/workflows/loop/actions/types.js +1 -0
  66. package/dist/workflows/loop/actions/workflow-action.js +255 -0
  67. package/dist/workflows/loop/actions.js +55 -1212
  68. package/dist/workflows/loop/closeout.js +5 -4
  69. package/dist/workflows/loop/context.js +2 -3
  70. package/dist/workflows/loop/events.js +3 -2
  71. package/dist/workflows/loop/policy/auto-policy.js +104 -0
  72. package/dist/workflows/loop/policy/cursor-fix-policy.js +31 -0
  73. package/dist/workflows/loop/rounds.js +3 -3
  74. package/dist/workflows/loop/signals.js +4 -7
  75. package/dist/workflows/loop/state.js +11 -11
  76. package/docs/README.md +3 -2
  77. package/docs/architecture/runtime-boundaries.md +147 -0
  78. package/docs/exec-plans/active/README.md +4 -0
  79. package/docs/exec-plans/completed/README.md +6 -2
  80. package/package.json +2 -1
  81. package/skills/ai-engineering-context/SKILL.md +21 -21
  82. package/skills/loop-agent/SKILL.md +73 -188
  83. package/skills/loop-agent/references/README.md +6 -2
  84. package/skills/loop-agent/references/harness-policy.md +113 -113
  85. package/skills/loop-agent/references/learned/README.md +13 -13
  86. package/skills/loop-agent/references/long-running-loop.md +59 -0
  87. package/skills/loop-agent/references/pi-subagent-assisted-mode.md +0 -2
  88. package/skills/loop-agent/references/verification-and-failure-handling.md +18 -0
  89. package/skills/requesting-code-review/SKILL.md +40 -40
  90. package/skills/requesting-code-review/code-reviewer.md +4 -4
  91. package/skills/systematic-debugging/CREATION-LOG.md +43 -43
  92. package/skills/systematic-debugging/SKILL.md +113 -113
  93. package/skills/systematic-debugging/condition-based-waiting.md +20 -20
  94. package/skills/systematic-debugging/defense-in-depth.md +27 -27
  95. package/skills/systematic-debugging/root-cause-tracing.md +38 -38
  96. package/skills/systematic-debugging/test-academic.md +6 -6
  97. package/skills/systematic-debugging/test-pressure-1.md +6 -6
  98. package/skills/systematic-debugging/test-pressure-2.md +2 -2
  99. package/skills/systematic-debugging/test-pressure-3.md +6 -6
  100. package/skills/verification-before-completion/SKILL.md +37 -37
@@ -2,41 +2,50 @@
2
2
  name: loop-agent
3
3
  description: >-
4
4
  Use when implementing features, processing PRDs or requirements, running structured loop-agent workflows, creating harness tasks, using Agent DAG, run-dag, pi-prompt planning/review, or Cursor bounded implementation in loop-agent. Triggers: loop-agent, workflow, structured development, harness task, Agent DAG, 结构化开发, 工作流, 需求实现, PRD 实现.
5
+ references:
6
+ - path: references/harness-policy.md
7
+ required: true
8
+ - path: references/hybrid-dag.md
9
+ required: true
10
+ - path: references/verification-and-failure-handling.md
11
+ required: true
12
+ - path: references/command-reference.md
13
+ required: true
5
14
  ---
6
15
 
7
16
  # loop-agent Workflow
8
17
 
9
- 这是 `loop-agent` 的入口文档。它只描述当前推荐入口,不再保留旧入口作为可选主路径。
18
+ 这是 `loop-agent` 的入口文档,只负责 trigger、routing 和硬规则。较长的 command details、workflow 细节与失败处理放在 `references/`,按需加载。
10
19
 
11
20
  ## Canonical Harness Policy
12
21
 
13
- Shared loop-agent harness workflow rules live in `references/harness-policy.md`. Repo-local `docs/loop-agent-harness.md` / `specs/loop-agent-harness.md` files should stay thin adapters for local runtime path, governance root, and verification commands.
22
+ Shared loop-agent harness workflow 规则见 `references/harness-policy.md`。Repo-local `docs/loop-agent-harness.md` / `specs/loop-agent-harness.md` 应保持为 local runtime pathgovernance root、verification commands thin adapters。
14
23
 
15
24
  ## 默认立场
16
25
 
17
26
  - 主入口是 **Agent DAG**。
18
27
  - 主会话负责编排、审 writeSet、复核验证与 handoff。
19
- - DAG `pi` executor 默认用于 read-only planning / review / diagnosis;当节点声明 `toolProfile: "write"` 时用于 bounded implementation / repair;Pi 模型矩阵保持 LOW=`gpt-5.3-codex-spark`、MED=`glm-5.2`、HIGH=`gpt-5.5`。
28
+ - DAG `pi` executor 默认用于 read-only planning / review / diagnosis;当节点声明 `toolProfile: "write"` 时用于 bounded implementation / repair;Pi 模型矩阵保持 LOW=`gpt-5.3-codex-spark`、MED=`glm-5.2`、HIGH=`gpt-5.5`。
20
29
  - `pi-prompt` 与 `cursor-prompt` 都是一次性 full-capability helper;用作 sidecar 时必须在 prompt 和 tool/model 参数里显式收窄。
21
- - Cursor 是显式启用的可选 bounded write backend;默认 no-Cursor DAG 使用 `executor: "pi"` + `toolProfile: "write"`,必须给出 allowed / forbidden paths。
30
+ - Cursor 是显式启用的可选 bounded write backend;默认 no-Cursor DAG 使用 `executor: "pi"` + `toolProfile: "write"`,必须给出 allowed / forbidden paths。
22
31
  - Shell verification 是事实源;任何完成声明都必须有本轮命令输出。
23
32
  - 长期结论写回 `docs/exec-plans/`、`docs/reports/`、`docs/progress/` 或 `./skill/`。
24
33
 
25
34
  ## 唯一推荐执行路径
26
35
 
27
36
  ```bash
28
- loop-agent new-task <task-id> "Task Title"
29
- # write <repo-root>/.harness/tasks/<task-id>/source/需求.md
30
- # write <repo-root>/.harness/tasks/<task-id>/source/执行约束.md
31
-
32
- loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
33
- loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
34
- loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
35
- ```
36
-
37
- `loop-agent` 默认指 npm 上已发布的全局 CLI。自举迭代 loop-agent 本仓库时,首次安装或有意升级可用 `npm install -g @tea-agent/loop-agent@latest`,但一次自举任务启动后不要中途升级控制器,并记录 `npm list -g @tea-agent/loop-agent --depth=0` 显示的实际版本。不要用当前工作区的 `npm link` 或 `npm run dev` 控制可能改动 CLI、DAG runtime、executor、package metadata 或 build output 的任务。`npm run dev -- <args>` 只用于源码调试和聚焦 CLI 开发。
38
-
39
- `<temp-dir>` 表示平台原生临时目录。macOS 和 Windows 都应使用实际平台路径;`/` 只用于 repo refs、JSON/Markdown 证据 refs 和 glob 约定。
37
+ loop-agent new-task <task-id> "Task Title"
38
+ # write <repo-root>/.harness/tasks/<task-id>/source/需求.md
39
+ # write <repo-root>/.harness/tasks/<task-id>/source/执行约束.md
40
+
41
+ loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
42
+ loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
43
+ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
44
+ ```
45
+
46
+ `loop-agent` 默认指 npm 上已发布的全局 CLI。自举迭代 loop-agent 本仓库时,首次安装或有意升级可用 `npm install -g @tea-agent/loop-agent@latest`,但一次自举任务启动后不要中途升级控制器,并记录 `npm list -g @tea-agent/loop-agent --depth=0` 显示的实际版本。不要用当前工作区的 `npm link` 或 `npm run dev` 控制可能改动 CLI、DAG runtime、executor、package metadata 或 build output 的任务。`npm run dev -- <args>` 只用于源码调试和聚焦 CLI 开发。
47
+
48
+ `<temp-dir>` 表示平台原生临时目录。macOS 和 Windows 都应使用实际平台路径;`/` 只用于 repo refs、JSON/Markdown 证据 refs 和 glob 约定。
40
49
 
41
50
  执行前必须审阅:
42
51
 
@@ -47,181 +56,51 @@ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
47
56
  - shell verification commands
48
57
  - decision gate mode
49
58
 
50
- ## Pi Sidecar
59
+ ## Pi Sidecar 入口规则
51
60
 
52
- 短时规划、审查、失败归因可使用 full-capability `pi-prompt`,默认模型是 `glm-5.2`。作为只读 sidecar 时必须显式传只读 tools:
53
-
54
- ```bash
55
- loop-agent pi-prompt \
56
- --cwd ~/go/src/loop-agent \
57
- --provider wizard-local \
58
- --model glm-5.2 \
59
- --tools read,grep,find,ls \
60
- --timeout 2400000 \
61
- "Read the task source and provide a concise implementation plan. Do not edit files."
62
- ```
63
-
64
- 规则:
65
-
66
- - `pi-prompt` 本身具备完整能力;只读 sidecar 必须使用 `--tools read,grep,find,ls` 并在 prompt 中写明不编辑文件。
67
- - 高复杂度 one-shot 诊断可显式加 `--model gpt-5.5`。
68
- - 输出是 advisory,不能替代 deterministic verification。
69
- - 发现必须写回 task source、report、progress 或 exec plan。
70
-
71
- ## Bounded Write Execution
61
+ 短时规划、审查、失败归因可使用 full-capability `pi-prompt`,默认模型是 `glm-5.2`:
72
62
 
63
+ - 只读 sidecar 必须显式传 `--tools read,grep,find,ls`,并在 prompt 中写明不编辑文件。
64
+ - 高复杂度 one-shot 诊断可显式加 `--model gpt-5.5`。
65
+ - 输出是 advisory,不能替代 deterministic verification;发现必须写回 task source、report、progress 或 exec plan。
66
+
67
+ ## Bounded Write Execution
68
+
73
69
  需要写代码时,默认使用 DAG `pi` executor 的 write tool profile。Pi writer 节点必须包含 task id、目标、allowed paths、forbidden paths、writeSet、硬约束和预期验证,并在执行后由主会话独立运行 shell verification。
74
-
75
- Cursor 只作为显式启用的可选 bounded write backend。需要使用 Cursor 时:
76
-
77
- ```bash
78
- loop-agent cursor-prompt \
79
- --cwd ~/go/src/loop-agent \
80
- --timeout 1800000 \
81
- --model composer-2.5 \
82
- "<bounded task prompt with allowedPaths and forbiddenPaths>"
83
- ```
84
-
85
- Cursor prompt 与 Pi writer prompt 都必须包含:
70
+
71
+ Cursor 只作为显式启用的可选 bounded write backend。调用示例与细节见 `references/pi-prompt.md`、`references/harness-policy.md` 和 `references/verification-and-failure-handling.md`。
72
+
73
+ Pi writer prompt 与 Cursor prompt 都必须包含:
86
74
 
87
75
  - task id
88
76
  - exact objective
89
77
  - allowed paths
90
78
  - forbidden paths
91
- - hard constraints
92
- - expected verification
93
- - instruction to preserve unrelated files
94
-
95
- bounded writer 完成后,主会话必须独立执行:
96
-
97
- ```bash
98
- git status --short
99
- git diff --stat
100
- bash scripts/check-repo.sh
101
- npm run lint
102
- npm test
103
- npm run typecheck
104
- loop-agent inspect
105
- loop-agent docs audit
106
- loop-agent handoff check <task-id>
107
- ```
108
-
109
- ## Operator Commands
110
-
111
- 运行状态、恢复和收口只使用这些 operator 面:
112
-
113
- ```bash
114
- loop-agent dag status --run-id <run-id>
115
- loop-agent dag doctor
116
- loop-agent dag report --latest --markdown
117
- loop-agent dag closeout-draft --run-id <run-id>
118
- loop-agent promote-run <task-id> --run-id <run-id>
119
- loop-agent closeout task <task-id>
120
- loop-agent inspect
121
- loop-agent doctor
122
- loop-agent spine audit <task-id> --markdown
123
- loop-agent knowledge curate --markdown
124
- loop-agent loop-benchmark --markdown
125
- loop-agent docs audit
126
- loop-agent handoff check <task-id>
127
- ```
128
-
129
- ## Long-Running Loop
130
-
131
- `loop` 是 experimental outer workflow state,用于跨多轮记录目标、压缩记忆和 round facts 引用。它不替代 Agent DAG,也不等同于已移除的顺序式 `run loop`。
132
-
133
- 当前已可用的最小入口:
134
-
135
- ```bash
136
- loop-agent loop init <task-id>
137
- loop-agent loop status <task-id>
138
- loop-agent loop run <task-id> --action shell-verify --command "bash scripts/check-repo.sh"
139
- loop-agent loop run <task-id> --action pi-review
140
- loop-agent loop run <task-id> --action cursor-fix --model composer-2.5
141
- loop-agent loop run <task-id> --action dag
142
- loop-agent loop run <task-id> --action dag --execute
143
- loop-agent loop run <task-id> --auto --max-rounds 3
144
- loop-agent loop run <task-id> --auto --max-rounds 3 --allow-cursor-fix
145
- loop-agent loop add-signal <task-id> --type human_followup --message "review this boundary before closeout"
146
- loop-agent loop closeout <task-id>
147
- loop-agent loop record-round <task-id> \
148
- --action manual \
149
- --result "summary" \
150
- --lesson "what to carry forward" \
151
- --next "next bounded action" \
152
- --decision continue \
153
- --ref ".harness/runs/completed/<run-id>/result.json"
154
- ```
155
-
156
- 规则:
157
-
158
- - `loop/objective.md` 与 `loop/context.md` 是运行态投影;exec plan / task source 仍是需求状态源。
159
- - `rounds.jsonl` 只引用 canonical facts,不复制完整 executor 日志。
160
- - `context.md` 每轮重写为压缩记忆,不无限 append。
161
- - `loop run --action shell-verify` 是 deterministic action;命令 exit code 决定 verification result,输出摘要写入 `loop/verification/round-N.json`。
162
- - `loop run --action pi-review` 必须保持 read-only;工具 allowlist 固定为 `read,grep,find,ls`,输出必须包含 `findingSummary`、`failureCategory`、`nextHypothesis`、`recommendedAction`、`fixScope`、`rootCause`,其中 `recommendedAction` 只能是 `implement_fix|replan|pause|done`。
163
- - `loop run --action cursor-fix` 必须读取 task `allowedPaths` / `forbiddenPaths`,拒绝空 allowedPaths 或 allowed/forbidden overlap;对 `complexity=medium|large` 的任务,还必须已有 loop `dag` round 证据,或在 `task.json.dagFallbackReason` 中写明 DAG runtime fallback 原因。调用现有 Cursor bounded executor,并把 one-shot evidence 归档到 `.harness/runs/completed|failed/`。
164
- - `cursor-fix` 只表示 bounded write round 已执行;它不会把 loop 标记 complete,下一步必须进入 `shell-verify` 或 review。
165
- - `loop run --action dag` 默认是 review mode:调用 `dag run-task <task-id> --profile auto --strict-models` 生成 DAG,再用 `dag validate --strict-models --strict-governance` 校验,并记录 review packet。
166
- - `loop run --action dag --execute` 才会调用 `run-dag`,随后读取 `dag report --json` 作为 round result;paused DAG 会让 loop 进入 `paused`。
167
- - `loop run --auto --max-rounds N` 使用 deterministic policy 选择下一轮 action;默认只会自动选择 shell-verify、pi-review、dag review 或 policy pause/block,不自动触发 Cursor 写入。
168
- - 自动 `cursor-fix` 必须显式 opt-in:`task.json.loopAutoWritePolicy="enabled"`,或 `loopAutoWritePolicy="approval-required"` 加 pending approval signal / `--allow-cursor-fix`。即使 opt-in,也必须通过 `allowedPaths`/`forbiddenPaths`/DAG evidence guard;guard 失败会 pause,不会绕过写入边界。
169
- - `loop add-signal` 写入 durable `signals.jsonl`,支持 `human_followup|approval|scope_changed|review_feedback`;urgent/scope_changed 会 pause,review feedback / human follow-up 先走 read-only Pi review,approval 触发下一轮 DAG review packet。
170
- - Signals 不直接覆盖 `objective.md`;DAG decision envelope / approve / reject / resume 仍由 DAG action 机制管理,loop 只记录 refs。
171
- - `loop closeout` 从 loop state、objective/context、rounds 和 signals 派生 `loop/closeout.md` draft;draft 会标出 workflow path(`dag` / `explicit-fallback` / `missing-dag-evidence` / `micro-or-small`)与 fallback reason。非 complete 状态必须标 partial/paused/blocked,不能修改 completed facts;medium/large loop 若缺少 DAG round 且没有 `dagFallbackReason`,必须把缺失 DAG 证据列为 remaining risk。
172
- - `events.jsonl` 只用于 observability,覆盖 loop_start、round_start、action_start、action_finish、context_rewrite、decision、loop_finish;不要把 events 当状态源。
173
- - auto mode 遇到同类 failure streak 达阈值会 blocked,避免无限重试。
174
- - 完成声明仍必须由 shell verification、review verdict 和 success criteria coverage 证明。
175
-
176
- ## Three-Pass Convergence
177
-
178
- Supervised DAG convergence is opt-in through task config:
179
-
180
- ```json
181
- {
182
- "convergence": {
183
- "enabled": true,
184
- "maxPasses": 3,
185
- "stopOnHardVerifyPass": true,
186
- "pauseOnRegression": true
187
- }
188
- }
189
- ```
190
-
191
- Rules:
192
-
193
- - The feature flag `HARNESS_DAG_CONVERGENCE=off` disables DAG convergence and restores single-repair behavior.
194
- - `process-supervisor-pi` output must include first-line `VERDICT:` plus a `REPAIR_ARTIFACT_JSON` fenced block; `repair-pi` / optional `repair-cursor` should use artifact `failureClass`, `rootCause`, `fixScope`, and `invariant` before raw logs.
195
- - When `hard-verify-shell` fails with a retryable category and `currentPass < maxPasses`, the runner preserves current pass artifacts under `convergence/pass-N/`, resets the supervisor/process-gate/repair/hard-verify segment plus blocked downstream nodes, and re-enters the DAG ranks.
196
- - `write-guard`, timeout, spawn/auth, and human-gate failures do not auto-retry.
197
- - Regression signals such as lower shell success count pause the run as `convergence-regression`.
198
- - `dag report --json` / markdown exposes `convergence.passHistory`.
199
- - Final completion still requires full shell verification; intermediate quota/focused checks are cost controls only.
200
-
201
- ## Repair Artifact / Spine / Knowledge
202
-
203
- - `process-supervisor-pi` output for gated supervised DAGs must include first-line `VERDICT:` plus a `REPAIR_ARTIFACT_JSON` fenced block.
204
- - `process-gate-shell` may set `shell.repairArtifactGate.fromNodeId`; the runner fails closed when the artifact is missing, schema-invalid, or its `fixScope` escapes the downstream repair writer allowedPaths/writeSet.
205
- - `spine audit <task-id>` checks minimal spec spine evidence: source files, path ownership, allowed/forbidden overlap, requirement coverage, and final verification command labels.
206
- - `dag validate --strict-governance --spine-task <task-id>` consumes the same spine audit and fails on error findings.
207
- - `knowledge curate` turns completed convergence patterns into a human-gated learned guidance proposal and runs skill safety preflight; it never edits accepted learned guidance directly.
79
+ - hard constraints
80
+ - expected verification
81
+ - instruction to preserve unrelated files
82
+
83
+ bounded writer 完成后,主会话必须独立复核;命令清单见 `references/verification-and-failure-handling.md` 的 "Cursor bounded write 后的独立复核"。
208
84
 
209
- ## SePO-Lite Prompt Evolution
85
+ ## 进阶主题路由
210
86
 
211
- - Learned prompt deltas are human-gated proposals under task source or skill references.
212
- - Prompt deltas must be Markdown-only process guidance; they must not add shell commands, credential handling, tool permission expansion, or completion-authority bypass rules.
213
- - Accepted learned patterns live in `./skill/references/learned/<repo>.md` or `default.md`.
214
- - DAG implementer prompts that already request the `loop-agent` skill may inline up to three learned Markdown sections as bounded guidance.
215
- - Learned guidance is advisory and cannot replace shell verification or write governance.
87
+ 以下主题只在 references 中维护细节,不在本文展开:
88
+
89
+ | 主题 | Reference |
90
+ |---|---|
91
+ | Long-Running Loop(`loop` init/status/run/record-round/add-signal/closeout、auto mode、signals) | `references/long-running-loop.md` |
92
+ | Three-Pass Convergence、repair artifact、spine audit、knowledge curate、SePO-lite prompt evolution | `references/harness-policy.md` |
93
+ | Operator commands(status/doctor/report/closeout/promote/inspect/spine/knowledge/docs/handoff) | `references/command-reference.md` |
94
+ | Post-Cursor 独立验证、verify knobs、failure handling、closeout | `references/verification-and-failure-handling.md` |
216
95
 
217
96
  ## Source Layout
218
97
 
219
98
  新代码优先从这些目录进入:
220
99
 
221
- | Area | Entry |
222
- |---|---|
223
- | CLI command tree / help / commander program | `src/cli/` |
224
- | DAG workflow | `src/workflows/dag/` |
100
+ | Area | Entry |
101
+ |---|---|
102
+ | CLI command tree / help / commander program | `src/cli/` |
103
+ | DAG workflow | `src/workflows/dag/` |
225
104
  | Long-running loop workflow | `src/workflows/loop/` |
226
105
  | Task runtime | `src/task/` |
227
106
  | Executors | `src/executors/` |
@@ -230,26 +109,33 @@ Rules:
230
109
  | Shared helpers | `src/shared/` |
231
110
  | Repo adapters | `src/adapters/` |
232
111
 
233
- 不要新增平行兼容入口。CLI public export 的唯一入口是 `src/cli/index.ts`;commander command tree 和 help 实现在 `src/cli/program.ts`。
112
+ 不要新增平行兼容入口。CLI public export 的唯一入口是 `src/cli/index.ts`;commander command tree 和 help 实现在 `src/cli/program.ts`。
234
113
 
235
- ## Hard Rules
236
-
237
- 1. One task = one bounded work chunk.
238
- 2. Source materials are mandatory: `source/需求.md` and `source/执行约束.md`.
239
- 3. Agent DAG is the implementation workflow.
114
+ ## Hard Rules
115
+
116
+ 1. One task = one bounded work chunk.
117
+ 2. Source materials are mandatory: `source/需求.md` and `source/执行约束.md`.
118
+ 3. Agent DAG is the implementation workflow.
240
119
  4. DAG `pi` executor stays read-only unless the node sets `toolProfile: "write"`; `pi-prompt` / `cursor-prompt` are full-capability one-shot helpers and must be bounded per call.
241
120
  5. Pi writer nodes and optional Cursor write execution must be bounded by explicit allowed / forbidden paths.
242
- 6. Completed DAG and one-shot run facts are read-only.
243
- 7. Do not write root `artifacts/` from read-only DAG or sidecar steps.
244
- 8. Do not keep hidden workflow state in chat only; write durable conclusions to repo artifacts.
245
- 9. Verify before completion.
121
+ 6. Completed DAG and one-shot run facts are read-only.
122
+ 7. Do not write root `artifacts/` from read-only DAG or sidecar steps.
123
+ 8. Do not keep hidden workflow state in chat only; write durable conclusions to repo artifacts.
124
+ 9. Verify before completion.
246
125
 
247
126
  ## References
248
127
 
128
+ Required(frontmatter 已声明):
129
+
249
130
  - `references/harness-policy.md`
250
131
  - `references/hybrid-dag.md`
251
- - `references/orchestrator-and-interventions.md`
132
+ - `references/verification-and-failure-handling.md`
252
133
  - `references/command-reference.md`
134
+
135
+ Optional(按需加载):
136
+
137
+ - `references/orchestrator-and-interventions.md`
138
+ - `references/long-running-loop.md`
253
139
  - `references/task-workflow.md`
254
140
  - `references/pi-prompt.md`
255
141
  - `references/one-shot-runs.md`
@@ -257,4 +143,3 @@ Rules:
257
143
  - `references/model-routing.md`
258
144
  - `references/multi-worktree.md`
259
145
  - `references/post-implementation-and-patterns.md`
260
- - `references/verification-and-failure-handling.md`
@@ -25,6 +25,9 @@ failure handling 与 workflow 细节放在这里,避免主 skill 变成百科
25
25
  | 解释 `.harness/runs/`、one-shot evidence、active 残留或 promotion | `one-shot-runs.md` |
26
26
  | 多 worktree 并行委派、delegate/harvest | `multi-worktree.md` |
27
27
  | 模型、provider、profile、fallback routing | `model-routing.md` |
28
+ | Long-running `loop` 命令、action 规则、auto mode、signals、loop closeout | `long-running-loop.md` |
29
+ | Three-pass convergence、repair artifact / spine audit / knowledge curate、SePO-lite prompt evolution | `harness-policy.md` |
30
+ | Cursor bounded write 后的独立复核、verify knobs、failure handling | `verification-and-failure-handling.md` |
28
31
 
29
32
  ## Reference 索引
30
33
 
@@ -41,7 +44,8 @@ failure handling 与 workflow 细节放在这里,避免主 skill 变成百科
41
44
  | `model-routing.md` | 查看或修改 model/provider 默认、profile、routing 或 fallback 行为 |
42
45
  | `post-implementation-and-patterns.md` | 处理 post-verify handoff、PRD item 拆分、fast bounded task、quick status 或 Pi timeout |
43
46
  | `multi-worktree.md` | 用 isolated worktree、`delegate` 与 `harvest` 并发执行互不重叠的 independent task |
44
- | `verification-and-failure-handling.md` | 选择 verify knob、解释 failure mode、执行 completion audit 与 closeout |
47
+ | `verification-and-failure-handling.md` | 选择 verify knob、Cursor bounded write 后的独立复核、解释 failure mode、执行 completion audit 与 closeout |
48
+ | `long-running-loop.md` | 使用 experimental long-running `loop` outer state:命令入口、action 规则、auto mode 写入边界、signals 与 loop closeout |
45
49
 
46
50
  ## 边界与状态源
47
51
 
@@ -56,7 +60,7 @@ failure handling 与 workflow 细节放在这里,避免主 skill 变成百科
56
60
  ## 维护规则
57
61
 
58
62
  - 不要把长段落复制回 `SKILL.md`;需要新增细节时,在本目录新增或更新 reference,并在 `SKILL.md` 添加 routing row。
59
- - 让 `SKILL.md` 保持约 200-300 行以内;reference 文件承担细节。
63
+ - 让 `SKILL.md` 保持 120-180 行以内;reference 文件承担细节。
60
64
  - 新 reference 应有清晰标题、触发场景、最小步骤、失败处理和维护边界。
61
65
  - 如果某个 reference 变成可独立触发、跨项目通用且不再依赖本仓库上下文,再考虑拆成独立 skill。
62
66
  - 更新 command、workflow policy 或 verification 规则时,同步核对 `harness.json`、`references/harness-policy.md`、repo-local harness adapter docs 和 verification matrix。