chore(ops): remove Herdr agent roles and dispatch scripts

Drop live roster/policy and herdr-agent start/dispatch helpers so collaboration follows AGENTS worktree/mutex only; archive prior governance evidence.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
weichen
2026-09-14 05:22:04 +00:00
co-authored by Cursor
parent c5810cd907
commit ea3eeadb77
10 changed files with 72 additions and 274 deletions
-1
View File
@@ -42,7 +42,6 @@
| 架构设计 | [system-design/README.md](system-design/README.md) |
| 测试报告 | [test-reports/](test-reports/) |
| 历史功能设计 | [archive/design/superpowers/](archive/design/superpowers/) |
| Herdr 角色、审批与备援 | [ops/2026-09-13-herdr-agent-roster.md](ops/2026-09-13-herdr-agent-roster.md) |
---
@@ -2,7 +2,7 @@
title: "Herdr Agent 角色、备援与自动审批治理"
status: done
created: 2026-09-13
updated: 2026-09-13
updated: 2026-09-14
owner: Codex
branch: feature/herdr-agent-governance
worktree: .worktrees/feature-herdr-agent-governance
@@ -11,6 +11,8 @@ mutex: ops-governance
# Herdr Agent 角色、备援与自动审批治理
> **superseded 2026-09-14**:活文档与 `scripts/herdr-agent-*.sh` 已移除;本文件仅作历史证据。见 [2026-09-14-remove-herdr-agent-settings.md](./2026-09-14-remove-herdr-agent-settings.md)。
## 目标
建立可审计的 Herdr Agent 能力分工、额度保护、故障接管和免人工工具审批入口,并明确 Herdr PI 与产品容器 PI Agent Runner 不是同一执行体。
@@ -47,9 +49,10 @@ mutex: ops-governance
## 相关链接
- Agent roster: [../../ops/2026-09-13-herdr-agent-roster.md](../../ops/2026-09-13-herdr-agent-roster.md)
- Handoff: [../../ops/handoffs/2026-09-13-herdr-agent-governance.md](../../ops/handoffs/2026-09-13-herdr-agent-governance.md)
- Agent roster: [2026-09-13-herdr-agent-roster.md](./2026-09-13-herdr-agent-roster.md)
- Handoff: [handoffs/2026-09-13-herdr-agent-governance.md](./handoffs/2026-09-13-herdr-agent-governance.md)
- Test report: 本任务文“证据 / 备注”
- 移除设定任务: [./2026-09-14-remove-herdr-agent-settings.md](./2026-09-14-remove-herdr-agent-settings.md)
## 证据 / 备注
@@ -1,10 +1,12 @@
# Herdr Agent 角色、审批与备援 SSOT
**更新**: 2026-09-13
**owner**: `orchestrator_codex`
**status**: active
> **archived / superseded 2026-09-14**:不再作为活协作规范;脚本已删除。历史证据保留本文件。移除任务见 [./2026-09-14-remove-herdr-agent-settings.md](./2026-09-14-remove-herdr-agent-settings.md)。
本文只管理工程协作终端,不管理产品运行时智能体。通用分支、worktree、mutex、集成槽、密钥和破坏性操作规则仍以仓库根 [AGENTS.md](../../AGENTS.md) 为准。
**更新**: 2026-09-13(归档标注 2026-09-14)
**owner**: `orchestrator_codex`
**status**: archived
本文只管理工程协作终端,不管理产品运行时智能体。通用分支、worktree、mutex、集成槽、密钥和破坏性操作规则仍以仓库根 [AGENTS.md](../../../AGENTS.md) 为准。
## 1. 身份边界
@@ -0,0 +1,51 @@
---
title: "移除 Herdr 工作与角色设定"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: feature/remove-herdr-agent-settings
worktree: "-"
mutex: agent-collab-docs
---
# 移除 Herdr 工作与角色设定
## 目标
从仓库活文档与脚本中移除 Herdr Agent 角色、审批、备援与派发设定,协作规范回到通用 AGENTS / worktree / mutex 流程。
## 范围
- 删除 `scripts/herdr-agent-start.sh`、`scripts/herdr-agent-dispatch.sh`
- 归档 roster / 相关 handoff
- 从 `AGENTS.md`、`PROJECT.md`、`.doc/README.md` 去掉 Herdr 专章与索引
## 非目标
- 不改写历史 audit / remediation / 已归档任务中的执行者名(如 `implementer_cursor`)作为证据
- 不卸载本机 Herdr 客户端
## 步骤
1. [x] 从 `dev` 开 `feature/remove-herdr-agent-settings` 并认领
2. [x] 移除活文档与脚本中的 Herdr 设定
3. [x] 归档 roster / handoff 并更新 CURRENT
4. [x] 提交
## 验收标准
- [x] 活文档与 `scripts/` 无 Herdr 角色/派发入口
- [x] 历史证据在 `archive/` 可追溯
## 相关链接
- Roster(已归档): [./2026-09-13-herdr-agent-roster.md](./2026-09-13-herdr-agent-roster.md)
- 既有治理归档: [./2026-09-13-herdr-agent-governance.md](./2026-09-13-herdr-agent-governance.md)
- Handoff(已归档): [./handoffs/2026-09-13-herdr-agent-governance.md](./handoffs/2026-09-13-herdr-agent-governance.md)
## 证据 / 备注
- 删除:`scripts/herdr-agent-start.sh`、`scripts/herdr-agent-dispatch.sh`
- 文档:去掉 `AGENTS.md` §6.6、`PROJECT.md` §10 Herdr 章与索引行、`.doc/README.md` roster 入口
- 归档:roster + handoff → `.doc/archive/ops/`
@@ -8,6 +8,8 @@ status: closed
# 交接:Herdr Agent 治理分支待集成
> **superseded 2026-09-14**:Herdr 角色/脚本已从活文档移除;本交接仅作历史证据。见 [.././2026-09-14-remove-herdr-agent-settings.md](.././2026-09-14-remove-herdr-agent-settings.md)。
## 目标(下一位 Agent 应完成什么)
治理规范已完成并准备合入 `dev`;本文件保留为集成证据。
@@ -36,9 +38,9 @@ status: closed
| 路径 | 说明 |
|------|------|
| `.doc/ops/2026-09-13-herdr-agent-roster.md` | 角色与路由 SSOT |
| `scripts/herdr-agent-start.sh` | 免人工审批启动入口 |
| `scripts/herdr-agent-dispatch.sh` | 主备派发与防重复策略 |
| `.doc/archive/ops/2026-09-13-herdr-agent-roster.md` | 角色与路由 SSOT(已归档) |
| `scripts/herdr-agent-start.sh` | 免人工审批启动入口(已删除) |
| `scripts/herdr-agent-dispatch.sh` | 主备派发与防重复策略(已删除) |
| `AGENTS.md` / `PROJECT.md` | 强制入口与 PI 身份边界 |
## 如何验证
@@ -59,5 +61,5 @@ git diff --check
## 相关链接
- CURRENT: [CURRENT.md](../CURRENT.md)
- Task: [2026-09-13-herdr-agent-governance.md](../../archive/ops/2026-09-13-herdr-agent-governance.md)
- Task: [2026-09-13-herdr-agent-governance.md](./2026-09-13-herdr-agent-governance.md)
- Checklist: 任务文中的验收标准
+1
View File
@@ -46,6 +46,7 @@
| Cursor-Auto | document-revision-evidence-count | fix/document-revision-evidence-count | - | document-revision-evidence-count | done |
| Cursor-Auto | document-revision-session-close | feature/document-revision-session-close | - | document-revision-session-close | done |
| Cursor-Auto | vite-frp-allowed-hosts | fix/vite-frp-allowed-hosts | - | web-devserver | done |
| Cursor-Auto | remove-herdr-agent-settings | feature/remove-herdr-agent-settings | - | agent-collab-docs | done |
> 新任务开始前登记。`branch` 必须为 `feature/<slug>` 或 `fix/<slug>`,**禁止** `dev` / `test` / `main`。同一 `mutex` 同时仅一个 `in_progress`。
-9
View File
@@ -164,15 +164,6 @@ curl -sf http://127.0.0.1:8080/health
- **不覆盖**:发现冲突先 handoff/blocker
- **交接优先**:口头转述不可代替 handoff 文件
### 6.6 Herdr 角色、自动审批与备援
- 本仓库 Herdr 角色、任务泳道、额度保护和备援顺序以 [Herdr Agent roster](./.doc/ops/2026-09-13-herdr-agent-roster.md) 为准。
- Herdr 实例统一通过 [`scripts/herdr-agent-start.sh`](./scripts/herdr-agent-start.sh) 启动;自动派发使用 [`scripts/herdr-agent-dispatch.sh`](./scripts/herdr-agent-dispatch.sh)。
- 自动审批只消除客户端逐条确认,不扩大任务授权;分支、worktree、mutex、集成槽和破坏性操作红线继续生效。
- 自动接管仅允许发生在未开始写入且明确的额度、认证、客户端或启动失败。`timeout` / `unknown` 不证明任务未执行,必须停止重复投递并先检查 pane 与 handoff。
- 名称 `context_pi` / “Herdr PI”专指协作终端内的 PI CLI;产品容器中的执行器统一称“产品 PI Agent Runner”,两者禁止混称或互相代替验收。
- 未进入 roster 的新模型(包括尚未接入的 Devin)默认 `standby`,通过一次只读任务和一次隔离 worktree 写任务验证后再进入路由。
---
## 7. 文档生命周期
+2 -9
View File
@@ -35,7 +35,7 @@
- **前端**:React + Vite
- **数据库**:PostgreSQL + pgvector(Goose 迁移)
- **产品执行器**:容器内 PI Agent Runner(真实 / stub)
- **工程协作**:Herdr 管理的 Claude / Codex / Cursor / Antigravity / PI / Kimi / Cline;其中 Herdr PI 与产品 PI Agent Runner 无关
- **工程协作**:按 [AGENTS.md](./AGENTS.md) 的分支 / worktree / mutex / 集成槽位协作(Cursor、Codex、Claude Code 等);产品 PI Agent Runner 仅指容器内执行器
- **工作流**:main、product_manager、test_manager 三套正式定义
---
@@ -69,7 +69,6 @@
| 整改方案 | [.doc/remediation/INDEX.md](./.doc/remediation/INDEX.md) |
| 测试报告归档 | [.doc/test-reports/](./.doc/test-reports/) |
| 测试报告规范 | [.cursor/rules/test-reports-standard.mdc](./.cursor/rules/test-reports-standard.mdc) |
| Herdr 角色与备援 | [.doc/ops/2026-09-13-herdr-agent-roster.md](./.doc/ops/2026-09-13-herdr-agent-roster.md) |
---
@@ -132,13 +131,7 @@ cd web && npm test && npm run build
---
## 10. Herdr 工程协作
- `orchestrator_codex` 负责拆解、方案、调度、风险控制和终审;主力实现默认交给 `implementer_cursor`。
- 启动实例用 `scripts/herdr-agent-start.sh`,派发与安全降级用 `scripts/herdr-agent-dispatch.sh`。
- 角色和备援 SSOT 见 [Herdr Agent roster](./.doc/ops/2026-09-13-herdr-agent-roster.md)。
## 11. 语言与提交
## 10. 语言与提交
- 对用户:**简体中文**
- 提交:Conventional Commits;在 `feature/*` 或 `fix/*` 上渐进式分批提交,合回 `dev` 用 `--no-ff`(禁止在三大主干直接 commit)
-128
View File
@@ -1,128 +0,0 @@
#!/usr/bin/env bash
# Dispatch to a standard live Herdr agent, with conservative failover.
set -euo pipefail
usage() {
cat <<'EOF'
用法:
scripts/herdr-agent-dispatch.sh --explain <lane>
scripts/herdr-agent-dispatch.sh [--timeout-ms N] <lane> <prompt>
lane: governance | critical-review | implementation | ui | test | fast-check | long-context
EOF
}
route_for() {
case "$1" in
governance) printf '%s\n' orchestrator_codex context_kimi implementer_cursor reserve_claude ;;
critical-review) printf '%s\n' orchestrator_codex reserve_claude context_kimi ;;
implementation) printf '%s\n' implementer_cursor implementer_cline verifier_antigravity orchestrator_codex ;;
ui) printf '%s\n' implementer_cursor verifier_antigravity implementer_cline ;;
test) printf '%s\n' implementer_cursor implementer_cline verifier_antigravity ;;
fast-check) printf '%s\n' verifier_antigravity implementer_cline implementer_cursor ;;
long-context) printf '%s\n' context_pi context_kimi orchestrator_codex ;;
*) return 1 ;;
esac
}
if [[ "${1:-}" == "--explain" ]]; then
[[ $# -eq 2 ]] || { usage >&2; exit 2; }
if ! route_for "$2"; then
printf '[错误] 未知 lane: %s\n' "$2" >&2
exit 2
fi
exit 0
fi
timeout_ms=120000
if [[ "${1:-}" == "--timeout-ms" ]]; then
[[ $# -ge 4 ]] || { usage >&2; exit 2; }
timeout_ms="$2"
shift 2
fi
if [[ $# -ne 2 ]]; then
usage >&2
exit 2
fi
lane="$1"
prompt="$2"
if ! routes="$(route_for "${lane}")"; then
printf '[错误] 未知 lane: %s\n' "${lane}" >&2
exit 2
fi
if [[ ! "${timeout_ms}" =~ ^[1-9][0-9]*$ ]]; then
printf '[错误] timeout 必须是正整数毫秒。\n' >&2
exit 2
fi
if [[ "${HERDR_ENV:-}" != "1" ]]; then
printf '[错误] 当前进程不在 Herdr 管理的 pane 中。\n' >&2
exit 1
fi
command -v jq >/dev/null 2>&1 || { printf '[错误] 缺少 jq。\n' >&2; exit 1; }
repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [[ -z "${repo_root}" || ! -f "${repo_root}/AGENTS.md" || ! -f "${repo_root}/PROJECT.md" ]]; then
printf '[错误] 必须从 Agent-System 任务 worktree 派发。\n' >&2
exit 1
fi
branch="$(git branch --show-current)"
if [[ "${branch}" != feature/* && "${branch}" != fix/* ]]; then
printf '[错误] 只允许从 feature/* 或 fix/* 分支派发,当前为 %s。\n' "${branch}" >&2
exit 1
fi
current_cwd="$(realpath -m "${repo_root}")"
agent_json="$(herdr agent list)"
dispatch_id="${BASHPID:-$$}-${SECONDS}"
retry_prefix="HERDR_RETRY:${dispatch_id}"
protocol="$(printf '\n\n[Herdr failover protocol]\n只有在尚未写文件、未运行有副作用命令,且仅因额度、认证或客户端故障无法开始时,回复独占一行 %s:quota、%s:auth 或 %s:client。已经开始工作时不得返回该标记;请写 handoff 并说明当前状态。' "${retry_prefix}" "${retry_prefix}" "${retry_prefix}")"
while IFS= read -r target; do
row="$(jq -c --arg name "${target}" '.result.agents[] | select(.name == $name)' <<<"${agent_json}" | head -n 1)"
if [[ -z "${row}" ]]; then
printf '[跳过] %s 未在线。\n' "${target}" >&2
continue
fi
status="$(jq -r '.agent_status' <<<"${row}")"
agent_cwd="$(jq -r '.cwd' <<<"${row}")"
if [[ "${agent_cwd}" != "${current_cwd}" ]]; then
printf '[跳过] %s cwd=%s,不是当前任务 worktree。\n' "${target}" "${agent_cwd}" >&2
continue
fi
if [[ "${status}" != "idle" && "${status}" != "done" ]]; then
printf '[跳过] %s 状态为 %s。\n' "${target}" "${status}" >&2
continue
fi
printf '[派发] lane=%s target=%s\n' "${lane}" "${target}" >&2
set +e
result="$(herdr agent prompt "${target}" "${prompt}${protocol}" --wait --timeout "${timeout_ms}" 2>&1)"
rc=$?
set -e
if [[ ${rc} -ne 0 ]]; then
if rg -q 'agent_blocked|agent_not_found|agent_not_ready' <<<"${result}"; then
printf '[降级] %s 在投递前不可用。\n' "${target}" >&2
continue
fi
printf '%s\n' "${result}" >&2
printf '[停止] 结果可能已投递;为避免重复执行,不自动切换备援。\n' >&2
exit 75
fi
transcript="$(herdr agent read "${target}" --source recent-unwrapped --lines 120 2>/dev/null || true)"
if rg -q "^${retry_prefix}:(quota|auth|client)$" <<<"${transcript}"; then
printf '[降级] %s 明确报告写入前失败。\n' "${target}" >&2
agent_json="$(herdr agent list)"
continue
fi
printf '%s\n' "${result}"
exit 0
done <<<"${routes}"
printf '[错误] lane=%s 无可用实例;请用 herdr-agent-start.sh 启动标准实例。\n' "${lane}" >&2
exit 69
-116
View File
@@ -1,116 +0,0 @@
#!/usr/bin/env bash
# Start a standard Herdr agent with non-interactive tool approvals.
set -euo pipefail
usage() {
cat <<'EOF'
用法:
scripts/herdr-agent-start.sh [--dry-run] <profile> <agent-name> <pane-id>
profile: claude | codex | cursor | antigravity | pi | kimi | cline
标准名称见 .doc/ops/2026-09-13-herdr-agent-roster.md。
EOF
}
dry_run=0
if [[ "${1:-}" == "--dry-run" ]]; then
dry_run=1
shift
fi
if [[ $# -ne 3 ]]; then
usage >&2
exit 2
fi
profile="$1"
agent_name="$2"
pane_id="$3"
shift 3
case "${profile}" in
claude)
kind="claude"
expected_name="reserve_claude"
native_args=(--dangerously-skip-permissions)
;;
codex)
kind="codex"
expected_name="orchestrator_codex"
native_args=(--ask-for-approval never --sandbox workspace-write)
;;
cursor)
kind="cursor"
expected_name="implementer_cursor"
native_args=(--force --sandbox enabled --approve-mcps --trust)
;;
antigravity)
kind="agy"
expected_name="verifier_antigravity"
native_args=(--dangerously-skip-permissions --sandbox)
;;
pi)
kind="pi"
expected_name="context_pi"
native_args=(--approve)
;;
kimi)
kind="kimi"
expected_name="context_kimi"
native_args=(--auto)
;;
cline)
kind="cline"
expected_name="implementer_cline"
native_args=(--tui --auto-approve true)
;;
*)
printf '[错误] 未知 profile: %s\n' "${profile}" >&2
usage >&2
exit 2
;;
esac
if [[ "${agent_name}" != "${expected_name}" ]]; then
printf '[错误] profile %s 的标准名称必须是 %s\n' "${profile}" "${expected_name}" >&2
exit 2
fi
if [[ ! "${pane_id}" =~ ^w[[:alnum:]]+:p[[:alnum:]]+$ ]]; then
printf '[错误] 非法 pane id: %s\n' "${pane_id}" >&2
exit 2
fi
command=(herdr agent start "${agent_name}" --kind "${kind}" --pane "${pane_id}" -- "${native_args[@]}")
if [[ ${dry_run} -eq 1 ]]; then
printf '%q ' "${command[@]}"
printf '\n'
exit 0
fi
if [[ "${HERDR_ENV:-}" != "1" ]]; then
printf '[错误] 当前进程不在 Herdr 管理的 pane 中。\n' >&2
exit 1
fi
repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [[ -z "${repo_root}" || ! -f "${repo_root}/AGENTS.md" || ! -f "${repo_root}/PROJECT.md" ]]; then
printf '[错误] 必须从 Agent-System 任务 worktree 启动。\n' >&2
exit 1
fi
branch="$(git branch --show-current)"
if [[ "${branch}" != feature/* && "${branch}" != fix/* ]]; then
printf '[错误] 自动审批实例只能在 feature/* 或 fix/* 分支启动,当前为 %s。\n' "${branch}" >&2
exit 1
fi
command -v jq >/dev/null 2>&1 || { printf '[错误] 缺少 jq。\n' >&2; exit 1; }
workspace_id="${pane_id%%:*}"
pane_json="$(herdr pane list --workspace "${workspace_id}")"
target_cwd="$(jq -r --arg pane "${pane_id}" '.result.panes[] | select(.pane_id == $pane) | .cwd' <<<"${pane_json}" | head -n 1)"
if [[ -z "${target_cwd}" || "$(realpath -m "${target_cwd}")" != "$(realpath -m "${repo_root}")" ]]; then
printf '[错误] 目标 pane 不存在或不在当前任务 worktree: %s\n' "${pane_id}" >&2
exit 1
fi
exec "${command[@]}"