feat(dev-workflow): Phase 2-9 prompt templates + orchestrator
Phase 2 头脑风暴: - prompts/brainstorming.md - 问答策略和需求收集模板 Phase 3 方案设计: - prompts/solution-design.md - 3个子代理启动配置 Phase 4 方案审核: - prompts/solution-review.md - 交叉审核和综合方案生成 Phase 5 方案汇报: - prompts/solution-report.md - 用户决策处理 Phase 6 Spec编排: - prompts/spec-planning.md - 依赖分析和分波计划 Phase 7 并行开发: - prompts/parallel-development.md - 波次执行逻辑 Phase 8 测试: - prompts/testing.md - 测试框架检测和重试逻辑 Phase 9 代码审查: - prompts/code-review.md - 3个子代理独立审查 Phase 10 修复验证: - prompts/fix-verification.md - 修复循环和最终汇报 主编排器: - orchestrator.py - 9阶段协调逻辑 - 状态管理和恢复机制
This commit is contained in:
@@ -0,0 +1,215 @@
|
||||
# 方案设计阶段 Prompt 模板
|
||||
|
||||
## 目标
|
||||
|
||||
启动3个子代理并行设计方案,每个子代理独立思考,探索不同的实现路径。
|
||||
|
||||
## 子代理启动配置
|
||||
|
||||
### 子代理 A - 通用型方案
|
||||
|
||||
```
|
||||
你是一个方案设计专家。请基于以下需求,设计一个实现方案。
|
||||
|
||||
## 项目背景
|
||||
{requirements_summary}
|
||||
|
||||
## 设计要求
|
||||
1. 提供完整的技术方案
|
||||
2. 包含架构设计、数据流、关键算法
|
||||
3. 考虑可扩展性和可维护性
|
||||
4. 列出需要创建的文件和目录结构
|
||||
5. 估算开发复杂度
|
||||
|
||||
## 输出格式
|
||||
|
||||
```markdown
|
||||
# 方案设计 - [方案名称]
|
||||
|
||||
## 概述
|
||||
[一句话描述方案特点]
|
||||
|
||||
## 技术选型
|
||||
- 语言:
|
||||
- 框架:
|
||||
- 关键依赖:
|
||||
|
||||
## 架构设计
|
||||
[架构图或描述]
|
||||
|
||||
## 核心模块
|
||||
1. [模块1]
|
||||
- 职责:
|
||||
- 接口:
|
||||
- 依赖:
|
||||
|
||||
2. [模块2]
|
||||
...
|
||||
|
||||
## 数据流
|
||||
[数据如何在模块间流动]
|
||||
|
||||
## 关键算法/逻辑
|
||||
[核心算法或业务逻辑]
|
||||
|
||||
## 文件结构
|
||||
```
|
||||
项目根目录/
|
||||
├── 文件1
|
||||
├── 目录/
|
||||
│ └── 文件2
|
||||
```
|
||||
|
||||
## 开发步骤
|
||||
1. [步骤1]
|
||||
2. [步骤2]
|
||||
|
||||
## 风险和挑战
|
||||
- [风险1]: [应对策略]
|
||||
|
||||
## 复杂度评估
|
||||
- 预计文件数:
|
||||
- 预计代码行数:
|
||||
- 开发难度: 低/中/高
|
||||
```
|
||||
|
||||
请自由发挥,不必拘泥于常规方案。
|
||||
```
|
||||
|
||||
### 子代理 B - 实用型方案
|
||||
|
||||
```
|
||||
你是一个务实的工程师。请基于以下需求,设计一个**最实用、最快速实现**的方案。
|
||||
|
||||
## 项目背景
|
||||
{requirements_summary}
|
||||
|
||||
## 设计原则
|
||||
1. 优先选择成熟、稳定的技术
|
||||
2. 尽量复用现有库,减少自研
|
||||
3. 代码简洁,易于理解和维护
|
||||
4. 快速交付,迭代优化
|
||||
|
||||
## 输出格式
|
||||
[同上]
|
||||
|
||||
请专注于**实用性**,避免过度设计。
|
||||
```
|
||||
|
||||
### 子代理 C - 创新型方案
|
||||
|
||||
```
|
||||
你是一个创新探索者。请基于以下需求,设计一个**有创意、有突破**的方案。
|
||||
|
||||
## 项目背景
|
||||
{requirements_summary}
|
||||
|
||||
## 设计原则
|
||||
1. 可以尝试新技术、新架构
|
||||
2. 不必拘泥于传统实现方式
|
||||
3. 考虑未来的可扩展性
|
||||
4. 允许有一定风险,但需说明
|
||||
|
||||
## 输出格式
|
||||
[同上]
|
||||
|
||||
请大胆探索,提供**与众不同的思路**。
|
||||
```
|
||||
|
||||
## 子代理启动命令
|
||||
|
||||
```python
|
||||
# 主代理执行
|
||||
import subprocess
|
||||
import json
|
||||
|
||||
def spawn_design_agents(requirements_summary: str):
|
||||
"""启动3个方案设计子代理"""
|
||||
|
||||
agents = [
|
||||
{"id": "A", "type": "general", "focus": "完整通用方案"},
|
||||
{"id": "B", "type": "practical", "focus": "实用快速方案"},
|
||||
{"id": "C", "type": "creative", "focus": "创新探索方案"}
|
||||
]
|
||||
|
||||
results = []
|
||||
|
||||
for agent in agents:
|
||||
prompt = get_prompt_template(agent["type"]).format(
|
||||
requirements_summary=requirements_summary
|
||||
)
|
||||
|
||||
# 使用 sessions_spawn 启动子代理
|
||||
result = subprocess.run([
|
||||
"openclaw", "agent", "spawn",
|
||||
"--prompt", prompt,
|
||||
"--model", "g5", # 使用高质量模型
|
||||
"--output", f".planning/dev-workflow/solutions/solution-{agent['id']}.md"
|
||||
], capture_output=True, text=True)
|
||||
|
||||
results.append({
|
||||
"agent_id": agent["id"],
|
||||
"output_file": f"solution-{agent['id']}.md",
|
||||
"status": "success" if result.returncode == 0 else "failed"
|
||||
})
|
||||
|
||||
return results
|
||||
```
|
||||
|
||||
## 输出文件
|
||||
|
||||
每个子代理输出保存到:
|
||||
- `.planning/dev-workflow/solutions/solution-A.md`
|
||||
- `.planning/dev-workflow/solutions/solution-B.md`
|
||||
- `.planning/dev-workflow/solutions/solution-C.md`
|
||||
|
||||
## 主代理汇总
|
||||
|
||||
所有子代理完成后,主代理生成方案对比:
|
||||
|
||||
```markdown
|
||||
# 方案对比摘要
|
||||
|
||||
## 方案概览
|
||||
|
||||
| 维度 | 方案A (通用型) | 方案B (实用型) | 方案C (创新型) |
|
||||
|------|---------------|---------------|---------------|
|
||||
| 特点 | 完整、规范 | 快速、实用 | 创新、突破 |
|
||||
| 复杂度 | 中 | 低 | 高 |
|
||||
| 风险 | 低 | 低 | 中 |
|
||||
| 开发周期 | 中 | 短 | 长 |
|
||||
|
||||
## 各方案亮点
|
||||
|
||||
### 方案A
|
||||
- [亮点1]
|
||||
- [亮点2]
|
||||
|
||||
### 方案B
|
||||
- [亮点1]
|
||||
- [亮点2]
|
||||
|
||||
### 方案C
|
||||
- [亮点1]
|
||||
- [亮点2]
|
||||
|
||||
## 推荐
|
||||
[主代理的初步推荐,供审核阶段参考]
|
||||
```
|
||||
|
||||
## 状态更新
|
||||
|
||||
```json
|
||||
{
|
||||
"phases": {
|
||||
"2": {
|
||||
"status": "completed",
|
||||
"agents": ["A", "B", "C"],
|
||||
"data": {
|
||||
"solutions": ["solution-A.md", "solution-B.md", "solution-C.md"],
|
||||
"comparison": "comparison.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user