feat: Add role specifications for 三省六部 architecture

- Introduced role specifications for 尚书省 (shangshu), 刑部 (xingbu), and 中书省 (zhongshu) to facilitate task management and execution flow.
- Implemented quality gates for each phase of the process to ensure compliance and quality assurance.
- Established a coordinator role to manage the overall workflow and task distribution among the departments.
- Created a team configuration file to define roles, responsibilities, and routing rules for task execution.
- Added localization support for DeepWiki in both English and Chinese, enhancing accessibility for users.
This commit is contained in:
catlog22
2026-03-06 11:26:27 +08:00
parent 56c06ecf3d
commit 33cc451b61
46 changed files with 3050 additions and 1832 deletions

View File

@@ -0,0 +1,133 @@
# Quality Gates — team-edict
看板强制上报、审议质量、执行验收的分级质量门控标准。
## 质量阈值
| 门控 | 分数 | 动作 |
|------|------|------|
| **通过** | >= 80% | 继续下一阶段 |
| **警告** | 60-79% | 记录警告,谨慎推进 |
| **失败** | < 60% | 必须解决后才能继续 |
---
## 各阶段质量门
### Phase 1: 接旨分拣 (coordinator)
| 检查项 | 标准 | 严重性 |
|--------|------|--------|
| 任务分类正确 | 正式旨意/简单问答判断符合规则 | Error |
| 任务标题合规 | 10-30字中文概括无路径/URL/系统元数据 | Error |
| Session 创建 | EDT-{slug}-{date} 格式,目录结构完整 | Error |
| 初始任务链 | PLAN/REVIEW/DISPATCH 任务创建,依赖正确 | Error |
### Phase 2: 中书省规划 (zhongshu)
| 检查项 | 标准 | 严重性 |
|--------|------|--------|
| 看板上报 | 接任务/进度/完成 三个时机均已上报 | Error |
| 方案文件存在 | `plan/zhongshu-plan.md` 已写入 | Error |
| 子任务清单完整 | 覆盖所有旨意要点,含部门分配 | Error |
| 验收标准可量化 | >= 2 条可验证的成功指标 | Warning |
| 风险点识别 | >= 1 条风险及回滚方案 | Warning |
### Phase 3: 门下省审议 (menxia)
| 检查项 | 标准 | 严重性 |
|--------|------|--------|
| 四维分析均完成 | 可行性/完整性/风险/资源均有结论 | Error |
| 多CLI全部执行 | gemini×2 + qwen + codex 均调用 | Error |
| 审议报告存在 | `review/menxia-review.md` 已写入 | Error |
| 结论明确 | 准奏✅ 或 封驳❌ + 具体理由 | Error |
| 封驳意见具体 | 逐条列出需修改问题(封驳时必须)| Error封驳时|
| 看板上报 | 接任务/进度/完成 三个时机均已上报 | Error |
### Phase 4: 尚书省调度 (shangshu)
| 检查项 | 标准 | 严重性 |
|--------|------|--------|
| 调度清单存在 | `plan/dispatch-plan.md` 已写入 | Error |
| 每个子任务有部门归属 | 100% 覆盖,无遗漏子任务 | Error |
| 依赖关系正确 | 串行依赖标注清晰,并行任务识别正确 | Error |
| 看板上报 | 接任务/进度/完成 三个时机均已上报 | Error |
### Phase 5: 六部执行 (gongbu/bingbu/hubu/libu/libu-hr/xingbu)
| 检查项 | 标准 | 严重性 |
|--------|------|--------|
| 看板上报完整 | 接任务/每步进度/完成/阻塞 均正确上报 | Error |
| 产出文件存在 | `artifacts/<dept>-output.md` 已写入 | Error |
| 验收标准满足 | 对照 dispatch-plan 中的要求逐条验证 | Error |
| 阻塞主动上报 | 无法继续时 state=Blocked + reason | Error阻塞时|
### 刑部专项: 质量验收
| 检查项 | 标准 | 严重性 |
|--------|------|--------|
| 测试通过率 | >= 95% | Error |
| code review | codex review 无 Critical 问题 | Error |
| test-fix 循环 | <= 3 轮 | Warning |
| QA 报告完整 | 通过/不通过结论 + 问题清单 | Error |
---
## 跨阶段一致性检查
### 封驳循环约束
| 检查 | 规则 |
|------|------|
| 封驳轮数 | coordinator 跟踪超过3轮必须 AskUserQuestion |
| 修改覆盖度 | 每轮中书省修改必须回应门下省的所有封驳意见 |
| 方案版本 | zhongshu-plan.md 每轮包含"本轮修改点"摘要 |
### 消息类型一致性
| Sender | message_type | Coordinator 处理 |
|--------|-------------|-----------------|
| zhongshu | plan_ready | -> spawn menxia |
| menxia | review_result (approved=true) | -> spawn shangshu |
| menxia | review_result (approved=false) | -> respawn zhongshu (round++) |
| shangshu | dispatch_ready | -> spawn 六部 workers |
| 六部 | *_complete | -> 标记完成,检查全部完成 |
| 任意 | error (Blocked) | -> 记录AskUserQuestion 或协调 |
### Task Prefix 唯一性
| Role | Prefix | 冲突检查 |
|------|--------|---------|
| zhongshu | PLAN | ✅ 唯一 |
| menxia | REVIEW | ✅ 唯一 |
| shangshu | DISPATCH | ✅ 唯一 |
| gongbu | IMPL | ✅ 唯一 |
| bingbu | OPS | ✅ 唯一 |
| hubu | DATA | ✅ 唯一 |
| libu | DOC | ✅ 唯一 |
| libu-hr | HR | ✅ 唯一 |
| xingbu | QA | ✅ 唯一 |
---
## 问题分级
### Error必须修复
- 看板上报缺失(任一强制时机未上报)
- 产出文件未写入
- 封驳超过3轮未询问用户
- 阻塞状态未上报
- task prefix 冲突
### Warning应当修复
- 进度上报粒度不足(步骤描述过于笼统)
- 验收标准不可量化
- 风险点无回滚方案
### Info建议改进
- 产出报告缺乏详细摘要
- wisdom contributions 未记录
- 调度批次可进一步优化并行度

View File

@@ -0,0 +1,180 @@
{
"version": "5.0.0",
"team_name": "team-edict",
"team_display_name": "Team Edict — 三省六部",
"description": "完整复刻 Edict 三省六部架构:太子接旨 -> 中书省规划 -> 门下省多CLI审议 -> 尚书省调度 -> 六部并行执行。强制看板状态上报,支持 Blocked 一等公民状态,全流程可观测。",
"architecture": "team-worker agent + role-specs + 串行审批链 + 多CLI并行审议",
"worker_agent": "team-worker",
"session_prefix": "EDT",
"roles": {
"coordinator": {
"alias": "太子",
"task_prefix": null,
"responsibility": "接旨分拣、驱动八阶段流程、封驳循环控制、六部并行调度、最终汇总奏报",
"message_types": ["plan_ready", "review_result", "dispatch_ready", "impl_complete", "ops_complete", "data_complete", "doc_complete", "hr_complete", "qa_complete", "error"]
},
"zhongshu": {
"alias": "中书省",
"task_prefix": "PLAN",
"role_spec": "role-specs/zhongshu.md",
"responsibility": "分析旨意、代码库探索gemini CLI、起草结构化执行方案",
"inner_loop": false,
"message_types": ["plan_ready", "error"]
},
"menxia": {
"alias": "门下省",
"task_prefix": "REVIEW",
"role_spec": "role-specs/menxia.md",
"responsibility": "四维并行审议gemini×2 + qwen + codex、输出准奏/封驳结论",
"inner_loop": false,
"multi_cli": {
"enabled": true,
"dimensions": [
{"name": "可行性", "tool": "gemini", "rule": "analysis-review-architecture"},
{"name": "完整性", "tool": "qwen"},
{"name": "风险评估", "tool": "gemini", "rule": "analysis-assess-security-risks"},
{"name": "资源评估", "tool": "codex"}
]
},
"message_types": ["review_result", "error"]
},
"shangshu": {
"alias": "尚书省",
"task_prefix": "DISPATCH",
"role_spec": "role-specs/shangshu.md",
"responsibility": "解析准奏方案、按六部路由规则拆解子任务、生成调度令清单",
"inner_loop": false,
"message_types": ["dispatch_ready", "error"]
},
"gongbu": {
"alias": "工部",
"task_prefix": "IMPL",
"role_spec": "role-specs/gongbu.md",
"responsibility": "功能开发、架构设计、代码实现、重构优化",
"inner_loop": true,
"message_types": ["impl_complete", "impl_progress", "error"]
},
"bingbu": {
"alias": "兵部",
"task_prefix": "OPS",
"role_spec": "role-specs/bingbu.md",
"responsibility": "基础设施运维、部署发布、CI/CD、性能监控、安全防御",
"inner_loop": true,
"message_types": ["ops_complete", "ops_progress", "error"]
},
"hubu": {
"alias": "户部",
"task_prefix": "DATA",
"role_spec": "role-specs/hubu.md",
"responsibility": "数据分析、统计汇总、成本分析、资源管理、报表生成",
"inner_loop": true,
"message_types": ["data_complete", "data_progress", "error"]
},
"libu": {
"alias": "礼部",
"task_prefix": "DOC",
"role_spec": "role-specs/libu.md",
"responsibility": "文档撰写、规范制定、UI/UX文案、API文档、对外沟通",
"inner_loop": true,
"message_types": ["doc_complete", "doc_progress", "error"]
},
"libu-hr": {
"alias": "吏部",
"task_prefix": "HR",
"role_spec": "role-specs/libu-hr.md",
"responsibility": "Agent管理、技能培训与优化、考核评估、协作规范制定",
"inner_loop": false,
"message_types": ["hr_complete", "error"]
},
"xingbu": {
"alias": "刑部",
"task_prefix": "QA",
"role_spec": "role-specs/xingbu.md",
"responsibility": "代码审查、测试验收、Bug定位修复、合规审计test-fix循环最多3轮",
"inner_loop": true,
"message_types": ["qa_complete", "qa_progress", "fix_required", "error"]
}
},
"pipeline": {
"type": "cascade_with_parallel_execution",
"description": "串行审批链 + 六部按依赖并行执行",
"stages": [
{
"stage": 1,
"name": "规划",
"roles": ["zhongshu"],
"blockedBy": []
},
{
"stage": 2,
"name": "审议",
"roles": ["menxia"],
"blockedBy": ["zhongshu"],
"retry": {"max_rounds": 3, "on_reject": "respawn zhongshu with feedback"}
},
{
"stage": 3,
"name": "调度",
"roles": ["shangshu"],
"blockedBy": ["menxia"]
},
{
"stage": 4,
"name": "执行",
"roles": ["gongbu", "bingbu", "hubu", "libu", "libu-hr", "xingbu"],
"blockedBy": ["shangshu"],
"parallel": true,
"note": "实际并行度由 dispatch-plan.md 中的 blockedBy 决定"
}
],
"diagram": "PLAN-001 -> REVIEW-001 -> DISPATCH-001 -> [IMPL/OPS/DATA/DOC/HR/QA 按需并行]"
},
"kanban_protocol": {
"description": "所有 worker 强制遵守的看板状态上报规范",
"state_machine": ["Pending", "Doing", "Blocked", "Done"],
"mandatory_events": [
{"event": "接任务时", "type": "state_update", "data": "state=Doing + current_step"},
{"event": "每个关键步骤", "type": "impl_progress", "data": "current + plan(步骤1✅|步骤2🔄|步骤3)"},
{"event": "完成时", "type": "task_handoff", "data": "from_role -> coordinator + remark"},
{"event": "阻塞时", "type": "error", "data": "state=Blocked + reason"}
],
"implementation": "team_msg(operation='log', session_id=<session_id>, from=<role>, ...)"
},
"routing_rules": {
"description": "尚书省六部路由规则",
"rules": [
{"keywords": ["功能开发", "架构", "代码", "重构", "API", "接口", "实现"], "department": "gongbu"},
{"keywords": ["部署", "CI/CD", "基础设施", "容器", "性能监控", "安全防御"], "department": "bingbu"},
{"keywords": ["数据分析", "统计", "成本", "报表", "资源管理"], "department": "hubu"},
{"keywords": ["文档", "README", "UI文案", "规范", "API文档", "对外沟通"], "department": "libu"},
{"keywords": ["测试", "QA", "Bug", "审查", "合规审计"], "department": "xingbu"},
{"keywords": ["Agent管理", "培训", "技能优化", "考核"], "department": "libu-hr"}
]
},
"session_dirs": {
"base": ".workflow/.team/EDT-{slug}-{YYYY-MM-DD}/",
"plan": "plan/",
"review": "review/",
"artifacts": "artifacts/",
"kanban": "kanban/",
"wisdom": "wisdom/contributions/",
"messages": ".msg/"
},
"artifacts": {
"zhongshu": "plan/zhongshu-plan.md",
"menxia": "review/menxia-review.md",
"shangshu": "plan/dispatch-plan.md",
"gongbu": "artifacts/gongbu-output.md",
"bingbu": "artifacts/bingbu-output.md",
"hubu": "artifacts/hubu-output.md",
"libu": "artifacts/libu-output.md",
"libu-hr": "artifacts/libu-hr-output.md",
"xingbu": "artifacts/xingbu-report.md"
}
}