cowork-flow 0.0.8 → 0.0.11

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "0.0.8",
3
+ "version": "0.0.11",
4
4
  "description": "CLI for installing and maintaining cowork-flow collaboration templates.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,17 +10,50 @@ 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. 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.
15
+ 4. Dispatch ready assignments using the Dispatch Protocol below.
16
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`.
17
+ 6. Record implementer outputs with `record-result` and reviewer outputs with `record-review`.
18
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.
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
+ ### Codex Orchestration Prompt
23
+
24
+ - 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.`
25
+ - 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.
26
+ - Use `/agent` in interactive CLI sessions when you need to inspect, steer, stop, or close active agent threads.
27
+
28
+ ### Fresh Worker Per Assignment
29
+
30
+ - 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.
31
+ - 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.
32
+ - Spawn a fresh worker for each ready assignment. Do not reuse the main agent context as the worker context.
33
+ - Use `agent-team/assignments/<assignment-id>.md` as the worker prompt body.
34
+ - 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.
35
+ - 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.
36
+
37
+ ### Worker Result Handling
38
+
39
+ - Wait for the consolidated Codex response for the requested batch before recording results.
40
+ - Treat worker statuses as follows:
41
+ - `DONE`: inspect changed files and verification evidence, then record `done` with `record-result`.
42
+ - `DONE_WITH_CONCERNS`: inspect the concerns before recording; retry if they affect correctness or scope.
43
+ - `NEEDS_CONTEXT`: add the missing context to the assignment or task context, then use `retry`.
44
+ - `BLOCKED`: decide whether to add context, choose a stronger agent, split the assignment, or stop for coordinator decision.
45
+
46
+ ### Review Chain
47
+
48
+ - 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.
49
+ - If the spec reviewer rejects or flags gaps, record the review result, retry the implementer with the specific gaps, then rerun the review.
50
+ - 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.
51
+ - Do not let implementer self-review replace `record-review` for spec or quality assignments.
20
52
 
21
53
  ## Rules
22
54
 
23
55
  - The script suggests; the main agent decides.
24
56
  - Do not parallelize assignments with overlapping write files.
25
57
  - Do not skip spec review or quality review.
58
+ - 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.
26
59
  - Do not rely on chat history for state; write results through `agent-team` commands.
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.11
@@ -13,10 +13,6 @@ agents:
13
13
  - code
14
14
  - test
15
15
  file_patterns:
16
- - "src/**"
17
- - "template/**"
18
- - "tests/**"
19
- - "test/**"
20
16
  risk_limits:
21
17
  max_parallel_write_conflicts: 0
22
18
  prompt: |
@@ -32,10 +28,6 @@ agents:
32
28
  - test
33
29
  - verification
34
30
  file_patterns:
35
- - "tests/**"
36
- - "test/**"
37
- - "src/**"
38
- - "template/**"
39
31
  risk_limits:
40
32
  max_parallel_write_conflicts: 0
41
33
  prompt: |
@@ -52,10 +44,6 @@ agents:
52
44
  - bugfix
53
45
  - code
54
46
  file_patterns:
55
- - "src/**"
56
- - "template/**"
57
- - "tests/**"
58
- - "test/**"
59
47
  risk_limits:
60
48
  max_parallel_write_conflicts: 0
61
49
  prompt: |
@@ -71,10 +59,6 @@ agents:
71
59
  - review
72
60
  - documentation
73
61
  file_patterns:
74
- - ".cowork-flow/changes/**"
75
- - ".cowork-flow/plans/**"
76
- - "README.md"
77
- - "template/**"
78
62
  risk_limits:
79
63
  max_parallel_write_conflicts: 0
80
64
  prompt: |
@@ -91,10 +75,6 @@ agents:
91
75
  - review
92
76
  - verification
93
77
  file_patterns:
94
- - "src/**"
95
- - "template/**"
96
- - "tests/**"
97
- - "test/**"
98
78
  risk_limits:
99
79
  max_parallel_write_conflicts: 0
100
80
  prompt: |
@@ -110,10 +90,6 @@ agents:
110
90
  - docs
111
91
  - documentation
112
92
  file_patterns:
113
- - "README.md"
114
- - "AGENTS.md"
115
- - ".cowork-flow/**/*.md"
116
- - ".agent/skills/**"
117
93
  risk_limits:
118
94
  max_parallel_write_conflicts: 0
119
95
  prompt: |
@@ -130,11 +106,6 @@ agents:
130
106
  - release
131
107
  - review
132
108
  file_patterns:
133
- - "package.json"
134
- - "package-lock.json"
135
- - "scripts/**"
136
- - "README.md"
137
- - ".cowork-flow/changes/**"
138
109
  risk_limits:
139
110
  max_parallel_write_conflicts: 0
140
111
  prompt: |
@@ -7,9 +7,10 @@ import re
7
7
  from pathlib import Path
8
8
 
9
9
 
10
- TASK_RE = re.compile(r"^### Task\s+(\d+):\s*(.+?)\s*$")
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: {assignment['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():