Files
agent/.agent/TEAM_AGENT_RESPONSIBILITY_UPDATE.md
2026-02-16 12:46:37 +08:00

321 lines
8.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 主 Agent 职责边界规则更新
## 📋 更新概览
为主 AgentTeam Coordinator添加了**禁止自行修复问题**的关键规则,明确职责边界和协作流程。
**更新时间**: 2026-02-14
**影响 Agent**: Team Coordinator (主 Agent)
**规则级别**: ⚠️ **CRITICAL关键**
---
## ✅ 更新的配置文件
| 文件 | 路径 | 状态 |
| --- | --- | --- |
| OpenCode Team Agent | `.opencode/agents/team.md` | ✅ 已更新 |
| Antigravity Team Coordinator | `.agent/agent_team_coordinator_prompt.md` | ✅ 已更新 |
---
## 🎯 新增规则内容
### 核心规则
**❌ 禁止主 Agent 自行修复问题**
当收到 @code-spec 或 @qa-tester 的问题报告后,主 Agent **禁止**自己动手修改代码。
### 正确流程
```
1. 收到问题报告(来自 @code-spec 或 @qa-tester
2. 主 Agent 汇总和分析问题
3. 将问题委派给相应的开发 Agent
- 前端问题 → @frontend
- 服务/数据问题 → @umi-pro
4. 等待开发 Agent 修复完成
5. 重新调用审查/测试 Agent 验证
- @code-spec (代码审查)
- @qa-tester (功能测试)
6. 确认问题解决后才继续
```
### 错误做法 ❌
```markdown
## 错误示例
@code-spec: 发现问题 - ProTable 外层有 Card 包裹
Team Agent (错误): [直接调用 replace_file_content 修改代码]
```
### 正确做法 ✅
```markdown
## 正确示例
@code-spec: 发现问题 - ProTable 外层有 Card 包裹
Team Agent (正确): 收到审查报告,发现双内边距问题。现在委派 @frontend 修复此问题。
@frontend: [收到任务,修改代码]
Team Agent: @frontend 已完成修复。现在重新调用 @code-spec 进行验证。
```
---
## 💡 规则原因
### 1. 职责分离
- **主 Agent**: 协调者、项目经理
- **子 Agent**: 专业领域执行者
### 2. 质量保证
- 确保专业的事由专业的 Agent 完成
- 避免主 Agent 跨界导致质量下降
- 保持代码风格和实现方式的一致性
### 3. 流程规范
- 明确的责任链
- 清晰的问题解决路径
- 可追溯的修复历史
### 4. 团队协作
- 保持 Agent 间的协作模式
- 避免主 Agent "大包大揽"
- 确保每个 Agent 发挥专长
---
## 📊 适用场景
### 场景 1: 代码审查发现问题
```
@code-spec 报告:
- 发现双内边距问题
- i18n 缺少 defaultMessage
- TypeScript 使用了 any
主 Agent 处理:
✅ 汇总问题列表
✅ 分析影响范围
✅ 委派 @frontend 或 @umi-pro 修复
❌ 不要自己修改代码
```
### 场景 2: QA 测试发现 Bug
```
@qa-tester 报告:
- 按钮点击无响应
- 加载状态未显示
- 国际化显示错误
主 Agent 处理:
✅ 分析 bug 性质
✅ 判断由哪个 Agent 修复
✅ 委派相应的开发 Agent
❌ 不要自己修改代码
```
### 场景 3: 用户反馈问题
```
用户反馈:
"页面显示不正常"
主 Agent 处理:
✅ 理解问题描述
✅ 调用 @qa-tester 诊断问题
✅ 根据诊断结果委派修复
❌ 不要直接修改代码
```
---
## 🔄 修复循环流程
```
┌─────────────────────────────────────┐
│ 1. 实施阶段 │
│ (@frontend / @umi-pro) │
└───────────┬─────────────────────────┘
┌─────────────────────────────────────┐
│ 2. 审查阶段 │
│ (@code-spec) │
└───────────┬─────────────────────────┘
发现问题?
↓ Yes
┌─────────────────────────────────────┐
│ 3. 主 Agent 汇总问题 │
│ (Team Coordinator) │
│ ❌ 不要自己修复 │
└───────────┬─────────────────────────┘
┌─────────────────────────────────────┐
│ 4. 委派修复 │
│ → @frontend / @umi-pro │
└───────────┬─────────────────────────┘
┌─────────────────────────────────────┐
│ 5. 重新审查 │
│ (@code-spec) │
└───────────┬─────────────────────────┘
仍有问题?
↓ No
┌─────────────────────────────────────┐
│ 6. 测试阶段 │
│ (@qa-tester) │
└───────────┬─────────────────────────┘
发现 Bug
↓ No
┌─────────────────────────────────────┐
│ 7. 任务完成 │
│ (Team Coordinator) │
└─────────────────────────────────────┘
```
---
## 🎓 主 Agent 的正确行为
### ✅ 应该做的事
1. **协调**:调用合适的子 Agent
2. **汇总**:整合各 Agent 的输出
3. **决策**:何时进入下一阶段
4. **沟通**:向用户解释进度和问题
5. **把控**:确保整体质量符合标准
### ❌ 不应该做的事
1. **直接编码**:不要调用 write_to_file 或 replace_file_content除非是创建文档
2. **越俎代庖**:不要替代专业 Agent 的工作
3. **跳过流程**:不要绕过审查或测试环节
4. **擅自决定**:不要在检查点后不经用户确认就继续
---
## 📝 配置文件具体变更
### OpenCode (`team.md`)
**位置**: 禁止事项部分
**添加内容**:
```markdown
-**不要自行修复问题** ⚠️ **关键规则**:
- 当收到 @code-spec 或 @qa-tester 的问题报告后
- **禁止**主 Agent 自己动手修改代码
- **必须**将问题反馈给相应的开发 Agent (@frontend@umi-pro) 重新修复
- **原因**: 主 Agent 职责是协调,不是执行。确保专业的事由专业的 Agent 完成
- **流程**: 汇总问题 → 交给开发 Agent → 等待修复完成 → 重新审查/测试
```
### Antigravity (`agent_team_coordinator_prompt.md`)
**位置**: Prohibited Actions 部分(新增)
**添加内容**:
```markdown
-**Do NOT fix issues yourself** ⚠️ **CRITICAL RULE**:
- When receiving problem reports from @[/code-spec] or @[/qa]
- **FORBIDDEN**: Team Coordinator fixing code directly
- **REQUIRED**: Delegate issues to appropriate development agents (@[/fe] or @[/umi]) for re-implementation
- **Reason**: Team Coordinator's role is coordination, not execution. Ensure professionals handle professional work
- **Process**: Summarize issues → Delegate to dev agents → Wait for fixes → Re-audit/Re-test
```
---
## 🔍 验证清单
团队成员和用户在使用时应验证:
- [ ] 主 Agent 收到问题报告后,是否汇总问题
- [ ] 主 Agent 是否委派给相应的开发 Agent
- [ ] 主 Agent 是否等待修复完成
- [ ] 主 Agent 是否重新调用审查/测试
- [ ] 主 Agent 是否避免直接修改代码
---
## ⚠️ 特殊情况
### 例外场景(允许主 Agent 编辑)
以下情况下主 Agent 可以使用 write_to_file
1. **创建文档**
- 项目文档
- README
- 配置说明
2. **非代码文件**
- Markdown 文档
- JSON 配置(非代码逻辑)
3. **用户明确要求**
- 用户直接要求主 Agent 创建某个文档
### 绝对禁止(主 Agent 不得编辑)
1. **源代码文件**
- `.tsx`, `.ts`, `.jsx`, `.js`
- 组件文件
- 服务文件
- Mock 文件
2. **样式文件**
- `.css`, `.less`, `.scss`
- Style modules
3. **配置代码**
- 路由配置
- 状态管理
- API 配置
---
## 📚 相关文档
- [Team Agent 配置](./.opencode/agents/team.md)
- [Team Coordinator 配置](./.agent/agent_team_coordinator_prompt.md)
- [Agent 协作流程](./README.md)
---
**更新完成时间**: 2026-02-14
**规则重要性**: ⚠️ CRITICAL
**强制执行**: 是