harveyz-skill 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/bin/cli.js +81 -0
- package/bundles.json +24 -0
- package/lib/bundles.js +39 -0
- package/lib/installer.js +46 -0
- package/lib/targets.js +23 -0
- package/package.json +42 -0
- package/skills/analysis/skill-analyzer/CHANGELOG.md +78 -0
- package/skills/analysis/skill-analyzer/SKILL.md +150 -0
- package/skills/harness/full-stack-debug-env/SKILL.md +468 -0
- package/skills/harness/full-stack-debug-env/references/README.md +31 -0
- package/skills/harness/full-stack-debug-env/references/tech-stacks/browser-spa.md +89 -0
- package/skills/harness/full-stack-debug-env/references/tech-stacks/docker-compose.md +77 -0
- package/skills/harness/full-stack-debug-env/references/tech-stacks/electron.md +123 -0
- package/skills/harness/full-stack-debug-env/references/tech-stacks/node-process.md +76 -0
- package/skills/superpowers-fork/brainstorming/SKILL.md +148 -0
- package/skills/superpowers-fork/executing-plans/SKILL.md +104 -0
- package/skills/superpowers-fork/systematic-debugging/SKILL.md +217 -0
- package/skills/superpowers-fork/using-git-worktrees/SKILL.md +192 -0
- package/skills/superpowers-fork/writing-plans/SKILL.md +187 -0
- package/skills/task/pm-task-dispatch/SKILL.md +165 -0
- package/skills/task/pm-task-dispatch/references/agent-mapping.md +59 -0
- package/skills/task/pm-task-dispatch/references/task-template.md +145 -0
- package/skills/task/task-close/SKILL.md +148 -0
- package/skills/task/task-close/references/output-templates.md +76 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-git-worktrees
|
|
3
|
+
description: "当需要创建隔离工作区(新分支)进行特性开发时使用。在执行实施计划或开始任何需要与当前工作隔离的任务前,必须先创建 worktree、运行项目设置、验证干净的测试基线。适用于:开始新功能开发、修复 bug、需要隔离环境的任何代码工作。"
|
|
4
|
+
user_invocable: true
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Using Git Worktrees - 隔离工作区
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
Git worktree 创建共享同一仓库的隔离工作空间,允许同时在多个分支上工作而无需切换。
|
|
13
|
+
|
|
14
|
+
**核心原则:** 系统化的目录选择 + 安全验证 = 可靠的隔离。
|
|
15
|
+
|
|
16
|
+
**开始时宣布:** "正在使用 using-git-worktrees 技能设置隔离工作区。"
|
|
17
|
+
|
|
18
|
+
## 目录选择优先级
|
|
19
|
+
|
|
20
|
+
### 1. 检查现有目录
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# 按优先级检查
|
|
24
|
+
ls -d .worktrees 2>/dev/null # 首选(隐藏目录)
|
|
25
|
+
ls -d worktrees 2>/dev/null # 备选
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**如果存在:** 使用该目录(两个都存在时 `.worktrees` 优先)
|
|
29
|
+
|
|
30
|
+
### 2. 检查 CLAUDE.md
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
grep -i "worktree.*director" CLAUDE.md 2>/dev/null
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**如果指定了偏好:** 直接使用,不询问
|
|
37
|
+
|
|
38
|
+
### 3. 询问用户
|
|
39
|
+
|
|
40
|
+
如果无目录且无 CLAUDE.md 偏好:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
未找到 worktree 目录。应该在哪里创建?
|
|
44
|
+
|
|
45
|
+
1. .worktrees/ (项目本地,隐藏)
|
|
46
|
+
2. ~/worktrees/<项目名>/ (全局位置)
|
|
47
|
+
|
|
48
|
+
选择哪个?
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 安全验证
|
|
52
|
+
|
|
53
|
+
### 本地目录(.worktrees 或 worktrees)
|
|
54
|
+
|
|
55
|
+
**创建前必须验证目录被忽略:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# 检查目录是否被忽略(遵守本地、全局和系统 .gitignore)
|
|
59
|
+
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**如果不未忽略:** Jesse 规则"立即修复损坏的东西":
|
|
63
|
+
1. 添加适当的行到 .gitignore
|
|
64
|
+
2. 提交更改
|
|
65
|
+
3. 继续创建 worktree
|
|
66
|
+
|
|
67
|
+
### 全局目录(~/.config/openclaw/worktrees/)
|
|
68
|
+
|
|
69
|
+
无需 .gitignore 验证 — 完全在项目外。
|
|
70
|
+
|
|
71
|
+
## 创建步骤
|
|
72
|
+
|
|
73
|
+
### 1. 检测项目名称
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
project=$(basename "$(git rev-parse --show-toplevel)")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 2. 创建 Worktree
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# 确定完整路径
|
|
83
|
+
case $LOCATION in
|
|
84
|
+
.worktrees|worktrees)
|
|
85
|
+
path="$LOCATION/$BRANCH_NAME"
|
|
86
|
+
;;
|
|
87
|
+
~/.config/openclaw/worktrees/*)
|
|
88
|
+
path="$HOME/.config/openclaw/worktrees/$project/$BRANCH_NAME"
|
|
89
|
+
;;
|
|
90
|
+
esac
|
|
91
|
+
|
|
92
|
+
# 创建 worktree(带新分支)
|
|
93
|
+
git worktree add "$path" -b "$BRANCH_NAME"
|
|
94
|
+
cd "$path"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. 运行项目设置
|
|
98
|
+
|
|
99
|
+
自动检测并运行适当的设置:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Node.js
|
|
103
|
+
if [ -f package.json ]; then npm install; fi
|
|
104
|
+
|
|
105
|
+
# Python
|
|
106
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
107
|
+
if [ -f pyproject.toml ]; then poetry install; fi
|
|
108
|
+
|
|
109
|
+
# Rust
|
|
110
|
+
if [ -f Cargo.toml ]; then cargo build; fi
|
|
111
|
+
|
|
112
|
+
# Go
|
|
113
|
+
if [ -f go.mod ]; then go mod download; fi
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 4. 验证干净基线
|
|
117
|
+
|
|
118
|
+
运行测试确保 worktree 起始干净:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# 示例(使用项目适当的命令)
|
|
122
|
+
npm test
|
|
123
|
+
cargo test
|
|
124
|
+
pytest
|
|
125
|
+
go test ./...
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**如果测试失败:** 报告失败,询问是否继续或调查。
|
|
129
|
+
|
|
130
|
+
**如果测试通过:** 报告就绪。
|
|
131
|
+
|
|
132
|
+
### 5. 报告位置
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
Worktree 就绪于 <full-path>
|
|
136
|
+
测试通过 (<N> 测试,0 失败)
|
|
137
|
+
准备好实现 <feature-name>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 快速参考
|
|
141
|
+
|
|
142
|
+
| 情况 | 操作 |
|
|
143
|
+
|------|------|
|
|
144
|
+
| `.worktrees/` 存在 | 使用它(验证被忽略) |
|
|
145
|
+
| `worktrees/` 存在 | 使用它(验证被忽略) |
|
|
146
|
+
| 两者都存在 | 使用 `.worktrees/` |
|
|
147
|
+
| 都不存在 | 检查 CLAUDE.md → 询问用户 |
|
|
148
|
+
| 目录未忽略 | 添加到 .gitignore + 提交 |
|
|
149
|
+
| 基线测试失败 | 报告失败 + 询问 |
|
|
150
|
+
| 无 package.json 等 | 跳过依赖安装 |
|
|
151
|
+
|
|
152
|
+
## 常见错误
|
|
153
|
+
|
|
154
|
+
### 跳过忽略验证
|
|
155
|
+
|
|
156
|
+
- **问题:** Worktree 内容被跟踪,污染 git status
|
|
157
|
+
- **修复:** 创建本地 worktree 前始终使用 `git check-ignore`
|
|
158
|
+
|
|
159
|
+
### 假设目录位置
|
|
160
|
+
|
|
161
|
+
- **问题:** 创建不一致,违反项目约定
|
|
162
|
+
- **修复:** 遵循优先级:现有 > CLAUDE.md > 询问
|
|
163
|
+
|
|
164
|
+
### 测试失败继续
|
|
165
|
+
|
|
166
|
+
- **问题:** 无法区分新 bug 和已存在问题
|
|
167
|
+
- **修复:** 报告失败,获得明确许可后再继续
|
|
168
|
+
|
|
169
|
+
### 硬编码设置命令
|
|
170
|
+
|
|
171
|
+
- **问题:** 在使用不同工具的项目上失败
|
|
172
|
+
- **修复:** 从项目文件自动检测(package.json 等)
|
|
173
|
+
|
|
174
|
+
## 与其他技能配合
|
|
175
|
+
|
|
176
|
+
**被调用方:**
|
|
177
|
+
- **brainstorming**(第4阶段)— 设计批准后实施前必需
|
|
178
|
+
- **executing-plans** — 执行任何任务前必需
|
|
179
|
+
- 任何需要隔离工作区的技能
|
|
180
|
+
|
|
181
|
+
**配合技能:**
|
|
182
|
+
- **finishing-a-development-branch** — 工作完成后清理
|
|
183
|
+
- **writing-plans** — 创建实施计划
|
|
184
|
+
- **brainstorming** — 设计阶段
|
|
185
|
+
|
|
186
|
+
## OpenClaw 环境适配
|
|
187
|
+
|
|
188
|
+
在 OpenClaw 环境中:
|
|
189
|
+
- 工作区路径:`~/.openclaw/agents/coding-master/workspace/`
|
|
190
|
+
- 计划保存到:`docs/superpowers/plans/`
|
|
191
|
+
- 规格保存到:`docs/superpowers/specs/`
|
|
192
|
+
- Worktree 创建后,在新目录中继续执行 writing-plans 和 executing-plans
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-plans
|
|
3
|
+
description: "当有规格说明或需求文档后,将设计拆解为可执行的小任务时使用。每个任务应该是 2-5 分钟可完成的,包含精确文件路径、完整代码和验证步骤。此技能与 brainstorming(生成规格)和 executing-plans(执行计划)配合使用,构成完整的工作流。"
|
|
4
|
+
user_invocable: true
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Writing Plans - 实施计划编写
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
将设计文档拆解为详细、可执行的实施计划。假设执行者对代码库零上下文但技能熟练。
|
|
13
|
+
|
|
14
|
+
**开始时宣布:** "正在使用 writing-plans 技能创建实施计划。"
|
|
15
|
+
|
|
16
|
+
## 计划文件位置
|
|
17
|
+
|
|
18
|
+
保存到:`docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md`
|
|
19
|
+
|
|
20
|
+
## 计划结构
|
|
21
|
+
|
|
22
|
+
### 文件头部(必须)
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
# [功能名称] 实施计划
|
|
26
|
+
|
|
27
|
+
**目标:** [一句话描述构建内容]
|
|
28
|
+
|
|
29
|
+
**架构:** [2-3 句话描述方法]
|
|
30
|
+
|
|
31
|
+
**技术栈:** [关键技术和库]
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 任务结构
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
### Task N: [组件名称]
|
|
40
|
+
|
|
41
|
+
**文件:**
|
|
42
|
+
- 创建: `exact/path/to/file.py`
|
|
43
|
+
- 修改: `exact/path/to/existing.py:123-145`
|
|
44
|
+
- 测试: `tests/exact/path/to/test.py`
|
|
45
|
+
|
|
46
|
+
- [ ] **Step 1: 编写失败的测试**
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
def test_specific_behavior():
|
|
50
|
+
result = function(input)
|
|
51
|
+
assert result == expected
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- [ ] **Step 2: 运行测试确认失败**
|
|
55
|
+
|
|
56
|
+
运行: `pytest tests/path/test.py::test_name -v`
|
|
57
|
+
预期: FAIL
|
|
58
|
+
|
|
59
|
+
- [ ] **Step 3: 编写最小实现**
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
def function(input):
|
|
63
|
+
return expected
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- [ ] **Step 4: 运行测试确认通过**
|
|
67
|
+
|
|
68
|
+
运行: `pytest tests/path/test.py::test_name -v`
|
|
69
|
+
预期: PASS
|
|
70
|
+
|
|
71
|
+
- [ ] **Step 5: 提交**
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git add tests/path/test.py src/path/file.py
|
|
75
|
+
git commit -m "feat: add specific feature"
|
|
76
|
+
```
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 任务粒度
|
|
80
|
+
|
|
81
|
+
**每个步骤 2-5 分钟完成:**
|
|
82
|
+
- "编写失败的测试" — 一步
|
|
83
|
+
- "运行测试确认失败" — 一步
|
|
84
|
+
- "编写最小实现" — 一步
|
|
85
|
+
- "运行测试确认通过" — 一步
|
|
86
|
+
- "提交" — 一步
|
|
87
|
+
|
|
88
|
+
## 文件结构规划
|
|
89
|
+
|
|
90
|
+
在定义任务前,先规划需要创建或修改的文件:
|
|
91
|
+
- 每个文件职责清晰
|
|
92
|
+
- 文件边界清晰
|
|
93
|
+
- 文件应一起修改的放一起
|
|
94
|
+
- 遵循现有代码库模式
|
|
95
|
+
|
|
96
|
+
## 禁止占位符
|
|
97
|
+
|
|
98
|
+
以下都是计划失败,禁止写入:
|
|
99
|
+
- "TBD"、"TODO"、"后续实现"
|
|
100
|
+
- "添加适当的错误处理"
|
|
101
|
+
- "参考 Task N"(必须重复代码)
|
|
102
|
+
- 描述做什么但不展示如何做
|
|
103
|
+
- 引用未在任何任务中定义的类型、函数或方法
|
|
104
|
+
|
|
105
|
+
## 自检清单
|
|
106
|
+
|
|
107
|
+
完成计划后,用新眼光检查:
|
|
108
|
+
|
|
109
|
+
### 1. 规格覆盖
|
|
110
|
+
浏览规格的每个部分,能否指向实现它的任务?列出任何空白。
|
|
111
|
+
|
|
112
|
+
### 2. 占位符扫描
|
|
113
|
+
搜索:TBD、TODO、"后续"、"类似 Task N" 等模式
|
|
114
|
+
|
|
115
|
+
### 3. 类型一致性
|
|
116
|
+
在后续任务中使用的类型、方法签名、属性名是否与前面定义一致?
|
|
117
|
+
|
|
118
|
+
## 执行移交
|
|
119
|
+
|
|
120
|
+
保存计划后,提供执行选项:
|
|
121
|
+
|
|
122
|
+
**"计划已完成并保存到 `docs/superpowers/plans/<filename>.md`。两个执行选项:**
|
|
123
|
+
|
|
124
|
+
**1. 子 Agent 驱动(推荐)** — 每个任务派发一个新的 subagent,任务间 review,快速迭代
|
|
125
|
+
|
|
126
|
+
**2. 内联执行** — 在当前 session 使用 executing-plans 执行,批量执行带检查点
|
|
127
|
+
|
|
128
|
+
**选择哪个?"**
|
|
129
|
+
|
|
130
|
+
## 典型计划示例
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
# 用户认证功能 实施计划
|
|
134
|
+
|
|
135
|
+
**目标:** 添加邮箱+密码用户认证
|
|
136
|
+
|
|
137
|
+
**架构:** 使用 JWT,无状态认证,密码 bcrypt 哈希
|
|
138
|
+
|
|
139
|
+
**技术栈:** Python, Flask, PyJWT, bcrypt
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### Task 1: 用户注册 API
|
|
144
|
+
|
|
145
|
+
**文件:**
|
|
146
|
+
- 创建: `src/api/users.py`
|
|
147
|
+
- 修改: `src/models/user.py`
|
|
148
|
+
- 测试: `tests/api/test_users.py`
|
|
149
|
+
|
|
150
|
+
- [ ] **Step 1: 编写注册失败测试**
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
def test_register_creates_user():
|
|
154
|
+
response = client.post('/api/register', json={
|
|
155
|
+
'email': 'test@example.com',
|
|
156
|
+
'password': 'secure123'
|
|
157
|
+
})
|
|
158
|
+
assert response.status_code == 201
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- [ ] **Step 2: 运行测试**
|
|
162
|
+
|
|
163
|
+
...
|
|
164
|
+
|
|
165
|
+
- [ ] **Step 5: 提交**
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git add src/api/users.py src/models/user.py tests/api/test_users.py
|
|
169
|
+
git commit -m "feat: add user registration endpoint"
|
|
170
|
+
```
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## 与其他技能配合
|
|
174
|
+
|
|
175
|
+
- **brainstorming** — 生成规格文档
|
|
176
|
+
- **executing-plans** — 执行计划
|
|
177
|
+
- **using-git-worktrees** — 创建隔离工作区
|
|
178
|
+
- **systematic-debugging** — 调试问题
|
|
179
|
+
|
|
180
|
+
## 常见错误
|
|
181
|
+
|
|
182
|
+
| 错误 | 正确做法 |
|
|
183
|
+
|------|----------|
|
|
184
|
+
| 任务太大 | 拆分为 2-5 分钟的步骤 |
|
|
185
|
+
| 缺少测试代码 | 每个任务都要有完整测试 |
|
|
186
|
+
| "参考其他地方" | 重复必要的代码 |
|
|
187
|
+
| 未验证一致性 | 自检清单第三项 |
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pm-task-dispatch
|
|
3
|
+
description: PM 任务派发技能。当需要创建新任务并派发给其他 Agent 时触发。流程:理解任务 → 需求澄清 → 分析细化 → 创建任务文档 → sessions_send 派发 → 追踪反馈。触发场景包括:(1)Harvey 提出新任务需求,(2)要求向特定 Agent 分派任务,(3)询问任务如何派发。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PM Task Dispatch
|
|
7
|
+
|
|
8
|
+
PM 任务派发的标准流程。
|
|
9
|
+
|
|
10
|
+
## 工作流
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
1. 理解任务 → 2. 需求澄清 → 3. 分析细化 → 4. 创建任务文档 → 5. 派发任务
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Step 1:理解任务
|
|
19
|
+
|
|
20
|
+
接收 Harvey 的任务描述,明确:
|
|
21
|
+
- **任务目标**:要完成什么?
|
|
22
|
+
- **约束条件**:有哪些限制(预算、技术栈、时间等)?
|
|
23
|
+
- **期望输出**:结果以什么形式交付?
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Step 2:需求澄清
|
|
28
|
+
|
|
29
|
+
**判断标准——是否需要 brainstorming:**
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Harvey 给了模糊指令?
|
|
33
|
+
├── 是 → 必须用 brainstorming skill 澄清
|
|
34
|
+
└── 否,但缺少以下任一信息?
|
|
35
|
+
├── 任务范围和边界
|
|
36
|
+
├── 优先级(priority)
|
|
37
|
+
├── 资源限制(GPU、API key、预算)
|
|
38
|
+
└── 执行 Agent(assignee)
|
|
39
|
+
└── 是 → 向 Harvey 确认后再继续
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**何时可以跳过 brainstorming:**
|
|
43
|
+
- Harvey 指令明确包含"做 X,用 Y agent,约束 Z"
|
|
44
|
+
- 任务来自已确认的 roadmap 或 project plan
|
|
45
|
+
- 重复性任务格式固定(如 daily article fetch)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Step 3:分析细化
|
|
50
|
+
|
|
51
|
+
**与 Step 2 的边界区分:**
|
|
52
|
+
- Step 2 = 向 Harvey 澄清意图(提问 → 得到确认答案)
|
|
53
|
+
- Step 3 = 分析任务本身(不向 Harvey 提问,基于已有信息决策)
|
|
54
|
+
|
|
55
|
+
**Step 3 内容:**
|
|
56
|
+
|
|
57
|
+
1. **确定项目**:确认任务属于哪个项目(已有项目填项目名,新项目先命名)
|
|
58
|
+
2. **拆分任务**:将任务拆为具体的 subtask
|
|
59
|
+
3. **匹配 Agent**:根据任务类型匹配执行 Agent(见 `references/agent-mapping.md`)
|
|
60
|
+
4. **确认验收标准**:如何确认任务完成?
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Step 4:创建任务文档
|
|
65
|
+
|
|
66
|
+
详见 `references/task-template.md`
|
|
67
|
+
|
|
68
|
+
**路径规则:**
|
|
69
|
+
- Task 文件夹:`~/Projects/project-management/tasks/<id>/`
|
|
70
|
+
- Task 文件:`~/Projects/project-management/tasks/<id>/task.md`
|
|
71
|
+
- Issue 文件:`projects/{project}/issues/{open|closed}/<id>-<slug>.md`
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Step 5:派发任务
|
|
76
|
+
|
|
77
|
+
**优化原则:** sessions_send 消息只包含简洁指令,任务详情由目标 Agent 自行读取 Markdown 文件。
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
sessions_send({
|
|
81
|
+
sessionKey: "agent:{target-agent}:discord:channel:{channel-id}",
|
|
82
|
+
message: "📋 新任务派发\n\n" +
|
|
83
|
+
"**任务编号:** {id}\n" +
|
|
84
|
+
"**任务文件夹:** tasks/{id}/\n\n" +
|
|
85
|
+
"请读取 tasks/{id}/task.md,根据文件内容执行任务。\n" +
|
|
86
|
+
"完成后使用 task-close skill 进行收尾。",
|
|
87
|
+
timeoutSeconds: 0 // 必须为 0
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**⚠️ 重要:timeoutSeconds 必须为 0(fire-and-forget)**
|
|
92
|
+
|
|
93
|
+
**任务文件结构(Agent 读取后执行):**
|
|
94
|
+
- `id` / `project` / `assignee` / `assigner` / `priority` / `status` → frontmatter 元数据
|
|
95
|
+
- `主要目标` → 核心目标(必读)
|
|
96
|
+
- `关键约束` → 约束条件(必读)
|
|
97
|
+
- `工作流` → 分步指引(可选)
|
|
98
|
+
- `使用工具` → 可用工具列表(可选)
|
|
99
|
+
- `评估标准` → 验收标准(可选)
|
|
100
|
+
- `资料管理` → 相关资料(可选)
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 错误处理
|
|
105
|
+
|
|
106
|
+
### sessions_send 失败
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
sessions_send 返回 error?
|
|
110
|
+
├── 网络问题 → 重试 1 次,间隔 10s
|
|
111
|
+
├── session 不存在 → 检查 agent-mapping,确认 channel-id 正确
|
|
112
|
+
└── 其他 → 立即向 Harvey 汇报
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Agent 无响应
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
派发后超过预期时间无反馈?
|
|
119
|
+
├── 检查 sessions_history 确认任务状态
|
|
120
|
+
├── 若 stopReason = "lane wait exceeded" → 目标队列堵塞,向 Harvey 汇报
|
|
121
|
+
└── 若任务卡住超过 30 分钟 → 向 Harvey 汇报阻塞情况
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 重复派发
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
收到重复任务指令?
|
|
128
|
+
├── 检查 tasks/ 目录是否已有相同 id 的任务文件夹
|
|
129
|
+
├── 已有且 status ≠ done → 跳过派发,告知 Harvey
|
|
130
|
+
└── 已有但 Harvey 要求重新执行 → 更新任务文件后重新派发
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 负面示例
|
|
136
|
+
|
|
137
|
+
> **模糊指令 → 直接派发 → 任务失败**
|
|
138
|
+
|
|
139
|
+
❌ 错误做法:
|
|
140
|
+
```
|
|
141
|
+
Harvey:"研究一下 AI 模型"
|
|
142
|
+
→ 直接派给 research-scientist
|
|
143
|
+
→ Agent 问:"研究什么?哪方面?什么约束?"
|
|
144
|
+
→ 任务卡住
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
✅ 正确做法:
|
|
148
|
+
```
|
|
149
|
+
Harvey:"研究一下 AI 模型"
|
|
150
|
+
→ Step 2 触发:用 brainstorming 向 Harvey 确认
|
|
151
|
+
"研究 AI 模型——请问:(1) 具体哪类模型?(2) 研究目的是什么(选型/学习/实现)?(3) 有预算或技术栈限制吗?"
|
|
152
|
+
→ Harvey 回复:"研究本地 STT 模型,用于 Discord 语音转命令,成本敏感"
|
|
153
|
+
→ Step 3 分析:任务明确,assignee = research-scientist
|
|
154
|
+
→ Step 4 创建任务文档
|
|
155
|
+
→ Step 5 派发
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Reference 文件索引
|
|
161
|
+
|
|
162
|
+
| 文件 | 内容 |
|
|
163
|
+
|------|------|
|
|
164
|
+
| `references/task-template.md` | Task 工单格式规范(frontmatter / 正文结构 / 示例) |
|
|
165
|
+
| `references/agent-mapping.md` | Agent 通道映射(openclaw/<agent> / channel-id / 职责) |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Agent 通道映射
|
|
2
|
+
|
|
3
|
+
## 当前已登记 Agent
|
|
4
|
+
|
|
5
|
+
| Agent | openclaw/<agent> | Discord 频道 | Channel ID |
|
|
6
|
+
|-------|----------------|-------------|-----------|
|
|
7
|
+
| research-scientist | `openclaw/research-scientist` | #research-scientist | `1489128984246751242` |
|
|
8
|
+
| coding-master | `openclaw/coding-master` | #coding-master | `1484628751005515886` |
|
|
9
|
+
| writing-assistant | `openclaw/writing-assistant` | #writing-assistant | `1482389159636107474` |
|
|
10
|
+
| general-affairs | `openclaw/general-affairs` | #general-affair | `1481354036580978688` |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Agent 职责速查
|
|
15
|
+
|
|
16
|
+
| Agent | 典型任务类型 |
|
|
17
|
+
|-------|-------------|
|
|
18
|
+
| **research-scientist** | 技术调研、方案研究、竞品分析、架构设计 |
|
|
19
|
+
| **coding-master** | 代码开发、功能实现、PR 审查、Git 操作 |
|
|
20
|
+
| **writing-assistant** | 文章抓取、翻译、内容整理、文档撰写 |
|
|
21
|
+
| **general-affairs** | 日常事务、提醒设置、信息查询、配额监控 |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 通知频道
|
|
26
|
+
|
|
27
|
+
- **Channel ID:** `1484647806127050753`(#notification)
|
|
28
|
+
- **用途:** Agent 完成任务后发送 `task_complete` 通知
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## sessions_send 标准格式
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
sessions_send({
|
|
36
|
+
sessionKey: "agent:{target-agent}:discord:channel:{channel-id}",
|
|
37
|
+
message: "Task #{id} 开始执行:{标题}\n\n...",
|
|
38
|
+
timeoutSeconds: 0 // 必须为 0
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 常见错误
|
|
43
|
+
|
|
44
|
+
| 错误 | 后果 |
|
|
45
|
+
|------|------|
|
|
46
|
+
| `timeoutSeconds` 非 0 | PM session 等待目标响应时卡住 |
|
|
47
|
+
| 发到错误 channel | 目标 Agent 收不到 |
|
|
48
|
+
| 通知发到 #product-manager | 回不到原 session |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 任务派发后追踪
|
|
53
|
+
|
|
54
|
+
1. **通知查询**:去 #notification(1484647806127050753)查 `task_complete`
|
|
55
|
+
2. **兜底查询**:`sessions_history({ sessionKey: "agent:{target}:...", limit: 3 })`
|
|
56
|
+
3. **状态判断**:
|
|
57
|
+
- `stopReason: stop` = 完成
|
|
58
|
+
- `toolUse` = 进行中
|
|
59
|
+
- `lane wait exceeded` = 目标队列堵塞
|