cowork-flow 0.0.37 → 0.0.39
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/README.md +27 -14
- package/package.json +1 -1
- package/src/commands/init.js +39 -28
- package/src/commands/sync.js +2 -2
- package/src/lib/asset-plan.js +127 -0
- package/src/lib/copy-template.js +101 -141
- package/src/lib/host-assets.js +231 -0
- package/src/lib/plan-applier.js +329 -0
- package/src/lib/platforms.js +15 -76
- package/src/lib/skill-registry.js +503 -0
- package/template/.claude/agents/cowork-check.md +10 -1
- package/template/.claude/agents/cowork-implement.md +11 -2
- package/template/.claude/hooks/inject-workflow-state.py +51 -254
- package/template/.codex/agents/cowork-check.toml +12 -3
- package/template/.codex/agents/cowork-implement.toml +11 -2
- package/template/.codex/agents/default.toml +3 -2
- package/template/.codex/agents/explorer.toml +3 -2
- package/template/.codex/agents/worker.toml +2 -1
- package/template/.codex/hooks/inject-workflow-state.py +46 -265
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/scripts/application/__init__.py +1 -0
- package/template/.cowork-flow/scripts/application/batch_execution.py +743 -0
- package/template/.cowork-flow/scripts/application/runtime_context_service.py +365 -0
- package/template/.cowork-flow/scripts/application/task_archive.py +220 -0
- package/template/.cowork-flow/scripts/application/task_context.py +765 -0
- package/template/.cowork-flow/scripts/application/task_creation.py +201 -0
- package/template/.cowork-flow/scripts/application/task_lifecycle.py +532 -0
- package/template/.cowork-flow/scripts/application/task_tree.py +179 -0
- package/template/.cowork-flow/scripts/commands/doctor.py +78 -57
- package/template/.cowork-flow/scripts/commands/party_mode_v2.py +671 -425
- package/template/.cowork-flow/scripts/commands/subagent.py +38 -26
- package/template/.cowork-flow/scripts/commands/task.py +535 -1953
- package/template/.cowork-flow/scripts/commands/task_archive_commands.py +195 -0
- package/template/.cowork-flow/scripts/commands/task_context_commands.py +240 -0
- package/template/.cowork-flow/scripts/commands/task_create_command.py +164 -0
- package/template/.cowork-flow/scripts/commands/task_navigation.py +407 -0
- package/template/.cowork-flow/scripts/commands/task_parser.py +364 -0
- package/template/.cowork-flow/scripts/commands/task_support.py +76 -0
- package/template/.cowork-flow/scripts/commands/task_tree_commands.py +160 -0
- package/template/.cowork-flow/scripts/common/core/execution_context.py +161 -85
- package/template/.cowork-flow/scripts/common/core/host_manifest.py +393 -0
- package/template/.cowork-flow/scripts/common/core/skill_registry.py +568 -0
- package/template/.cowork-flow/scripts/common/gates/coding_standards.py +58 -7
- package/template/.cowork-flow/scripts/common/gates/gates.py +323 -46
- package/template/.cowork-flow/scripts/common/gates/models.py +196 -0
- package/template/.cowork-flow/scripts/common/gates/registry.py +79 -0
- package/template/.cowork-flow/scripts/common/gates/tdd_evidence.py +13 -13
- package/template/.cowork-flow/scripts/common/gates/validate_coding_standards.py +104 -62
- package/template/.cowork-flow/scripts/common/gates/validate_implementation.py +39 -22
- package/template/.cowork-flow/scripts/common/gates/validate_rules.py +223 -40
- package/template/.cowork-flow/scripts/common/git/git_context.py +216 -182
- package/template/.cowork-flow/scripts/common/host/__init__.py +1 -0
- package/template/.cowork-flow/scripts/common/host/workflow_state_hook.py +303 -0
- package/template/.cowork-flow/scripts/common/storage/__init__.py +1 -0
- package/template/.cowork-flow/scripts/common/storage/operation_log.py +72 -0
- package/template/.cowork-flow/scripts/common/storage/state_store.py +279 -0
- package/template/.cowork-flow/scripts/common/storage/unit_of_work.py +214 -0
- package/template/.cowork-flow/scripts/common/task/active_task.py +93 -135
- package/template/.cowork-flow/scripts/common/task/batch_mode.py +33 -120
- package/template/.cowork-flow/scripts/common/task/decision_review.py +85 -0
- package/template/.cowork-flow/scripts/common/task/readiness.py +9 -15
- package/template/.cowork-flow/scripts/common/task/task_repository.py +156 -0
- package/template/.cowork-flow/scripts/run.py +24 -0
- package/template/.cowork-flow/spec/contracts/decision-anchor.md +8 -2
- package/template/.cowork-flow/spec/contracts/subagent-dispatch.md +2 -4
- package/template/.cowork-flow/spec/contracts/workflow-state-templates.md +1 -1
- package/template/.cowork-flow/spec/protocols/decision-review.md +28 -0
- package/template/.cowork-flow/spec/protocols/review.md +34 -0
- package/template/.cowork-flow/spec/protocols/spec-maintenance.md +16 -0
- package/template/.cowork-flow/spec/protocols/tdd.md +30 -0
- package/template/.cowork-flow/spec/references/definition-of-done.md +4 -4
- package/template/.cowork-flow/spec/references/orchestration-patterns.md +1 -1
- package/template/.cowork-flow/spec/runtime/contract-registry.json +25 -0
- package/template/.cowork-flow/spec/runtime/host-assets.json +214 -0
- package/template/.cowork-flow/spec/runtime/index.md +8 -0
- package/template/.cowork-flow/spec/runtime/rules.json +61 -10
- package/template/.cowork-flow/spec/runtime/skill-registry.json +397 -0
- package/template/.cowork-flow/spec/schemas/host-assets.schema.json +173 -0
- package/template/.cowork-flow/spec/schemas/rules.schema.json +10 -1
- package/template/.cowork-flow/spec/schemas/skill-registry.schema.json +202 -0
- package/template/.cowork-flow/workflow.md +18 -13
- package/template/.opencode/agents/cowork-check.md +11 -0
- package/template/.opencode/agents/cowork-implement.md +16 -1
- package/template/.zcode/.zcode-plugin/plugin.json +1 -1
- package/template/.zcode/hooks/inject-context.js +3 -85
- package/template/.zcode/hooks/inject-context.selfcheck.mjs +6 -6
- package/template/.zcode/scaffold/.cowork-flow/spec/contracts/decision-anchor.md +8 -2
- package/template/.zcode/scaffold/.cowork-flow/spec/contracts/subagent-dispatch.md +2 -4
- package/template/.zcode/scaffold/.cowork-flow/spec/runtime/rules.json +61 -10
- package/template/.zcode/scaffold/.cowork-flow/spec/schemas/rules.schema.json +10 -1
- package/template/.zcode/scaffold/.cowork-flow/workflow.md +18 -13
- package/template/.zcode/scaffold/AGENTS.md +18 -8
- package/template/AGENTS.md +1 -1
- package/template/skills/batch-mode/SKILL.md +140 -76
- package/template/skills/brainstorming/SKILL.md +2 -2
- package/template/skills/cowork-flow/SKILL.md +42 -0
- package/template/skills/party-mode/SHARED-BOUNDARIES.md +1 -1
- package/template/skills/party-mode/SKILL.md +48 -119
- package/template/.cowork-flow/scripts/common/gates/spec_validator.py +0 -53
- package/template/.cowork-flow/scripts/common/gates/validate_jsonl.py +0 -32
- package/template/skills/before-dev/SKILL.md +0 -41
- package/template/skills/check/SKILL.md +0 -53
- package/template/skills/check/simplification-guide.md +0 -47
- package/template/skills/continue/SKILL.md +0 -29
- package/template/skills/doubt-review/SKILL.md +0 -118
- package/template/skills/finish-work/SKILL.md +0 -32
- package/template/skills/party-mode-v2/SKILL.md +0 -75
- package/template/skills/start/SKILL.md +0 -78
- package/template/skills/tdd/SKILL.md +0 -74
- package/template/skills/update-spec/SKILL.md +0 -39
- package/template/skills/using-cowork-flow/SKILL.md +0 -80
|
@@ -1,151 +1,80 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: party-mode
|
|
3
|
-
description: Use when the user manually requests Party Mode or a
|
|
3
|
+
description: Use when the user manually requests Party Mode or a runtime-controlled multi-agent board discussion where children communicate through board APIs and the moderator only monitors or corrects drift.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Party Mode
|
|
7
7
|
|
|
8
|
-
Use this skill as
|
|
8
|
+
Use this skill as the single public Party Mode entrypoint.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The Python runtime is the source of truth for discussion state, board
|
|
11
|
+
visibility, validation, round limits, and final reports. The runtime board owns
|
|
12
|
+
child-visible discussion state.
|
|
11
13
|
|
|
12
14
|
## Boundaries
|
|
13
15
|
|
|
14
16
|
See [SHARED-BOUNDARIES.md](SHARED-BOUNDARIES.md) for common boundaries and advisory limits.
|
|
15
17
|
|
|
16
|
-
-
|
|
18
|
+
- Party Mode is advisory only. It does not satisfy formal Implement or Check.
|
|
19
|
+
- The moderator does not forward, summarize, rewrite, or synthesize child opinions for other child agents.
|
|
17
20
|
|
|
18
|
-
##
|
|
21
|
+
## Runtime First
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- `max_agents=3`
|
|
23
|
-
- `max_rounds=5`
|
|
24
|
-
|
|
25
|
-
These defaults are configurable values, not hard-coded constants. Effective config order:
|
|
23
|
+
Always use the runtime controller:
|
|
26
24
|
|
|
27
25
|
```text
|
|
28
|
-
|
|
26
|
+
.cowork-flow/run party-v2 init
|
|
27
|
+
.cowork-flow/run party-v2 monitor
|
|
28
|
+
.cowork-flow/run party-v2 view
|
|
29
|
+
.cowork-flow/run party-v2 post
|
|
30
|
+
.cowork-flow/run party-v2 respond
|
|
31
|
+
.cowork-flow/run party-v2 advance
|
|
32
|
+
.cowork-flow/run party-v2 record-action-result
|
|
33
|
+
.cowork-flow/run party-v2 finalize
|
|
29
34
|
```
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- `max_rounds`
|
|
35
|
-
- agent roster or review lenses
|
|
36
|
-
- report enabled
|
|
37
|
-
- report path
|
|
38
|
-
- round phase policy, including when challenge may continue and when convergence must begin
|
|
39
|
-
|
|
40
|
-
Safety gates:
|
|
41
|
-
|
|
42
|
-
- continue conditions can be tightened but not removed
|
|
43
|
-
- stop conditions can be tightened but not removed
|
|
44
|
-
- schema core fields can be extended but not removed
|
|
45
|
-
- exceeding effective limits requires explicit user approval
|
|
46
|
-
|
|
47
|
-
## Round Model
|
|
48
|
-
|
|
49
|
-
1. Frame the question, decision needed, scope, and evidence packet.
|
|
50
|
-
2. Select the smallest useful agent roster or review lenses within effective `max_agents`. Record why each selected voice is useful and why omitted voices are not needed.
|
|
51
|
-
3. Round 1 uses fresh child contexts. Send each child the same packet and one lens. Child agents cannot see each other.
|
|
52
|
-
4. Synthesize evidence-backed positions into a compact claim table: `claim_id`, owner, claim, evidence, counterclaim, evidence gap, and decision impact.
|
|
53
|
-
5. Continue only when a continue condition is met. Send narrow follow-up prompts to the smallest useful set of children, and bind each prompt to one `claim_id`.
|
|
54
|
-
6. Follow-up rounds should prefer the same live child that produced or challenged the relevant position. Send only the target claim, counterclaim, evidence gap, and ask the child to `agree`, `reject`, or `revise`.
|
|
55
|
-
7. For Challenge rounds, the default stance is scrutiny. Test the opposing claim first; choose `agree` only after naming the evidence that compels agreement.
|
|
56
|
-
8. Spawn an extra child only when the effective roster or lens config allows it, a live child failed, or the user approves expansion.
|
|
57
|
-
9. Stop when any stop condition is met and no dispatched child is still running. Then close live children through the Host Adapter close primitive.
|
|
58
|
-
|
|
59
|
-
Round intent:
|
|
60
|
-
|
|
61
|
-
- Opening round: independent first judgments.
|
|
62
|
-
- Challenge rounds: rebuttal, risk drilldown, or evidence repair on specific disagreements.
|
|
63
|
-
- Convergence rounds: decision check only. Verify, narrow, or choose. Do not open new directions.
|
|
64
|
-
|
|
65
|
-
Default mapping:
|
|
66
|
-
|
|
67
|
-
- Round 1 = Opening.
|
|
68
|
-
- Round 2+ = Challenge while continue conditions still expose material disagreement, material risk, missing evidence, or untestable acceptance criteria.
|
|
69
|
-
- Convergence begins when the coordinator can write one recommended direction and no material challenge condition remains.
|
|
36
|
+
Do not bypass a runtime rejection by manually accepting child output. Runtime
|
|
37
|
+
validation failures must be fixed by a corrected child submission or by ending
|
|
38
|
+
the discussion.
|
|
70
39
|
|
|
71
|
-
|
|
40
|
+
## Board Rules
|
|
72
41
|
|
|
73
|
-
|
|
42
|
+
- Child agents communicate through the board API.
|
|
43
|
+
- Child-visible board output must be current-round only.
|
|
44
|
+
- Historical board state is runtime-private and may be used only for audit or final reports.
|
|
45
|
+
- Use at least three child agents unless the effective runtime config explicitly allows a different value.
|
|
46
|
+
- The runtime emits host-neutral next actions. The active Host Adapter or moderator executes them for Codex, Claude Code, or OpenCode.
|
|
47
|
+
- Host action results must be recorded back through `record-action-result` so `agents.json`, audit logs, and action history can prove lifecycle state.
|
|
74
48
|
|
|
75
|
-
|
|
49
|
+
## Child Response Rules
|
|
76
50
|
|
|
77
|
-
|
|
78
|
-
- A high risk lacks enough evidence.
|
|
79
|
-
- Acceptance criteria are still not testable.
|
|
80
|
-
- A child found new file, command, rule, or user-scenario evidence.
|
|
81
|
-
- The coordinator cannot write one recommended direction.
|
|
82
|
-
|
|
83
|
-
## Stop Conditions
|
|
84
|
-
|
|
85
|
-
Stop when any condition holds:
|
|
86
|
-
|
|
87
|
-
- Recommendation, rejected options, and measurable acceptance criteria are clear.
|
|
88
|
-
- Remaining issue is user value preference, not missing evidence.
|
|
89
|
-
- A full round adds no evidence and does not narrow scope.
|
|
90
|
-
- Effective `max_rounds` is reached.
|
|
91
|
-
- Output fails schema, and one repair prompt does not fix it.
|
|
92
|
-
|
|
93
|
-
## Waiting Children
|
|
94
|
-
|
|
95
|
-
- A wait timeout is not a child timeout.
|
|
96
|
-
- If a child remains live after a wait timeout, wait again or report it in `pending_children`.
|
|
97
|
-
- Do not close, cancel, omit, or synthesize around a live child unless the user explicitly asks to close it.
|
|
98
|
-
- When the discussion has converged or the user ends it, close live children after their final output is recorded.
|
|
99
|
-
|
|
100
|
-
## Child Output Schema
|
|
101
|
-
|
|
102
|
-
Each child must return these core fields. Extra fields are allowed only after them.
|
|
51
|
+
When a child sees a different position, it must choose exactly one:
|
|
103
52
|
|
|
104
53
|
```text
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
tradeoff:
|
|
109
|
-
rejected_option:
|
|
110
|
-
acceptance_signal:
|
|
111
|
-
what_would_change_my_mind:
|
|
54
|
+
maintain
|
|
55
|
+
revise
|
|
56
|
+
concede
|
|
112
57
|
```
|
|
113
58
|
|
|
114
|
-
|
|
59
|
+
`concede` requires accepted evidence and why the prior position failed.
|
|
60
|
+
`revise` requires the accepted part, rejected part, and updated position.
|
|
61
|
+
`maintain` requires counter evidence or counter reasoning.
|
|
115
62
|
|
|
116
|
-
|
|
117
|
-
claim_id:
|
|
118
|
-
responding_to:
|
|
119
|
-
opposing_claim:
|
|
120
|
-
position_delta:
|
|
121
|
-
evidence_delta:
|
|
122
|
-
still_disagree:
|
|
123
|
-
```
|
|
63
|
+
Unsupported agreement, vague revision, and evidence-free rebuttal are invalid.
|
|
124
64
|
|
|
125
|
-
|
|
126
|
-
Reject unsupported opinion. Evidence should name files, commands, rules, observed behavior, user scenarios, or concrete assumptions.
|
|
65
|
+
## Moderator Role
|
|
127
66
|
|
|
128
|
-
|
|
67
|
+
The moderator may:
|
|
129
68
|
|
|
130
|
-
|
|
69
|
+
- run runtime commands,
|
|
70
|
+
- execute host-neutral next actions through the active host,
|
|
71
|
+
- record off-topic warnings through the runtime,
|
|
72
|
+
- close children only when the runtime asks for closeout,
|
|
73
|
+
- show runtime status or final reports to the user.
|
|
131
74
|
|
|
132
|
-
|
|
133
|
-
effective_max_agents:
|
|
134
|
-
effective_max_rounds:
|
|
135
|
-
rounds_used:
|
|
136
|
-
selected_agents:
|
|
137
|
-
claim_table:
|
|
138
|
-
agent_turns:
|
|
139
|
-
pending_children:
|
|
140
|
-
consensus:
|
|
141
|
-
disagreements:
|
|
142
|
-
evidence:
|
|
143
|
-
decision:
|
|
144
|
-
rejected_options:
|
|
145
|
-
acceptance_criteria:
|
|
146
|
-
open_questions:
|
|
147
|
-
early_stop_reason:
|
|
148
|
-
stop_reason:
|
|
149
|
-
```
|
|
75
|
+
The moderator must not:
|
|
150
76
|
|
|
151
|
-
|
|
77
|
+
- forward one child opinion to another child,
|
|
78
|
+
- create a claim table for child prompts,
|
|
79
|
+
- vote-count as validation,
|
|
80
|
+
- decide which child is correct.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Spec markdown section validator for cowork-flow."""
|
|
3
|
-
|
|
4
|
-
from __future__ import annotations
|
|
5
|
-
|
|
6
|
-
import re
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
|
|
9
|
-
SECTION_CONFIG: dict[str, tuple[str, ...]] = {
|
|
10
|
-
"contract": ("Goal", "When to Use", "Rules", "Examples"),
|
|
11
|
-
"skill": ("Overview", "When to Use", "Steps", "Verification"),
|
|
12
|
-
"guide": ("Goal", "When to Use", "Process", "Anti-Rationalization"),
|
|
13
|
-
"default": ("Goal", "Rules"),
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
HEADER_RE = re.compile(r"^##\s+(.+)$", re.MULTILINE)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def validate_sections(file_path: Path | str, spec_type: str = "default") -> tuple[bool, list[str]]:
|
|
20
|
-
"""Validate a spec markdown file has all required sections.
|
|
21
|
-
|
|
22
|
-
Returns (is_valid, error_messages).
|
|
23
|
-
"""
|
|
24
|
-
path = Path(file_path)
|
|
25
|
-
errors: list[str] = []
|
|
26
|
-
|
|
27
|
-
if not path.is_file():
|
|
28
|
-
return False, [f"File not found: {path}"]
|
|
29
|
-
|
|
30
|
-
content = path.read_text(encoding="utf-8").strip()
|
|
31
|
-
if not content:
|
|
32
|
-
return False, ["File is empty"]
|
|
33
|
-
|
|
34
|
-
required = SECTION_CONFIG.get(spec_type)
|
|
35
|
-
if required is None:
|
|
36
|
-
return False, [f"Unknown spec type: {spec_type}"]
|
|
37
|
-
|
|
38
|
-
matches = list(HEADER_RE.finditer(content))
|
|
39
|
-
found: dict[str, str] = {}
|
|
40
|
-
for i, m in enumerate(matches):
|
|
41
|
-
name = m.group(1).strip()
|
|
42
|
-
start = m.end()
|
|
43
|
-
end = matches[i + 1].start() if i + 1 < len(matches) else len(content)
|
|
44
|
-
body = content[start:end].strip()
|
|
45
|
-
found[name] = body
|
|
46
|
-
|
|
47
|
-
for req in required:
|
|
48
|
-
if req not in found:
|
|
49
|
-
errors.append(f"Missing: {req}")
|
|
50
|
-
elif not found[req]:
|
|
51
|
-
errors.append(f"Empty: {req}")
|
|
52
|
-
|
|
53
|
-
return (not errors, errors)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""JSONL file format validator for cowork-flow context files."""
|
|
3
|
-
|
|
4
|
-
from __future__ import annotations
|
|
5
|
-
|
|
6
|
-
import json
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def validate_format(file_path: Path | str) -> tuple[bool, list[str]]:
|
|
11
|
-
"""Validate a JSONL file and return (is_valid, error_messages)."""
|
|
12
|
-
path = Path(file_path)
|
|
13
|
-
errors: list[str] = []
|
|
14
|
-
|
|
15
|
-
try:
|
|
16
|
-
content = path.read_text(encoding="utf-8").strip()
|
|
17
|
-
except (OSError, UnicodeDecodeError) as exc:
|
|
18
|
-
return False, [f"Cannot read file: {exc}"]
|
|
19
|
-
|
|
20
|
-
if not content:
|
|
21
|
-
return False, ["File is empty"]
|
|
22
|
-
|
|
23
|
-
for line_no, raw_line in enumerate(content.splitlines(), start=1):
|
|
24
|
-
line = raw_line.strip()
|
|
25
|
-
if not line:
|
|
26
|
-
continue
|
|
27
|
-
try:
|
|
28
|
-
json.loads(line)
|
|
29
|
-
except json.JSONDecodeError as exc:
|
|
30
|
-
errors.append(f"Line {line_no}: Invalid JSON: {exc}")
|
|
31
|
-
|
|
32
|
-
return (not errors, errors)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: before-dev
|
|
3
|
-
description: MANDATORY GATE — call before ANY code change, file edit, or subagent dispatch. Checks workflow state and either allows or blocks the action.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Before Dev — Pre-Development Workflow Gate
|
|
7
|
-
|
|
8
|
-
MUST invoke before any file edit, code change, or subagent dispatch. Reads the current `<workflow-state>` block and decides: allow or block.
|
|
9
|
-
|
|
10
|
-
This skill is NOT a checklist or context loader — it is a gate. Do not proceed to code changes without passing through this gate.
|
|
11
|
-
|
|
12
|
-
**Exemptions**: read-only Q&A, pure query commands (`git status`, `task next`, `task current`), user explicitly says "just make the change, skip the workflow".
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Step 1: Read Workflow State
|
|
17
|
-
|
|
18
|
-
Read the `<workflow-state>` block (Status, Source). If absent, check for `cowork_runtime_context_id` in the user prompt:
|
|
19
|
-
- **Has it** → subagent without injected state. Skip directly to the `delegated_subtask` branch below.
|
|
20
|
-
- **No `cowork_runtime_context_id`** → no context identity. Fail-closed: block and direct the user to `task start` or `continue`.
|
|
21
|
-
|
|
22
|
-
## Step 2: Act by Status
|
|
23
|
-
|
|
24
|
-
| Status | Action |
|
|
25
|
-
|--------|--------|
|
|
26
|
-
| `no_task` | BLOCK. Direct to `brainstorming` / `writing-plans` / `continue`. Allow read-only Q&A. |
|
|
27
|
-
| `delegated_subtask` | Execute. `subagent bind <id> <key>`, load task dir, complete leaf work. No start/resume/commit. |
|
|
28
|
-
| `planning` | BLOCK implementation. Allow planning files only (`decision-anchor.md`, `*.jsonl`). |
|
|
29
|
-
| `in_progress` | ALLOW. Load context (below). L2 tasks require `doubt-review` before implementing. |
|
|
30
|
-
| `review` | Verify with `cowork-check`. Minor fixes only — no new implementation. |
|
|
31
|
-
| `completed` | BLOCK. Create a new task via `task archive` → `task create`. |
|
|
32
|
-
|
|
33
|
-
### Context loading for `in_progress`
|
|
34
|
-
|
|
35
|
-
1. Read `<task>/decision-anchor.md` (goals, scope, acceptance criteria).
|
|
36
|
-
2. Read `<task>/implement.jsonl` + plan steps (from `<task>/task.json` relatedFiles or `.cowork-flow/plans/`).
|
|
37
|
-
3. Confirm success criteria, files involved, and verification commands. Begin implementation.
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
**Fail-closed fallback**: if `<workflow-state>` is absent AND no `cowork_runtime_context_id` is present, block all changes and direct to `task start` or `continue`. Abnormal statuses (`stale`, `unknown`, or unrecognized) are treated the same — run `resume` first.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: check
|
|
3
|
-
description: Use after code or workflow changes to verify quality, spec compliance, tests, cross-layer contracts, and template/root consistency before finish-work.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Check
|
|
7
|
-
|
|
8
|
-
Use this after implementation and before `finish-work`.
|
|
9
|
-
|
|
10
|
-
Apply ERROR_OUTPUT_AS_DATA contract. If tempted to skip steps, re-execute with verifiable evidence.
|
|
11
|
-
|
|
12
|
-
## Steps
|
|
13
|
-
|
|
14
|
-
1. Read active task decision-anchor.md, plan, and `check.jsonl`.
|
|
15
|
-
2. Review `git diff --name-only` and `git diff`.
|
|
16
|
-
3. Check contracts across caller/callee, command output, persisted state, templates, and docs.
|
|
17
|
-
4. Verify spec compliance:
|
|
18
|
-
- Read each spec file listed in `check.jsonl`.
|
|
19
|
-
- For each guideline in the spec, check the diff for violations (naming, structure, encoding, error handling, quality gates).
|
|
20
|
-
- Spec files not listed in `check.jsonl` do not apply to this check.
|
|
21
|
-
5. Verify all new/modified code against project coding standards:
|
|
22
|
-
- For every source file added or changed in the diff, determine whether it is backend or frontend.
|
|
23
|
-
- Read the matching index (`.cowork-flow/spec/backend/index.md` or `.cowork-flow/spec/frontend/index.md`) to discover which guideline files apply.
|
|
24
|
-
- Read each applicable guideline file and cross-check the changed code for violations (UTF-8 enforcement, directory structure, error handling, layering, component patterns, etc.).
|
|
25
|
-
- Report each violation with: file path, violated rule, and a one-line fix suggestion.
|
|
26
|
-
6. Confirm `.cowork-flow/spec/` is updated or explicitly unchanged.
|
|
27
|
-
7. Review test intent: reject shallow tests that do not fail for meaningful behavior breaks.
|
|
28
|
-
8. Run focused tests that would fail if the changed behavior broke.
|
|
29
|
-
9. Run broader validation when the change touches shared runtime, templates, packaging, or public workflow.
|
|
30
|
-
10. Report `test_intent_review` with the key tests that defend decision-anchor.md acceptance behavior.
|
|
31
|
-
11. Report spec compliance: for each spec/ file checked, state pass/fail with evidence from the diff.
|
|
32
|
-
|
|
33
|
-
## Report
|
|
34
|
-
|
|
35
|
-
Return:
|
|
36
|
-
|
|
37
|
-
- Issues found and fixes made.
|
|
38
|
-
- Files reviewed.
|
|
39
|
-
- Commands run and results.
|
|
40
|
-
- Remaining risks.
|
|
41
|
-
|
|
42
|
-
Do not claim success from intent. Use command output and reviewed diffs as evidence.
|
|
43
|
-
|
|
44
|
-
## Debug Quality Check
|
|
45
|
-
|
|
46
|
-
- Root cause fix has a corresponding regression test (not a symptom fix)
|
|
47
|
-
- Not a symptom fix (fixed UI-level duplication instead of API-level duplication)
|
|
48
|
-
- Evidence recorded in `<task>/debug.jsonl` (if applicable)
|
|
49
|
-
- If a repeatedly triggered bug, break-loop record is in `<task>/break-loop.md`
|
|
50
|
-
|
|
51
|
-
## Simplification Review
|
|
52
|
-
|
|
53
|
-
See [simplification-guide.md](./simplification-guide.md) when refactoring > 50 lines.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Simplification Review
|
|
2
|
-
|
|
3
|
-
Run when code changes exceed 50 lines or review finds readability issues.
|
|
4
|
-
|
|
5
|
-
## Pre-Simplification Self-Check (Chesterton's Fence)
|
|
6
|
-
|
|
7
|
-
For each simplification, answer:
|
|
8
|
-
- What is this code's responsibility? Who calls it? What does it call?
|
|
9
|
-
- Will existing tests' defined behavior be broken?
|
|
10
|
-
- Why did the original author write it this way? (check git blame)
|
|
11
|
-
|
|
12
|
-
If you cannot answer, stop — you do not understand this code.
|
|
13
|
-
|
|
14
|
-
## Simplification Signals
|
|
15
|
-
|
|
16
|
-
| Signal | Action |
|
|
17
|
-
|---|---|
|
|
18
|
-
| Nesting depth >= 3 levels | Extract guard clause or helper |
|
|
19
|
-
| Function > 50 lines | Split by responsibility into multiple named functions |
|
|
20
|
-
| Nested ternary `a ? b : c ? d : e` | Replace with if/else / switch / lookup |
|
|
21
|
-
| Boolean flag arguments `doThing(true, false, true)` | Replace with options object or split into two functions |
|
|
22
|
-
| Same condition checked >= 3 times | Extract as a named predicate function |
|
|
23
|
-
| Redundant wrapper `async () => await foo()` | Export foo directly |
|
|
24
|
-
| Unused import / variable | Remove (after confirming no side effects) |
|
|
25
|
-
| Missing type hint (when project convention requires it) | Add it |
|
|
26
|
-
|
|
27
|
-
## Naming Readability Signals
|
|
28
|
-
|
|
29
|
-
| Signal | Action |
|
|
30
|
-
|---|---|
|
|
31
|
-
| `data`, `result`, `temp`, `val` | Rename to describe content: `userProfile`, `errors` |
|
|
32
|
-
| Abbreviations `usr`, `cfg`, `btn`, `evt` | Use full words (`id`, `url`, `api` are exceptions) |
|
|
33
|
-
| Name contradicts behavior (`get` but mutates) | Rename to reflect actual behavior |
|
|
34
|
-
| "What" comment (`// increment counter` on `count++`) | Remove comment |
|
|
35
|
-
| "Why" comment (`// Retry because API is flaky`) | Keep |
|
|
36
|
-
|
|
37
|
-
## Rule of 500
|
|
38
|
-
|
|
39
|
-
If a refactoring would modify > 500 lines, use automated tools (sed/codemod/AST transform) rather than manual editing — manual large-scale changes are error-prone and cause review fatigue.
|
|
40
|
-
|
|
41
|
-
## Red Flags
|
|
42
|
-
|
|
43
|
-
- Simplification causes test failures (behavior was changed — violates "preserve behavior" principle)
|
|
44
|
-
- "Simplification" results in longer and harder-to-read code
|
|
45
|
-
- Renaming based on personal preference rather than project convention
|
|
46
|
-
- Removing error handling "to make the code cleaner"
|
|
47
|
-
- Batching multiple simplifications into one non-rollbackable large commit
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: continue
|
|
3
|
-
description: Use when resuming an in-progress cowork-flow task after interruption, context compression, or a new session.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Continue
|
|
7
|
-
|
|
8
|
-
Use this to recover the next actionable step without rereading the whole repository.
|
|
9
|
-
|
|
10
|
-
## Steps
|
|
11
|
-
|
|
12
|
-
1. Run `.cowork-flow/run resume` or `.\.cowork-flow\run.cmd resume` on Windows.
|
|
13
|
-
2. Run `.cowork-flow/run task current`.
|
|
14
|
-
3. Read the active task `decision-anchor.md`.
|
|
15
|
-
4. Read the current plan only if the task references one.
|
|
16
|
-
5. Read the relevant JSONL index for the current phase: `implement.jsonl`, `check.jsonl`, or `debug.jsonl`.
|
|
17
|
-
6. Inspect `git status --short` and any changed files relevant to the task.
|
|
18
|
-
|
|
19
|
-
## Output
|
|
20
|
-
|
|
21
|
-
State:
|
|
22
|
-
|
|
23
|
-
- Active task and phase.
|
|
24
|
-
- Completed work.
|
|
25
|
-
- Next step.
|
|
26
|
-
- Blockers.
|
|
27
|
-
- Verification still required.
|
|
28
|
-
|
|
29
|
-
Avoid broad archive/history scans unless the active task explicitly depends on them.
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: doubt-review
|
|
3
|
-
description: Use when making non-trivial implementation decisions, starting L2 tasks, or claiming behavioral correctness. Use when correctness matters more than speed, working in unfamiliar code, or stakes are high.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Doubt Review
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
Non-trivial decisions must pass doubt review before being allowed into implementation. This is not optional self-reflection — it is a sub-step of the before-dev gate for L2 tasks.
|
|
11
|
-
|
|
12
|
-
Unlike `/review` (a verdict on a completed artifact), doubt-review is an in-flight posture: non-trivial decisions are cross-examined while course-correction is still cheap.
|
|
13
|
-
|
|
14
|
-
## When to Apply
|
|
15
|
-
|
|
16
|
-
Trigger conditions (any one applies):
|
|
17
|
-
- L2 tasks (L1 optional but recommended)
|
|
18
|
-
- Introducing or modifying branching logic
|
|
19
|
-
- Crossing module boundaries
|
|
20
|
-
- Relying on properties the type system cannot verify (thread safety, idempotency, ordering invariants)
|
|
21
|
-
- When the user explicitly requests it
|
|
22
|
-
|
|
23
|
-
Does not apply to:
|
|
24
|
-
- Mechanical operations (renaming, formatting, file moves)
|
|
25
|
-
- Reading/summarizing existing code
|
|
26
|
-
- One-line changes where correctness is obvious
|
|
27
|
-
- When the user explicitly requests speed over verification
|
|
28
|
-
|
|
29
|
-
## The 5-Step Doubt Cycle
|
|
30
|
-
|
|
31
|
-
### Step 1: CLAIM — a clear 2-3 line statement
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
CLAIM: "<one-sentence decision>"
|
|
35
|
-
WHY THIS MATTERS: <why this decision being wrong would be fatal>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If you cannot write a CLAIM in 2-3 lines, you have a vague feeling, not a decision. The distance between feeling and decision is the research/thinking you need to do.
|
|
39
|
-
|
|
40
|
-
### Step 2: EXTRACT — minimal reviewable unit
|
|
41
|
-
|
|
42
|
-
- Code: diff or function (not an entire file)
|
|
43
|
-
- Decision: 3-5 sentences + constraints
|
|
44
|
-
- Strip reasoning — provide only the input, not the conclusion
|
|
45
|
-
|
|
46
|
-
### Step 3: DOUBT — fresh-context adversarial review
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
Find problems with this artifact. Assume the author is overconfident. Look for:
|
|
50
|
-
- Undeclared assumptions
|
|
51
|
-
- Unhandled edge cases
|
|
52
|
-
- Hidden coupling or shared state
|
|
53
|
-
- Violated contract scenarios
|
|
54
|
-
- Broken existing conventions
|
|
55
|
-
- Failure modes under unexpected input
|
|
56
|
-
|
|
57
|
-
Do not confirm. Do not summarize. Find problems, or explicitly state that no problems were found after review.
|
|
58
|
-
|
|
59
|
-
ARTIFACT: <paste artifact>
|
|
60
|
-
CONTRACT: <paste constraints>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Critical**: pass only ARTIFACT + CONTRACT, not CLAIM. Including CLAIM biases the reviewer toward agreement.
|
|
64
|
-
|
|
65
|
-
Note: you cannot spawn a fresh-context reviewer from within a subagent context. If you encounter a situation requiring doubt while inside a subagent, surface back to the main session.
|
|
66
|
-
|
|
67
|
-
### Step 4: RECONCILE — classify each finding
|
|
68
|
-
|
|
69
|
-
By priority (first matching category wins):
|
|
70
|
-
1. CONTRACT misunderstanding → fix CONTRACT, then reclassify
|
|
71
|
-
2. Valid + actionable → modify artifact, restart doubt cycle
|
|
72
|
-
3. Valid but acceptable trade-off → record explicitly
|
|
73
|
-
4. Noise → record and exclude
|
|
74
|
-
|
|
75
|
-
### Step 5: STOP — bounded loop
|
|
76
|
-
|
|
77
|
-
Stop when any condition is met:
|
|
78
|
-
- Next round produces only trivial or already-considered findings
|
|
79
|
-
- 3 cycles complete (stop; report to the user and do not proceed to a 4th)
|
|
80
|
-
- User explicitly says "that's enough"
|
|
81
|
-
|
|
82
|
-
Substantive findings remaining after 3 cycles = artifact is immature. Return to Step 2 to decompose.
|
|
83
|
-
|
|
84
|
-
## Common Rationalizations
|
|
85
|
-
|
|
86
|
-
| Excuse | Why It Fails | Better Approach |
|
|
87
|
-
|---|---|---|
|
|
88
|
-
| "I'm confident, skip doubt" | Confidence correlates poorly with correctness. Highest confidence is where blind spots hide. | Write a 2-line CLAIM and pass the artifact to fresh-context review. Confidence is not a gate. |
|
|
89
|
-
| "Spawning a reviewer is expensive" | Debugging a bad commit in production costs more. The doubt cycle is bounded. | Run one doubt cycle now; a bounded 5-step loop costs far less than a production debug session. |
|
|
90
|
-
| "Review will catch it at the review stage" | Review is the final gate. Doubt catches issues in-flight while course-correction is still cheap. | Catch it in-flight; run doubt-review before the artifact is committed or merged. |
|
|
91
|
-
| "Doubting every step causes infinite delay" | Doubt only applies to non-trivial decisions. Re-read When NOT to Use. | Confirm this decision is non-trivial per trigger conditions; if so, proceed — otherwise skip without guilt. |
|
|
92
|
-
| "Reviewer disagrees means I'm wrong" | Reviewer lacks your context; disagreement is information, not a verdict. RECONCILE then decide. | Classify the finding via RECONCILE: contract fix, valid trade-off, or noise — then proceed on that basis. |
|
|
93
|
-
|
|
94
|
-
## Red Flags
|
|
95
|
-
|
|
96
|
-
- Skipping doubt steps because "I'm confident"
|
|
97
|
-
- Treating reviewer output as authoritative rather than informational
|
|
98
|
-
- Looping past 3 cycles without escalating to the user
|
|
99
|
-
- Reviewer prompt uses "is this good?" instead of "find problems"
|
|
100
|
-
- 2+ consecutive cycles with substantive findings but 0 classified as "actionable" — you are validating, not doubting
|
|
101
|
-
- Passing CLAIM to the reviewer (biases toward agreement)
|
|
102
|
-
- Doubt theater: spawning a reviewer against an unchanged artifact (getting the same finding = stalling)
|
|
103
|
-
|
|
104
|
-
## Relationship to Existing Systems
|
|
105
|
-
|
|
106
|
-
- before-dev: doubt-review is a sub-step of the before-dev gate for L2 tasks
|
|
107
|
-
- check: check verifies implementation correctness; doubt-review questions decision direction. Use both.
|
|
108
|
-
- party-mode: board discussion can produce CLAIMs, but cannot substitute for fresh-context doubt review
|
|
109
|
-
- TDD: the RED step of TDD is doubt made concrete — a failing test is a disproof attempt
|
|
110
|
-
- break-loop: when a reviewer finds a true failure mode, connect to the debugging skill to locate and fix
|
|
111
|
-
|
|
112
|
-
## Verification
|
|
113
|
-
|
|
114
|
-
- Every non-trivial decision has a CLAIM record
|
|
115
|
-
- Every non-trivial artifact undergoes at least one fresh-context review
|
|
116
|
-
- Reviewer receives ARTIFACT + CONTRACT (not CLAIM)
|
|
117
|
-
- Findings are classified (not rubber-stamped)
|
|
118
|
-
- Stop conditions are satisfied
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: finish-work
|
|
3
|
-
description: Use when implementation and verification are complete and cowork-flow work needs final scope review, commit/archive/session recording, or handoff.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Finish Work
|
|
7
|
-
|
|
8
|
-
Use this in the main session after implementation and `check` are complete.
|
|
9
|
-
|
|
10
|
-
## Gate
|
|
11
|
-
|
|
12
|
-
Before claiming completion, verify:
|
|
13
|
-
|
|
14
|
-
- Active task exists, or the work was explicitly read-only/no-task.
|
|
15
|
-
- `check` or equivalent final review ran.
|
|
16
|
-
- `git diff` was reviewed for scope.
|
|
17
|
-
- Relevant tests, build, lint, or focused validation ran.
|
|
18
|
-
- `.cowork-flow/spec/` was updated when the change created durable knowledge.
|
|
19
|
-
- Plan checkboxes and task status match reality.
|
|
20
|
-
- No unrelated dirty files are staged.
|
|
21
|
-
|
|
22
|
-
## Sequence
|
|
23
|
-
|
|
24
|
-
1. Run `git status --short`.
|
|
25
|
-
2. Run `git diff --check`.
|
|
26
|
-
3. Run focused tests and then broader project verification when appropriate.
|
|
27
|
-
4. Update the plan/task status.
|
|
28
|
-
5. Archive completed task/change artifacts when requested or required by workflow.
|
|
29
|
-
6. Record the session with `.cowork-flow/run add-session --commit "-"` unless a prior commit hash is intentionally being recorded.
|
|
30
|
-
7. If commit policy allows, stage only expected files and commit once.
|
|
31
|
-
|
|
32
|
-
If the user asks not to commit, stop before staging and report the verified state.
|