@tea-agent/loop-agent 0.25.6 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +1020 -1006
- package/bin/loop-agent.js +21 -21
- package/dist/commands/cursor-prompt.js +6 -6
- package/dist/commands/loop-benchmark.js +11 -11
- package/dist/commands/pi-reuse-benchmark.js +16 -16
- package/dist/executors/dag-pi-executor.js +26 -20
- package/dist/executors/model-routing.js +34 -18
- package/dist/governance/manifest-types.js +33 -5
- package/dist/sidecars/cursor-prompt/executor.js +1 -1
- package/dist/task/task-demand-routing.js +3 -1
- package/dist/worker/console/chat/model-resolver.js +15 -3
- package/dist/worker/observe/static/constants.js +3 -2
- package/dist/worker/observe/static/copy.js +67 -67
- package/dist/worker/observe/static/dag-layout.d.ts +31 -31
- package/dist/worker/observe/static/dag-layout.js +83 -83
- package/dist/worker/observe/static/dag-model.js +1 -0
- package/dist/worker/observe/static/dom.js +220 -220
- package/dist/worker/observe/static/relations.js +133 -133
- package/dist/worker/observe/static/router.js +93 -93
- package/dist/worker/observe/static/run-processing.js +148 -148
- package/dist/worker/observe/static/styles.css +182 -42
- package/dist/worker/observe/static/views/batch.js +227 -227
- package/dist/worker/observe/static/views/dag-graph.js +172 -172
- package/dist/worker/observe/static/views/failures.js +143 -143
- package/dist/worker/observe/static/views/feature.js +492 -492
- package/dist/worker/observe/static/views/run.js +453 -453
- package/dist/worker/observe/static/views/shell.js +7 -7
- package/dist/worker/observe/static/views/timeline.js +163 -163
- package/dist/workflows/dag/canvas-observer.js +275 -275
- package/dist/workflows/dag/lifecycle.js +40 -30
- package/dist/workflows/dag/node-execution.js +13 -0
- package/dist/workflows/dag/types.js +59 -19
- package/docs/skills/README.md +7 -7
- package/docs/templates/adr.md +60 -60
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
- package/docs/templates/agent-dag-report.schema.json +473 -473
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
- package/docs/templates/backend-test-result.schema.json +99 -99
- package/docs/templates/feature-spec.md +53 -53
- package/docs/templates/frontend-design-contract.md +42 -42
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -17
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -21
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -27
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -27
- package/docs/templates/frontend-eval/metrics.md +138 -138
- package/docs/templates/frontend-eval/smoke-targets.md +53 -53
- package/docs/templates/frontend-task-constraints.md +35 -35
- package/docs/templates/frontend-task-requirement.md +70 -70
- package/docs/templates/harness.schema.json +29 -7
- package/docs/templates/init-evolution-review.md +35 -35
- package/docs/templates/interactive-ui-round2-experiment.md +66 -66
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -118
- package/docs/templates/knowledge-sync-dag.json +178 -178
- package/docs/templates/knowledge-sync-draft.schema.json +71 -71
- package/docs/templates/product-line/closeout.yaml +9 -9
- package/docs/templates/product-line/design.md +13 -13
- package/docs/templates/product-line/links.md +10 -10
- package/docs/templates/product-line/requirement.md +17 -17
- package/docs/templates/product-line/test-plan.md +7 -7
- package/docs/templates/production-readiness-checklist.md +57 -57
- package/docs/templates/project-start-checklist.md +9 -9
- package/docs/templates/qa-report.md +48 -48
- package/docs/templates/sprint-contract.md +29 -29
- package/docs/templates/worker-dogfood-evidence.md +80 -80
- package/docs/templates/worker-dogfood-setup.md +68 -68
- package/harness.json +1 -2
- package/package.json +1 -1
- package/scripts/kb-bootstrap-init-skeleton.sh +0 -0
- package/scripts/kb-graph-incremental-prepare.mjs +386 -386
- package/scripts/kb-graph-materialize.mjs +105 -105
- package/scripts/kb-graph-promote.mjs +164 -164
- package/scripts/kb-query.mjs +554 -554
- package/skills/ai-engineering-context/SKILL.md +48 -48
- package/skills/analyze-product-dependencies/SKILL.md +67 -67
- package/skills/analyze-product-dependencies/agents/openai.yaml +4 -4
- package/skills/analyze-product-dependencies/references/api-documentation-schema.md +30 -30
- package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +28 -28
- package/skills/analyze-product-dependencies/references/example.md +76 -76
- package/skills/analyze-product-dependencies/references/forward-test-cases.md +35 -35
- package/skills/analyze-product-dependencies/references/input-contract.md +11 -11
- package/skills/analyze-product-dependencies/references/scouting-rules.md +61 -61
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +267 -267
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +101 -101
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +142 -142
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +76 -76
- package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +146 -146
- package/skills/analyze-product-requirements/SKILL.md +90 -90
- package/skills/analyze-product-requirements/agents/openai.yaml +4 -4
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +91 -91
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +56 -56
- package/skills/analyze-product-requirements/references/example.md +86 -86
- package/skills/analyze-product-requirements/references/forward-test-cases.md +66 -66
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +32 -32
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +33 -33
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +35 -35
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +193 -193
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +69 -69
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +97 -97
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +98 -98
- package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +156 -156
- package/skills/browser-tools/browser-content.js +103 -103
- package/skills/browser-tools/browser-cookies.js +35 -35
- package/skills/browser-tools/browser-eval.js +53 -53
- package/skills/browser-tools/browser-hn-scraper.js +108 -108
- package/skills/browser-tools/browser-nav.js +44 -44
- package/skills/browser-tools/browser-pick.js +162 -162
- package/skills/browser-tools/browser-screenshot.js +34 -34
- package/skills/browser-tools/browser-start.js +86 -86
- package/skills/browser-tools/package-lock.json +2556 -2556
- package/skills/browser-tools/package.json +19 -19
- package/skills/code-review-core/SKILL.md +20 -20
- package/skills/codebase-scout/SKILL.md +19 -19
- package/skills/grill-me/SKILL.md +10 -10
- package/skills/loop-agent/references/README.md +67 -67
- package/skills/loop-agent/references/docs-converge.md +126 -126
- package/skills/loop-agent/references/hybrid-dag.md +2 -2
- package/skills/loop-agent/references/learned/README.md +21 -21
- package/skills/loop-agent/references/long-running-loop.md +57 -57
- package/skills/loop-agent/references/model-routing.md +2 -0
- package/skills/loop-agent/references/one-shot-runs.md +85 -85
- package/skills/loop-agent/references/pi-prompt.md +23 -23
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -84
- package/skills/playwright-cli/SKILL.md +420 -420
- package/skills/playwright-cli/references/element-attributes.md +23 -23
- package/skills/playwright-cli/references/playwright-tests.md +39 -39
- package/skills/playwright-cli/references/request-mocking.md +87 -87
- package/skills/playwright-cli/references/running-code.md +241 -241
- package/skills/playwright-cli/references/session-management.md +225 -225
- package/skills/playwright-cli/references/storage-state.md +275 -275
- package/skills/playwright-cli/references/test-generation.md +433 -433
- package/skills/playwright-cli/references/tracing.md +139 -139
- package/skills/playwright-cli/references/video-recording.md +143 -143
- package/skills/requesting-code-review/SKILL.md +101 -101
- package/skills/requesting-code-review/code-reviewer.md +168 -168
- package/skills/systematic-debugging/CREATION-LOG.md +119 -119
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
- package/skills/systematic-debugging/condition-based-waiting.md +115 -115
- package/skills/systematic-debugging/defense-in-depth.md +122 -122
- package/skills/systematic-debugging/find-polluter.sh +63 -63
- package/skills/systematic-debugging/root-cause-tracing.md +169 -169
- package/skills/systematic-debugging/test-academic.md +14 -14
- package/skills/systematic-debugging/test-pressure-1.md +58 -58
- package/skills/systematic-debugging/test-pressure-2.md +68 -68
- package/skills/systematic-debugging/test-pressure-3.md +69 -69
- package/skills/using-git-worktrees/SKILL.md +215 -215
- package/skills/verification-before-completion/SKILL.md +154 -154
- package/skills/webapp-testing/SKILL.md +19 -19
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
# Long-Running Loop 详细规则
|
|
2
|
-
|
|
3
|
-
需要跨多轮记录目标、压缩记忆、round facts 引用,或使用 `loop init|status|run|record-round|add-signal|closeout` 时使用本文。`loop` 是 experimental outer workflow state:它不替代 Agent DAG,也不等同于已移除的顺序式 `run loop`。共享 policy 摘要见 `harness-policy.md` 的 "Long-running loop policy" 一节。
|
|
4
|
-
|
|
5
|
-
## 最小入口
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
loop-agent loop init <task-id>
|
|
9
|
-
loop-agent loop status <task-id>
|
|
10
|
-
loop-agent loop run <task-id> --action shell-verify --command "bash scripts/check-repo.sh"
|
|
11
|
-
loop-agent loop run <task-id> --action pi-review
|
|
12
|
-
loop-agent loop run <task-id> --action dag
|
|
13
|
-
loop-agent loop run <task-id> --action dag --execute
|
|
14
|
-
loop-agent loop run <task-id> --auto --max-rounds 3
|
|
15
|
-
loop-agent loop run <task-id> --auto --max-rounds 3
|
|
16
|
-
loop-agent loop add-signal <task-id> --type human_followup --message "review this boundary before closeout"
|
|
17
|
-
loop-agent loop closeout <task-id>
|
|
18
|
-
loop-agent loop record-round <task-id> \
|
|
19
|
-
--action manual \
|
|
20
|
-
--result "summary" \
|
|
21
|
-
--lesson "what to carry forward" \
|
|
22
|
-
--next "next bounded action" \
|
|
23
|
-
--decision continue \
|
|
24
|
-
--ref ".harness/runs/completed/<run-id>/result.json"
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## 状态源与记忆规则
|
|
28
|
-
|
|
29
|
-
- `loop/objective.md` 与 `loop/context.md` 是运行态投影;exec plan / task source 仍是需求状态源。
|
|
30
|
-
- `rounds.jsonl` 只引用 canonical facts,不复制完整 executor 日志。
|
|
31
|
-
- `context.md` 每轮重写为压缩记忆,不无限 append。
|
|
32
|
-
- `events.jsonl` 只用于 observability,覆盖 loop_start、round_start、action_start、action_finish、context_rewrite、decision、loop_finish;不要把 events 当状态源。
|
|
33
|
-
|
|
34
|
-
## Action 规则
|
|
35
|
-
|
|
36
|
-
- `loop run --action shell-verify` 是 deterministic action;命令 exit code 决定 verification result,输出摘要写入 `loop/verification/round-N.json`。
|
|
37
|
-
- `loop run --action pi-review` 必须保持 read-only;工具 allowlist 固定为 `read,grep,find,ls`,输出必须包含 `findingSummary`、`failureCategory`、`nextHypothesis`、`recommendedAction`、`fixScope`、`rootCause`,其中 `recommendedAction` 只能是 `implement_fix|replan|pause|done`。
|
|
38
|
-
- 自动写入只能通过 `loop run --action dag --execute` / auto DAG execute;须读取 task `allowedPaths` / `forbiddenPaths` 并审查 writer writeSet。
|
|
39
|
-
- `loop run --action dag` 默认是 review mode:调用 `dag run-task <task-id> --profile auto --strict-models` 生成 DAG,再用 `dag validate --strict-models --strict-governance` 校验,并记录 review packet。
|
|
40
|
-
- `loop run --action dag --execute` 才会调用 `run-dag`,随后读取 `dag report --json` 作为 round result;paused DAG 会让 loop 进入 `paused`。
|
|
41
|
-
|
|
42
|
-
## Auto mode 与写入边界
|
|
43
|
-
|
|
44
|
-
- `loop run --auto --max-rounds N` 使用 deterministic policy 选择下一轮 action;默认只会自动选择 shell-verify、pi-review、dag review 或 policy pause/block。
|
|
45
|
-
- 自动 DAG execute 必须显式 opt-in:`task.json.loopAutoExecutionPolicy="enabled"`,或 `approval-required` 加 pending approval;旧 `loopAutoWritePolicy` fail-fast。
|
|
46
|
-
- auto mode 遇到同类 failure streak 达阈值会 blocked,避免无限重试。
|
|
47
|
-
|
|
48
|
-
## Signals
|
|
49
|
-
|
|
50
|
-
- `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。
|
|
51
|
-
- Signals 不直接覆盖 `objective.md`;DAG decision envelope / approve / reject / resume 仍由 DAG action 机制管理,loop 只记录 refs。
|
|
52
|
-
|
|
53
|
-
## Closeout
|
|
54
|
-
|
|
55
|
-
- `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。
|
|
56
|
-
- 非 complete 状态必须标 partial/paused/blocked,不能修改 completed facts;medium/large loop 若缺少 DAG round 且没有 `dagFallbackReason`,必须把缺失 DAG 证据列为 remaining risk。
|
|
57
|
-
- 完成声明仍必须由 shell verification、review verdict 和 success criteria coverage 证明。
|
|
1
|
+
# Long-Running Loop 详细规则
|
|
2
|
+
|
|
3
|
+
需要跨多轮记录目标、压缩记忆、round facts 引用,或使用 `loop init|status|run|record-round|add-signal|closeout` 时使用本文。`loop` 是 experimental outer workflow state:它不替代 Agent DAG,也不等同于已移除的顺序式 `run loop`。共享 policy 摘要见 `harness-policy.md` 的 "Long-running loop policy" 一节。
|
|
4
|
+
|
|
5
|
+
## 最小入口
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
loop-agent loop init <task-id>
|
|
9
|
+
loop-agent loop status <task-id>
|
|
10
|
+
loop-agent loop run <task-id> --action shell-verify --command "bash scripts/check-repo.sh"
|
|
11
|
+
loop-agent loop run <task-id> --action pi-review
|
|
12
|
+
loop-agent loop run <task-id> --action dag
|
|
13
|
+
loop-agent loop run <task-id> --action dag --execute
|
|
14
|
+
loop-agent loop run <task-id> --auto --max-rounds 3
|
|
15
|
+
loop-agent loop run <task-id> --auto --max-rounds 3
|
|
16
|
+
loop-agent loop add-signal <task-id> --type human_followup --message "review this boundary before closeout"
|
|
17
|
+
loop-agent loop closeout <task-id>
|
|
18
|
+
loop-agent loop record-round <task-id> \
|
|
19
|
+
--action manual \
|
|
20
|
+
--result "summary" \
|
|
21
|
+
--lesson "what to carry forward" \
|
|
22
|
+
--next "next bounded action" \
|
|
23
|
+
--decision continue \
|
|
24
|
+
--ref ".harness/runs/completed/<run-id>/result.json"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 状态源与记忆规则
|
|
28
|
+
|
|
29
|
+
- `loop/objective.md` 与 `loop/context.md` 是运行态投影;exec plan / task source 仍是需求状态源。
|
|
30
|
+
- `rounds.jsonl` 只引用 canonical facts,不复制完整 executor 日志。
|
|
31
|
+
- `context.md` 每轮重写为压缩记忆,不无限 append。
|
|
32
|
+
- `events.jsonl` 只用于 observability,覆盖 loop_start、round_start、action_start、action_finish、context_rewrite、decision、loop_finish;不要把 events 当状态源。
|
|
33
|
+
|
|
34
|
+
## Action 规则
|
|
35
|
+
|
|
36
|
+
- `loop run --action shell-verify` 是 deterministic action;命令 exit code 决定 verification result,输出摘要写入 `loop/verification/round-N.json`。
|
|
37
|
+
- `loop run --action pi-review` 必须保持 read-only;工具 allowlist 固定为 `read,grep,find,ls`,输出必须包含 `findingSummary`、`failureCategory`、`nextHypothesis`、`recommendedAction`、`fixScope`、`rootCause`,其中 `recommendedAction` 只能是 `implement_fix|replan|pause|done`。
|
|
38
|
+
- 自动写入只能通过 `loop run --action dag --execute` / auto DAG execute;须读取 task `allowedPaths` / `forbiddenPaths` 并审查 writer writeSet。
|
|
39
|
+
- `loop run --action dag` 默认是 review mode:调用 `dag run-task <task-id> --profile auto --strict-models` 生成 DAG,再用 `dag validate --strict-models --strict-governance` 校验,并记录 review packet。
|
|
40
|
+
- `loop run --action dag --execute` 才会调用 `run-dag`,随后读取 `dag report --json` 作为 round result;paused DAG 会让 loop 进入 `paused`。
|
|
41
|
+
|
|
42
|
+
## Auto mode 与写入边界
|
|
43
|
+
|
|
44
|
+
- `loop run --auto --max-rounds N` 使用 deterministic policy 选择下一轮 action;默认只会自动选择 shell-verify、pi-review、dag review 或 policy pause/block。
|
|
45
|
+
- 自动 DAG execute 必须显式 opt-in:`task.json.loopAutoExecutionPolicy="enabled"`,或 `approval-required` 加 pending approval;旧 `loopAutoWritePolicy` fail-fast。
|
|
46
|
+
- auto mode 遇到同类 failure streak 达阈值会 blocked,避免无限重试。
|
|
47
|
+
|
|
48
|
+
## Signals
|
|
49
|
+
|
|
50
|
+
- `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。
|
|
51
|
+
- Signals 不直接覆盖 `objective.md`;DAG decision envelope / approve / reject / resume 仍由 DAG action 机制管理,loop 只记录 refs。
|
|
52
|
+
|
|
53
|
+
## Closeout
|
|
54
|
+
|
|
55
|
+
- `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。
|
|
56
|
+
- 非 complete 状态必须标 partial/paused/blocked,不能修改 completed facts;medium/large loop 若缺少 DAG round 且没有 `dagFallbackReason`,必须把缺失 DAG 证据列为 remaining risk。
|
|
57
|
+
- 完成声明仍必须由 shell verification、review verdict 和 success criteria coverage 证明。
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
Agent DAG node 的模型来自 DAG JSON 中的 `executorModels`,并由 `dag validate --strict-models` 检查 canonical matrix 漂移。若变更模型配置,须同步更新 `harness.json`、相关测试、repo docs 与本 skill。
|
|
19
19
|
|
|
20
|
+
`executorModels.pi` 的每档值支持两种形式:裸模型名继续走内置映射或默认 `wizard-local`;`provider/model` 限定引用则显式选择 Pi provider,只在第一个 `/` 处分割并保留模型 ID 的剩余部分。provider 定义与凭证仍归 Pi 的 `~/.pi/agent/models.json` 和环境配置所有。例如不同档可分别写 `wizard-local/glm-5.2` 与 `deepseek/deepseek-v4-flash`。
|
|
21
|
+
|
|
20
22
|
`pi-prompt` 是独立 one-shot helper,不使用 `harness.json.models` 或 DAG `executorModels`。当前默认是 `wizard-local/glm-5.2`;高复杂度 one-shot 显式传 `--model gpt-5.5`。Agent DAG `pi` executor 的 canonical matrix 保持;读写 profile 共用同一矩阵:
|
|
21
23
|
|
|
22
24
|
```json
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# One-shot Run Evidence(`.harness/runs/`)
|
|
2
|
-
|
|
3
|
-
当你使用 `cursor-prompt`、Pi `cursor` tool、`promote-run`,或在治理检查中看到 `.harness/runs/active` warning 时,读本文。
|
|
4
|
-
|
|
5
|
-
## 目录职责
|
|
6
|
-
|
|
7
|
-
`.harness/runs/` 保存一次性工具调用的运行证据。它不是 task 状态源,也不是 Agent DAG run 目录。
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
.harness/runs/active/<run-id>/ # 正在执行或异常残留的 one-shot tool run
|
|
11
|
-
.harness/runs/completed/<run-id>/ # 成功完成的 one-shot run evidence
|
|
12
|
-
.harness/runs/failed/<run-id>/ # 失败的 one-shot run evidence
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
每个 run directory 通常包含:
|
|
16
|
-
|
|
17
|
-
```text
|
|
18
|
-
run.md
|
|
19
|
-
meta.json
|
|
20
|
-
artifacts/
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
`run.md` 是人类可读摘要;`meta.json` 是机器可读 run metadata;`artifacts/` 是该次 one-shot 的交付物目录。
|
|
24
|
-
|
|
25
|
-
## 什么时候创建
|
|
26
|
-
|
|
27
|
-
会创建 `.harness/runs/` 的常见入口:
|
|
28
|
-
|
|
29
|
-
- `loop-agent cursor-prompt ...`
|
|
30
|
-
- Pi `cursor` tool / loop-agent cursor tool 的 one-shot Cursor 调用
|
|
31
|
-
- 内部 two-phase one-shot logging:先 `createActiveCursorRun()`,再 `finalizeCursorRunLog()`
|
|
32
|
-
|
|
33
|
-
创建条件:
|
|
34
|
-
|
|
35
|
-
- 调用的 `cwd` 必须是含 `.harness/` 的 harness repo。
|
|
36
|
-
- `cursor-prompt` 会先创建 `.harness/runs/active/<run-id>/`,再把结果归档。
|
|
37
|
-
- 成功时整个目录移动到 `.harness/runs/completed/<run-id>/`。
|
|
38
|
-
- 失败、timeout 或 cancel 时整个目录移动到 `.harness/runs/failed/<run-id>/`。
|
|
39
|
-
|
|
40
|
-
当前 `pi-prompt` 不创建 `.harness/runs/`。它是 one-shot helper,但不维护 run evidence、task state、verification 或 handoff artifact。
|
|
41
|
-
|
|
42
|
-
## 与 task / DAG 的关系
|
|
43
|
-
|
|
44
|
-
| 目录 | 含义 | 是否代表 task 完成 |
|
|
45
|
-
|---|---|---|
|
|
46
|
-
| `.harness/tasks/<task-id>/` | task 运行态状态源 | 是 task 状态源 |
|
|
47
|
-
| `.harness/runs/<state>/<run-id>/` | one-shot tool run evidence | 否,只是一次执行证据 |
|
|
48
|
-
| `.harness/dag-runs/<state>/<run-id>/` | Agent DAG run facts | 否,只是 DAG run facts |
|
|
49
|
-
|
|
50
|
-
completed one-shot evidence 若要进入 task artifacts,使用:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
loop-agent promote-run <task-id> --run-id <run-id>
|
|
54
|
-
loop-agent closeout task <task-id>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
`promote-run` 只读 `.harness/runs/completed/**`,生成或更新 task `artifacts/修改记录.md` / `artifacts/验证结果.md`,不修改 completed run facts。
|
|
58
|
-
|
|
59
|
-
## Active 目录清理
|
|
60
|
-
|
|
61
|
-
`.harness/runs/active/` 只应存在 live one-shot run。治理检查发现 active 内容时会 warning:
|
|
62
|
-
|
|
63
|
-
```text
|
|
64
|
-
[HARNESS RUNTIME WARNING] .harness/runs/active contains runtime entries
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
处理规则:
|
|
68
|
-
|
|
69
|
-
- 如果确有 one-shot 正在执行,可以保留;必要时用 `HARNESS_ALLOW_ACTIVE_TOOL_RUNS=1` 跑治理检查。
|
|
70
|
-
- 如果是已完成、失败或中断残留,应移动到 `completed/` / `failed/`,或在确认无价值后删除。
|
|
71
|
-
- 如果是 `.DS_Store` 等系统垃圾文件,直接删除;它不是合法 run evidence。
|
|
72
|
-
- 不要把 active 残留当作 task 完成证据。
|
|
73
|
-
|
|
74
|
-
严格检查可用:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
HARNESS_STRICT_ACTIVE_TOOL_RUNS=1 bash scripts/check-harness-runtime-clean.sh
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## 不要做什么
|
|
81
|
-
|
|
82
|
-
- 不要提交 `.harness/runs/**` 运行态内容。
|
|
83
|
-
- 不要手动改写 `.harness/runs/completed/**` 或 `.harness/runs/failed/**` 事实。
|
|
84
|
-
- 不要把 `.harness/runs/active/**` 当作长期记录。
|
|
85
|
-
- 不要把 one-shot evidence 直接等同于 task artifacts;需要汇总时用 `promote-run`。
|
|
1
|
+
# One-shot Run Evidence(`.harness/runs/`)
|
|
2
|
+
|
|
3
|
+
当你使用 `cursor-prompt`、Pi `cursor` tool、`promote-run`,或在治理检查中看到 `.harness/runs/active` warning 时,读本文。
|
|
4
|
+
|
|
5
|
+
## 目录职责
|
|
6
|
+
|
|
7
|
+
`.harness/runs/` 保存一次性工具调用的运行证据。它不是 task 状态源,也不是 Agent DAG run 目录。
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
.harness/runs/active/<run-id>/ # 正在执行或异常残留的 one-shot tool run
|
|
11
|
+
.harness/runs/completed/<run-id>/ # 成功完成的 one-shot run evidence
|
|
12
|
+
.harness/runs/failed/<run-id>/ # 失败的 one-shot run evidence
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
每个 run directory 通常包含:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
run.md
|
|
19
|
+
meta.json
|
|
20
|
+
artifacts/
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`run.md` 是人类可读摘要;`meta.json` 是机器可读 run metadata;`artifacts/` 是该次 one-shot 的交付物目录。
|
|
24
|
+
|
|
25
|
+
## 什么时候创建
|
|
26
|
+
|
|
27
|
+
会创建 `.harness/runs/` 的常见入口:
|
|
28
|
+
|
|
29
|
+
- `loop-agent cursor-prompt ...`
|
|
30
|
+
- Pi `cursor` tool / loop-agent cursor tool 的 one-shot Cursor 调用
|
|
31
|
+
- 内部 two-phase one-shot logging:先 `createActiveCursorRun()`,再 `finalizeCursorRunLog()`
|
|
32
|
+
|
|
33
|
+
创建条件:
|
|
34
|
+
|
|
35
|
+
- 调用的 `cwd` 必须是含 `.harness/` 的 harness repo。
|
|
36
|
+
- `cursor-prompt` 会先创建 `.harness/runs/active/<run-id>/`,再把结果归档。
|
|
37
|
+
- 成功时整个目录移动到 `.harness/runs/completed/<run-id>/`。
|
|
38
|
+
- 失败、timeout 或 cancel 时整个目录移动到 `.harness/runs/failed/<run-id>/`。
|
|
39
|
+
|
|
40
|
+
当前 `pi-prompt` 不创建 `.harness/runs/`。它是 one-shot helper,但不维护 run evidence、task state、verification 或 handoff artifact。
|
|
41
|
+
|
|
42
|
+
## 与 task / DAG 的关系
|
|
43
|
+
|
|
44
|
+
| 目录 | 含义 | 是否代表 task 完成 |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `.harness/tasks/<task-id>/` | task 运行态状态源 | 是 task 状态源 |
|
|
47
|
+
| `.harness/runs/<state>/<run-id>/` | one-shot tool run evidence | 否,只是一次执行证据 |
|
|
48
|
+
| `.harness/dag-runs/<state>/<run-id>/` | Agent DAG run facts | 否,只是 DAG run facts |
|
|
49
|
+
|
|
50
|
+
completed one-shot evidence 若要进入 task artifacts,使用:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
loop-agent promote-run <task-id> --run-id <run-id>
|
|
54
|
+
loop-agent closeout task <task-id>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`promote-run` 只读 `.harness/runs/completed/**`,生成或更新 task `artifacts/修改记录.md` / `artifacts/验证结果.md`,不修改 completed run facts。
|
|
58
|
+
|
|
59
|
+
## Active 目录清理
|
|
60
|
+
|
|
61
|
+
`.harness/runs/active/` 只应存在 live one-shot run。治理检查发现 active 内容时会 warning:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
[HARNESS RUNTIME WARNING] .harness/runs/active contains runtime entries
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
处理规则:
|
|
68
|
+
|
|
69
|
+
- 如果确有 one-shot 正在执行,可以保留;必要时用 `HARNESS_ALLOW_ACTIVE_TOOL_RUNS=1` 跑治理检查。
|
|
70
|
+
- 如果是已完成、失败或中断残留,应移动到 `completed/` / `failed/`,或在确认无价值后删除。
|
|
71
|
+
- 如果是 `.DS_Store` 等系统垃圾文件,直接删除;它不是合法 run evidence。
|
|
72
|
+
- 不要把 active 残留当作 task 完成证据。
|
|
73
|
+
|
|
74
|
+
严格检查可用:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
HARNESS_STRICT_ACTIVE_TOOL_RUNS=1 bash scripts/check-harness-runtime-clean.sh
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 不要做什么
|
|
81
|
+
|
|
82
|
+
- 不要提交 `.harness/runs/**` 运行态内容。
|
|
83
|
+
- 不要手动改写 `.harness/runs/completed/**` 或 `.harness/runs/failed/**` 事实。
|
|
84
|
+
- 不要把 `.harness/runs/active/**` 当作长期记录。
|
|
85
|
+
- 不要把 one-shot evidence 直接等同于 task artifacts;需要汇总时用 `promote-run`。
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# One-shot Pi SDK Prompt Helper(`pi-prompt`)
|
|
2
|
-
|
|
3
|
-
短时 Pi SDK task、不需要完整 `.harness/tasks/<id>` workflow 时使用本文。替代 ad-hoc 临时代码脚本导入 `executeSingleSdkAttempt` 的做法。
|
|
4
|
-
|
|
5
|
-
### One-shot Pi SDK prompt helper
|
|
6
|
-
|
|
7
|
-
短时 Pi SDK task、不需要完整 `.harness/tasks/<id>` workflow 时,用 `loop-agent pi-prompt`,勿创建 ad-hoc 临时代码脚本导入 `executeSingleSdkAttempt`。`pi-prompt` 是一次性 full-capability helper;是否只读由本次调用的 prompt 与 `--tools` 决定。
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
loop-agent pi-prompt "Reply with exactly OK."
|
|
11
|
-
loop-agent pi-prompt --stdin < <temp-dir>/task.md
|
|
12
|
-
loop-agent pi-prompt --file <temp-dir>/task.md
|
|
13
|
-
loop-agent pi-prompt --cwd ~/go/src/loop-agent --tools read,grep,find,ls "Review the current diff. Do not edit files."
|
|
14
|
-
loop-agent pi-prompt --cwd ~/go/src/loop-agent --tools subagent,read --timeout 2400000 "Use subagent exactly once ..."
|
|
15
|
-
loop-agent pi-prompt --model gpt-5.5 --cwd ~/go/src/loop-agent "Deeply diagnose this failure."
|
|
16
|
-
loop-agent pi-prompt "Reply with exactly OK."
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
`<temp-dir>` 表示平台原生临时目录;实际命令中使用本机路径。
|
|
20
|
-
|
|
21
|
-
默认:`--provider wizard-local --model glm-5.2`;高复杂度 one-shot 可显式 `--model gpt-5.5`。按需用 `--provider`、`--model`、`--thinking`、`--tools`、`--timeout` 覆盖。
|
|
22
|
-
|
|
23
|
-
`pi-prompt` 仅用于 quick one-shot SDK call。**不**创建 `.harness/tasks/`、不跑 verification、不写 handoff artifact、不保留 workflow state。须可恢复、可验证的 implementation work 用 DAG 路径;需要隔离写入时使用 bounded Cursor 或 `delegate`。
|
|
1
|
+
# One-shot Pi SDK Prompt Helper(`pi-prompt`)
|
|
2
|
+
|
|
3
|
+
短时 Pi SDK task、不需要完整 `.harness/tasks/<id>` workflow 时使用本文。替代 ad-hoc 临时代码脚本导入 `executeSingleSdkAttempt` 的做法。
|
|
4
|
+
|
|
5
|
+
### One-shot Pi SDK prompt helper
|
|
6
|
+
|
|
7
|
+
短时 Pi SDK task、不需要完整 `.harness/tasks/<id>` workflow 时,用 `loop-agent pi-prompt`,勿创建 ad-hoc 临时代码脚本导入 `executeSingleSdkAttempt`。`pi-prompt` 是一次性 full-capability helper;是否只读由本次调用的 prompt 与 `--tools` 决定。
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
loop-agent pi-prompt "Reply with exactly OK."
|
|
11
|
+
loop-agent pi-prompt --stdin < <temp-dir>/task.md
|
|
12
|
+
loop-agent pi-prompt --file <temp-dir>/task.md
|
|
13
|
+
loop-agent pi-prompt --cwd ~/go/src/loop-agent --tools read,grep,find,ls "Review the current diff. Do not edit files."
|
|
14
|
+
loop-agent pi-prompt --cwd ~/go/src/loop-agent --tools subagent,read --timeout 2400000 "Use subagent exactly once ..."
|
|
15
|
+
loop-agent pi-prompt --model gpt-5.5 --cwd ~/go/src/loop-agent "Deeply diagnose this failure."
|
|
16
|
+
loop-agent pi-prompt "Reply with exactly OK."
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`<temp-dir>` 表示平台原生临时目录;实际命令中使用本机路径。
|
|
20
|
+
|
|
21
|
+
默认:`--provider wizard-local --model glm-5.2`;高复杂度 one-shot 可显式 `--model gpt-5.5`。按需用 `--provider`、`--model`、`--thinking`、`--tools`、`--timeout` 覆盖。
|
|
22
|
+
|
|
23
|
+
`pi-prompt` 仅用于 quick one-shot SDK call。**不**创建 `.harness/tasks/`、不跑 verification、不写 handoff artifact、不保留 workflow state。须可恢复、可验证的 implementation work 用 DAG 路径;需要隔离写入时使用 bounded Cursor 或 `delegate`。
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
# Pi Subagent Assisted Mode
|
|
2
|
-
|
|
3
|
-
loop-agent task 启用 `piSubagentMode`、在 analyze/plan/spec/retrospective 内需要 read-only scout/planner/reviewer subagents,或配置 project-local agents/prompts 时使用本文。
|
|
4
|
-
|
|
5
|
-
`task.json` 支持可选字段 `piSubagentMode`,用于 step 级 `subagent` tool delegation:
|
|
6
|
-
|
|
7
|
-
| Mode | analyze | plan | spec | implement | retrospective | verify |
|
|
8
|
-
|------|---------|------|------|-----------|----------------|--------|
|
|
9
|
-
| `off`(默认) | read only | read only | read only | +write/edit/bash | read only | read only |
|
|
10
|
-
| `analyze-plan` | **+subagent** | **+subagent** | **+subagent** | 同 off | 同 off | 同 off |
|
|
11
|
-
| `full` | **+subagent** | **+subagent** | **+subagent** | 同 off | **+subagent** | 同 off |
|
|
12
|
-
|
|
13
|
-
### 何时启用
|
|
14
|
-
|
|
15
|
-
在 `task.json` 设 `piSubagentMode: "analyze-plan"` 或 `piSubagentMode: "full"` 当:
|
|
16
|
-
- task 涉及大规模 codebase 阅读,适合 parallel scout agents
|
|
17
|
-
- analysis 或 planning 需多角度调查(如跨模块比较实现)
|
|
18
|
-
- retrospective review 适合独立 reviewer subagent(`full` mode)
|
|
19
|
-
|
|
20
|
-
### step 内使用 `subagent` 的指引
|
|
21
|
-
|
|
22
|
-
subagent 可用时,**仅用于 read-only task**:
|
|
23
|
-
- **Parallel scout**:dispatch 多个 subagent 同时搜索/阅读不同区域
|
|
24
|
-
- **Chain**:一个 subagent scout,另一个基于发现 planning
|
|
25
|
-
- **Reviewer**:用 subagent 在定稿前 review analysis/plan
|
|
26
|
-
|
|
27
|
-
**不要**用 subagent 做 writing、editing 或执行命令。subagent 输出仅 advisory;务必 verify 并将发现并入自己的输出。**不要**把 subagent 结果当作权威 state 或 artifact source。
|
|
28
|
-
|
|
29
|
-
### 前置条件
|
|
30
|
-
|
|
31
|
-
- Pi runtime 环境须有 `subagent` tool(经 Pi subagent extension 加载)
|
|
32
|
-
- 推荐用 Pi 自带 example 文件安装:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
mkdir -p ~/.pi/agent/extensions/subagent ~/.pi/agent/agents ~/.pi/agent/prompts
|
|
36
|
-
|
|
37
|
-
ln -sf /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts ~/.pi/agent/extensions/subagent/index.ts
|
|
38
|
-
ln -sf /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/agents.ts ~/.pi/agent/extensions/subagent/agents.ts
|
|
39
|
-
|
|
40
|
-
for f in /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/agents/*.md; do
|
|
41
|
-
ln -sf "$f" ~/.pi/agent/agents/$(basename "$f")
|
|
42
|
-
done
|
|
43
|
-
|
|
44
|
-
for f in /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/prompts/*.md; do
|
|
45
|
-
ln -sf "$f" ~/.pi/agent/prompts/$(basename "$f")
|
|
46
|
-
done
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
- 最小 smoke check:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
pi -p --no-session --no-context-files --no-skills --tools subagent "Reply with exactly OK."
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
预期输出:`OK`
|
|
56
|
-
- mode 按 task opt-in;默认 `off` 保持向后兼容
|
|
57
|
-
- 任何 mode 下 `implement` 都不给 `subagent`(防止 nested multi-writer)
|
|
58
|
-
|
|
59
|
-
### 内置 Project-Local Agents 与 Prompts
|
|
60
|
-
|
|
61
|
-
本 repo 提供 `.pi/agents/` 与 `.pi/prompts/` 模板,供 `piSubagentMode` 使用:
|
|
62
|
-
|
|
63
|
-
**Agents**(`.pi/agents/`)
|
|
64
|
-
|
|
65
|
-
| Agent | Role | 对应阶段 |
|
|
66
|
-
|-------|------|----------|
|
|
67
|
-
| `loop-agent-scout` | 只读侦察:code、tests、docs、governance | Scout |
|
|
68
|
-
| `loop-agent-planner` | 最小可执行计划;强调验证与回退 | Plan |
|
|
69
|
-
| `loop-agent-reviewer` | 严格审查:范围漂移、验证缺口、契约破坏 | Verify / Review |
|
|
70
|
-
| `loop-agent-worker` | 有界实现与修补 | Implement |
|
|
71
|
-
|
|
72
|
-
另有通用 agents:`scout` / `planner` / `worker` / `reviewer`(中文提示,可被通用 prompt 模板调用)。模型以各 agent frontmatter 为准(当前仓库默认对齐 `harness.json` 的 Pi executor)。
|
|
73
|
-
|
|
74
|
-
**Prompt Templates**(`.pi/prompts/`):输入 `/loop-agent-*` 或通用模板名调用
|
|
75
|
-
|
|
76
|
-
| Template | Flow |
|
|
77
|
-
|----------|------|
|
|
78
|
-
| `loop-agent-scout-and-plan` | parallel scout → planner |
|
|
79
|
-
| `loop-agent-analyze-wide` | 3 parallel scouts → 结构化分析 |
|
|
80
|
-
| `loop-agent-review-only` | 独立审查计划/实现/验证 |
|
|
81
|
-
| `loop-agent-implement-and-review` | worker → reviewer → worker |
|
|
82
|
-
| `scout-and-plan` / `implement` / `implement-and-review` | 通用 chain(调用 `scout`/`planner`/`worker`/`reviewer`) |
|
|
83
|
-
|
|
84
|
-
传 `agentScope: "both"` + `confirmProjectAgents: false` 以访问 repo-local agents。
|
|
1
|
+
# Pi Subagent Assisted Mode
|
|
2
|
+
|
|
3
|
+
loop-agent task 启用 `piSubagentMode`、在 analyze/plan/spec/retrospective 内需要 read-only scout/planner/reviewer subagents,或配置 project-local agents/prompts 时使用本文。
|
|
4
|
+
|
|
5
|
+
`task.json` 支持可选字段 `piSubagentMode`,用于 step 级 `subagent` tool delegation:
|
|
6
|
+
|
|
7
|
+
| Mode | analyze | plan | spec | implement | retrospective | verify |
|
|
8
|
+
|------|---------|------|------|-----------|----------------|--------|
|
|
9
|
+
| `off`(默认) | read only | read only | read only | +write/edit/bash | read only | read only |
|
|
10
|
+
| `analyze-plan` | **+subagent** | **+subagent** | **+subagent** | 同 off | 同 off | 同 off |
|
|
11
|
+
| `full` | **+subagent** | **+subagent** | **+subagent** | 同 off | **+subagent** | 同 off |
|
|
12
|
+
|
|
13
|
+
### 何时启用
|
|
14
|
+
|
|
15
|
+
在 `task.json` 设 `piSubagentMode: "analyze-plan"` 或 `piSubagentMode: "full"` 当:
|
|
16
|
+
- task 涉及大规模 codebase 阅读,适合 parallel scout agents
|
|
17
|
+
- analysis 或 planning 需多角度调查(如跨模块比较实现)
|
|
18
|
+
- retrospective review 适合独立 reviewer subagent(`full` mode)
|
|
19
|
+
|
|
20
|
+
### step 内使用 `subagent` 的指引
|
|
21
|
+
|
|
22
|
+
subagent 可用时,**仅用于 read-only task**:
|
|
23
|
+
- **Parallel scout**:dispatch 多个 subagent 同时搜索/阅读不同区域
|
|
24
|
+
- **Chain**:一个 subagent scout,另一个基于发现 planning
|
|
25
|
+
- **Reviewer**:用 subagent 在定稿前 review analysis/plan
|
|
26
|
+
|
|
27
|
+
**不要**用 subagent 做 writing、editing 或执行命令。subagent 输出仅 advisory;务必 verify 并将发现并入自己的输出。**不要**把 subagent 结果当作权威 state 或 artifact source。
|
|
28
|
+
|
|
29
|
+
### 前置条件
|
|
30
|
+
|
|
31
|
+
- Pi runtime 环境须有 `subagent` tool(经 Pi subagent extension 加载)
|
|
32
|
+
- 推荐用 Pi 自带 example 文件安装:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mkdir -p ~/.pi/agent/extensions/subagent ~/.pi/agent/agents ~/.pi/agent/prompts
|
|
36
|
+
|
|
37
|
+
ln -sf /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts ~/.pi/agent/extensions/subagent/index.ts
|
|
38
|
+
ln -sf /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/agents.ts ~/.pi/agent/extensions/subagent/agents.ts
|
|
39
|
+
|
|
40
|
+
for f in /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/agents/*.md; do
|
|
41
|
+
ln -sf "$f" ~/.pi/agent/agents/$(basename "$f")
|
|
42
|
+
done
|
|
43
|
+
|
|
44
|
+
for f in /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/prompts/*.md; do
|
|
45
|
+
ln -sf "$f" ~/.pi/agent/prompts/$(basename "$f")
|
|
46
|
+
done
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- 最小 smoke check:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pi -p --no-session --no-context-files --no-skills --tools subagent "Reply with exactly OK."
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
预期输出:`OK`
|
|
56
|
+
- mode 按 task opt-in;默认 `off` 保持向后兼容
|
|
57
|
+
- 任何 mode 下 `implement` 都不给 `subagent`(防止 nested multi-writer)
|
|
58
|
+
|
|
59
|
+
### 内置 Project-Local Agents 与 Prompts
|
|
60
|
+
|
|
61
|
+
本 repo 提供 `.pi/agents/` 与 `.pi/prompts/` 模板,供 `piSubagentMode` 使用:
|
|
62
|
+
|
|
63
|
+
**Agents**(`.pi/agents/`)
|
|
64
|
+
|
|
65
|
+
| Agent | Role | 对应阶段 |
|
|
66
|
+
|-------|------|----------|
|
|
67
|
+
| `loop-agent-scout` | 只读侦察:code、tests、docs、governance | Scout |
|
|
68
|
+
| `loop-agent-planner` | 最小可执行计划;强调验证与回退 | Plan |
|
|
69
|
+
| `loop-agent-reviewer` | 严格审查:范围漂移、验证缺口、契约破坏 | Verify / Review |
|
|
70
|
+
| `loop-agent-worker` | 有界实现与修补 | Implement |
|
|
71
|
+
|
|
72
|
+
另有通用 agents:`scout` / `planner` / `worker` / `reviewer`(中文提示,可被通用 prompt 模板调用)。模型以各 agent frontmatter 为准(当前仓库默认对齐 `harness.json` 的 Pi executor)。
|
|
73
|
+
|
|
74
|
+
**Prompt Templates**(`.pi/prompts/`):输入 `/loop-agent-*` 或通用模板名调用
|
|
75
|
+
|
|
76
|
+
| Template | Flow |
|
|
77
|
+
|----------|------|
|
|
78
|
+
| `loop-agent-scout-and-plan` | parallel scout → planner |
|
|
79
|
+
| `loop-agent-analyze-wide` | 3 parallel scouts → 结构化分析 |
|
|
80
|
+
| `loop-agent-review-only` | 独立审查计划/实现/验证 |
|
|
81
|
+
| `loop-agent-implement-and-review` | worker → reviewer → worker |
|
|
82
|
+
| `scout-and-plan` / `implement` / `implement-and-review` | 通用 chain(调用 `scout`/`planner`/`worker`/`reviewer`) |
|
|
83
|
+
|
|
84
|
+
传 `agentScope: "both"` + `confirmProjectAgents: false` 以访问 repo-local agents。
|