cowork-flow 2.2.0 → 2.4.0
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 +33 -1
- package/README.en.md +46 -22
- package/README.md +10 -7
- 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 +5 -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 +8 -2
- package/presets/codex/.codex-plugin/plugin.json +1 -1
- package/presets/codex/skills/cowork-flow-bootstrap/SKILL.md +8 -2
- package/presets/kimi-code/.kimi-plugin/plugin.json +1 -1
- package/presets/kimi-code/skills/cowork-flow-bootstrap/SKILL.md +8 -2
- package/presets/opencode/cowork-flow/skills/cowork-flow-bootstrap/SKILL.md +8 -2
- package/presets/qoder/.qoder-plugin/plugin.json +1 -1
- package/presets/qoder/skills/cowork-flow-bootstrap/SKILL.md +8 -2
- package/presets/zcode/.zcode-plugin/plugin.json +1 -1
- package/presets/zcode/skills/cowork-flow-bootstrap/SKILL.md +8 -2
- package/src/cli.js +1 -1
- package/src/commands/init.js +200 -16
- package/src/commands/registry.js +10 -7
- package/src/commands/source-refresh.js +5 -1
- package/src/commands/sync.js +4 -1
- package/src/lib/copy-template.js +23 -5
- package/src/lib/host-assets.js +119 -4
- 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 +104 -0
- package/template/.cowork-flow/scripts/services/fact_view.py +21 -15
- package/template/.cowork-flow/scripts/services/task_context.py +13 -7
- package/template/.cowork-flow/scripts/services/task_creation.py +72 -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 +21 -14
- package/template/.cowork-flow/spec/contracts/plan-binding.md +2 -1
- 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/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 +160 -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 +19 -92
|
@@ -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
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
# Security Quick Reference
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Security quick reference. Load on demand when handling user input, authentication, data storage, or external integrations.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Contract: ERROR_OUTPUT_AS_DATA_V1 (see .cowork-flow/spec/contracts/error-output-as-data.md)
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Input validation
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- Validate all external input at the boundary (API entry points, file uploads, CLI arguments)
|
|
10
|
+
- Error messages must not leak internal implementation details (stack traces, paths, library versions)
|
|
11
|
+
- Use parameterized queries; never concatenate SQL strings
|
|
12
|
+
- Prefer length/type/range allowlists over blocklists
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Authentication and authorization
|
|
15
15
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
16
|
+
- Authentication state is not stored on the client (httpOnly secure cookie only)
|
|
17
|
+
- Perform permission checks on every protected operation (do not rely on the frontend to hide controls)
|
|
18
|
+
- Authentication failures do not distinguish wrong username from wrong password (use a uniform "authentication failed" message)
|
|
19
|
+
- Sessions have an expiry time and rotate on privilege change
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Dependencies and supply chain
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
23
|
+
- Third-party dependencies come from trusted sources
|
|
24
|
+
- No known CVEs (`pip audit` / `npm audit`)
|
|
25
|
+
- Lockfiles are committed to version control
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Data and privacy
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
29
|
+
- Logs contain no sensitive data (passwords, tokens, PII)
|
|
30
|
+
- Encrypt in transit (TLS) and at rest (bcrypt/argon2)
|
|
31
|
+
- Treat error output as untrusted data (see ERROR_OUTPUT_AS_DATA_V1)
|
|
32
32
|
|
|
33
|
-
## OWASP Top 10
|
|
33
|
+
## OWASP Top 10 quick mapping
|
|
34
34
|
|
|
35
|
-
|
|
|
35
|
+
| ID | Category | Check | Risk if missing |
|
|
36
36
|
|---|---|---|---|
|
|
37
|
-
| A01 |
|
|
38
|
-
| A02 |
|
|
39
|
-
| A03 |
|
|
40
|
-
| A04 | XXE |
|
|
41
|
-
| A05 |
|
|
42
|
-
| A06 |
|
|
43
|
-
| A07 | XSS |
|
|
44
|
-
| A08 |
|
|
45
|
-
| A09 |
|
|
46
|
-
| A10 |
|
|
47
|
-
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
- `spec/contracts/error-output-as-data.md` —
|
|
51
|
-
- `skills/test-first/SKILL.md` —
|
|
37
|
+
| A01 | Injection | Parameterized queries | Data disclosure or loss |
|
|
38
|
+
| A02 | Broken authentication | bcrypt + session rotation | Account takeover |
|
|
39
|
+
| A03 | Sensitive data exposure | Encryption in transit + at rest + no leakage | Data disclosure |
|
|
40
|
+
| A04 | XXE | Disable external entity parsing | XML injection |
|
|
41
|
+
| A05 | Broken access control | Re-authorize on every request | Unauthorized operations |
|
|
42
|
+
| A06 | Security misconfiguration | Secure defaults + no debug headers | Information disclosure |
|
|
43
|
+
| A07 | XSS | Input/output encoding + CSP | Browser-side code execution |
|
|
44
|
+
| A08 | Insecure deserialization | Do not deserialize untrusted data | RCE |
|
|
45
|
+
| A09 | Vulnerable components | Regular audits | Known exploits |
|
|
46
|
+
| A10 | Unauthorized replay | Nonce + rate limit | Automated abuse |
|
|
47
|
+
|
|
48
|
+
## See also
|
|
49
|
+
|
|
50
|
+
- `spec/contracts/error-output-as-data.md` — defending against prompt injection
|
|
51
|
+
- `skills/test-first/SKILL.md` — security regression test evidence
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
# Testing Checklist
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Quick reference for test quality. Load on demand when reviewing test files, writing test cases, or checking behavior coverage.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Test structure
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- AAA
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- Test names describe behavior: `test_<unit>_<scenario>_<expected>`
|
|
8
|
+
- AAA layout (visual separation between Arrange/Act/Assert)
|
|
9
|
+
- One test verifies one behavior
|
|
10
|
+
- Assert behavior contracts, not implementation details
|
|
11
|
+
- Mocks verify behavior calls, not call counts
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Depth
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
15
|
+
- Not a test that passes via `assert True`
|
|
16
|
+
- Not a test that only checks whether a function exists
|
|
17
|
+
- Not a test that uses `unittest.mock` call counts instead of behavior verification
|
|
18
|
+
- Not a test that snapshots an empty structure (`assert result == {}`)
|
|
19
|
+
- Does not depend on test execution order
|
|
20
|
+
- Does not skip necessary setup/teardown
|
|
21
|
+
- Asserts exact values or behavior contracts, not truthy/falsy
|
|
22
|
+
- Has at least one test for the error path
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Anti-patterns
|
|
25
25
|
|
|
26
|
-
|
|
|
26
|
+
| Anti-pattern | Problem | Alternative |
|
|
27
27
|
|---|---|---|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
28
|
+
| Hard-coding expected values to implementation output | Test couples to implementation; it fails when implementation changes but behavior does not | Verify the behavior contract: input -> expected output |
|
|
29
|
+
| Mocking internal calls of the function under test | Tests implementation instead of behavior | Keep mocks at boundaries (API/filesystem/time) |
|
|
30
|
+
| Packing unrelated behaviors into one test | A failure does not reveal what broke | One test per behavior, with a descriptive name |
|
|
31
|
+
| Asserting `assert True` | Always passes | Use semantic assertions (assertEqual/assertGreater, etc.) |
|
|
32
|
+
| Only checking that a function exists (`assert module.func`) | Does not verify behavior | Call the function and verify output or exceptions |
|
|
33
|
+
| Not cleaning up global state / fixtures | Cross-test pollution causes order dependence | Clean up in setup/teardown |
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Scope
|
|
36
36
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
37
|
+
- The changed function/module has a direct unit test
|
|
38
|
+
- Downstream dependencies have integration tests
|
|
39
|
+
- Boundary conditions (empty/extreme values/concurrency) have at least one test
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## See also
|
|
42
42
|
|
|
43
|
-
- `spec/backend/quality-guidelines.md` —
|
|
44
|
-
- `skills/test-first/SKILL.md` —
|
|
45
|
-
- `references/security-checklist.md` —
|
|
43
|
+
- `spec/backend/quality-guidelines.md` — backend testing rules
|
|
44
|
+
- `skills/test-first/SKILL.md` — full TDD workflow
|
|
45
|
+
- `references/security-checklist.md` — security boundary checks in tests
|
|
@@ -442,16 +442,36 @@
|
|
|
442
442
|
],
|
|
443
443
|
"excludedPrefixes": [
|
|
444
444
|
"skills/",
|
|
445
|
+
"locales/",
|
|
445
446
|
".zcode/",
|
|
446
447
|
".qoder/"
|
|
447
448
|
],
|
|
449
|
+
"localization": {
|
|
450
|
+
"default": "zh-CN",
|
|
451
|
+
"supported": [
|
|
452
|
+
"zh-CN",
|
|
453
|
+
"en-US"
|
|
454
|
+
],
|
|
455
|
+
"assets": {
|
|
456
|
+
"en-US": [
|
|
457
|
+
".cowork-flow/spec/contracts/decision-anchor.md",
|
|
458
|
+
".cowork-flow/templates/plan-template.md"
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
},
|
|
448
462
|
"syncPolicy": {
|
|
449
463
|
"protectedFiles": [
|
|
450
464
|
".cowork-flow/config.yaml",
|
|
451
465
|
".cowork-flow/.developer"
|
|
452
466
|
],
|
|
467
|
+
"forceProtectedFiles": [
|
|
468
|
+
".cowork-flow/config.yaml"
|
|
469
|
+
],
|
|
453
470
|
"protectedPrefixes": [
|
|
454
|
-
".cowork-flow/spec/",
|
|
471
|
+
".cowork-flow/spec/backend/",
|
|
472
|
+
".cowork-flow/spec/frontend/",
|
|
473
|
+
".cowork-flow/spec/guides/",
|
|
474
|
+
".cowork-flow/spec/references/",
|
|
455
475
|
".cowork-flow/tasks/",
|
|
456
476
|
".cowork-flow/plans/"
|
|
457
477
|
],
|
|
@@ -459,9 +479,7 @@
|
|
|
459
479
|
".cowork-flow/.gitignore",
|
|
460
480
|
".cowork-flow/.version",
|
|
461
481
|
".cowork-flow/run",
|
|
462
|
-
".cowork-flow/run.cmd"
|
|
463
|
-
".cowork-flow/spec/contracts/workflow-state-templates.md",
|
|
464
|
-
".cowork-flow/spec/runtime/scope-rules.json"
|
|
482
|
+
".cowork-flow/run.cmd"
|
|
465
483
|
],
|
|
466
484
|
"safePrefixes": [
|
|
467
485
|
".cowork-flow/"
|
|
@@ -511,6 +529,7 @@
|
|
|
511
529
|
".claude/skills/update-spec",
|
|
512
530
|
".claude/skills/using-cowork-flow",
|
|
513
531
|
".claude/skills/writing-plans",
|
|
532
|
+
".cowork-flow/plan-template.md",
|
|
514
533
|
".cowork-flow/project-context.md",
|
|
515
534
|
".cowork-flow/scripts/application",
|
|
516
535
|
".cowork-flow/scripts/services/batch_execution.py",
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
# Runtime Specs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This directory holds machine configuration read directly by the workflow runtime.
|
|
4
4
|
|
|
5
|
-
- `contract-registry.json`:
|
|
6
|
-
- `host-assets.json`:
|
|
5
|
+
- `contract-registry.json`: registry of the contract digests injected by hooks/plugins.
|
|
6
|
+
- `host-assets.json`: single source for host platforms, asset ownership, skill read roots and host discovery channels (`skillReadRoot` / `skillDiscovery[]`, entries are repo-relative paths plus `gates` / `evidence`; machine-level payloads do not participate as skill sources), machine-level plugin payload declarations (`payload`: the package-relative payload directory and plugin manifest name; `null` for hosts without a plugin payload; machine install locations are not declared here), the sync protection policy, and the obsolete-asset migration list. The structure is constrained by `../schemas/host-assets.schema.json`. `capabilityMatrix.hosts` must cover every id declared in `platforms` — the required host set is derived from platform data; the runtime does not maintain a host-name constant.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
避免崩溃,但必须在 digest 中暴露 warning;doctor/tests 负责发现缺失。
|
|
8
|
+
Missing or corrupted runtime files must not silently grant critical workflow capabilities. Host plugins may use a minimal fallback to avoid crashing, but must expose a warning in the digest; doctor/tests are responsible for detecting absence.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
`spec/backend/`、`spec/frontend/`、`spec/guides/` 并输出审查结论。
|
|
10
|
+
User natural-language specs are not registered in this directory; the `task-review` skill reads `spec/backend/`, `spec/frontend/`, and `spec/guides/` directly and reports review findings.
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
Runtime write boundaries:
|
|
15
13
|
|
|
16
|
-
- CLI
|
|
17
|
-
- JSON
|
|
18
|
-
- init/sync
|
|
19
|
-
-
|
|
14
|
+
- CLI/host/Git adaptation lives in `scripts/adapters/`; use-case services live in `scripts/services/`.
|
|
15
|
+
- JSON state is read and written through `scripts/infra/storage/` with explicit UTF-8.
|
|
16
|
+
- init/sync commit assets through Asset Plan, staging, backup, and rollback; the version file is updated last.
|
|
17
|
+
- Old state is only allowed at read boundaries with migration tests; new writes must use the current schema and authoritative paths.
|