cowork-flow 2.3.0 → 2.4.1
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/CHANGELOG.md +31 -1
- package/README.en.md +34 -18
- package/README.md +8 -5
- package/docs/architecture.en.md +95 -0
- package/docs/architecture.md +7 -3
- package/docs/direction.en.md +71 -0
- package/docs/direction.md +6 -1
- package/docs/hosts.en.md +299 -0
- package/docs/hosts.md +3 -1
- package/docs/index.en.md +30 -0
- package/docs/index.md +2 -0
- package/docs/release.en.md +108 -0
- package/docs/release.md +2 -0
- package/package.json +2 -2
- package/presets/claude-code/.claude-plugin/plugin.json +1 -1
- package/presets/claude-code/skills/cowork-flow-bootstrap/SKILL.md +4 -0
- package/presets/codex/.codex-plugin/plugin.json +1 -1
- package/presets/codex/skills/cowork-flow-bootstrap/SKILL.md +4 -0
- package/presets/kimi-code/.kimi-plugin/plugin.json +1 -1
- package/presets/kimi-code/skills/cowork-flow-bootstrap/SKILL.md +4 -0
- package/presets/opencode/cowork-flow/skills/cowork-flow-bootstrap/SKILL.md +4 -0
- package/presets/qoder/.qoder-plugin/plugin.json +1 -1
- package/presets/qoder/skills/cowork-flow-bootstrap/SKILL.md +4 -0
- package/presets/zcode/.zcode-plugin/plugin.json +1 -1
- package/presets/zcode/skills/cowork-flow-bootstrap/SKILL.md +4 -0
- package/src/commands/init.js +129 -2
- package/src/commands/registry.js +3 -1
- package/src/commands/source-refresh.js +5 -1
- package/src/commands/sync.js +3 -0
- package/src/lib/copy-template.js +23 -5
- package/src/lib/host-assets.js +117 -2
- package/src/lib/language.js +162 -0
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/config.yaml +8 -0
- package/template/.cowork-flow/scripts/adapters/cli/task_create_command.py +5 -3
- package/template/.cowork-flow/scripts/adapters/host/host_manifest.py +71 -2
- package/template/.cowork-flow/scripts/infra/config.py +85 -0
- package/template/.cowork-flow/scripts/services/decision_anchor_schema.py +228 -0
- package/template/.cowork-flow/scripts/services/fact_view.py +27 -15
- package/template/.cowork-flow/scripts/services/plan_binding.py +34 -0
- package/template/.cowork-flow/scripts/services/plan_schema.py +182 -0
- package/template/.cowork-flow/scripts/services/task_context.py +84 -12
- package/template/.cowork-flow/scripts/services/task_creation.py +89 -30
- package/template/.cowork-flow/scripts/services/task_gate_profiles.py +7 -24
- package/template/.cowork-flow/spec/contracts/context-injection.md +5 -4
- package/template/.cowork-flow/spec/contracts/decision-anchor.md +35 -19
- package/template/.cowork-flow/spec/contracts/plan-binding.md +27 -4
- package/template/.cowork-flow/spec/index.md +26 -26
- package/template/.cowork-flow/spec/references/definition-of-done.md +26 -26
- package/template/.cowork-flow/spec/references/index.md +16 -16
- package/template/.cowork-flow/spec/references/orchestration-patterns.md +71 -71
- package/template/.cowork-flow/spec/references/security-checklist.md +37 -37
- package/template/.cowork-flow/spec/references/testing-checklist.md +32 -32
- package/template/.cowork-flow/spec/runtime/contract-registry.json +1 -0
- package/template/.cowork-flow/spec/runtime/host-assets.json +23 -4
- package/template/.cowork-flow/spec/runtime/index.md +10 -12
- package/template/.cowork-flow/spec/schemas/host-assets.schema.json +31 -0
- package/template/.cowork-flow/spec/schemas/index.md +5 -5
- package/template/.cowork-flow/templates/plan-template.md +91 -0
- package/template/locales/en-US/.cowork-flow/spec/contracts/decision-anchor.md +169 -0
- package/template/locales/en-US/.cowork-flow/templates/plan-template.md +91 -0
- package/template/skills/runtime-health/scripts/doctor.py +110 -0
- package/template/skills/task-planning/SKILL.md +21 -94
|
@@ -289,7 +289,8 @@ Verify: npm run test:fast; python3 -m pytest tests/ -q
|
|
|
289
289
|
- **Gates**: static preview text, identical on all hosts; the delegated
|
|
290
290
|
variant replaces the self-declaration sentence with "scope is inherited
|
|
291
291
|
from the parent task (read-only reference)".
|
|
292
|
-
- **Verify**: `## 验证命令` lines from
|
|
292
|
+
- **Verify**: `## Verification Commands`/`## 验证命令` lines from
|
|
293
|
+
decision-anchor (first 10, 120 chars
|
|
293
294
|
each) — the agent's own declared self-checks; omitted when none.
|
|
294
295
|
- **Per-edit warning**: PostToolUse on an edit tool injects at most one
|
|
295
296
|
line when the edited file is outside the task's declared scope —
|
|
@@ -326,9 +327,9 @@ Verify: npm run test:fast; python3 -m pytest tests/ -q
|
|
|
326
327
|
budget/limits come from `.cowork-flow/spec/runtime/scope-rules.json`, the
|
|
327
328
|
single source consumed at runtime; a missing or malformed file degrades to
|
|
328
329
|
embedded defaults that are byte-identical with the shipped file (locked by
|
|
329
|
-
`tests/test_scope_rules.py`). The file is
|
|
330
|
-
|
|
331
|
-
it do not survive a sync.
|
|
330
|
+
`tests/test_scope_rules.py`). The file is framework-managed: `cwf project
|
|
331
|
+
sync` refreshes it as part of the synced `spec/runtime/` tree, so local edits
|
|
332
|
+
to it do not survive a sync.
|
|
332
333
|
- Absent for `no_task` / `planning` / `completed` states. Block content is
|
|
333
334
|
byte-identical across host lines for the whole fixture matrix
|
|
334
335
|
(`test/fixtures/stage-contract-matrix.json` drives the equality test:
|
|
@@ -8,8 +8,9 @@ the alternatives", which compresses the number of task artifacts.
|
|
|
8
8
|
|
|
9
9
|
## Schema
|
|
10
10
|
|
|
11
|
-
These section names are
|
|
12
|
-
|
|
11
|
+
These section names are machine-readable. The runtime parser accepts both the
|
|
12
|
+
Chinese and English heading sets, and new anchors use the language configured in
|
|
13
|
+
`.cowork-flow/config.yaml` (`zh-CN` is the default).
|
|
13
14
|
|
|
14
15
|
```markdown
|
|
15
16
|
# Decision Anchor
|
|
@@ -38,14 +39,17 @@ translated heading would simply stop being read.
|
|
|
38
39
|
|
|
39
40
|
## Section requirements
|
|
40
41
|
|
|
42
|
+
Both heading columns below are accepted; the left column is the `zh-CN` output
|
|
43
|
+
and the right column the `en-US` output.
|
|
44
|
+
|
|
41
45
|
| Section | Required | Why |
|
|
42
46
|
|------|------|------|
|
|
43
|
-
| `## 目标` | required | no goal, no acceptance baseline |
|
|
44
|
-
| `## 验收标准` | required | `task_start` is blocked without acceptance criteria |
|
|
45
|
-
| `## 被拒方案` | optional | required for brainstorming tasks, so a rejected option is not reconsidered during execution |
|
|
46
|
-
| `## 关键假设` | optional | filled in for complex tasks to surface implicit constraints; not read by the runtime parser |
|
|
47
|
-
| `## 范围边界` | optional | prevents scope creep |
|
|
48
|
-
| `## 验证命令` | optional | filled in for complex tasks, as the basis for automated verification;
|
|
47
|
+
| `## 目标` / `## Goal` | required | no goal, no acceptance baseline |
|
|
48
|
+
| `## 验收标准` / `## Acceptance Criteria` | required | `task_start` is blocked without acceptance criteria |
|
|
49
|
+
| `## 被拒方案` / `## Rejected Options` | optional | required for brainstorming tasks, so a rejected option is not reconsidered during execution |
|
|
50
|
+
| `## 关键假设` / `## Key Assumptions` | optional | filled in for complex tasks to surface implicit constraints; not read by the runtime parser |
|
|
51
|
+
| `## 范围边界` / `## Scope Boundary` | optional | prevents scope creep |
|
|
52
|
+
| `## 验证命令` / `## Verification Commands` | required for strict non-Tiny; optional for legacy/Tiny | filled in for complex tasks, as the basis for automated verification; a strict non-Tiny task also needs the configured-language section and a filled spec/gate check for the task's `dev_type` (deciding command, or clause-by-clause `pass` / `not_applicable` with reason) |
|
|
49
53
|
|
|
50
54
|
### Machine-readable line formats (for injection)
|
|
51
55
|
|
|
@@ -55,11 +59,13 @@ fact view (`services/fact_view.parse_decision_anchor`). Line-format conventions:
|
|
|
55
59
|
- `## 验证命令`: one command per line (an optional `- ` prefix), truncated to 120
|
|
56
60
|
characters, at most 10 lines; the implementing agent runs them itself
|
|
57
61
|
(self-declared, self-checked) and the reviewer verifies the execution evidence.
|
|
58
|
-
|
|
59
|
-
section
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
A strict non-Tiny task must also carry a `规范核对:` line in the configured
|
|
63
|
+
language's section, with the actual `pass` / `not_applicable` result and a
|
|
64
|
+
reason. The template placeholder (`<pass / not_applicable + 理由>`) does not
|
|
65
|
+
satisfy the start gate. This line is a hard start gate for strict non-Tiny
|
|
66
|
+
tasks, while its content remains self-declared and is reviewed by the check
|
|
67
|
+
agent. The fact view recognizes the line and does not return it as a shell
|
|
68
|
+
command.
|
|
63
69
|
- `## 范围边界`: only the first non-empty line is taken, truncated to 160
|
|
64
70
|
characters.
|
|
65
71
|
|
|
@@ -84,15 +90,24 @@ After merging (5 files): `decision-anchor.md` + `implement.jsonl` + `check.jsonl
|
|
|
84
90
|
## Lifecycle check coupling
|
|
85
91
|
|
|
86
92
|
- The preflight for `task next <dir> --run` checks that `decision-anchor.md` is
|
|
87
|
-
non-empty and requires the `## 目标`
|
|
93
|
+
non-empty and requires the `## 目标` / `## Goal` and `## 验收标准` /
|
|
94
|
+
`## Acceptance Criteria` sections to be present.
|
|
88
95
|
- **Gate profile `meta.gateProfile`**: a newly created task is written as
|
|
89
96
|
`"strict"`; an unmarked task is treated as `"legacy"` — existing tasks are not
|
|
90
97
|
retro-fitted with the stricter gate, and the profile is queryable through the
|
|
91
98
|
fact view. On top of the section check, a strict task additionally requires: at
|
|
92
|
-
least one parseable `- [ ] AC-xxx: ...` row in `##
|
|
93
|
-
no non-AC list rows in that
|
|
94
|
-
`task specs` dev-type dispatch
|
|
95
|
-
|
|
99
|
+
least one parseable `- [ ] AC-xxx: ...` row in `## 验收标准` /
|
|
100
|
+
`## Acceptance Criteria`, no duplicate AC ids, no non-AC list rows in that
|
|
101
|
+
section, and a declared `dev_type` (otherwise `task specs` dev-type dispatch
|
|
102
|
+
silently comes back shorter).
|
|
103
|
+
- A strict non-Tiny task also requires the configured-language
|
|
104
|
+
`## 验证命令` / `## Verification Commands` section with a filled
|
|
105
|
+
`规范核对:` / `Spec check:` line. A missing section, the other-language
|
|
106
|
+
heading, or the template placeholder blocks start. Tiny tasks and legacy tasks
|
|
107
|
+
are exempt. The bound plan's `## 最终验证` / `## Final Verification` section
|
|
108
|
+
carries the same filled check; plan structure and language are covered by
|
|
109
|
+
`plan-binding.md`.
|
|
110
|
+
- An acceptance row's checkbox state (`- [ ]` / `- [x]`) and the evidence records
|
|
96
111
|
(the task directory's `evidence.jsonl`) are the fact source of the completion
|
|
97
112
|
gate: completion is blocked when an unchecked AC exists (`LIFECYCLE-AC-001`), a
|
|
98
113
|
declared AC has no evidence (`LIFECYCLE-AC-002`), a strict task cannot read any
|
|
@@ -149,4 +164,5 @@ source; if a task directory has only `prd.md` and no `decision-anchor.md`,
|
|
|
149
164
|
`decision-anchor.md is missing or empty`.
|
|
150
165
|
|
|
151
166
|
An existing legacy task needs a human to convert the `prd.md` content into
|
|
152
|
-
`decision-anchor.md`, fill in `## 目标`
|
|
167
|
+
`decision-anchor.md`, fill in `## 目标` / `## Goal` and `## 验收标准` /
|
|
168
|
+
`## Acceptance Criteria`, and only then start.
|
|
@@ -48,11 +48,32 @@ into `in_progress`:
|
|
|
48
48
|
- `task.json.meta.planFile` exists.
|
|
49
49
|
- `planFile` is a repo-relative `.cowork-flow/plans/` path.
|
|
50
50
|
- The plan file exists and is non-empty.
|
|
51
|
-
- `decision-anchor.md` contains `## 目标` and
|
|
51
|
+
- `decision-anchor.md` contains `## Goal`/`## 目标` and
|
|
52
|
+
`## Acceptance Criteria`/`## 验收标准`.
|
|
52
53
|
- `implement.jsonl` passes the existing context validation.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
- For a strict non-Tiny task, the plan title contains the configured-language
|
|
55
|
+
marker (`实施计划` / `Implementation Plan`).
|
|
56
|
+
- The plan contains the six configured-language `##` template headings in
|
|
57
|
+
template order: `目标` / `验收标准` / `全局约束` / `文件边界` / `任务` /
|
|
58
|
+
`最终验证`, or their `en-US` equivalents. Extra custom sections are allowed;
|
|
59
|
+
fenced code is ignored; a known template heading from the other language is
|
|
60
|
+
rejected.
|
|
61
|
+
- Any `### 任务` / `### Task` task heading uses the configured-language prefix.
|
|
62
|
+
- `## 最终验证` / `## Final Verification` contains a line starting with
|
|
63
|
+
`规范核对:` / `Spec check:` and carrying an actual `pass` or
|
|
64
|
+
`not_applicable` result. The template placeholder (`<pass / not_applicable +
|
|
65
|
+
理由>` / `<pass / not_applicable + reason>`) does not satisfy the gate.
|
|
66
|
+
- The strict non-Tiny anchor carries the configured-language `## 验证命令` /
|
|
67
|
+
`## Verification Commands` section with the same filled spec-check result;
|
|
68
|
+
see `decision-anchor.md`.
|
|
69
|
+
|
|
70
|
+
Creation and `--from-plan` binding stay permissive: a planning task may create
|
|
71
|
+
and bind a plan before its structure is final. These checks run only at the
|
|
72
|
+
planning → `in_progress` start gate.
|
|
73
|
+
|
|
74
|
+
A Tiny task may have no planFile and is exempt from the plan-shape and anchor
|
|
75
|
+
spec-check gates. A legacy task (no `meta.gateProfile: "strict"`) keeps the
|
|
76
|
+
historical checks; this contract does not retro-fit either profile.
|
|
56
77
|
|
|
57
78
|
## Implementation recovery
|
|
58
79
|
|
|
@@ -78,6 +99,8 @@ The recovery output lists paths only and never expands the plan prose.
|
|
|
78
99
|
- No Markdown AST or DSL.
|
|
79
100
|
- No comparing AC text against plan task prose.
|
|
80
101
|
- No matching verification commands against evidence records.
|
|
102
|
+
- No semantic validation of the spec-check result or reason; the structural
|
|
103
|
+
check only requires an actual `pass` / `not_applicable` token.
|
|
81
104
|
- No plan-approval data model.
|
|
82
105
|
|
|
83
106
|
These capabilities are considered only after warning noise and real payoff have been
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
# Cowork Flow Spec Index
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This directory holds project specs, runtime contracts, and runtime configuration schemas. Layers by responsibility:
|
|
4
4
|
|
|
5
|
-
|
|
|
5
|
+
| Directory | Purpose |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
| `contracts/` |
|
|
8
|
-
| `runtime/` | runtime
|
|
9
|
-
| `schemas/` | runtime
|
|
10
|
-
| `backend/` |
|
|
11
|
-
| `frontend/` |
|
|
12
|
-
| `guides/` | brainstorming/task-planning
|
|
13
|
-
| `references/` |
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
`
|
|
19
|
-
`task-review` skill
|
|
20
|
-
`guides/`
|
|
7
|
+
| `contracts/` | Human-readable contracts for the workflow, host adapters, and subagent protocol. |
|
|
8
|
+
| `runtime/` | Machine configuration read by the runtime, including the contract registry and host asset manifest. |
|
|
9
|
+
| `schemas/` | JSON Schemas for runtime configuration and host contracts. |
|
|
10
|
+
| `backend/` | Backend implementation specs; the review skill reads them on demand and checks each clause. |
|
|
11
|
+
| `frontend/` | Frontend implementation specs; the review skill reads them on demand and checks each clause. |
|
|
12
|
+
| `guides/` | Pre-implementation thinking, cross-layer design, and reuse guidance for brainstorming/task-planning. |
|
|
13
|
+
| `references/` | On-demand reference material (DoD, testing checklist, security checklist, orchestration patterns); never auto-loaded. Load conditions are in the `references` array of contract-registry.json. |
|
|
14
|
+
|
|
15
|
+
Sync ownership: `contracts/`, `runtime/`, `schemas/`, and this file are framework-maintained and follow `cwf project sync`; `backend/`, `frontend/`, `guides/`, and `references/` are project-maintained, and `sync` never overwrites or deletes files there.
|
|
16
|
+
|
|
17
|
+
The workflow kernel only owns machine-checkable facts: task state, file scope, runtime context, and archive consistency.
|
|
18
|
+
Actions, stage guidance, and dedicated runtimes are declared by each Skill's `manifest.json`; there is no centralized Skill registry.
|
|
19
|
+
Natural-language specs under `backend/` and `frontend/` are not registered as runtime gates; the `task-review` skill reads them according to the current diff and task scope and checks each clause.
|
|
20
|
+
`guides/` is pre-implementation clarification and planning reference; selected conclusions belong in `decision-anchor.md` or the task plan.
|
|
21
21
|
|
|
22
22
|
## references/
|
|
23
23
|
|
|
24
|
-
>
|
|
24
|
+
> On-demand reference material. **Never auto-loaded in the main session** — read only when a skill entry or agent judges it necessary.
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
1.
|
|
28
|
-
2.
|
|
29
|
-
3.
|
|
26
|
+
Reference files:
|
|
27
|
+
1. Provide supplemental context for skill entries (the main skill is the entry point; references supplement it).
|
|
28
|
+
2. Reduce what each session must load (narrow-domain specs such as `spec/backend/` are read only when needed).
|
|
29
|
+
3. Provide quick checklists during planning, check, or review.
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
- contract-registry
|
|
33
|
-
- skill
|
|
34
|
-
-
|
|
35
|
-
-
|
|
31
|
+
Loading rules:
|
|
32
|
+
- Read when one of the `loadWhen` conditions in contract-registry matches.
|
|
33
|
+
- Read when a skill body explicitly references a reference ID.
|
|
34
|
+
- Read when the user requests a specific check in the main session.
|
|
35
|
+
- **Never auto-loaded** — that is the difference from `contracts/`.
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
# Definition of Done
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Project-level completion gates. Every change must satisfy these before it is considered "done". They complement per-task ACs; they do not replace them.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## General gates (all tasks)
|
|
6
6
|
|
|
7
|
-
| # |
|
|
7
|
+
| # | Check | Verification |
|
|
8
8
|
|---|---|---|
|
|
9
|
-
| G1 |
|
|
10
|
-
| G2 |
|
|
11
|
-
| G3 |
|
|
12
|
-
| G4 |
|
|
13
|
-
| G5 | Git status snapshot
|
|
9
|
+
| G1 | Implementation satisfies the decision-anchor acceptance criteria | All ACs are verified |
|
|
10
|
+
| G2 | Behavior changes have corresponding tests or an explicit verification command; high-risk tasks cover failure, boundary, or regression paths | `./.cowork-flow/run task next <dir> --validate` and the task verification commands pass |
|
|
11
|
+
| G3 | Check phase is complete with no unresolved blocker | `task-review` verdict is pass, and the completion lifecycle blocker count is 0 |
|
|
12
|
+
| G4 | No newly introduced lint/type/build warnings | lint / build commands pass |
|
|
13
|
+
| G5 | Git status snapshot contains only task-related changes, including staged, unstaged, and untracked | git status --porcelain=v1 -uall |
|
|
14
14
|
|
|
15
|
-
## L0
|
|
15
|
+
## L0 only (docs/format/comments only)
|
|
16
16
|
|
|
17
|
-
| # |
|
|
17
|
+
| # | Check |
|
|
18
18
|
|---|---|
|
|
19
|
-
| L0-1 |
|
|
20
|
-
| L0-2 | git diff --check
|
|
19
|
+
| L0-1 | Change is confirmed non-behavioral (docs/format/comments only) |
|
|
20
|
+
| L0-2 | `git diff --check` reports no whitespace errors |
|
|
21
21
|
|
|
22
|
-
## L1
|
|
22
|
+
## L1 only (single-module behavior change)
|
|
23
23
|
|
|
24
|
-
| # |
|
|
24
|
+
| # | Check |
|
|
25
25
|
|---|---|
|
|
26
|
-
| L1-1 |
|
|
27
|
-
| L1-2 |
|
|
26
|
+
| L1-1 | Brainstorming record exists |
|
|
27
|
+
| L1-2 | Changes do not spread into unrelated modules (git diff range matches task.scope) |
|
|
28
28
|
|
|
29
|
-
## L2
|
|
29
|
+
## L2 only (cross-layer / architecture / migration)
|
|
30
30
|
|
|
31
|
-
| # |
|
|
31
|
+
| # | Check |
|
|
32
32
|
|---|---|
|
|
33
|
-
| L2-1 | proposal.md / spec.md / design.md
|
|
34
|
-
| L2-2 |
|
|
35
|
-
| L2-3 | readiness
|
|
36
|
-
| L2-4 | spec-sync Skill
|
|
33
|
+
| L2-1 | proposal.md / spec.md / design.md are complete |
|
|
34
|
+
| L2-2 | Structured decision review completed per Skill guidance, or explicitly recorded as not applicable |
|
|
35
|
+
| L2-3 | All readiness gates pass (no blocker from `task next <dir> --run`) |
|
|
36
|
+
| L2-4 | spec-sync Skill confirms spec synchronization, or explicitly records that no update is needed |
|
|
37
37
|
|
|
38
|
-
## DoD
|
|
38
|
+
## DoD vs per-task AC
|
|
39
39
|
|
|
40
40
|
| DoD | AC |
|
|
41
41
|
|---|---|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
42
|
+
| Project-level invariant — this task is no exception | Completion conditions specific to the decision-anchor |
|
|
43
|
+
| Source: spec/references/definition-of-done | Source: <task>/decision-anchor.md |
|
|
44
|
+
| Satisfying both = the task is truly complete |
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# References —
|
|
1
|
+
# References — On-Demand Reference Material
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **Never auto-loaded.** Read only when a skill entry explicitly references a reference ID, or when an agent judges it necessary.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
1.
|
|
7
|
-
2.
|
|
8
|
-
3.
|
|
5
|
+
This directory holds narrow-scope quick-reference cards that supplement skill entries. Compared with `spec/contracts/` (contracts) and `spec/backend|frontend/` (domain specs), reference files:
|
|
6
|
+
1. Provide quick checklists during check / finish (not full specs).
|
|
7
|
+
2. Provide defensive rule sets for analyzing potential prompt injection.
|
|
8
|
+
3. Declare the collaboration patterns cowork-flow already implements.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- contract-registry.json
|
|
12
|
-
- skill
|
|
13
|
-
-
|
|
14
|
-
-
|
|
10
|
+
Loading rules:
|
|
11
|
+
- Read when one of `contract-registry.json`'s `references[*].loadWhen` conditions matches.
|
|
12
|
+
- Read when a skill body explicitly references a reference ID.
|
|
13
|
+
- Read when the user requests a specific check in the main session (for example, "security checklist").
|
|
14
|
+
- **Never auto-loaded** — that is the difference from `contracts/`.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- [definition-of-done.md](definition-of-done.md) — DoD
|
|
18
|
-
- [testing-checklist.md](testing-checklist.md) —
|
|
19
|
-
- [security-checklist.md](security-checklist.md) — OWASP Top 10
|
|
20
|
-
- [orchestration-patterns.md](orchestration-patterns.md) —
|
|
16
|
+
Current references:
|
|
17
|
+
- [definition-of-done.md](definition-of-done.md) — DoD: project-level completion gates (L0/L1/L2).
|
|
18
|
+
- [testing-checklist.md](testing-checklist.md) — quick reference for test structure, depth, and anti-patterns.
|
|
19
|
+
- [security-checklist.md](security-checklist.md) — OWASP Top 10 mapping plus a quick check.
|
|
20
|
+
- [orchestration-patterns.md](orchestration-patterns.md) — declarative catalog of the collaboration patterns already implemented.
|
|
@@ -1,141 +1,141 @@
|
|
|
1
1
|
# Orchestration Patterns
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
3
|
+
> Declarative catalog of the collaboration patterns already implemented.
|
|
4
|
+
> This file is a human-readable summary of the `spec/contracts/` series — the contracts are authoritative.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Core principle
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
**The main session is the only coordinator. Fixed subagents are leaf executors. The user is the final decision-maker.**
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Pattern 1: Leaf executors (implemented)
|
|
13
13
|
|
|
14
14
|
```
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
main session -> cowork-implement (implement) -> return -> main session verifies
|
|
16
|
+
main session -> cowork-check (verify) -> return -> main session confirms
|
|
17
|
+
main session -> cowork-research (research) -> return -> main session synthesizes
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
**When to use**: the plan declares parallel low-conflict slices (clean file ownership, independent verification); research that needs context isolation (cowork-research); the independent review required before completion (cowork-check).
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- R-AG-001:
|
|
24
|
-
- R-AG-002:
|
|
25
|
-
- R-AG-003:
|
|
26
|
-
- R-AG-004:
|
|
22
|
+
**Constraints**:
|
|
23
|
+
- R-AG-001: subagents must not dispatch other subagents
|
|
24
|
+
- R-AG-002: subagents must not modify spec files
|
|
25
|
+
- R-AG-003: subagents must not operate Git
|
|
26
|
+
- R-AG-004: subagents must not commit/archive
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
**Verification**: create the runtime context with `subagent init --role` before dispatch; the child's first action must be `subagent bind`; the parent checks `status: bound`.
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Pattern 2: Parallel fan-out + merge (implemented, main-session managed)
|
|
33
33
|
|
|
34
34
|
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
main session ─┬─> cowork-implement (task-slice-a) ─┐
|
|
36
|
+
├─> cowork-implement (task-slice-b) ─┤─> all return ─> integrated verification ─> main session synthesizes
|
|
37
|
+
└─> cowork-research (background) ─┘
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
**When to use**: multiple low-coupling implementation slices can run in parallel.
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
1.
|
|
44
|
-
2.
|
|
45
|
-
3.
|
|
46
|
-
4.
|
|
47
|
-
5.
|
|
48
|
-
6.
|
|
42
|
+
**Verification checklist**:
|
|
43
|
+
1. No write conflicts between subtasks (different files or isolated through git worktree)
|
|
44
|
+
2. Each subagent produces a different type of finding
|
|
45
|
+
3. The merge step fits within the main agent's context window
|
|
46
|
+
4. The user's wait is long enough for parallel wall-clock gains to matter
|
|
47
|
+
5. Converge on a single cowork-check review and a single commit (the receipt fingerprint covers the merged change set)
|
|
48
|
+
6. Two tasks cannot run in parallel in one worktree (the file-scope gate reads the whole working tree); cross-task parallelism uses separate worktrees/clones and coordinates through board dependency edges
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
If any answer is no, fall back to Pattern 1 sequential execution.
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
-
##
|
|
54
|
+
## Pattern 3: Sequential skill chain (implemented, user-driven)
|
|
55
55
|
|
|
56
56
|
```
|
|
57
|
-
|
|
57
|
+
User runs: task next --run --title ... -> brainstorming -> task-planning -> task next <dir> --run -> implement -> check -> task next <dir> --run --intent review
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
**When to use**: stages depend on each other, and user judgment between stages is valuable.
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
62
|
+
**Why there is no lifecycle-orchestration agent**:
|
|
63
|
+
- An orchestration agent summarizes between hand-offs, losing nuance
|
|
64
|
+
- User checkpoints between stages catch wrong directions early
|
|
65
|
+
- The cost of a human check is lower than the rework cost of going the wrong way
|
|
66
66
|
|
|
67
67
|
---
|
|
68
68
|
|
|
69
|
-
##
|
|
69
|
+
## Pattern 4: Party Mode V2 Board (implemented, advisory)
|
|
70
70
|
|
|
71
71
|
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
main session ─> start Discussion (party-v2 runtime board)
|
|
73
|
+
─> subagents communicate through the board (never directly)
|
|
74
|
+
─> moderator monitors drift and does not decide
|
|
75
|
+
─> produces advice and does not change task state
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
78
|
+
**Constraints**:
|
|
79
|
+
- The board cannot advance task state
|
|
80
|
+
- It cannot replace the Implement/Check formal gates
|
|
81
|
+
- The moderator must not relay, summarize, or synthesize subagent opinions
|
|
82
82
|
|
|
83
83
|
---
|
|
84
84
|
|
|
85
|
-
##
|
|
85
|
+
## Anti-pattern A: Router persona (forbidden)
|
|
86
86
|
|
|
87
87
|
```
|
|
88
|
-
/workflow ->
|
|
88
|
+
/workflow -> agent persona ("what role do you need?") -> sub-persona -> agent persona (restates) -> user
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
**Why not**: a pure routing layer has no domain value; double restatement loses information and costs ~2x tokens; the `<workflow-state>` routing in AGENTS.md already covers this
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
**Alternative**: route directly with the `<workflow-state>` block; do not use personas.
|
|
94
94
|
|
|
95
95
|
---
|
|
96
96
|
|
|
97
|
-
##
|
|
97
|
+
## Anti-pattern B: Persona calling persona (forbidden)
|
|
98
98
|
|
|
99
99
|
```
|
|
100
|
-
cowork-check("
|
|
100
|
+
cowork-check("sees security-related code") -> cowork-security-audit
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
**Why not**: personas are designed to produce a single perspective; chaining breaks that design; summaries passed between personas lose context; failure modes multiply
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
**Alternative**: the current persona recommends a follow-up audit in its report; the user or main session runs the second round.
|
|
106
106
|
|
|
107
107
|
---
|
|
108
108
|
|
|
109
|
-
##
|
|
109
|
+
## Anti-pattern C: Deep nesting (forbidden)
|
|
110
110
|
|
|
111
111
|
```
|
|
112
112
|
/ship -> quality-coordinator -> code-reviewer -> security-auditor
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
**Why not**: each layer adds latency and tokens without decision value; deep persona context degrades after repeated summarization
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
**Alternative**: cowork-flow's current depth = 1 (main session -> leaf subagent). Do not introduce intermediate layers.
|
|
118
118
|
|
|
119
119
|
---
|
|
120
120
|
|
|
121
|
-
##
|
|
121
|
+
## Decision flow
|
|
122
122
|
|
|
123
123
|
```
|
|
124
|
-
|
|
125
|
-
├──
|
|
126
|
-
└──
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
124
|
+
Is the task one perspective on one artifact?
|
|
125
|
+
├── Yes -> call it directly. Stop.
|
|
126
|
+
└── No -> can the tasks run in parallel?
|
|
127
|
+
├── No -> sequential skill chain (user-driven)
|
|
128
|
+
└── Yes -> parallel fan-out (main-session coordinated)
|
|
129
|
+
Verification checklist:
|
|
130
|
+
- subtasks have no write conflicts
|
|
131
|
+
- each persona produces a different type
|
|
132
|
+
- the merge step fits in the main context
|
|
133
|
+
Any failure -> fall back to sequential
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
##
|
|
136
|
+
## See also
|
|
137
137
|
|
|
138
|
-
- `spec/contracts/subagent-dispatch.md` — formal dispatch
|
|
139
|
-
- `spec/contracts/party-mode-v2-board.md` — Party Mode V2
|
|
140
|
-
- `spec/backend
|
|
141
|
-
- `skills/cowork-flow/SKILL.md` — workflow state
|
|
138
|
+
- `spec/contracts/subagent-dispatch.md` — authoritative formal dispatch protocol
|
|
139
|
+
- `spec/contracts/party-mode-v2-board.md` — authoritative Party Mode V2 definition
|
|
140
|
+
- `spec/backend/`, `spec/frontend/`, `spec/guides/` — user-defined specs, read clause by clause by the review skill
|
|
141
|
+
- `skills/cowork-flow/SKILL.md` — workflow state routing
|