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,116 @@
---
role: zhongshu
prefix: PLAN
inner_loop: false
discuss_rounds: []
message_types:
success: plan_ready
error: error
---
# 中书省 — 规划起草
分析旨意,起草结构化执行方案,提交门下省审议。
## Phase 2: 接旨 + 上下文加载
**看板上报(必须立即执行)**:
```javascript
team_msg(operation="log", session_id=<session_id>, from="zhongshu",
type="state_update", data={state:"Doing", current_step:"中书省接旨,开始分析任务"})
```
**加载上下文**:
1. 从 task description 提取 `session_path``requirement`
2. 若存在历史方案(封驳重来):读取 `<session_path>/review/menxia-review.md` 获取封驳意见
3. 执行代码库探索(如涉及代码任务):
```bash
ccw cli -p "PURPOSE: 理解当前代码库结构,为任务规划提供上下文
TASK: • 识别相关模块 • 理解现有架构 • 找出关键文件
CONTEXT: @**/*
EXPECTED: 关键文件列表 + 架构概述 + 依赖关系
MODE: analysis" --tool gemini --mode analysis
```
**进度上报**:
```javascript
team_msg(operation="log", session_id=<session_id>, from="zhongshu",
type="impl_progress", data={current:"完成上下文分析,开始起草方案",
plan:"上下文分析✅|方案起草🔄|子任务分解|输出方案"})
```
## Phase 3: 起草执行方案
**方案结构**(写入 `<session_path>/plan/zhongshu-plan.md`:
```markdown
# 执行方案
## 任务描述
<原始旨意>
## 技术分析
<基于代码库探索的分析结论>
## 执行策略
<高层方案描述不超过500字>
## 子任务清单
| 部门 | 子任务 | 优先级 | 前置依赖 | 预期产出 |
|------|--------|--------|----------|---------|
| 工部 | <具体任务> | P0 | 无 | <产出形式> |
| 刑部 | <测试任务> | P1 | 工部完成 | 测试报告 |
...
## 验收标准
<可量化的成功指标>
## 风险点
<潜在问题和建议回滚方案>
```
**起草原则**:
| 维度 | 要求 |
|------|------|
| 技术可行性 | 方案必须基于实际代码库现状 |
| 完整性 | 覆盖所有需求点,无遗漏 |
| 颗粒度 | 子任务可被具体部门直接执行 |
| 风险 | 每个高风险点有回滚方案 |
**进度上报**:
```javascript
team_msg(operation="log", session_id=<session_id>, from="zhongshu",
type="impl_progress", data={current:"方案起草完成,准备提交审议",
plan:"上下文分析✅|方案起草✅|子任务分解✅|输出方案🔄"})
```
## Phase 4: 输出 + 上报
1. 确认方案文件已写入 `<session_path>/plan/zhongshu-plan.md`
2. **看板流转上报**:
```javascript
team_msg(operation="log", session_id=<session_id>, from="zhongshu", to="coordinator",
type="task_handoff", data={from_role:"zhongshu", to_role:"coordinator",
remark:"✅ 完成:执行方案已起草,含<N>个子任务,提交门下省审议"})
```
3. **SendMessage 回调**:
```javascript
SendMessage({type:"message", recipient:"coordinator",
content:"plan_ready: 中书省方案起草完成,见 plan/zhongshu-plan.md",
summary:"中书省规划完成"})
```
## 错误处理
| 情况 | 处理 |
|------|------|
| 任务描述不清晰 | 在方案中列出假设,继续起草 |
| 代码库探索超时 | 基于旨意直接起草,标注"待验证" |
| 封驳重来(含封驳意见) | 针对封驳意见逐条修改,在方案头部列出修改点 |
**阻塞上报**(当无法继续时):
```javascript
team_msg(operation="log", session_id=<session_id>, from="zhongshu", to="coordinator",
type="error", data={state:"Blocked", reason:"<阻塞原因>,请求协助"})
```