cowork-flow 0.0.4 → 0.0.7
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 +44 -1
- package/package.json +8 -5
- package/src/lib/copy-template.js +9 -9
- package/src/lib/package-info.js +8 -2
- package/template/.agent/skills/agent-team-execution/SKILL.md +26 -0
- package/template/{.superpowers → .agent/skills}/brainstorming/scripts/start-server.sh +0 -0
- package/template/{.superpowers → .agent/skills}/brainstorming/scripts/stop-server.sh +0 -0
- package/template/.agent/skills/start/SKILL.md +1 -0
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/agent-team/adapters.yaml +15 -0
- package/template/.cowork-flow/agent-team/agents.yaml +142 -0
- package/template/.cowork-flow/agent-team/policy.yaml +23 -0
- package/template/.cowork-flow/config.yaml +9 -0
- package/template/.cowork-flow/run +10 -93
- package/template/.cowork-flow/run.cmd +12 -115
- package/template/.cowork-flow/scripts/agent_team.py +584 -0
- package/template/.cowork-flow/scripts/change.py +68 -15
- package/template/.cowork-flow/scripts/common/agent_team.py +467 -0
- package/template/.cowork-flow/scripts/common/archive_utils.py +72 -0
- package/template/.cowork-flow/scripts/common/config.py +18 -0
- package/template/.cowork-flow/scripts/common/git_context.py +17 -0
- package/template/.cowork-flow/scripts/common/task_utils.py +5 -18
- package/template/.cowork-flow/scripts/run.py +92 -0
- package/template/.cowork-flow/scripts/task.py +1 -1
- package/template/.cowork-flow/workflow.md +65 -158
- package/template/.superpowers/executing-plans/SKILL.md +2 -0
- package/template/AGENTS.md +3 -2
- /package/template/{.superpowers → .agent/skills}/brainstorming/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/frame-template.html +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/helper.js +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/server.cjs +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/spec-document-reviewer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/visual-companion.md +0 -0
- /package/template/{.superpowers → .agent/skills}/requesting-code-review/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/requesting-code-review/code-reviewer.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/implementer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/spec-reviewer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/writing-plans/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/writing-plans/plan-document-reviewer-prompt.md +0 -0
|
@@ -15,6 +15,7 @@ from .paths import DIR_WORKFLOW, get_repo_root
|
|
|
15
15
|
# Defaults
|
|
16
16
|
DEFAULT_SESSION_COMMIT_MESSAGE = "chore: record journal"
|
|
17
17
|
DEFAULT_MAX_JOURNAL_LINES = 2000
|
|
18
|
+
DEFAULT_AGENT_TEAM_ENABLED = False
|
|
18
19
|
|
|
19
20
|
CONFIG_FILE = "config.yaml"
|
|
20
21
|
|
|
@@ -108,6 +109,23 @@ def get_max_journal_lines(repo_root: Path | None = None) -> int:
|
|
|
108
109
|
return DEFAULT_MAX_JOURNAL_LINES
|
|
109
110
|
|
|
110
111
|
|
|
112
|
+
def _is_true(value: object) -> bool:
|
|
113
|
+
if value is True:
|
|
114
|
+
return True
|
|
115
|
+
if isinstance(value, str):
|
|
116
|
+
return value.strip().lower() == "true"
|
|
117
|
+
return False
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def get_agent_team_enabled(repo_root: Path | None = None) -> bool:
|
|
121
|
+
"""Return whether agent-team runtime commands are enabled."""
|
|
122
|
+
config = _load_config(repo_root)
|
|
123
|
+
agent_team = config.get("agent_team")
|
|
124
|
+
if not isinstance(agent_team, dict):
|
|
125
|
+
return DEFAULT_AGENT_TEAM_ENABLED
|
|
126
|
+
return _is_true(agent_team.get("enabled"))
|
|
127
|
+
|
|
128
|
+
|
|
111
129
|
def get_hooks(event: str, repo_root: Path | None = None) -> list[str]:
|
|
112
130
|
"""Get hook commands for a lifecycle event.
|
|
113
131
|
|
|
@@ -253,6 +253,13 @@ def _task_plan_references(repo_root: Path, snapshot: CurrentTaskSnapshot) -> lis
|
|
|
253
253
|
return plan_refs
|
|
254
254
|
|
|
255
255
|
|
|
256
|
+
def _task_has_agent_team_status(repo_root: Path, snapshot: CurrentTaskSnapshot) -> bool:
|
|
257
|
+
"""Return whether the current task has persisted agent-team runtime state."""
|
|
258
|
+
if not snapshot.path:
|
|
259
|
+
return False
|
|
260
|
+
return (repo_root / snapshot.path / "agent-team" / "status.json").is_file()
|
|
261
|
+
|
|
262
|
+
|
|
256
263
|
def _build_resume_checklist(
|
|
257
264
|
repo_root: Path,
|
|
258
265
|
snapshot: CurrentTaskSnapshot,
|
|
@@ -269,6 +276,9 @@ def _build_resume_checklist(
|
|
|
269
276
|
|
|
270
277
|
current_task = snapshot.path
|
|
271
278
|
commands.append(f"./{DIR_WORKFLOW}/run task list-context {current_task}")
|
|
279
|
+
if _task_has_agent_team_status(repo_root, snapshot):
|
|
280
|
+
commands.append(f"./{DIR_WORKFLOW}/run agent-team status {current_task}")
|
|
281
|
+
commands.append(f"./{DIR_WORKFLOW}/run agent-team next {current_task}")
|
|
272
282
|
|
|
273
283
|
if snapshot.has_prd:
|
|
274
284
|
read_files.append(f"{current_task}/prd.md")
|
|
@@ -329,6 +339,13 @@ def _append_resume_checklist(
|
|
|
329
339
|
else:
|
|
330
340
|
lines.append("- No plan reference found in task context; do not search all plans unless needed.")
|
|
331
341
|
|
|
342
|
+
agent_team_commands = [
|
|
343
|
+
command for command in commands if f"./{DIR_WORKFLOW}/run agent-team " in command
|
|
344
|
+
]
|
|
345
|
+
if agent_team_commands:
|
|
346
|
+
lines.append(f"- Check agent-team status: {agent_team_commands[0]}")
|
|
347
|
+
lines.append(f"- Continue agent-team dispatch: {agent_team_commands[1]}")
|
|
348
|
+
|
|
332
349
|
lines.append("- Do not bulk-read .cowork-flow/spec/ or workspace journals; follow JSONL references on demand.")
|
|
333
350
|
lines.append("")
|
|
334
351
|
|
|
@@ -10,11 +10,11 @@ Provides:
|
|
|
10
10
|
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
|
-
import shutil
|
|
14
13
|
import sys
|
|
15
14
|
from datetime import datetime
|
|
16
15
|
from pathlib import Path
|
|
17
16
|
|
|
17
|
+
from .archive_utils import archive_directory_resumable
|
|
18
18
|
from .paths import get_repo_root
|
|
19
19
|
|
|
20
20
|
PATH_TRAVERSAL_PREFIXES = ("./", "../")
|
|
@@ -139,23 +139,10 @@ def archive_task_dir(task_dir_abs: Path, repo_root: Path | None = None) -> Path
|
|
|
139
139
|
task_name = task_dir_abs.name
|
|
140
140
|
archive_dest = month_dir / task_name
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
try:
|
|
148
|
-
shutil.move(str(task_dir_abs), str(archive_dest))
|
|
149
|
-
except (OSError, IOError, shutil.Error) as e:
|
|
150
|
-
print(f"Error: Failed to move task to archive: {e}", file=sys.stderr)
|
|
151
|
-
if archive_dest.exists() and task_dir_abs.exists():
|
|
152
|
-
print("Error: archive move left both source and target paths present.", file=sys.stderr)
|
|
153
|
-
print(f" Source: {task_dir_abs}", file=sys.stderr)
|
|
154
|
-
print(f" Target: {archive_dest}", file=sys.stderr)
|
|
155
|
-
elif archive_dest.exists():
|
|
156
|
-
print(f"Error: archive target path exists after failure: {archive_dest}", file=sys.stderr)
|
|
157
|
-
elif task_dir_abs.exists():
|
|
158
|
-
print(f"Error: source task directory is still present: {task_dir_abs}", file=sys.stderr)
|
|
142
|
+
result = archive_directory_resumable(task_dir_abs, archive_dest)
|
|
143
|
+
if not result.ok:
|
|
144
|
+
level = "Warning" if result.partial else "Error"
|
|
145
|
+
print(f"{level}: {result.message}", file=sys.stderr)
|
|
159
146
|
return None
|
|
160
147
|
|
|
161
148
|
return archive_dest
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""Shared cowork-flow command dispatcher."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
COMMAND_SCRIPTS = {
|
|
12
|
+
"resume": "resume.py",
|
|
13
|
+
"task": "task.py",
|
|
14
|
+
"change": "change.py",
|
|
15
|
+
"get-context": "get_context.py",
|
|
16
|
+
"get_context": "get_context.py",
|
|
17
|
+
"get-developer": "get_developer.py",
|
|
18
|
+
"get_developer": "get_developer.py",
|
|
19
|
+
"init-developer": "init_developer.py",
|
|
20
|
+
"init_developer": "init_developer.py",
|
|
21
|
+
"add-session": "add_session.py",
|
|
22
|
+
"add_session": "add_session.py",
|
|
23
|
+
"agent-team": "agent_team.py",
|
|
24
|
+
"agent_team": "agent_team.py",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def print_usage() -> None:
|
|
29
|
+
print(
|
|
30
|
+
"""Usage:
|
|
31
|
+
./.cowork-flow/run <command> [args...]
|
|
32
|
+
./.cowork-flow/run python [python-args...]
|
|
33
|
+
|
|
34
|
+
Common commands:
|
|
35
|
+
resume
|
|
36
|
+
task
|
|
37
|
+
change
|
|
38
|
+
get-context
|
|
39
|
+
get-developer
|
|
40
|
+
init-developer
|
|
41
|
+
add-session
|
|
42
|
+
agent-team
|
|
43
|
+
""".rstrip()
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def scripts_dir() -> Path:
|
|
48
|
+
return Path(__file__).resolve().parent
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def run_python(args: list[str]) -> int:
|
|
52
|
+
completed = subprocess.run([sys.executable, *args], check=False)
|
|
53
|
+
return int(completed.returncode)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def run_script(script_name: str, args: list[str]) -> int:
|
|
57
|
+
script_path = scripts_dir() / script_name
|
|
58
|
+
if not script_path.is_file():
|
|
59
|
+
print(f"Error: script not found: {script_path}", file=sys.stderr)
|
|
60
|
+
return 2
|
|
61
|
+
return run_python([str(script_path), *args])
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def main(argv: list[str] | None = None) -> int:
|
|
65
|
+
args = list(sys.argv[1:] if argv is None else argv)
|
|
66
|
+
if not args:
|
|
67
|
+
print_usage()
|
|
68
|
+
return 2
|
|
69
|
+
|
|
70
|
+
command = args[0]
|
|
71
|
+
rest = args[1:]
|
|
72
|
+
if command in {"-h", "--help", "help"}:
|
|
73
|
+
print_usage()
|
|
74
|
+
return 0
|
|
75
|
+
if command == "python":
|
|
76
|
+
return run_python(rest)
|
|
77
|
+
|
|
78
|
+
script_name = COMMAND_SCRIPTS.get(command)
|
|
79
|
+
if script_name is None:
|
|
80
|
+
candidate = scripts_dir() / f"{command}.py"
|
|
81
|
+
if candidate.is_file():
|
|
82
|
+
script_name = candidate.name
|
|
83
|
+
else:
|
|
84
|
+
print(f"Error: unknown cowork-flow command: {command}", file=sys.stderr)
|
|
85
|
+
print_usage()
|
|
86
|
+
return 2
|
|
87
|
+
|
|
88
|
+
return run_script(script_name, rest)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
raise SystemExit(main())
|
|
@@ -932,7 +932,7 @@ def cmd_start(args: argparse.Namespace) -> int:
|
|
|
932
932
|
|
|
933
933
|
# Convert to relative path for storage
|
|
934
934
|
try:
|
|
935
|
-
task_dir =
|
|
935
|
+
task_dir = full_path.relative_to(repo_root).as_posix()
|
|
936
936
|
except ValueError:
|
|
937
937
|
task_dir = str(full_path)
|
|
938
938
|
|
|
@@ -8,47 +8,19 @@
|
|
|
8
8
|
获取上下文 -> 阅读规范 -> 任务分级 -> 规格与计划 -> 执行实现 -> 验证审阅 -> 状态同步 -> session 记录
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
命令示例默认使用 macOS / Linux / Git Bash / WSL 写法;Windows cmd / PowerShell 中使用 `.\.cowork-flow\run.cmd <command>` 替代 `./.cowork-flow/run <command>`。
|
|
11
|
+
所有任务先明确目标和验收标准,再进入实现;所有完成结论都必须有验证证据。命令示例默认使用 macOS / Linux / Git Bash / WSL;Windows cmd / PowerShell 使用 `.\.cowork-flow\run.cmd <command>` 替代 `./.cowork-flow/run <command>`。
|
|
14
12
|
|
|
15
13
|
---
|
|
16
14
|
|
|
17
15
|
## 2. 职责边界
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`cowork-flow change`
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
- spec:外部行为与验收标准
|
|
25
|
-
- design:重要设计取舍,主要用于复杂或跨层变更
|
|
26
|
-
- change.yaml:变更状态、分级、关联 plan / task
|
|
27
|
-
- archive:完成后的行为规格归档
|
|
28
|
-
|
|
29
|
-
### 2.2 superpowers
|
|
30
|
-
|
|
31
|
-
`superpowers` 负责工作方法:
|
|
32
|
-
|
|
33
|
-
- `superpowers:brainstorming`:澄清需求、比较方案、形成设计
|
|
34
|
-
- `superpowers:writing-plans`:把设计拆成可执行计划
|
|
35
|
-
- `superpowers:test-driven-development` 是实现阶段的强制方法。除一次性原型、生成代码、纯配置文件等明确例外并经人工确认外,功能新增、缺陷修复、重构和行为变更都必须按 RED-GREEN-REFACTOR 推进:先写失败测试并确认失败原因正确,再写最小实现使测试通过,最后在测试保护下重构。复杂或难点问题:深度优先
|
|
36
|
-
- `superpowers:executing-plans`:按计划顺序执行
|
|
37
|
-
- `superpowers:subagent-driven-development`:在适合时并行拆分独立工作
|
|
38
|
-
- `superpowers:verification-before-completion`:完成前用证据验证
|
|
39
|
-
|
|
40
|
-
### 2.3 任务状态与上下文
|
|
17
|
+
| 对象 | 负责内容 |
|
|
18
|
+
|------|----------|
|
|
19
|
+
| `cowork-flow change` | 行为变更治理:`proposal` 说明为什么改,`spec` 定义外部行为与验收标准,`design` 记录复杂或跨层设计取舍,`change.yaml` 保存状态/分级/关联 plan 与 task,`archive` 归档完成后的行为规格。 |
|
|
20
|
+
| `superpowers` | 工作方法:`brainstorming` 澄清需求和方案,`writing-plans` 拆可执行计划,`test-driven-development` 约束实现,`executing-plans` 顺序执行,`subagent-driven-development` 并行拆分,`verification-before-completion` 完成前取证。 |
|
|
21
|
+
| `.cowork-flow` | 任务状态和上下文:当前开发者、当前任务、PRD、`implement/check/debug` 上下文、journal、session 记录和任务归档。 |
|
|
41
22
|
|
|
42
|
-
`.cowork-flow`
|
|
43
|
-
|
|
44
|
-
- 当前开发者身份
|
|
45
|
-
- 当前任务
|
|
46
|
-
- 任务 PRD
|
|
47
|
-
- implement / check / debug 上下文
|
|
48
|
-
- journal 与 session 记录
|
|
49
|
-
- 任务归档
|
|
50
|
-
|
|
51
|
-
执行按 superpowers 方法推进;`.cowork-flow` 不替代 superpowers,也不替代项目验证命令。
|
|
23
|
+
`.cowork-flow` 不替代 superpowers,也不替代项目验证命令。除一次性原型、生成代码、纯配置文件等明确例外并经人工确认外,功能新增、缺陷修复、重构和行为变更都必须按 RED-GREEN-REFACTOR 推进;复杂或难点问题按深度优先。
|
|
52
24
|
|
|
53
25
|
---
|
|
54
26
|
|
|
@@ -58,8 +30,8 @@
|
|
|
58
30
|
2. **规格先行**:有行为变化时,先补规格,再写计划,再实现。
|
|
59
31
|
3. **计划后编码**:复杂或行为变更任务必须先形成可执行计划。
|
|
60
32
|
4. **上下文显式化**:不要依赖记忆,把关键规范、设计、计划写入任务上下文。
|
|
61
|
-
5.
|
|
62
|
-
6.
|
|
33
|
+
5. **一次一个任务**:避免在多个无关任务之间切换。
|
|
34
|
+
6. **执行中回写状态**:plan、task、change metadata 和 journal 不应长期漂移。
|
|
63
35
|
7. **证据先于结论**:未验证前不声称完成、通过或可交付。
|
|
64
36
|
8. **经验沉淀回规范**:实现中发现的契约、坑点、规则应更新到 `.cowork-flow/spec/`。
|
|
65
37
|
|
|
@@ -69,15 +41,13 @@
|
|
|
69
41
|
|
|
70
42
|
### 4.1 初始化开发者身份
|
|
71
43
|
|
|
72
|
-
|
|
44
|
+
首次进入项目时执行;如果已经存在开发者身份,只需读取当前身份。
|
|
73
45
|
|
|
74
46
|
```bash
|
|
75
47
|
./.cowork-flow/run get-developer
|
|
76
48
|
./.cowork-flow/run init-developer <developer-name>
|
|
77
49
|
```
|
|
78
50
|
|
|
79
|
-
如果已经存在开发者身份,只需读取当前身份。
|
|
80
|
-
|
|
81
51
|
### 4.2 获取当前上下文
|
|
82
52
|
|
|
83
53
|
每次开始工作先执行:
|
|
@@ -89,13 +59,7 @@ git status
|
|
|
89
59
|
git log --oneline -10
|
|
90
60
|
```
|
|
91
61
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- 当前开发者是谁
|
|
95
|
-
- 是否存在当前任务
|
|
96
|
-
- 是否存在未归档任务
|
|
97
|
-
- 工作区是否干净
|
|
98
|
-
- 最近提交是否影响当前任务
|
|
62
|
+
至少确认当前开发者、当前任务、未归档任务、工作区状态,以及最近提交是否影响当前任务。
|
|
99
63
|
|
|
100
64
|
### 4.3 阅读固定入口文件
|
|
101
65
|
|
|
@@ -116,51 +80,11 @@ done
|
|
|
116
80
|
|
|
117
81
|
所有任务先分级,再选择流程。
|
|
118
82
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
- 小范围重构
|
|
125
|
-
- 测试补充
|
|
126
|
-
- 注释、格式、脚本清理
|
|
127
|
-
- 不改变用户可观察行为的内部调整
|
|
128
|
-
|
|
129
|
-
流程:
|
|
130
|
-
|
|
131
|
-
```text
|
|
132
|
-
任务 -> 读取规范 -> 简短计划 -> 实现 -> 验证 -> 记录 session
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### 5.2 L1:局部行为变化
|
|
136
|
-
|
|
137
|
-
适用场景:
|
|
138
|
-
|
|
139
|
-
- 单模块功能调整
|
|
140
|
-
- 单接口行为变化
|
|
141
|
-
- 局部数据处理逻辑变化
|
|
142
|
-
- 有明确边界的新能力
|
|
143
|
-
|
|
144
|
-
流程:
|
|
145
|
-
|
|
146
|
-
```text
|
|
147
|
-
cowork-flow change -> brainstorming -> writing-plans -> 任务上下文 -> 执行计划 -> 验证 -> 归档与记录
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### 5.3 L2:跨层或重要行为变化
|
|
151
|
-
|
|
152
|
-
适用场景:
|
|
153
|
-
|
|
154
|
-
- 跨前后端或跨服务变更
|
|
155
|
-
- API / DB / 消息 / 缓存 / 文件等契约变化
|
|
156
|
-
- 架构边界变化
|
|
157
|
-
- 影响发布、迁移、安全、权限或兼容性的变更
|
|
158
|
-
|
|
159
|
-
流程:
|
|
160
|
-
|
|
161
|
-
```text
|
|
162
|
-
cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上下文 -> 执行计划 -> 多视角审阅 -> 验证 -> 归档与记录
|
|
163
|
-
```
|
|
83
|
+
| 等级 | 适用场景 | 流程 |
|
|
84
|
+
|------|----------|------|
|
|
85
|
+
| L0:无外部行为变化 | 文档整理、小范围重构、测试补充、注释/格式/脚本清理、不改变用户可观察行为的内部调整 | 任务 -> 读取规范 -> 简短计划 -> 实现 -> 验证 -> 记录 session |
|
|
86
|
+
| L1:局部行为变化 | 单模块功能调整、单接口行为变化、局部数据处理逻辑变化、有明确边界的新能力 | cowork-flow change -> brainstorming -> writing-plans -> 任务上下文 -> 执行计划 -> 验证 -> 归档与记录 |
|
|
87
|
+
| L2:跨层或重要行为变化 | 跨前后端或跨服务变更;API / DB / 消息 / 缓存 / 文件等契约变化;架构边界变化;影响发布、迁移、安全、权限或兼容性的变更 | cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上下文 -> 执行计划 -> 多视角审阅 -> 验证 -> 归档与记录 |
|
|
164
88
|
|
|
165
89
|
---
|
|
166
90
|
|
|
@@ -175,13 +99,7 @@ cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上
|
|
|
175
99
|
|
|
176
100
|
### 6.2 写入任务 PRD
|
|
177
101
|
|
|
178
|
-
在任务目录创建或更新 `prd.md
|
|
179
|
-
|
|
180
|
-
- 目标
|
|
181
|
-
- 范围
|
|
182
|
-
- 验收标准
|
|
183
|
-
- 相关文件或模块
|
|
184
|
-
- 验证方式
|
|
102
|
+
在任务目录创建或更新 `prd.md`,至少包含:目标、范围、验收标准、相关文件或模块、验证方式。
|
|
185
103
|
|
|
186
104
|
### 6.3 初始化任务上下文
|
|
187
105
|
|
|
@@ -189,13 +107,7 @@ cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上
|
|
|
189
107
|
./.cowork-flow/run task init-context <task-dir> <type>
|
|
190
108
|
```
|
|
191
109
|
|
|
192
|
-
`<type>`
|
|
193
|
-
|
|
194
|
-
- `backend`
|
|
195
|
-
- `frontend`
|
|
196
|
-
- `fullstack`
|
|
197
|
-
- `test`
|
|
198
|
-
- `docs`
|
|
110
|
+
`<type>` 按任务选择:`backend`、`frontend`、`fullstack`、`test`、`docs`。
|
|
199
111
|
|
|
200
112
|
### 6.4 补充任务上下文
|
|
201
113
|
|
|
@@ -214,11 +126,11 @@ cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上
|
|
|
214
126
|
|
|
215
127
|
执行要求:
|
|
216
128
|
|
|
217
|
-
- 按 `prd.md`
|
|
218
|
-
- 遵循 `.cowork-flow/spec/`
|
|
219
|
-
-
|
|
220
|
-
- 若执行中发现行为变化升级,立即重新分级并进入 L1 / L2
|
|
221
|
-
- 执行计划中的每个实现步骤必须优先进入 `superpowers:test-driven-development`
|
|
129
|
+
- 按 `prd.md` 和上下文实现。
|
|
130
|
+
- 遵循 `.cowork-flow/spec/` 中的相关规范。
|
|
131
|
+
- 变更保持聚焦。
|
|
132
|
+
- 若执行中发现行为变化升级,立即重新分级并进入 L1 / L2 流程。
|
|
133
|
+
- 执行计划中的每个实现步骤必须优先进入 `superpowers:test-driven-development` 循环,不得先写生产代码再补测试。
|
|
222
134
|
|
|
223
135
|
---
|
|
224
136
|
|
|
@@ -252,47 +164,59 @@ cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上
|
|
|
252
164
|
.cowork-flow/plans/YYYY-MM-DD-<slug>.md
|
|
253
165
|
```
|
|
254
166
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
- 可勾选步骤
|
|
258
|
-
- 每步验证方式
|
|
259
|
-
- 当前执行状态
|
|
260
|
-
- 阻塞与决策记录位置
|
|
167
|
+
计划必须包含可勾选步骤、每步验证方式、当前执行状态、阻塞与决策记录位置。
|
|
261
168
|
|
|
262
169
|
### 7.5 同步计划与状态边界
|
|
263
170
|
|
|
264
|
-
`.cowork-flow/changes/<slug>/` 只保存 proposal、design、behavior specs 和 change.yaml
|
|
265
|
-
实现 checklist 只保存在 `.cowork-flow/plans/*.md`。
|
|
266
|
-
任务运行状态只保存在 `.cowork-flow/tasks/`。
|
|
267
|
-
|
|
268
|
-
不要在 change 目录中维护实现 checklist,避免维护两套细节状态。
|
|
171
|
+
- `.cowork-flow/changes/<slug>/` 只保存 proposal、design、behavior specs 和 `change.yaml`。
|
|
172
|
+
- 实现 checklist 只保存在 `.cowork-flow/plans/*.md`。
|
|
173
|
+
- 任务运行状态只保存在 `.cowork-flow/tasks/`。
|
|
174
|
+
- 不要在 change 目录中维护实现 checklist,避免维护两套细节状态。
|
|
269
175
|
|
|
270
176
|
### 7.6 创建或绑定任务
|
|
271
177
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
- proposal
|
|
275
|
-
- spec
|
|
276
|
-
- design,如存在
|
|
277
|
-
- implementation plan
|
|
278
|
-
- 相关 `.cowork-flow/spec/`
|
|
279
|
-
- 相关代码模式或契约文件
|
|
178
|
+
将 proposal、spec、design(如存在)、implementation plan、相关 `.cowork-flow/spec/`、相关代码模式或契约文件加入任务上下文。
|
|
280
179
|
|
|
281
180
|
### 7.7 按 superpowers 方法执行
|
|
282
181
|
|
|
283
|
-
|
|
182
|
+
执行 plan 前,先判断**是否存在适合并行执行的独立任务**。并行是优化手段,不是完成定义;`agent_team.enabled` 只决定在适合并行时优先使用哪种机制,不决定是否必须并行。
|
|
183
|
+
|
|
184
|
+
适合并行的条件包括:
|
|
284
185
|
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
-
|
|
186
|
+
- 子任务之间没有共享写文件,或共享写文件已有明确顺序边界。
|
|
187
|
+
- 子任务之间没有强顺序依赖。
|
|
188
|
+
- 每个子任务都有清晰输入、输出和验收方式。
|
|
189
|
+
- 主 agent 能在集成前独立审查每个结果。
|
|
190
|
+
- 并行带来的收益大于调度、审阅和集成成本。
|
|
191
|
+
|
|
192
|
+
不适合并行的情况包括:
|
|
193
|
+
|
|
194
|
+
- 改动集中在同一组强耦合文件。
|
|
195
|
+
- 需要密集的 TDD 红绿循环或即时反馈。
|
|
196
|
+
- parser、schema、runtime、测试需要同步演进。
|
|
197
|
+
- 子任务边界不清,拆分后的主要成本会落在集成。
|
|
198
|
+
- 任务规模小于并行调度成本。
|
|
199
|
+
|
|
200
|
+
不得为了满足流程形式而强行拆分高耦合任务。若不适合并行,必须简要记录不使用并行的理由,并在当前会话中按 plan 顺序执行。
|
|
201
|
+
|
|
202
|
+
若适合并行:
|
|
203
|
+
|
|
204
|
+
- 当 `.cowork-flow/config.yaml` 中设置 `agent_team.enabled: true` 时,使用 `./.cowork-flow/run agent-team prepare <task-dir> --plan <plan-file>` 生成调度图,再用 `./.cowork-flow/run agent-team next <task-dir>` 获取可并行 assignments,由主 agent 审核并调度 subAgent。
|
|
205
|
+
- 当 `.cowork-flow/config.yaml` 中设置 `agent_team.enabled: false` 且宿主支持 subAgent 时,可使用 `superpowers:subagent-driven-development` 开启多 agent 并行执行。
|
|
206
|
+
- 当宿主不支持 subAgent 或任务不适合并行时,使用 `superpowers:executing-plans` 或当前会话顺序执行。
|
|
207
|
+
|
|
208
|
+
无论是否并行,都必须严格遵循 `superpowers:test-driven-development`,不得先写生产代码再补测试。
|
|
288
209
|
|
|
289
210
|
执行中必须持续同步:
|
|
290
211
|
|
|
291
212
|
- plan checkbox
|
|
292
213
|
- plan 当前执行状态
|
|
293
214
|
- 任务状态
|
|
215
|
+
- agent-team status / result / review / retry 工件,如本次执行启用了 agent team
|
|
294
216
|
- 必要的 `.cowork-flow/spec/` 更新
|
|
295
217
|
|
|
218
|
+
启用 agent team 时,主 agent 仍是协调者:负责审核并行安全性、补充上下文、处理阻塞、集成结果,并在完成前运行 `./.cowork-flow/run agent-team complete <task-dir>`。
|
|
219
|
+
|
|
296
220
|
---
|
|
297
221
|
|
|
298
222
|
## 8. 验证与审阅
|
|
@@ -321,14 +245,7 @@ cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上
|
|
|
321
245
|
|
|
322
246
|
### 8.3 L2 额外审阅
|
|
323
247
|
|
|
324
|
-
L2
|
|
325
|
-
|
|
326
|
-
- 行为契约
|
|
327
|
-
- 数据流
|
|
328
|
-
- 错误处理
|
|
329
|
-
- 兼容性
|
|
330
|
-
- 测试覆盖
|
|
331
|
-
- 发布或迁移风险
|
|
248
|
+
L2 任务完成前需要多视角审阅:行为契约、数据流、错误处理、兼容性、测试覆盖、发布或迁移风险。
|
|
332
249
|
|
|
333
250
|
---
|
|
334
251
|
|
|
@@ -336,13 +253,7 @@ L2 任务完成前需要多视角审阅:
|
|
|
336
253
|
|
|
337
254
|
### 9.1 收尾前同步状态
|
|
338
255
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
- 当前 task 状态准确
|
|
342
|
-
- plan checkbox 与真实进度一致
|
|
343
|
-
- change metadata 与 plan 高层状态一致
|
|
344
|
-
- `.cowork-flow/spec/` 已沉淀必要经验
|
|
345
|
-
- 工作区状态清晰
|
|
256
|
+
结束前确认当前 task 状态、plan checkbox、change metadata、必要的 `.cowork-flow/spec/` 沉淀和工作区状态都与真实进度一致。
|
|
346
257
|
|
|
347
258
|
### 9.2 记录 session
|
|
348
259
|
|
|
@@ -370,7 +281,7 @@ L2 任务完成前需要多视角审阅:
|
|
|
370
281
|
|
|
371
282
|
---
|
|
372
283
|
|
|
373
|
-
## 10.
|
|
284
|
+
## 10. 状态持久化与恢复
|
|
374
285
|
|
|
375
286
|
长任务必须把关键状态写入文件,而不是只留在聊天上下文中。
|
|
376
287
|
|
|
@@ -387,11 +298,7 @@ L2 任务完成前需要多视角审阅:
|
|
|
387
298
|
|
|
388
299
|
如果状态只存在于对话中,就不能视为可靠流程状态。
|
|
389
300
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
## 11. 恢复与上下文压缩
|
|
393
|
-
|
|
394
|
-
多轮对话、长任务、中断恢复或上下文压缩后,必须先走最小恢复层,再按需读取细节。
|
|
301
|
+
### 10.1 恢复分层
|
|
395
302
|
|
|
396
303
|
| 层级 | 读取内容 | 使用时机 |
|
|
397
304
|
|------|----------|----------|
|
|
@@ -399,7 +306,7 @@ L2 任务完成前需要多视角审阅:
|
|
|
399
306
|
| 任务执行层 | 当前任务 `prd.md`、当前 plan 状态、`task.py list-context <task-dir>` | 准备继续实现或检查前 |
|
|
400
307
|
| 细节规范层 | jsonl 指向的具体 spec、代码模式或计划段落 | 当前修改确实需要该细节时 |
|
|
401
308
|
|
|
402
|
-
|
|
309
|
+
### 10.2 恢复规则
|
|
403
310
|
|
|
404
311
|
- 先执行 `./.cowork-flow/run resume`。
|
|
405
312
|
- 按 `RESUME CHECKLIST` 读取当前 PRD、当前 plan 和 `list-context` 输出。
|
|
@@ -411,7 +318,7 @@ L2 任务完成前需要多视角审阅:
|
|
|
411
318
|
|
|
412
319
|
---
|
|
413
320
|
|
|
414
|
-
##
|
|
321
|
+
## 11. 禁止事项
|
|
415
322
|
|
|
416
323
|
- 不跳过上下文读取直接编码。
|
|
417
324
|
- 不在未验证时声称完成。
|
|
@@ -422,7 +329,7 @@ L2 任务完成前需要多视角审阅:
|
|
|
422
329
|
|
|
423
330
|
---
|
|
424
331
|
|
|
425
|
-
##
|
|
332
|
+
## 12. 完成定义
|
|
426
333
|
|
|
427
334
|
一个任务只有在以下条件同时满足时,才算完成:
|
|
428
335
|
|
|
@@ -13,6 +13,8 @@ Load plan, review critically, execute all tasks, report when complete.
|
|
|
13
13
|
|
|
14
14
|
**Note:** Tell your human partner that Superpowers works much better with access to subagents. The quality of its work will be significantly higher if run on a platform with subagent support (such as Claude Code or Codex). If subagents are available, use superpowers:subagent-driven-development instead of this skill.
|
|
15
15
|
|
|
16
|
+
If the project includes cowork-flow `agent-team` runtime and the plan has independent tasks, prefer `agent-team-execution` so dispatch plans, results, reviews, retries, and metrics are persisted in the task directory.
|
|
17
|
+
|
|
16
18
|
## The Process
|
|
17
19
|
|
|
18
20
|
### Step 1: Load and Review Plan
|
package/template/AGENTS.md
CHANGED
|
@@ -106,8 +106,9 @@
|
|
|
106
106
|
3. 任何会修改仓库文件的请求,都必须先分级为 `L0` / `L1` / `L2`,再进入对应流程;不要把“很小”当成可以绕过流程的理由。
|
|
107
107
|
4. `L1` / `L2` 行为变更必须先有 `change -> spec -> plan`;`L2` 还必须有 `design.md`,然后才能进入实现。
|
|
108
108
|
5. 实现前必须把任务上下文写入 `.cowork-flow/tasks/<task>/implement.jsonl`、`check.jsonl`、`debug.jsonl`,并在 `start` 之后再改代码。
|
|
109
|
-
6.
|
|
110
|
-
7.
|
|
109
|
+
6. 执行 plan 时,如存在可独立并行任务,且 `.cowork-flow/config.yaml` 中已设置 `agent_team.enabled: true`,可使用 `./.cowork-flow/run agent-team prepare <task-dir> --plan <plan-file>` 与 `agent-team next` 生成并执行 agent-team 调度;主 agent 仍负责协调、审阅和状态回写。
|
|
110
|
+
7. 收尾前必须跑验证、同步 plan / task / change 状态,完成 `finish-work` 检查,再按项目策略记录 session。
|
|
111
|
+
8. 多轮对话、长任务恢复或上下文压缩后,先运行 `./.cowork-flow/run resume` 并查看 `RESUME CHECKLIST`;只读取清单列出的 PRD、当前 plan 和 jsonl 引用,不要全量重读 `.cowork-flow/spec/` 或历史 journal。
|
|
111
112
|
|
|
112
113
|
Use the `.agent/skills/start` skill when starting a new session to:
|
|
113
114
|
- Initialize your developer identity
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/template/{.superpowers → .agent/skills}/brainstorming/spec-document-reviewer-prompt.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/template/{.superpowers → .agent/skills}/subagent-driven-development/implementer-prompt.md
RENAMED
|
File without changes
|
/package/template/{.superpowers → .agent/skills}/subagent-driven-development/spec-reviewer-prompt.md
RENAMED
|
File without changes
|
|
File without changes
|
/package/template/{.superpowers → .agent/skills}/writing-plans/plan-document-reviewer-prompt.md
RENAMED
|
File without changes
|