cowork-flow 0.0.4 → 0.0.5

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.
Files changed (37) hide show
  1. package/README.md +17 -0
  2. package/package.json +6 -4
  3. package/src/lib/copy-template.js +9 -9
  4. package/src/lib/package-info.js +8 -2
  5. package/template/.agent/skills/agent-team-execution/SKILL.md +26 -0
  6. package/template/{.superpowers → .agent/skills}/brainstorming/scripts/start-server.sh +0 -0
  7. package/template/{.superpowers → .agent/skills}/brainstorming/scripts/stop-server.sh +0 -0
  8. package/template/.agent/skills/start/SKILL.md +1 -0
  9. package/template/.cowork-flow/.version +1 -1
  10. package/template/.cowork-flow/agent-team/adapters.yaml +15 -0
  11. package/template/.cowork-flow/agent-team/agents.yaml +68 -0
  12. package/template/.cowork-flow/agent-team/policy.yaml +23 -0
  13. package/template/.cowork-flow/config.yaml +9 -0
  14. package/template/.cowork-flow/run +4 -0
  15. package/template/.cowork-flow/run.cmd +7 -0
  16. package/template/.cowork-flow/scripts/agent_team.py +508 -0
  17. package/template/.cowork-flow/scripts/common/agent_team.py +241 -0
  18. package/template/.cowork-flow/scripts/common/config.py +18 -0
  19. package/template/.cowork-flow/scripts/common/git_context.py +17 -0
  20. package/template/.cowork-flow/scripts/task.py +1 -1
  21. package/template/.cowork-flow/workflow.md +43 -159
  22. package/template/.superpowers/executing-plans/SKILL.md +2 -0
  23. package/template/AGENTS.md +3 -2
  24. /package/template/{.superpowers → .agent/skills}/brainstorming/SKILL.md +0 -0
  25. /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/frame-template.html +0 -0
  26. /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/helper.js +0 -0
  27. /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/server.cjs +0 -0
  28. /package/template/{.superpowers → .agent/skills}/brainstorming/spec-document-reviewer-prompt.md +0 -0
  29. /package/template/{.superpowers → .agent/skills}/brainstorming/visual-companion.md +0 -0
  30. /package/template/{.superpowers → .agent/skills}/requesting-code-review/SKILL.md +0 -0
  31. /package/template/{.superpowers → .agent/skills}/requesting-code-review/code-reviewer.md +0 -0
  32. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/SKILL.md +0 -0
  33. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
  34. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/implementer-prompt.md +0 -0
  35. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/spec-reviewer-prompt.md +0 -0
  36. /package/template/{.superpowers → .agent/skills}/writing-plans/SKILL.md +0 -0
  37. /package/template/{.superpowers → .agent/skills}/writing-plans/plan-document-reviewer-prompt.md +0 -0
package/README.md CHANGED
@@ -28,6 +28,7 @@ cowork-flow 是一个用于新项目初始化协作流程的模板仓库。它
28
28
  └── .cowork-flow/
29
29
  ├── config.yaml
30
30
  ├── workflow.md
31
+ ├── agent-team/
31
32
  ├── scripts/
32
33
  ├── spec/
33
34
  ├── changes/
@@ -56,6 +57,9 @@ cowork-flow 是一个用于新项目初始化协作流程的模板仓库。它
56
57
  `template/.cowork-flow/plans/`
57
58
  保存可执行步骤、验证方式和执行状态。
58
59
 
60
+ `template/.cowork-flow/agent-team/`
61
+ 保存 agent team 的项目级 registry、适配器和策略。默认适配器是 `codex`,由主 agent 调度 Codex 子 agent;没有子 agent 能力时可退回 `manual` 提示词模式。
62
+
59
63
  ## 快速开始
60
64
 
61
65
  使用 CLI 把模板内容安装到目标项目根目录:
@@ -172,6 +176,19 @@ cowork-flow sync . --dry-run
172
176
  ./.cowork-flow/run task start <task-dir>
173
177
  ```
174
178
 
179
+ 执行 plan 时准备 agent team:
180
+
181
+ 默认 `agent_team.enabled: false`。运行 `agent-team prepare/status/next/record-result/record-review/retry/complete` 前,先在 `.cowork-flow/config.yaml` 中设置 `agent_team.enabled: true`。
182
+
183
+ ```bash
184
+ ./.cowork-flow/run agent-team init
185
+ ./.cowork-flow/run agent-team prepare <task-dir> --plan <plan-file>
186
+ ./.cowork-flow/run agent-team next <task-dir>
187
+ ./.cowork-flow/run agent-team complete <task-dir>
188
+ ```
189
+
190
+ `agent-team` 命令会生成任务目录内的 dispatch plan、assignments、状态、审阅和 metrics 工件。默认 `codex` 适配器采用主 agent 调度型:脚本生成 Codex-ready 分派文件,主 agent 负责调用子 agent、协调并回写结果。
191
+
175
192
  记录 session:
176
193
 
177
194
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "CLI for installing and maintaining cowork-flow collaboration templates.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,12 +10,14 @@
10
10
  "bin",
11
11
  "src",
12
12
  "template",
13
- "README.md"
13
+ "README.md",
14
+ "!template/**/__pycache__/**",
15
+ "!template/**/*.pyc"
14
16
  ],
15
17
  "scripts": {
16
18
  "test": "node --test",
17
- "test:template": "./template/.cowork-flow/run python -m unittest discover tests -v",
18
- "pack:check": "npm_config_cache=/tmp/cowork-flow-npm-cache npm pack --dry-run --json",
19
+ "test:template": "node scripts/run-template-tests.js",
20
+ "pack:check": "node scripts/pack-check.js",
19
21
  "test:all": "npm test && npm run test:template && npm run pack:check"
20
22
  },
21
23
  "engines": {
@@ -90,9 +90,7 @@ export async function buildSuperpowersPlan(targetDir, options = {}) {
90
90
  }
91
91
 
92
92
  const PROTECTED_SYNC_FILES = new Set([
93
- 'AGENTS.md',
94
- '.cowork-flow/config.yaml',
95
- '.cowork-flow/workflow.md'
93
+ '.cowork-flow/config.yaml'
96
94
  ]);
97
95
 
98
96
  const PROTECTED_SYNC_PREFIXES = [
@@ -105,7 +103,7 @@ const PROTECTED_SYNC_PREFIXES = [
105
103
 
106
104
  const SAFE_SYNC_PREFIXES = [
107
105
  '.agent/skills/',
108
- '.cowork-flow/scripts/'
106
+ '.cowork-flow/'
109
107
  ];
110
108
 
111
109
  const SAFE_SYNC_FILES = new Set([
@@ -119,14 +117,16 @@ const COWORK_FLOW_START = '<!-- COWORK-FLOW:START -->';
119
117
  const COWORK_FLOW_END = '<!-- COWORK-FLOW:END -->';
120
118
 
121
119
  function isProtectedSyncFile(relativePath) {
122
- return PROTECTED_SYNC_FILES.has(relativePath)
123
- || PROTECTED_SYNC_PREFIXES.some((prefix) => relativePath.startsWith(prefix));
120
+ const templatePath = toTemplatePath(relativePath);
121
+ return PROTECTED_SYNC_FILES.has(templatePath)
122
+ || PROTECTED_SYNC_PREFIXES.some((prefix) => templatePath.startsWith(prefix));
124
123
  }
125
124
 
126
125
  function isSafeSyncFile(relativePath) {
127
- return SAFE_SYNC_FILES.has(relativePath)
128
- || SAFE_SYNC_PREFIXES.some((prefix) => relativePath.startsWith(prefix))
129
- || relativePath.endsWith('/.gitkeep');
126
+ const templatePath = toTemplatePath(relativePath);
127
+ return SAFE_SYNC_FILES.has(templatePath)
128
+ || SAFE_SYNC_PREFIXES.some((prefix) => templatePath.startsWith(prefix))
129
+ || templatePath.endsWith('/.gitkeep');
130
130
  }
131
131
 
132
132
  function replaceManagedBlock(targetContent, templateContent) {
@@ -31,9 +31,14 @@ export function compareVersions(left, right) {
31
31
  return 0;
32
32
  }
33
33
 
34
+ export function npmCommandOptions(platform = process.platform) {
35
+ return platform === 'win32' ? { shell: true } : {};
36
+ }
37
+
34
38
  export async function fetchLatestVersion(packageName = 'cowork-flow') {
35
39
  const result = await execFileAsync('npm', ['view', packageName, 'version'], {
36
- encoding: 'utf8'
40
+ encoding: 'utf8',
41
+ ...npmCommandOptions()
37
42
  });
38
43
  return result.stdout.trim();
39
44
  }
@@ -41,7 +46,8 @@ export async function fetchLatestVersion(packageName = 'cowork-flow') {
41
46
  export async function runGlobalInstall(packageSpec = 'cowork-flow@latest') {
42
47
  return new Promise((resolvePromise, rejectPromise) => {
43
48
  const child = spawn('npm', ['install', '-g', packageSpec], {
44
- stdio: 'inherit'
49
+ stdio: 'inherit',
50
+ ...npmCommandOptions()
45
51
  });
46
52
  child.on('error', rejectPromise);
47
53
  child.on('close', (code) => resolvePromise(code ?? 1));
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: agent-team-execution
3
+ description: Use when executing an approved implementation plan with independent tasks, multiple agents, or an explicit request to use agent team execution
4
+ ---
5
+
6
+ # Agent Team Execution
7
+
8
+ Use this skill after a task is active and an approved `.cowork-flow/plans/*.md` file is in task context.
9
+
10
+ ## Process
11
+
12
+ 1. Run `./.cowork-flow/run agent-team prepare <task-dir> --plan <plan-file>`.
13
+ 2. Review `agent-team/dispatch-plan.yaml` for unsafe parallelism, file conflicts, missing context, or weak agent matches.
14
+ 3. Run `./.cowork-flow/run agent-team next <task-dir>` to get ready assignments.
15
+ 4. In Codex, dispatch the ready assignments to the recommended agent types. Tell each worker it is not alone in the codebase, must respect the write boundary, must not revert others' edits, and must list changed files.
16
+ 5. While workers run, coordinate: answer questions, unblock context gaps, and integrate non-conflicting results.
17
+ 6. Record outputs with `record-result` and reviews with `record-review`.
18
+ 7. Use `retry` only after adding missing context, changing agent choice, or splitting an oversized assignment.
19
+ 8. Run `complete` before claiming the agent team work is done.
20
+
21
+ ## Rules
22
+
23
+ - The script suggests; the main agent decides.
24
+ - Do not parallelize assignments with overlapping write files.
25
+ - Do not skip spec review or quality review.
26
+ - Do not rely on chat history for state; write results through `agent-team` commands.
@@ -336,6 +336,7 @@ Implement the task described in `prd.md`.
336
336
  - Follow all specs injected into implement context
337
337
  - Keep changes scoped to requirements
338
338
  - Run the project verification commands from `AGENTS.md` or `.cowork-flow/config.yaml` before finishing
339
+ - If executing an approved plan with independent work, use `agent-team-execution`: run `agent-team prepare`, review the dispatch plan, use `agent-team next` for ready assignments, and finish with `agent-team complete`.
339
340
 
340
341
  **Step 9: Check Quality** `[AI]`
341
342
 
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -0,0 +1,15 @@
1
+ # Agent Team Adapters
2
+
3
+ default: codex
4
+ fallback: manual
5
+
6
+ adapters:
7
+ codex:
8
+ mode: coordinator-dispatched
9
+ description: 主 agent 使用 Codex 子 agent 工具执行脚本生成的 assignments。
10
+ output_file: adapters/codex.json
11
+
12
+ manual:
13
+ mode: prompt-only
14
+ description: 生成可复制的 assignment prompt,由人或其他宿主执行并回写结果。
15
+ output_file: adapters/manual.json
@@ -0,0 +1,68 @@
1
+ # Agent Team Registry
2
+ # Project teams may customize this file after initialization.
3
+
4
+ default_adapter: codex
5
+
6
+ agents:
7
+ implementer:
8
+ codex_type: worker
9
+ capabilities:
10
+ - implementation
11
+ - test-writing
12
+ preferred_task_types:
13
+ - code
14
+ - test
15
+ file_patterns:
16
+ - "src/**"
17
+ - "template/**"
18
+ - "tests/**"
19
+ - "test/**"
20
+ risk_limits:
21
+ max_parallel_write_conflicts: 0
22
+
23
+ spec-reviewer:
24
+ codex_type: default
25
+ capabilities:
26
+ - spec-review
27
+ - acceptance-check
28
+ preferred_task_types:
29
+ - review
30
+ - documentation
31
+ file_patterns:
32
+ - ".cowork-flow/changes/**"
33
+ - ".cowork-flow/plans/**"
34
+ - "README.md"
35
+ - "template/**"
36
+ risk_limits:
37
+ max_parallel_write_conflicts: 0
38
+
39
+ quality-reviewer:
40
+ codex_type: default
41
+ capabilities:
42
+ - code-quality-review
43
+ - test-review
44
+ preferred_task_types:
45
+ - review
46
+ - verification
47
+ file_patterns:
48
+ - "src/**"
49
+ - "template/**"
50
+ - "tests/**"
51
+ - "test/**"
52
+ risk_limits:
53
+ max_parallel_write_conflicts: 0
54
+
55
+ docs-agent:
56
+ codex_type: worker
57
+ capabilities:
58
+ - documentation
59
+ - workflow-writing
60
+ preferred_task_types:
61
+ - docs
62
+ file_patterns:
63
+ - "README.md"
64
+ - "AGENTS.md"
65
+ - ".cowork-flow/**/*.md"
66
+ - ".agent/skills/**"
67
+ risk_limits:
68
+ max_parallel_write_conflicts: 0
@@ -0,0 +1,23 @@
1
+ # Agent Team Policy
2
+
3
+ parallel:
4
+ allow_parallel_batches: true
5
+ disallow_file_write_conflicts: true
6
+ require_coordinator_review: true
7
+
8
+ reviews:
9
+ require_spec_review: true
10
+ require_quality_review: true
11
+ chain:
12
+ - implementer
13
+ - spec-reviewer
14
+ - quality-reviewer
15
+
16
+ retry:
17
+ max_attempts: 3
18
+ retry_on:
19
+ - needs_context
20
+ - failed_verification
21
+ - review_rejected
22
+ - adapter_failed
23
+ escalation: needs-coordinator-decision
@@ -14,6 +14,15 @@ session_commit_message: "chore: record journal"
14
14
  # Maximum lines per journal file before rotating to a new one
15
15
  max_journal_lines: 2000
16
16
 
17
+ #-------------------------------------------------------------------------------
18
+ # Agent Team Runtime
19
+ #-------------------------------------------------------------------------------
20
+
21
+ # Disabled by default. Set to true before using agent-team runtime commands such
22
+ # as prepare/status/next/record-result/record-review/retry/complete.
23
+ agent_team:
24
+ enabled: false
25
+
17
26
  #-------------------------------------------------------------------------------
18
27
  # Task Lifecycle Hooks
19
28
  #-------------------------------------------------------------------------------
@@ -21,6 +21,7 @@ print_usage() {
21
21
  get-developer
22
22
  init-developer
23
23
  add-session
24
+ agent-team
24
25
 
25
26
  解释器选择顺序:
26
27
  COWORK_FLOW_PYTHON -> PYTHON -> python3 -> python -> py -3
@@ -150,6 +151,9 @@ case "$command_name" in
150
151
  add-session|add_session)
151
152
  run_script "$SCRIPTS_DIR/add_session.py" "$@"
152
153
  ;;
154
+ agent-team|agent_team)
155
+ run_script "$SCRIPTS_DIR/agent_team.py" "$@"
156
+ ;;
153
157
  *)
154
158
  if [ -f "$SCRIPTS_DIR/$command_name.py" ]; then
155
159
  run_script "$SCRIPTS_DIR/$command_name.py" "$@"
@@ -31,6 +31,8 @@ if /I "%COMMAND_NAME%"=="init-developer" goto run_init_developer
31
31
  if /I "%COMMAND_NAME%"=="init_developer" goto run_init_developer
32
32
  if /I "%COMMAND_NAME%"=="add-session" goto run_add_session
33
33
  if /I "%COMMAND_NAME%"=="add_session" goto run_add_session
34
+ if /I "%COMMAND_NAME%"=="agent-team" goto run_agent_team
35
+ if /I "%COMMAND_NAME%"=="agent_team" goto run_agent_team
34
36
 
35
37
  if exist "%SCRIPTS_DIR%\%COMMAND_NAME%.py" (
36
38
  call :run_script "%SCRIPTS_DIR%\%COMMAND_NAME%.py"
@@ -81,6 +83,10 @@ exit /b %ERRORLEVEL%
81
83
  call :run_script "%SCRIPTS_DIR%\add_session.py"
82
84
  exit /b %ERRORLEVEL%
83
85
 
86
+ :run_agent_team
87
+ call :run_script "%SCRIPTS_DIR%\agent_team.py"
88
+ exit /b %ERRORLEVEL%
89
+
84
90
  :print_usage
85
91
  echo 用法:
86
92
  echo .\.cowork-flow\run.cmd ^<command^> [args...]
@@ -94,6 +100,7 @@ echo get-context
94
100
  echo get-developer
95
101
  echo init-developer
96
102
  echo add-session
103
+ echo agent-team
97
104
  echo.
98
105
  echo 解释器选择顺序:
99
106
  echo COWORK_FLOW_PYTHON -^> PYTHON -^> python3 -^> python -^> py -3