cowork-flow 0.0.9 → 0.0.12
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/package.json
CHANGED
|
@@ -10,20 +10,61 @@ Use this skill after a task is active and an approved `.cowork-flow/plans/*.md`
|
|
|
10
10
|
## Process
|
|
11
11
|
|
|
12
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.
|
|
13
|
+
2. Review `agent-team/dispatch-plan.yaml` for unsafe parallelism, file conflicts, missing context, or weak agent matches. If the graph is unsafe, fix the plan dependencies or split assignments, then rerun `prepare`.
|
|
14
14
|
3. Run `./.cowork-flow/run agent-team next <task-dir>` to get ready assignments.
|
|
15
|
-
4.
|
|
16
|
-
5.
|
|
17
|
-
6.
|
|
18
|
-
7.
|
|
19
|
-
8.
|
|
20
|
-
9.
|
|
21
|
-
|
|
15
|
+
4. Dispatch ready assignments using the Dispatch Protocol below.
|
|
16
|
+
5. While workers run, coordinate: answer questions, unblock context gaps, and integrate non-conflicting results.
|
|
17
|
+
6. Record implementer outputs with `record-result` and reviewer outputs with `record-review`.
|
|
18
|
+
7. Use `retry` only after adding missing context, changing agent choice, or splitting an oversized assignment.
|
|
19
|
+
8. Repeat `next -> dispatch -> record` until no assignments remain.
|
|
20
|
+
9. Run `./.cowork-flow/run agent-team complete <task-dir>` before claiming the agent team work is done.
|
|
21
|
+
|
|
22
|
+
## Dispatch Protocol
|
|
23
|
+
|
|
24
|
+
Do not invoke `superpowers:subagent-driven-development` from this skill. Agent-team has its own persisted state machine; use Codex subagent orchestration directly and keep `agent-team` as the source of truth for ready assignments, results, reviews, retries, and completion.
|
|
25
|
+
|
|
26
|
+
### Codex Orchestration Prompt
|
|
27
|
+
|
|
28
|
+
- Ask Codex explicitly to spawn subagents. Use this wording for each ready batch: `Spawn one <agent_type> agent per ready assignment, wait for all requested results, and summarize each result by assignment id.`
|
|
29
|
+
- Codex handles spawning, routing follow-up instructions, waiting for results, and closing completed agent threads. Do not look for an `agent-team` spawn subcommand; the Python script only prepares state and prompts.
|
|
30
|
+
- Use `/agent` in interactive CLI sessions when you need to inspect, steer, stop, or close active agent threads.
|
|
31
|
+
|
|
32
|
+
### Subagent Evidence Gate
|
|
33
|
+
|
|
34
|
+
- Do not treat wording in the final answer as evidence that a subagent actually ran. Phrases like "worker reported" or "explorer agent result" can be produced by the parent agent without a real child thread.
|
|
35
|
+
- Before recording any assignment result, confirm real subagent evidence from the Codex host: visible subagent activity in the app or CLI, `/agent` showing the child thread, JSON event output whose item type shows an agent thread or agent job, or a successful `spawn_agents_on_csv` output written by child workers.
|
|
36
|
+
- If no subagent evidence appears, stop before `record-result` or `record-review`. Report that the Codex runtime did not expose or start subagents for this batch, include the exact dispatch prompt or command used, and keep the assignment ready for retry in a working runtime.
|
|
37
|
+
- In `codex exec --json` experiments, inspect the event stream. A run that only shows the parent thread plus ordinary `command_execution` items is not a successful subagent dispatch, even if the final answer claims an agent result.
|
|
38
|
+
|
|
39
|
+
### Fresh Worker Per Assignment
|
|
40
|
+
|
|
41
|
+
- Spawn one agent per ready assignment. Use the assignment's `agent_type` as the Codex spawn target; built-in Codex agent types include `default`, `worker`, and `explorer`, and project or personal custom agents may add more.
|
|
42
|
+
- Treat `recommended_agent` as the agent-team registry match and prompt source, not as the Codex spawn target unless it also names a real Codex custom agent.
|
|
43
|
+
- Spawn a fresh worker for each ready assignment. Do not reuse the main agent context as the worker context.
|
|
44
|
+
- Use `agent-team/assignments/<assignment-id>.md` as the worker prompt body.
|
|
45
|
+
- Add this scene-setting to every worker prompt: it is not alone in the codebase, it must respect the listed write boundary, it must not revert other agents' edits, and it must report changed files plus exact verification commands.
|
|
46
|
+
- Dispatch multiple ready assignments in parallel only after confirming their write files do not overlap. If they overlap, dispatch them sequentially or repair the dependency graph.
|
|
47
|
+
|
|
48
|
+
### Worker Result Handling
|
|
49
|
+
|
|
50
|
+
- Wait for the consolidated Codex response for the requested batch before recording results.
|
|
51
|
+
- Treat worker statuses as follows:
|
|
52
|
+
- `DONE`: inspect changed files and verification evidence, then record `done` with `record-result`.
|
|
53
|
+
- `DONE_WITH_CONCERNS`: inspect the concerns before recording; retry if they affect correctness or scope.
|
|
54
|
+
- `NEEDS_CONTEXT`: add the missing context to the assignment or task context, then use `retry`.
|
|
55
|
+
- `BLOCKED`: decide whether to add context, choose a stronger agent, split the assignment, or stop for coordinator decision.
|
|
56
|
+
|
|
57
|
+
### Review Chain
|
|
58
|
+
|
|
59
|
+
- After an implementer is recorded, let `agent-team next` unlock that task's spec reviewer. Dispatch the reviewer as a fresh worker using its generated assignment prompt.
|
|
60
|
+
- If the spec reviewer rejects or flags gaps, record the review result, retry the implementer with the specific gaps, then rerun the review.
|
|
61
|
+
- Only after spec review is approved should the quality reviewer run. If quality review rejects, retry the implementer with the specific issues and rerun the review chain.
|
|
62
|
+
- Do not let implementer self-review replace `record-review` for spec or quality assignments.
|
|
22
63
|
|
|
23
64
|
## Rules
|
|
24
65
|
|
|
25
66
|
- The script suggests; the main agent decides.
|
|
26
67
|
- Do not parallelize assignments with overlapping write files.
|
|
27
68
|
- Do not skip spec review or quality review.
|
|
28
|
-
- In Codex, `agent-team` is coordinator-dispatched: the Python script generates assignments, and the main agent performs the real
|
|
69
|
+
- In Codex, `agent-team` is coordinator-dispatched: the Python script generates assignments, and the main agent performs the real subagent dispatch calls while preserving `agent-team` state.
|
|
29
70
|
- Do not rely on chat history for state; write results through `agent-team` commands.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.12
|
|
@@ -10,6 +10,7 @@ from pathlib import Path
|
|
|
10
10
|
TASK_RE = re.compile(r"^#{2,3} Task\s+(\d+):\s*(.+?)\s*$")
|
|
11
11
|
FILE_RE = re.compile(r"^-\s+(Create|Modify|Test):\s+`([^`]+)`")
|
|
12
12
|
DEP_RE = re.compile(r"depends on Task\s+(\d+)", re.IGNORECASE)
|
|
13
|
+
TERMINAL_TASK_RE = re.compile(r"(final|integration|verify|verification|验收|集成|最终|全量|收尾)", re.IGNORECASE)
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def parse_plan(text: str) -> list[dict[str, object]]:
|
|
@@ -99,6 +100,25 @@ def _task_dependencies(tasks: list[dict[str, object]]) -> list[dict[str, str]]:
|
|
|
99
100
|
}
|
|
100
101
|
)
|
|
101
102
|
|
|
103
|
+
title = task.get("title", "")
|
|
104
|
+
if isinstance(title, str) and TERMINAL_TASK_RE.search(title):
|
|
105
|
+
existing = {
|
|
106
|
+
dependency["depends_on_task"]
|
|
107
|
+
for dependency in dependencies
|
|
108
|
+
if dependency["task"] == task_id
|
|
109
|
+
}
|
|
110
|
+
for previous in tasks[:index]:
|
|
111
|
+
previous_id = str(previous["id"])
|
|
112
|
+
if previous_id in existing:
|
|
113
|
+
continue
|
|
114
|
+
dependencies.append(
|
|
115
|
+
{
|
|
116
|
+
"task": task_id,
|
|
117
|
+
"depends_on_task": previous_id,
|
|
118
|
+
"reason": "terminal-task",
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
|
|
102
122
|
return dependencies
|
|
103
123
|
|
|
104
124
|
|
|
@@ -447,14 +467,18 @@ def _render_named_items(title: str, items: object) -> list[str]:
|
|
|
447
467
|
|
|
448
468
|
|
|
449
469
|
def render_assignment_prompt(assignment: dict[str, object]) -> str:
|
|
470
|
+
agent_type = assignment["agent_type"]
|
|
450
471
|
lines = [
|
|
451
472
|
f"# {assignment['id']}",
|
|
452
473
|
"",
|
|
453
474
|
f"Role: {assignment['role']}",
|
|
454
475
|
f"Recommended agent: {assignment['recommended_agent']}",
|
|
455
|
-
f"Agent type: {
|
|
476
|
+
f"Agent type: {agent_type}",
|
|
477
|
+
f"Spawn target agent type: {agent_type}",
|
|
456
478
|
f"Task: {assignment.get('title', '')}",
|
|
457
479
|
"",
|
|
480
|
+
f"Spawn one {agent_type} agent for this assignment. Use this file as the complete worker prompt.",
|
|
481
|
+
"",
|
|
458
482
|
]
|
|
459
483
|
agent_prompt = assignment.get("agent_prompt")
|
|
460
484
|
if isinstance(agent_prompt, str) and agent_prompt.strip():
|
|
@@ -224,13 +224,13 @@ done
|
|
|
224
224
|
- 子任务边界不清,拆分后的主要成本会落在集成。
|
|
225
225
|
- 任务规模小于 subagent 调度成本。
|
|
226
226
|
|
|
227
|
-
若不适合使用 subagent
|
|
227
|
+
若不适合使用 subagent,必须简要记录理由,并按 `superpowers`方法论执行。
|
|
228
228
|
|
|
229
229
|
若适合使用 subagent:
|
|
230
230
|
|
|
231
231
|
- 当 `.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。
|
|
232
|
-
- 当 `agent_team.enabled: false`
|
|
233
|
-
- 当宿主不支持 subAgent
|
|
232
|
+
- 当 `agent_team.enabled: false` 或者`agent_team`执行失败,使用 `superpowers`并行执行 或宿主等价机制开启多 agent 执行。
|
|
233
|
+
- 当宿主不支持 subAgent 或任务不适合拆分时,按 `superpowers`方法论执行。
|
|
234
234
|
|
|
235
235
|
无论是否使用 subagent,都必须严格遵循 `superpowers:test-driven-development`,不得先写生产代码再补测试。
|
|
236
236
|
|