refactor(agent-collaboration-kit): split stable core from project overrides

- Reorganize flat files into core/ templates/ examples/ scripts/ with VERSION
- Deduplicate: single-source state machine, three-round policy, acceptance signals
- Abstract orchestration in closed-loop.md with manual mode; move Orca commands to orca-adapter.md
- Add tasks.schema.json + validate_tasks.py (jsonschema or builtin rules, no hard deps)
- Add filled examples, concurrency write rule, kitVersion tracking; unify to Chinese

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 10:01:09 +08:00
parent 58de2650c2
commit d7a74578dc
18 changed files with 1177 additions and 806 deletions
@@ -0,0 +1,90 @@
# 角色与权限(稳定核心)
本文件是**角色模型、路径权限、任务状态机、完成定义**的单一事实源(SSOT)。其它文件只引用本文件,不重复定义。
目标:让每个 Agent 只处理自己能验证的事情,减少上下文污染和越权修改。
---
## 角色模型
| 角色 | 主要职责 | 验证方式 | 不应做的事 |
|------|----------|----------|------------|
| Product/Test Coordinator | 需求拆解、任务记录、黑盒测试、复测验收、调度开发 | 浏览器、API、集成脚本、用户可见行为 | 修改应用源码、凭 worker_done 直接标记完成 |
| Developer Worker | 实现修复、写单元测试、运行构建和白盒验证 | 单元测试、类型检查、构建、本地运行 | 修改产品规格、标记 verified、绕过测试声称完成 |
| User / Decision Owner | 决定范围、优先级、阻塞项是否继续 | 审阅报告和遗留清单 | 直接替代复测证据 |
---
## 路径权限模板
目标项目在自己的 `AGENTS.md` 中填入实际路径(见 `templates/AGENTS.template.md`)。
| 路径 | Product/Test | Developer | 说明 |
|------|:------------:|:---------:|------|
| `<spec_paths>` | R/W | Read-only | PRD、API spec、设计文档 |
| `<integration_test_paths>` | R/W | Read-only | 浏览器用例、API smoke、回归清单 |
| `<test_records_path>` | R/W | Read-only | 复测记录,通常可 gitignore |
| `<source_paths>` | Read-only | R/W | 应用源码 |
| `<unit_test_paths>` | Read-only | R/W | 单元测试 |
| `<shared_config_templates>` | Read-only | R/W | 可提交配置模板 |
| `<local_config>` | Read-only | Read-only | 本地私有配置,不提交 |
| `tasks.yaml` | R/W | Read-only | 见下方「任务板写入约定」 |
---
## 任务状态机(SSOT
```text
open
-> dispatched
-> fixed_by_dev
-> retesting
-> verified
```
失败分支:
```text
dispatched -> blocked
fixed_by_dev -> failed_retest -> dispatched
failed_retest(累计 3 轮) -> leftover
```
状态定义:
| 状态 | 写入者 | 含义 |
|------|--------|------|
| `open` | Product/Test | 已发现,等待处理 |
| `dispatched` | Product/Test | 已派发给开发 Agent |
| `fixed_by_dev` | Product/Test(据 worker_done 回写) | 开发声称已修复并提供验证 |
| `retesting` | Product/Test | 正在复测 |
| `failed_retest` | Product/Test | 复测失败,可继续派发 |
| `verified` | Product/Test | 复测通过 |
| `blocked` | Product/Test | 需要用户决策或外部条件 |
| `leftover` | Product/Test | 累计 3 轮仍未通过,留给人工或专项处理 |
三轮失败的处理细则见 `optimization-method.md` §「三轮失败策略」。
---
## 任务板写入约定(并发安全)
`tasks.yaml` 是持久事实源,为避免多 Worker 并发写冲突:
- **只有 Coordinator 写 `tasks.yaml`**。Developer Worker 对它是只读的。
- Developer 的实现状态、证据通过 `worker_done` 消息回传,由 Coordinator 落盘。
- 每次写入前先读最新内容,写入后更新顶层 `updatedAt`
- 单次写入应是一个任务的一次状态跃迁,避免整表批量重写。
---
## 完成定义(Definition of Done
一个任务只有同时满足以下条件,才能标记 `verified`
- Developer 已提供修改文件和验证证据。
- Product/Test 在正确 worktree 和正确服务实例上复测(对齐检查见 `closed-loop.md`)。
- 相关单元测试、构建、集成或浏览器检查通过。
- `tasks.yaml` 中记录了复测证据。
- 用户可见行为符合验收标准。