cowork-flow 0.0.7 → 0.0.9

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.7",
3
+ "version": "0.0.9",
4
4
  "description": "CLI for installing and maintaining cowork-flow collaboration templates.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,15 +12,18 @@ Use this skill after a task is active and an approved `.cowork-flow/plans/*.md`
12
12
  1. Run `./.cowork-flow/run agent-team prepare <task-dir> --plan <plan-file>`.
13
13
  2. Review `agent-team/dispatch-plan.yaml` for unsafe parallelism, file conflicts, missing context, or weak agent matches.
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.
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.
15
+ 4. In Codex with `[features] multi_agent = true`, dispatch each ready assignment with `spawn_agent` using the generated `agent-team/assignments/<assignment-id>.md` prompt content. Dispatch multiple ready assignments in parallel only after confirming their write files do not overlap.
16
+ 5. Collect each spawned worker result with `wait_agent`, then call `close_agent` to free the worker slot. 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.
17
+ 6. Only fall back to manual prompt execution when the current host does not expose `spawn_agent`, `wait_agent`, or `close_agent`. Do not use manual execution merely because the assignment is stored as Markdown.
18
+ 7. While workers run, coordinate: answer questions, unblock context gaps, and integrate non-conflicting results.
19
+ 8. Record outputs with `record-result` and reviews with `record-review`.
20
+ 9. Use `retry` only after adding missing context, changing agent choice, or splitting an oversized assignment.
21
+ 10. Run `complete` before claiming the agent team work is done.
20
22
 
21
23
  ## Rules
22
24
 
23
25
  - The script suggests; the main agent decides.
24
26
  - Do not parallelize assignments with overlapping write files.
25
27
  - 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 `spawn_agent` / `wait_agent` / `close_agent` calls.
26
29
  - Do not rely on chat history for state; write results through `agent-team` commands.
@@ -1,66 +1,27 @@
1
1
  ---
2
2
  name: start
3
- description: Use when beginning a development session in a project that uses the cowork-flow template
3
+ description: Use when starting or resuming work in a project that uses the cowork-flow template, after context compression, or before any request that may modify repository files. Initialize session context and route work into the L0/L1/L2 workflow.
4
4
  ---
5
5
 
6
6
  # Start Session
7
7
 
8
- Initialize your AI development session and begin working on tasks.
8
+ Use this skill as the entrypoint for cowork-flow projects.
9
9
 
10
- <HARD-GATE>
11
- Any request that changes repository files MUST go through this skill's task workflow.
12
- Questions may be answered directly, but file edits are at least `L0` and require a task,
13
- PRD, context initialization, task activation, verification, and session recording.
14
- Do not use a direct-edit shortcut unless the user explicitly tells you not to use
15
- cowork-flow for this task.
16
- </HARD-GATE>
10
+ Any request that changes repository files MUST first be classified as `L0`, `L1`, or `L2`, then follow the matching workflow in `.cowork-flow/workflow.md`.
11
+ Do not use direct-edit shortcuts unless the user explicitly tells you not to use cowork-flow for this task.
17
12
 
18
- ---
19
-
20
- ## Operation Types
21
-
22
- | Marker | Meaning | Executor |
23
- |--------|---------|----------|
24
- | `[AI]` | Bash scripts or tool calls executed by AI | You (AI) |
25
- | `[USER]` | Skills executed by user | User |
26
-
27
- ---
13
+ ## Start
28
14
 
29
- ## Initialization `[AI]`
30
-
31
- ### Step 1: Understand Development Workflow
32
-
33
- First, read the workflow guide and the project-level collaboration rules:
15
+ 1. Read `AGENTS.md` and `.cowork-flow/workflow.md`.
16
+ 2. Run `./.cowork-flow/run resume`.
17
+ 3. If developer identity is missing, run:
34
18
 
35
19
  ```bash
36
- cat .cowork-flow/workflow.md
37
- cat AGENTS.md
20
+ ./.cowork-flow/run get-developer
21
+ ./.cowork-flow/run init-developer <developer-name>
38
22
  ```
39
23
 
40
- **Follow the instructions in `workflow.md` and `AGENTS.md`** - they contain:
41
- - Core principles (Read Before Write, Follow Standards, etc.)
42
- - File system structure
43
- - Development process
44
- - Best practices
45
- - Project-specific collaboration and documentation rules
46
-
47
- Command examples use macOS / Linux / Git Bash / WSL syntax. In native Windows
48
- cmd or PowerShell, replace `./.cowork-flow/run <command>` with
49
- `.\.cowork-flow\run.cmd <command>`.
50
-
51
- > **Important**:
52
- > Reusable skills are already part of the template. During project onboarding, put project-specific facts in `AGENTS.md`, `.cowork-flow/workflow.md`, `.cowork-flow/config.yaml`, and `.cowork-flow/spec/` rather than editing `SKILL.md`.
53
-
54
- ### Step 2: Get Current Context
55
-
56
- ```bash
57
- ./.cowork-flow/run resume
58
- ```
59
-
60
- This shows: developer identity, git status, current task (if any), active tasks, and
61
- the minimal `RESUME CHECKLIST` for loading task details on demand.
62
-
63
- ### Step 3: Read Guidelines Index
24
+ 4. Read only the spec index files:
64
25
 
65
26
  ```bash
66
27
  for f in .cowork-flow/spec/frontend/index.md .cowork-flow/spec/backend/index.md .cowork-flow/spec/guides/index.md; do
@@ -68,361 +29,55 @@ for f in .cowork-flow/spec/frontend/index.md .cowork-flow/spec/backend/index.md
68
29
  done
69
30
  ```
70
31
 
71
- > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
72
- > At this step, just read the indexes to understand what's available.
73
- > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist.
74
-
75
- ### Step 4: Report and Ask
76
-
77
- Report what you learned and ask: "What would you like to work on?"
32
+ 5. Report current context:
33
+ - current developer
34
+ - current task
35
+ - active tasks
36
+ - worktree state
37
+ - anything that may affect the next step
78
38
 
79
- ---
80
-
81
- ## Task Classification
82
-
83
- When user describes a task, classify it:
84
-
85
- | Type | Criteria | Workflow |
86
- |------|----------|----------|
87
- | **Question** | User asks about code, architecture, or how something works, and no repository files need to change | Answer directly after session context is loaded |
88
- | **L0 Change** | Docs, tests, comments, config, small refactors, or any file change without external behavior change | Task Workflow, no Behavior Change Gate |
89
- | **L1 Change** | Bounded behavior change in one module or one interface | Behavior Change Gate → Task Workflow |
90
- | **L2 Change** | Cross-layer, architectural, migration, permission, compatibility, release, or security-impacting change | Behavior Change Gate + `design.md` → Task Workflow |
91
- | **Unclear / Complex** | Vague goal, multiple possible interpretations, or architectural decisions | **Brainstorm → classify L0/L1/L2 → gated workflow** |
92
-
93
- ### Decision Rule
39
+ Command examples use macOS / Linux / Git Bash / WSL syntax. In native Windows cmd or PowerShell, replace `./.cowork-flow/run <command>` with `.\.cowork-flow\run.cmd <command>`.
94
40
 
95
- > **Any file change must enter L0 / L1 / L2 workflow.**
96
- >
97
- > A typo, comment, one-line fix, or "quick" change is still a repository change.
98
- > Do not treat small size as permission to skip PRD, context, verification, or session recording.
99
- >
100
- > **If in doubt, use Brainstorm + Task Workflow.**
101
- >
102
- > Task Workflow ensures code-specs are injected to the right context, resulting in higher quality code.
103
- > The overhead is minimal, but the benefit is significant.
41
+ ## Route The Request
104
42
 
105
- > **Subtask Decomposition**: If brainstorm reveals multiple independent work items,
106
- > consider creating subtasks using `--parent` flag or `add-subtask` command.
107
- > See the brainstorm skill's Step 8 for details.
43
+ After context is loaded, choose exactly one path.
108
44
 
109
- ### Behavior Change Gate
45
+ ### Question Only
110
46
 
111
- Before entering Task Workflow, classify the change as `L0` / `L1` / `L2` using `.cowork-flow/workflow.md`.
47
+ Use this path when the user only wants explanation, analysis, or review, and no repository files need to change.
112
48
 
113
- - `L0`: No external behavior change. Continue with the existing Task Workflow.
114
- - `L1`: Behavior change in a bounded module. Do **not** go straight to PRD/Research. First run:
115
- 1. `./.cowork-flow/run change create <slug>`
116
- 2. `superpowers:brainstorming` to create or complete `proposal/spec`
117
- 3. `./.cowork-flow/run change validate <slug>`
118
- 4. `superpowers:writing-plans` to produce the implementation plan
119
- - `L2`: Same as `L1`, plus required `design.md`. Multi-perspective review happens after implementation in the review gate.
49
+ - Answer directly.
50
+ - If the request turns into a file change, stop and reclassify it as `L0`, `L1`, or `L2`.
120
51
 
121
- Only return to the task workflow after the spec and plan gates are complete.
52
+ ### Repository Change
122
53
 
123
- Before Phase 2, always complete this task handoff:
124
-
125
- 1. Create or update `.cowork-flow/plans/YYYY-MM-DD-<slug>.md` with the execution checklist
126
- 2. Create or bind a task directory
127
- 3. Ensure `prd.md` summarizes the approved `proposal/spec/design/plan`
128
- 4. Add the approved change artifacts and plan into task context
129
- 5. Treat the plan file as a living execution artifact: keep checkbox state and current execution status synced during implementation, not only at the end
130
-
131
- - If the task came from **Simple Task**, resume with **Path B Step 2 (Create Task Directory)** and **Step 3 (Write PRD)**, then do the task handoff above and continue to Phase 2.
132
- - If the task came from **Brainstorm**, reuse the brainstorm-created task directory and PRD, then do the same task handoff and continue with **Path A / Phase 2**.
133
-
134
- ---
54
+ Use this path for any repository edit, including small docs, comments, tests, refactors, or behavior changes.
135
55
 
136
- ## Question Only
56
+ 1. Classify the task using `.cowork-flow/workflow.md`:
57
+ - `L0`: no external behavior change
58
+ - `L1`: bounded behavior change
59
+ - `L2`: cross-layer or important behavior change
60
+ 2. Follow the matching workflow in `.cowork-flow/workflow.md`:
61
+ - `L0`: section 6
62
+ - `L1` / `L2`: section 7
63
+ 3. Before editing files, ensure task context exists under `.cowork-flow/tasks/<task>/`.
64
+ 4. Before handoff, follow workflow verification, state sync, and session recording requirements.
137
65
 
138
- For questions that do not modify repository files, work directly:
139
-
140
- 1. Answer the question.
141
- 2. If the answer reveals that files should change, stop and re-enter Task Classification.
142
- 3. Do not modify files from this section.
143
-
144
- ---
145
-
146
- ## L0 / Simple Task
147
-
148
- For simple, well-defined tasks that modify files without external behavior change:
149
-
150
- 1. Clarify only if the goal, scope, or verification method is unclear.
151
- 2. Determine whether the task is `L0`, `L1`, or `L2`.
152
- 3. **If it is `L1/L2`, complete the Behavior Change Gate first. After that, execute Path B Step 2 and Step 3, complete the task handoff, then continue with Phase 2.**
153
- 4. **If it is `L0`, execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps. Do NOT switch to ad hoc direct editing.**
154
- - Create task directory (Phase 1 Path B, Step 2)
155
- - Write PRD (Step 3)
156
- - Research codebase (Phase 2, Step 5)
157
- - Configure context (Step 6)
158
- - Activate task (Step 7)
159
- - Implement (Phase 3, Step 8)
160
- - Check quality (Step 9)
161
- - Complete (Step 10)
162
-
163
- ---
66
+ Do not maintain a second implementation checklist in this skill.
164
67
 
165
- ## Complex Task - Brainstorm First
68
+ ## Required Routing Rules
166
69
 
167
- For complex or vague tasks, **automatically start the brainstorm process** — do NOT skip directly to implementation.
168
-
169
- See `$brainstorm` for the full process. Summary:
170
-
171
- 1. **Acknowledge and classify** - State your understanding
172
- 2. **Create task directory** - Track evolving requirements in `prd.md`
173
- 3. **Ask questions one at a time** - Update PRD after each answer
174
- 4. **Propose approaches** - For architectural decisions
175
- 5. **Confirm final requirements** - Get explicit approval
176
- 6. **If behavior changes are involved, complete the Behavior Change Gate**
177
- 7. **Proceed to Task Workflow** - Reuse the brainstorm-created task directory/PRD, complete the task handoff, then continue from Phase 2 with clear requirements and plan
178
-
179
- ---
180
-
181
- ## Task Workflow (Development Tasks)
182
-
183
- **Why this workflow?**
184
- - Run a dedicated research pass before coding
185
- - Configure specs in jsonl context files
186
- - Implement using injected context
187
- - Verify with a separate check pass
188
- - Result: Code that follows project conventions automatically
189
-
190
- ### Overview: Two Entry Points
191
-
192
- ```
193
- From Brainstorm (Complex Task):
194
- PRD confirmed → Research → Configure Context → Activate → Implement → Check → Complete
195
-
196
- From Simple Task:
197
- Confirm → Create Task → Write PRD → Research → Configure Context → Activate → Implement → Check → Complete
198
- ```
199
-
200
- **Key principle: Research happens AFTER requirements are clear (PRD exists).**
201
-
202
- ---
203
-
204
- ### Phase 1: Establish Requirements
205
-
206
- #### Path A: From Brainstorm (skip to Phase 2)
207
-
208
- PRD and task directory already exist from brainstorm. Skip directly to Phase 2.
209
-
210
- #### Path B: From Simple Task
211
-
212
- **Step 1: Confirm Understanding** `[AI]`
213
-
214
- Quick confirm:
215
- - What is the goal?
216
- - What type of development? (frontend / backend / fullstack)
217
- - Any specific requirements or constraints?
218
-
219
- If unclear, ask clarifying questions.
220
-
221
- **Step 2: Create Task Directory** `[AI]`
222
-
223
- ```bash
224
- TASK_DIR=$(./.cowork-flow/run task create "<title>" --slug <name>)
225
- ```
226
-
227
- **Step 3: Write PRD** `[AI]`
228
-
229
- Create `prd.md` in the task directory with:
230
-
231
- ```markdown
232
- # <Task Title>
233
-
234
- ## Goal
235
- <What we're trying to achieve>
236
-
237
- ## Requirements
238
- - <Requirement 1>
239
- - <Requirement 2>
240
-
241
- ## Acceptance Criteria
242
- - [ ] <Criterion 1>
243
- - [ ] <Criterion 2>
244
-
245
- ## Technical Notes
246
- <Any technical decisions or constraints>
247
- ```
248
-
249
- ---
250
-
251
- ### Phase 2: Prepare for Implementation (shared)
252
-
253
- > Both paths converge here. PRD and task directory must exist before proceeding.
254
-
255
- **Step 4: Code-Spec Depth Check** `[AI]`
256
-
257
- If the task touches infra or cross-layer contracts, do not start implementation until code-spec depth is defined.
258
-
259
- Trigger this requirement when the change includes any of:
260
- - New or changed command/API signatures
261
- - Database schema or migration changes
262
- - Infra integrations (storage, queue, cache, secrets, env contracts)
263
- - Cross-layer payload transformations
264
-
265
- Must-have before proceeding:
266
- - [ ] Target code-spec files to update are identified
267
- - [ ] Concrete contract is defined (signature, fields, env keys)
268
- - [ ] Validation and error matrix is defined
269
- - [ ] At least one Good/Base/Bad case is defined
270
-
271
- **Step 5: Research the Codebase** `[AI]`
272
-
273
- Based on the confirmed PRD, run a focused research pass and produce:
274
-
275
- 1. Relevant spec files in `.cowork-flow/spec/`
276
- 2. Existing code patterns to follow (2-3 examples)
277
- 3. Files that will likely need modification
278
-
279
- Use this output format:
280
-
281
- ```markdown
282
- ## Relevant Specs
283
- - <path>: <why it's relevant>
284
-
285
- ## Code Patterns Found
286
- - <pattern>: <example file path>
287
-
288
- ## Files to Modify
289
- - <path>: <what change>
290
- ```
291
-
292
- **Step 6: Configure Context** `[AI]`
293
-
294
- Initialize default context:
295
-
296
- ```bash
297
- ./.cowork-flow/run task init-context "$TASK_DIR" <type>
298
- # type: backend | frontend | fullstack
299
- ```
300
-
301
- Add specs found in your research pass:
302
-
303
- ```bash
304
- # For each relevant spec and code pattern:
305
- ./.cowork-flow/run task add-context "$TASK_DIR" implement "<path>" "<reason>"
306
- ./.cowork-flow/run task add-context "$TASK_DIR" check "<path>" "<reason>"
307
- ```
308
-
309
- If this task came through the Behavior Change Gate, add the approved artifacts before coding:
310
-
311
- ```bash
312
- ./.cowork-flow/run task add-context "$TASK_DIR" implement ".cowork-flow/changes/<slug>/proposal.md" "Approved change proposal"
313
- ./.cowork-flow/run task add-context "$TASK_DIR" implement ".cowork-flow/changes/<slug>/spec.md" "Approved behavior spec"
314
- ./.cowork-flow/run task add-context "$TASK_DIR" implement ".cowork-flow/changes/<slug>/design.md" "Approved design for L2 changes"
315
- ./.cowork-flow/run task add-context "$TASK_DIR" implement ".cowork-flow/plans/YYYY-MM-DD-<slug>.md" "Approved implementation plan"
316
- ./.cowork-flow/run task add-context "$TASK_DIR" check ".cowork-flow/changes/<slug>/spec.md" "Check implementation against approved spec"
317
- ./.cowork-flow/run task add-context "$TASK_DIR" check ".cowork-flow/plans/YYYY-MM-DD-<slug>.md" "Check implementation against approved plan"
318
- ```
319
-
320
- **Step 7: Activate Task** `[AI]`
321
-
322
- ```bash
323
- ./.cowork-flow/run task start "$TASK_DIR"
324
- ```
325
-
326
- This sets `.current-task` so hooks can inject context.
327
-
328
- ---
329
-
330
- ### Phase 3: Execute (shared)
331
-
332
- **Step 8: Implement** `[AI]`
333
-
334
- Implement the task described in `prd.md`.
335
-
336
- - Follow all specs injected into implement context
337
- - Keep changes scoped to requirements
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`.
340
-
341
- **Step 9: Check Quality** `[AI]`
342
-
343
- Run a quality pass against check context:
344
-
345
- - Review all code changes against the specs
346
- - Fix issues directly
347
- - Ensure lint and typecheck pass
348
-
349
- **Step 10: Complete** `[AI]`
350
-
351
- 1. Verify lint and typecheck pass
352
- 2. Report what was implemented
353
- 3. Follow the current session convention for completion:
354
- - Test the changes
355
- - Have the agreed executor handle business-code changes according to project policy
356
- - Run `$record-session` to record this session
357
-
358
- ---
359
-
360
- ## Continuing Existing Task
361
-
362
- If `resume.py` shows a current task:
363
-
364
- 1. Read the task's `prd.md` to understand the goal
365
- 2. Check `task.json` for current status
366
- 3. Ask user: "Continue working on <task-name>?"
367
-
368
- If yes, resume from the appropriate step (usually Step 7 or 8).
369
-
370
- ---
70
+ - If the task is vague, complex, or has multiple possible interpretations, use the project brainstorming flow before implementation.
71
+ - If the task changes behavior, do not skip `change -> spec -> plan`; for `L2`, do not skip `design.md`.
72
+ - If an approved plan has independent work and `.cowork-flow/config.yaml` enables agent teams, use `agent-team-execution` and finish that path with `agent-team complete`.
73
+ - If context was compressed or the task is being resumed, use the minimal recovery path below instead of bulk-reading the repo.
371
74
 
372
75
  ## Resume / Context Compression
373
76
 
374
- When a conversation has many rounds, a task runs for a long time, or context was
375
- compressed, resume with the smallest useful context:
77
+ When resuming after a long task, a new session, or context compression:
376
78
 
377
79
  1. Run `./.cowork-flow/run resume`.
378
- 2. Follow the `RESUME CHECKLIST` section.
379
- 3. Read the current task `prd.md`.
380
- 4. Run `./.cowork-flow/run task list-context <task-dir>` and read only the jsonl references needed for the current phase.
381
- 5. If a plan is listed, read its current execution status before continuing implementation.
382
-
383
- Do not bulk-read `.cowork-flow/spec/`, all plans, all tasks, or workspace journals
384
- just because context was compressed. Use the checklist as the minimal recovery
385
- anchor, then load details on demand.
386
-
387
- ---
388
-
389
- ## Skills Reference
390
-
391
- ### User Skills `[USER]`
392
-
393
- | Skill | When to Use |
394
- |---------|-------------|
395
- | `$start` | Begin a session (this skill) |
396
- | `$finish-work` | Final verification before handoff or commit |
397
- | `$record-session` | After task completion and project commit/handoff policy is satisfied |
398
-
399
- ### AI Scripts `[AI]`
400
-
401
- | Script | Purpose |
402
- |--------|---------|
403
- | `./.cowork-flow/run resume` | Resume session with minimal context checklist |
404
- | `./.cowork-flow/run get-context` | Get session context |
405
- | `./.cowork-flow/run task create` | Create task directory |
406
- | `./.cowork-flow/run task init-context` | Initialize jsonl files |
407
- | `./.cowork-flow/run task add-context` | Add spec to jsonl |
408
- | `./.cowork-flow/run task start` | Set current task |
409
- | `./.cowork-flow/run task finish` | Clear current task |
410
- | `./.cowork-flow/run task archive` | Archive completed task |
411
-
412
- ### Workflow Phases `[AI]`
413
-
414
- | Phase | Purpose | Context Source |
415
- |-------|---------|----------------|
416
- | research | Analyze codebase | direct repo inspection |
417
- | implement | Write code | `implement.jsonl` |
418
- | check | Review & fix | `check.jsonl` |
419
- | debug | Fix specific issues | `debug.jsonl` |
420
-
421
- ---
422
-
423
- ## Key Principle
80
+ 2. Follow `RESUME CHECKLIST` from `resume.py`.
81
+ 3. Read only the current PRD, current plan status, and the jsonl references needed for the current phase.
82
+ 4. Do not bulk-read `.cowork-flow/spec/`, all plans, all tasks, or workspace journals.
424
83
 
425
- > **Code-spec context is injected, not remembered.**
426
- >
427
- > The Task Workflow ensures agents receive relevant code-spec context automatically.
428
- > This is more reliable than hoping the AI "remembers" conventions.
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.9
@@ -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,7 +7,7 @@ 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
13
 
@@ -5,22 +5,27 @@
5
5
  开发过程必须形成稳定闭环:
6
6
 
7
7
  ```text
8
- 获取上下文 -> 阅读规范 -> 任务分级 -> 规格与计划 -> 执行实现 -> 验证审阅 -> 状态同步 -> session 记录
8
+ 获取上下文 -> 阅读规范 -> 任务分级 -> 目标/规格/计划 -> 执行实现 -> 验证审阅 -> 状态同步 -> session 记录
9
9
  ```
10
10
 
11
- 所有任务先明确目标和验收标准,再进入实现;所有完成结论都必须有验证证据。命令示例默认使用 macOS / Linux / Git Bash / WSL;Windows cmd / PowerShell 使用 `.\.cowork-flow\run.cmd <command>` 替代 `./.cowork-flow/run <command>`。
11
+ 所有任务先明确目标和验收标准,再进入实现;所有完成结论都必须有验证证据。
12
+
13
+ 命令示例默认使用 macOS / Linux / Git Bash / WSL;Windows cmd / PowerShell 使用 `.\.cowork-flow\run.cmd <command>` 替代 `./.cowork-flow/run <command>`。
12
14
 
13
15
  ---
14
16
 
15
17
  ## 2. 职责边界
16
18
 
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 记录和任务归档。 |
19
+ cowork-flow 只负责保存流程状态和任务上下文;具体执行方法由当前 agent 宿主提供。
20
+
21
+ | 对象 | 定位 | 主要产物 |
22
+ |------|------|----------|
23
+ | `cowork-flow change` | 行为变更规格 | `proposal.md`、`spec.md`、`design.md`、`change.yaml` |
24
+ | `.cowork-flow/tasks` | 任务执行上下文 | `prd.md`、`implement.jsonl`、`check.jsonl`、`debug.jsonl` |
25
+ | `.cowork-flow/plans` | 实施计划 | 可执行步骤、验证方式、当前执行状态 |
26
+ | `agent 执行方法` | 需求澄清、计划拆分、TDD、subagent 调度、完成前验证 | 由宿主能力或可用技能提供 |
22
27
 
23
- `.cowork-flow` 不替代 superpowers,也不替代项目验证命令。除一次性原型、生成代码、纯配置文件等明确例外并经人工确认外,功能新增、缺陷修复、重构和行为变更都必须按 RED-GREEN-REFACTOR 推进;复杂或难点问题按深度优先。
28
+ `.cowork-flow` 不替代 agent 的执行判断,也不替代项目验证命令。
24
29
 
25
30
  ---
26
31
 
@@ -54,6 +59,11 @@
54
59
 
55
60
  ```bash
56
61
  ./.cowork-flow/run resume
62
+ ```
63
+
64
+ 如 `resume` 输出不足以判断当前状态,再补充执行:
65
+
66
+ ```bash
57
67
  ./.cowork-flow/run task list
58
68
  git status
59
69
  git log --oneline -10
@@ -80,11 +90,23 @@ done
80
90
 
81
91
  所有任务先分级,再选择流程。
82
92
 
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 -> 任务上下文 -> 执行计划 -> 多视角审阅 -> 验证 -> 归档与记录 |
93
+ ### L0:无外部行为变化
94
+
95
+ 适用:文档整理、小范围重构、测试补充、注释/格式/脚本清理、不改变用户可观察行为的内部调整。
96
+
97
+ 流程:任务 -> 读取规范 -> 简短计划 -> 实现 -> 验证 -> 记录 session。
98
+
99
+ ### L1:局部行为变化
100
+
101
+ 适用:单模块功能调整、单接口行为变化、局部数据处理逻辑变化、有明确边界的新能力。
102
+
103
+ 流程:cowork-flow change -> brainstorming -> writing-plans -> 任务上下文 -> 执行计划 -> 验证 -> 归档与记录。
104
+
105
+ ### L2:跨层或重要行为变化
106
+
107
+ 适用:跨前后端或跨服务变更;API / DB / 消息 / 缓存 / 文件等契约变化;架构边界变化;影响发布、迁移、安全、权限或兼容性的变更。
108
+
109
+ 流程:cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上下文 -> 执行计划 -> 多视角审阅 -> 验证 -> 归档与记录。
88
110
 
89
111
  ---
90
112
 
@@ -130,7 +152,8 @@ done
130
152
  - 遵循 `.cowork-flow/spec/` 中的相关规范。
131
153
  - 变更保持聚焦。
132
154
  - 若执行中发现行为变化升级,立即重新分级并进入 L1 / L2 流程。
133
- - 执行计划中的每个实现步骤必须优先进入 `superpowers:test-driven-development` 循环,不得先写生产代码再补测试。
155
+ - 涉及代码逻辑或行为时,必须优先进入 `superpowers:test-driven-development` 循环,不得先写生产代码再补测试。
156
+ - 纯文档、格式或说明性修改按 PRD 验收标准验证,不强行补无意义测试。
134
157
 
135
158
  ---
136
159
 
@@ -177,35 +200,39 @@ done
177
200
 
178
201
  将 proposal、spec、design(如存在)、implementation plan、相关 `.cowork-flow/spec/`、相关代码模式或契约文件加入任务上下文。
179
202
 
180
- ### 7.7 按 superpowers 方法执行
203
+ ### 7.7 执行
204
+
205
+ 执行 plan 前,先判断**是否存在适合拆分的独立任务**。
181
206
 
182
- 执行 plan 前,先判断**是否存在适合并行执行的独立任务**。并行是优化手段,不是完成定义;`agent_team.enabled` 只决定在适合并行时优先使用哪种机制,不决定是否必须并行。
207
+ 只要宿主支持 subAgent,且任务适合拆分,就应优先采用 subagent 执行。`agent_team.enabled` 只决定是否使用 cowork-flow 内置 agent-team 调度,不决定是否可以使用 subagent。
183
208
 
184
- 适合并行的条件包括:
209
+ 并行是优化手段,不是完成定义;不得为了满足流程形式而强行拆分高耦合任务。
210
+
211
+ 适合使用 subagent 的条件包括:
185
212
 
186
213
  - 子任务之间没有共享写文件,或共享写文件已有明确顺序边界。
187
214
  - 子任务之间没有强顺序依赖。
188
215
  - 每个子任务都有清晰输入、输出和验收方式。
189
216
  - 主 agent 能在集成前独立审查每个结果。
190
- - 并行带来的收益大于调度、审阅和集成成本。
217
+ - subagent 带来的收益大于调度、审阅和集成成本。
191
218
 
192
- 不适合并行的情况包括:
219
+ 不适合使用 subagent 的情况包括:
193
220
 
194
221
  - 改动集中在同一组强耦合文件。
195
222
  - 需要密集的 TDD 红绿循环或即时反馈。
196
223
  - parser、schema、runtime、测试需要同步演进。
197
224
  - 子任务边界不清,拆分后的主要成本会落在集成。
198
- - 任务规模小于并行调度成本。
225
+ - 任务规模小于 subagent 调度成本。
199
226
 
200
- 不得为了满足流程形式而强行拆分高耦合任务。若不适合并行,必须简要记录不使用并行的理由,并在当前会话中按 plan 顺序执行。
227
+ 若不适合使用 subagent,必须简要记录理由,并在当前会话中按 plan 顺序执行。
201
228
 
202
- 若适合并行:
229
+ 若适合使用 subagent:
203
230
 
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` 或当前会话顺序执行。
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` 但宿主支持 subAgent 时,使用 `superpowers:subagent-driven-development` 或宿主等价机制开启多 agent 执行。
233
+ - 当宿主不支持 subAgent 或任务不适合拆分时,使用 `superpowers:executing-plans` 或当前会话顺序执行。
207
234
 
208
- 无论是否并行,都必须严格遵循 `superpowers:test-driven-development`,不得先写生产代码再补测试。
235
+ 无论是否使用 subagent,都必须严格遵循 `superpowers:test-driven-development`,不得先写生产代码再补测试。
209
236
 
210
237
  执行中必须持续同步:
211
238
 
@@ -236,7 +263,7 @@ done
236
263
  完成前至少确认:
237
264
 
238
265
  - 相关测试通过
239
- - 新增或修改的行为有测试先失败、再通过的验证证据
266
+ - 新增或修改的代码行为有测试先失败、再通过的验证证据
240
267
  - lint / format / build / typecheck 按项目要求通过
241
268
  - 行为符合 cowork-flow change 规格或 PRD
242
269
  - 相关 `.cowork-flow/spec/` 已同步
@@ -279,6 +306,13 @@ L2 任务完成前需要多视角审阅:行为契约、数据流、错误处
279
306
  ./.cowork-flow/run change archive <slug>
280
307
  ```
281
308
 
309
+ 在windows下遇到归档异常,尝试使用下面脚本修复:
310
+
311
+ ```bash
312
+ $user = "$env:USERDOMAIN\$env:USERNAME"
313
+ icacls .\.cowork-flow /grant "$($user):(OI)(CI)(F)" /T
314
+ ```
315
+
282
316
  ---
283
317
 
284
318
  ## 10. 状态持久化与恢复
@@ -337,6 +371,6 @@ L2 任务完成前需要多视角审阅:行为契约、数据流、错误处
337
371
  - cowork-flow change 规格或计划中的必要步骤已完成
338
372
  - 验证命令已按项目要求执行
339
373
  - 失败、跳过或无法执行的验证已明确说明
340
- - 相关规范已更新
374
+ - 必要的相关规范已更新,或已说明无需更新
341
375
  - change metadata、计划状态、任务状态不冲突
342
376
  - session 已记录
@@ -95,20 +95,6 @@
95
95
  - 如果跟丢上下文,先停下来重新整理。
96
96
 
97
97
  <!-- COWORK-FLOW:START -->
98
- # cowork-flow 强门禁
99
-
100
- 若与项目自定义说明冲突,以项目说明和用户明确指令为准。
101
-
102
- 命令示例默认使用 macOS / Linux / Git Bash / WSL 写法;Windows cmd / PowerShell 中使用 `.\.cowork-flow\run.cmd <command>` 替代 `./.cowork-flow/run <command>`。
103
-
104
- 1. 每次新会话、重新接手任务、或上下文明显丢失时,先执行 `./.cowork-flow/run resume`,再进入 `.agent/skills/start`。
105
- 2. 执行 `start` 时,先读 `AGENTS.md`、`.cowork-flow/workflow.md` 和 `resume.py` 的输出,不要直接编码。
106
- 3. 任何会修改仓库文件的请求,都必须先分级为 `L0` / `L1` / `L2`,再进入对应流程;不要把“很小”当成可以绕过流程的理由。
107
- 4. `L1` / `L2` 行为变更必须先有 `change -> spec -> plan`;`L2` 还必须有 `design.md`,然后才能进入实现。
108
- 5. 实现前必须把任务上下文写入 `.cowork-flow/tasks/<task>/implement.jsonl`、`check.jsonl`、`debug.jsonl`,并在 `start` 之后再改代码。
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。
112
98
 
113
99
  Use the `.agent/skills/start` skill when starting a new session to:
114
100
  - Initialize your developer identity