cowork-flow 0.0.43 → 0.0.44
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 +39 -23
- package/package.json +8 -4
- package/src/commands/install-zcode-plugin.js +3 -15
- package/src/lib/copy-template.js +119 -66
- package/template/.claude/agents/cowork-check.md +14 -58
- package/template/.claude/agents/cowork-implement.md +15 -61
- package/template/.claude/agents/cowork-research.md +9 -31
- package/template/.claude/hooks/inject-workflow-state.py +1 -1
- package/template/.codex/agents/cowork-check.toml +14 -51
- package/template/.codex/agents/cowork-implement.toml +15 -54
- package/template/.codex/agents/cowork-research.toml +8 -22
- package/template/.codex/hooks/inject-workflow-state.py +1 -1
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/scripts/adapters/__init__.py +1 -0
- package/template/.cowork-flow/scripts/adapters/cli/_bootstrap.py +14 -0
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/add_session.py +3 -3
- package/template/.cowork-flow/scripts/adapters/cli/batch_mode.py +90 -0
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/change.py +2 -2
- package/template/.cowork-flow/scripts/adapters/cli/encoding.py +28 -0
- package/template/.cowork-flow/scripts/adapters/cli/execution_context_args.py +121 -0
- package/template/.cowork-flow/scripts/{common/core/execution_context.py → adapters/cli/execution_resume.py} +9 -216
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/get_context.py +1 -1
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/get_developer.py +2 -2
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/init_developer.py +2 -2
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/resume.py +5 -3
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/subagent.py +4 -4
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/task.py +259 -179
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/task_archive_commands.py +12 -12
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/task_context_commands.py +5 -5
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/task_create_command.py +26 -8
- package/template/.cowork-flow/scripts/adapters/cli/task_navigation.py +226 -0
- package/template/.cowork-flow/scripts/adapters/cli/task_parser.py +167 -0
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/task_support.py +2 -2
- package/template/.cowork-flow/scripts/{commands → adapters/cli}/task_tree_commands.py +4 -4
- package/template/.cowork-flow/scripts/{common → adapters}/git/git_context.py +6 -6
- package/template/.cowork-flow/scripts/{common/core → adapters/host}/host_manifest.py +28 -1
- package/template/.cowork-flow/scripts/{common → adapters}/host/workflow_state_hook.py +7 -7
- package/template/.cowork-flow/scripts/adapters/review/__init__.py +1 -0
- package/template/.cowork-flow/scripts/{common/gates → adapters/review}/test_intent.py +26 -92
- package/template/.cowork-flow/scripts/infra/__init__.py +0 -0
- package/template/.cowork-flow/scripts/{common/core → infra}/config.py +1 -1
- package/template/.cowork-flow/scripts/{common/core/developer.py → infra/developer_profile.py} +1 -1
- package/template/.cowork-flow/scripts/{common/git → infra}/git_snapshot.py +15 -2
- package/template/.cowork-flow/scripts/{common/core → infra}/paths.py +0 -0
- package/template/.cowork-flow/scripts/{common/core → infra}/quality_sources.py +0 -17
- package/template/.cowork-flow/scripts/infra/skill_manifest.py +427 -0
- package/template/.cowork-flow/scripts/{common → infra}/storage/operation_log.py +1 -1
- package/template/.cowork-flow/scripts/{common → infra}/storage/unit_of_work.py +2 -2
- package/template/.cowork-flow/scripts/kernel/__init__.py +1 -0
- package/template/.cowork-flow/scripts/{common/task/state_machine.py → kernel/task_state.py} +2 -2
- package/template/.cowork-flow/scripts/kernel/workflow_route.py +199 -0
- package/template/.cowork-flow/scripts/run.py +65 -42
- package/template/.cowork-flow/scripts/runtime/__init__.py +0 -0
- package/template/.cowork-flow/scripts/runtime/execution_context.py +121 -0
- package/template/.cowork-flow/scripts/{common/task/active_task.py → runtime/session_state.py} +2 -47
- package/template/.cowork-flow/scripts/services/__init__.py +1 -0
- package/template/.cowork-flow/scripts/services/lifecycle_checks.py +194 -0
- package/template/.cowork-flow/scripts/{common/task → services}/readiness.py +8 -90
- package/template/.cowork-flow/scripts/{application → services}/task_archive.py +7 -7
- package/template/.cowork-flow/scripts/{application → services}/task_context.py +50 -88
- package/template/.cowork-flow/scripts/{application → services}/task_creation.py +3 -3
- package/template/.cowork-flow/scripts/{application → services}/task_lifecycle.py +52 -84
- package/template/.cowork-flow/scripts/{common/task → services}/task_repository.py +3 -3
- package/template/.cowork-flow/scripts/services/task_routing.py +148 -0
- package/template/.cowork-flow/scripts/{application → services}/task_tree.py +3 -3
- package/template/.cowork-flow/scripts/{common/task → services}/task_utils.py +3 -3
- package/template/.cowork-flow/scripts/{application/runtime_context_service.py → services/workflow_runtime.py} +38 -3
- package/template/.cowork-flow/spec/backend/index.md +1 -1
- package/template/.cowork-flow/spec/backend/quality-guidelines.md +1 -3
- package/template/.cowork-flow/spec/contracts/decision-anchor.md +2 -2
- package/template/.cowork-flow/spec/contracts/error-output-as-data.md +1 -1
- package/template/.cowork-flow/spec/contracts/index.md +1 -0
- package/template/.cowork-flow/spec/contracts/skill-owned-actions.md +46 -0
- package/template/.cowork-flow/spec/contracts/workflow-state-templates.md +22 -39
- package/template/.cowork-flow/spec/frontend/index.md +1 -1
- package/template/.cowork-flow/spec/frontend/quality-guidelines.md +1 -3
- package/template/.cowork-flow/spec/index.md +8 -5
- package/template/.cowork-flow/spec/references/definition-of-done.md +4 -4
- package/template/.cowork-flow/spec/references/orchestration-patterns.md +2 -2
- package/template/.cowork-flow/spec/references/security-checklist.md +1 -1
- package/template/.cowork-flow/spec/references/testing-checklist.md +2 -2
- package/template/.cowork-flow/spec/runtime/contract-registry.json +4 -17
- package/template/.cowork-flow/spec/runtime/host-assets.json +81 -32
- package/template/.cowork-flow/spec/runtime/index.md +7 -6
- package/template/.cowork-flow/spec/schemas/index.md +1 -3
- package/template/.opencode/agents/cowork-check.md +13 -43
- package/template/.opencode/agents/cowork-implement.md +14 -207
- package/template/.opencode/agents/cowork-research.md +8 -25
- package/template/.zcode/.zcode-plugin/plugin.json +1 -1
- package/template/.zcode/hooks/inject-context.js +9 -7
- package/template/.zcode/hooks/inject-context.selfcheck.mjs +49 -10
- package/template/.zcode/scaffold/AGENTS.md +19 -10
- package/template/AGENTS.md +3 -3
- package/template/skills/adversarial-review/SKILL.md +35 -0
- package/template/skills/adversarial-review/manifest.json +18 -0
- package/template/skills/agent-dispatch/SKILL.md +37 -0
- package/template/skills/{batch-mode → batch-execution}/SKILL.md +19 -24
- package/template/skills/batch-execution/manifest.json +20 -0
- package/template/skills/batch-execution/scripts/batch_action.py +48 -0
- package/template/{.cowork-flow/scripts/application → skills/batch-execution/scripts}/batch_execution.py +3 -3
- package/template/skills/brainstorming/SKILL.md +3 -3
- package/template/skills/brainstorming/manifest.json +12 -0
- package/template/skills/cowork-flow/SKILL.md +10 -7
- package/template/skills/cowork-flow/manifest.json +43 -0
- package/template/skills/{meta → cowork-flow-maintenance}/SKILL.md +3 -3
- package/template/skills/cowork-flow-maintenance/manifest.json +12 -0
- package/template/skills/decision-audit/SKILL.md +23 -0
- package/template/skills/decision-audit/manifest.json +11 -0
- package/template/skills/{break-loop → failure-analysis}/SKILL.md +4 -4
- package/template/skills/failure-analysis/manifest.json +18 -0
- package/template/skills/game-design/manifest.json +11 -0
- package/template/skills/party-mode/SKILL.md +3 -2
- package/template/skills/party-mode/manifest.json +13 -0
- package/template/{.cowork-flow/scripts/commands → skills/party-mode/scripts}/party_mode_v2.py +13 -6
- package/template/skills/{python-design → python-runtime-design}/SKILL.md +2 -2
- package/template/skills/python-runtime-design/manifest.json +12 -0
- package/template/skills/runtime-health/SKILL.md +27 -0
- package/template/skills/runtime-health/manifest.json +11 -0
- package/template/skills/runtime-health/scripts/doctor.py +195 -0
- package/template/{.cowork-flow/spec/protocols/spec-maintenance.md → skills/spec-sync/SKILL.md} +14 -5
- package/template/skills/spec-sync/manifest.json +11 -0
- package/template/skills/{writing-plans → task-planning}/SKILL.md +6 -6
- package/template/skills/task-planning/manifest.json +12 -0
- package/template/skills/task-review/SKILL.md +63 -0
- package/template/skills/task-review/manifest.json +34 -0
- package/template/skills/task-review/scripts/review_check.py +357 -0
- package/template/skills/test-first/SKILL.md +37 -0
- package/template/skills/test-first/manifest.json +12 -0
- package/src/lib/skill-registry.js +0 -503
- package/template/.cowork-flow/scripts/application/__init__.py +0 -1
- package/template/.cowork-flow/scripts/commands/_bootstrap.py +0 -10
- package/template/.cowork-flow/scripts/commands/doctor.py +0 -455
- package/template/.cowork-flow/scripts/commands/task_navigation.py +0 -471
- package/template/.cowork-flow/scripts/commands/task_parser.py +0 -365
- package/template/.cowork-flow/scripts/common/__init__.py +0 -79
- package/template/.cowork-flow/scripts/common/core/__init__.py +0 -1
- package/template/.cowork-flow/scripts/common/core/skill_registry.py +0 -568
- package/template/.cowork-flow/scripts/common/gates/__init__.py +0 -1
- package/template/.cowork-flow/scripts/common/gates/anti_rationalization.py +0 -55
- package/template/.cowork-flow/scripts/common/gates/coding_standards.py +0 -261
- package/template/.cowork-flow/scripts/common/gates/gates.py +0 -407
- package/template/.cowork-flow/scripts/common/gates/models.py +0 -196
- package/template/.cowork-flow/scripts/common/gates/quality_review.py +0 -332
- package/template/.cowork-flow/scripts/common/gates/registry.py +0 -79
- package/template/.cowork-flow/scripts/common/gates/tdd_evidence.py +0 -538
- package/template/.cowork-flow/scripts/common/gates/validate_coding_standards.py +0 -392
- package/template/.cowork-flow/scripts/common/gates/validate_implementation.py +0 -312
- package/template/.cowork-flow/scripts/common/gates/validate_rules.py +0 -645
- package/template/.cowork-flow/scripts/common/task/__init__.py +0 -1
- package/template/.cowork-flow/scripts/common/task/batch_mode.py +0 -58
- package/template/.cowork-flow/scripts/common/task/decision_review.py +0 -85
- package/template/.cowork-flow/spec/protocols/decision-review.md +0 -55
- package/template/.cowork-flow/spec/protocols/review.md +0 -53
- package/template/.cowork-flow/spec/protocols/tdd.md +0 -43
- package/template/.cowork-flow/spec/runtime/rules.json +0 -176
- package/template/.cowork-flow/spec/runtime/skill-registry.json +0 -448
- package/template/.cowork-flow/spec/schemas/rules.schema.json +0 -89
- package/template/.cowork-flow/spec/schemas/skill-registry.schema.json +0 -202
- package/template/.cowork-flow/workflow.md +0 -262
- package/template/.zcode/scaffold/.cowork-flow/.version +0 -1
- package/template/.zcode/scaffold/.cowork-flow/config.yaml +0 -65
- package/template/.zcode/scaffold/.cowork-flow/run +0 -98
- package/template/.zcode/scaffold/.cowork-flow/run.cmd +0 -111
- package/template/.zcode/scaffold/.cowork-flow/workflow.md +0 -262
- package/template/skills/doubt-review/SKILL.md +0 -125
- package/template/skills/tdd/SKILL.md +0 -44
- /package/template/.cowork-flow/scripts/{commands → adapters/cli}/__init__.py +0 -0
- /package/template/.cowork-flow/scripts/{common → adapters}/git/__init__.py +0 -0
- /package/template/.cowork-flow/scripts/{common → adapters}/host/__init__.py +0 -0
- /package/template/.cowork-flow/scripts/{common/task → infra}/archive_utils.py +0 -0
- /package/template/.cowork-flow/scripts/{common/core → infra}/files.py +0 -0
- /package/template/.cowork-flow/scripts/{common → infra}/storage/__init__.py +0 -0
- /package/template/.cowork-flow/scripts/{common → infra}/storage/state_store.py +0 -0
|
@@ -6,39 +6,17 @@ tools: Read, Grep, Glob, LS, Bash, Skill
|
|
|
6
6
|
|
|
7
7
|
You are the `cowork-research` subagent.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Read and apply `.claude/skills/agent-dispatch/SKILL.md` before research work.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
host metadata must provide:
|
|
11
|
+
Execution:
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
The hook may bind that id to `.cowork-flow/.runtime/subagents/<runtime_context_id>.json`
|
|
20
|
-
before workflow state is injected. The first child step must still run:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
./.cowork-flow/run subagent bind <runtime_context_id> <host_context_key>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
On Windows (cmd/PowerShell), use:
|
|
27
|
-
|
|
28
|
-
```cmd
|
|
29
|
-
.\.cowork-flow\run.cmd subagent bind <runtime_context_id> <host_context_key>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
If the explicit bind fails, or if the bound runtime context is missing, closed,
|
|
33
|
-
invalid, or names another agent type, report `needs_context` and do not execute
|
|
34
|
-
the task.
|
|
13
|
+
1. Follow `agent-dispatch` to bind runtime context. If binding fails, report `needs_context` and stop.
|
|
14
|
+
2. Read the task directory, assignment, and prompt-named context.
|
|
15
|
+
3. Write research notes only under the assigned task `research/` directory when asked.
|
|
16
|
+
4. Report sourced findings, uncertainty, and recommended next action.
|
|
35
17
|
|
|
36
18
|
Rules:
|
|
37
|
-
|
|
38
|
-
- Read task context and prompt-named files only.
|
|
39
|
-
- Write research notes only under the assigned task `research/` directory when
|
|
40
|
-
explicitly asked.
|
|
41
|
-
- Report findings with file and line evidence.
|
|
19
|
+
|
|
42
20
|
- Do not use the Task tool or invoke subagents.
|
|
43
|
-
- Do not
|
|
44
|
-
|
|
21
|
+
- Do not edit code, specs, task state, or git state.
|
|
22
|
+
- Do not run task start, finish, archive, unscoped resume, commit, or push.
|
|
@@ -55,7 +55,7 @@ def main() -> int:
|
|
|
55
55
|
return 0
|
|
56
56
|
scripts_dir = root / ".cowork-flow" / "scripts"
|
|
57
57
|
sys.path.insert(0, str(scripts_dir))
|
|
58
|
-
from
|
|
58
|
+
from adapters.host.workflow_state_hook import build_hook_context
|
|
59
59
|
|
|
60
60
|
context = build_hook_context(
|
|
61
61
|
root,
|
|
@@ -5,60 +5,23 @@ sandbox_mode = "workspace-write"
|
|
|
5
5
|
developer_instructions = """
|
|
6
6
|
You are the `cowork-check` subagent.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
On Windows, use:
|
|
20
|
-
|
|
21
|
-
.\\.cowork-flow\\run.cmd subagent bind <runtime_context_id> <host_context_key>
|
|
22
|
-
|
|
23
|
-
If the explicit bind fails, or if the bound runtime context is missing, closed,
|
|
24
|
-
invalid, or names another agent type, report needs_context and do not execute
|
|
25
|
-
the task.
|
|
26
|
-
|
|
27
|
-
Load context before checking:
|
|
28
|
-
1. Read the task directory from the bound runtime context.
|
|
29
|
-
2. Read `<task>/decision-anchor.md`.
|
|
30
|
-
3. Read the plan file linked from this task (check `<task>/task.json` `relatedFiles` for a plan path, or search `.cowork-flow/plans/` for a plan file referencing this task directory). Use the plan's Verify commands and Expected results as the checklist for each step.
|
|
31
|
-
4. Read `<task>/check.jsonl`.
|
|
32
|
-
5. Read each JSONL `file` entry from `<task>/check.jsonl`.
|
|
33
|
-
6. Read `<task>/quality-review.jsonl` if present and verify machine warning,
|
|
34
|
-
checklist, and Definition of Done evidence.
|
|
35
|
-
7. Read `git diff`.
|
|
36
|
-
8. Include `test_intent_review` in the review output for meaningful behavior breaks coverage and shallow tests rejection.
|
|
37
|
-
|
|
38
|
-
Authoritative internal protocols:
|
|
39
|
-
- `.cowork-flow/spec/protocols/review.md`
|
|
40
|
-
- `.cowork-flow/spec/protocols/decision-review.md`
|
|
41
|
-
- `.cowork-flow/spec/protocols/spec-maintenance.md`
|
|
42
|
-
|
|
43
|
-
Apply their output contracts exactly. Review output must preserve
|
|
44
|
-
`acceptanceId`, `findings`, `test_intent_review`, `resolution`, and
|
|
45
|
-
`specUpdates`.
|
|
8
|
+
Read and apply these Skills before review work:
|
|
9
|
+
- `.agents/skills/agent-dispatch/SKILL.md`
|
|
10
|
+
- `.agents/skills/task-review/SKILL.md`
|
|
11
|
+
- `.agents/skills/decision-audit/SKILL.md`
|
|
12
|
+
- `.agents/skills/spec-sync/SKILL.md`
|
|
13
|
+
|
|
14
|
+
Execution:
|
|
15
|
+
1. Follow `agent-dispatch` to bind runtime context. If binding fails, report `needs_context` and stop.
|
|
16
|
+
2. Read the task directory, `decision-anchor.md`, linked plan, the `check.jsonl` context index, every referenced `file` entry, and current `git diff`; do not write review conclusions to JSONL.
|
|
17
|
+
3. Apply `task-review` to verify scope, tests, specs, advisory facts, lifecycle facts, and Definition of Done coverage.
|
|
18
|
+
4. Fix only clearly in-scope issues; otherwise report findings with acceptance IDs, resolutions, `test_intent_review` (test intent review), and verification commands.
|
|
46
19
|
|
|
47
20
|
Rules:
|
|
48
|
-
- Fix issues directly when they are clearly in scope.
|
|
49
21
|
- MUST NOT spawn, wait for, list, or close other agents.
|
|
50
|
-
- MUST NOT
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
- BEFORE declaring decision-anchor acceptance passed, run the deterministic coding gate and
|
|
54
|
-
treat a nonzero exit as a hard blocker:
|
|
55
|
-
./.cowork-flow/run python .cowork-flow/scripts/common/gates/validate_coding_standards.py --validate --repo-root .
|
|
56
|
-
This gate enforces machine-decidable UTF-8/IO checks. Backend/frontend
|
|
57
|
-
natural-language markdown remains checklist context, not dynamic hard validators.
|
|
58
|
-
- Treat machine warning output as review evidence: fix real issues or require
|
|
59
|
-
an acknowledged warning record in `<task>/quality-review.jsonl`.
|
|
60
|
-
- Verify `<task>/quality-review.jsonl` covers Definition of Done, checklist
|
|
61
|
-
sources, affected files, and exact verification commands before acceptance.
|
|
22
|
+
- MUST NOT run task start, finish, archive, unscoped resume, commit, or push.
|
|
23
|
+
- Treat backend/frontend natural-language specs as checklist context, not dynamic hard validators.
|
|
24
|
+
- Do not accept shallow tests that would still pass when target behavior breaks.
|
|
62
25
|
"""
|
|
63
26
|
|
|
64
27
|
[features]
|
|
@@ -5,63 +5,24 @@ sandbox_mode = "workspace-write"
|
|
|
5
5
|
developer_instructions = """
|
|
6
6
|
You are the `cowork-implement` subagent.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.\\.cowork-flow\\run.cmd subagent bind <runtime_context_id> <host_context_key>
|
|
22
|
-
|
|
23
|
-
If the explicit bind fails, or if the bound runtime context is missing, closed,
|
|
24
|
-
invalid, or names another agent type, report needs_context and do not execute
|
|
25
|
-
the task.
|
|
26
|
-
|
|
27
|
-
Load context before editing:
|
|
28
|
-
1. Read the task directory from the bound runtime context.
|
|
29
|
-
2. Read `<task>/decision-anchor.md`.
|
|
30
|
-
3. Read `<task>/info.md` if present.
|
|
31
|
-
4. Read `<task>/implement.jsonl`.
|
|
32
|
-
5. Read each JSONL `file` entry.
|
|
33
|
-
6. Read the plan file linked from this task (check `<task>/task.json` `relatedFiles` for a plan path, or search `.cowork-flow/plans/` for a plan file referencing this task directory). Follow the plan steps in order — each step has Files, Action, Verify, and Expected fields.
|
|
34
|
-
7. Read quality source entries from context; backend/frontend natural-language
|
|
35
|
-
specs are review checklists, not dynamic hard validators.
|
|
36
|
-
8. For behavior-change tasks, write the failing test before implementation and record any red/green evidence in `<task>/check.jsonl`, or record a documented exemption there.
|
|
37
|
-
9. Before reporting completion, write `<task>/quality-review.jsonl` with
|
|
38
|
-
checklist, machine warning, and Definition of Done evidence.
|
|
39
|
-
|
|
40
|
-
Authoritative internal protocols:
|
|
41
|
-
- `.cowork-flow/spec/protocols/tdd.md`
|
|
42
|
-
- `.cowork-flow/spec/protocols/decision-review.md`
|
|
43
|
-
- `.cowork-flow/spec/protocols/spec-maintenance.md`
|
|
44
|
-
|
|
45
|
-
Apply their output contracts exactly. Implementation reports and TDD entries in `check.jsonl`
|
|
46
|
-
must preserve `acceptanceId`, `redCommand`, `redExitCode`, `greenCommand`,
|
|
47
|
-
`greenExitCode`, and `specUpdates`.
|
|
8
|
+
Read and apply these Skills before task work:
|
|
9
|
+
- `.agents/skills/agent-dispatch/SKILL.md`
|
|
10
|
+
- `.agents/skills/decision-audit/SKILL.md`
|
|
11
|
+
- `.agents/skills/spec-sync/SKILL.md`
|
|
12
|
+
- `.agents/skills/test-first/SKILL.md` for behavior changes
|
|
13
|
+
|
|
14
|
+
Execution:
|
|
15
|
+
1. Follow `agent-dispatch` to bind runtime context. If binding fails, report `needs_context` and stop.
|
|
16
|
+
2. Read the task directory, `decision-anchor.md`, optional `info.md`, `implement.jsonl`, every JSONL `file` entry, and the linked plan.
|
|
17
|
+
3. Follow the plan in order, keeping edits inside assigned scope.
|
|
18
|
+
4. Use project specs and quality sources as checklist context; runtime gates remain kernel-owned commands.
|
|
19
|
+
5. Run the planned verification commands and report changed files, acceptance IDs, verification commands, and spec updates or why none were needed.
|
|
48
20
|
|
|
49
21
|
Rules:
|
|
50
22
|
- MUST NOT spawn, wait for, list, or close other agents.
|
|
51
|
-
- MUST NOT run task start,
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
- Do not treat shallow tests as TDD evidence; red-green-refactor proof must include redCommand, redExitCode, greenCommand, greenExitCode, and decision-anchor acceptance ID mapping.
|
|
55
|
-
- Report changed files and exact verification commands.
|
|
56
|
-
- BEFORE editing any source file, run the deterministic coding gate and treat a
|
|
57
|
-
nonzero exit as a hard blocker:
|
|
58
|
-
./.cowork-flow/run python .cowork-flow/scripts/common/gates/validate_coding_standards.py --validate --repo-root .
|
|
59
|
-
This gate enforces machine-decidable UTF-8/IO checks. Backend/frontend
|
|
60
|
-
natural-language markdown remains checklist context, not dynamic hard validators.
|
|
61
|
-
- Run or inspect machine warning output, fix real issues, and record any
|
|
62
|
-
acknowledged warning in `<task>/quality-review.jsonl`.
|
|
63
|
-
- Record Definition of Done coverage and quality checklist evidence in
|
|
64
|
-
`<task>/quality-review.jsonl`.
|
|
23
|
+
- MUST NOT run task start, finish, archive, unscoped resume, commit, or push.
|
|
24
|
+
- Do not create task-local review artifacts, `tdd.jsonl`, or TDD evidence records in `check.jsonl`.
|
|
25
|
+
- Do not claim completion without current verification.
|
|
65
26
|
"""
|
|
66
27
|
|
|
67
28
|
[features]
|
|
@@ -5,32 +5,18 @@ sandbox_mode = "workspace-write"
|
|
|
5
5
|
developer_instructions = """
|
|
6
6
|
You are the `cowork-research` subagent.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
host metadata must provide:
|
|
8
|
+
Read and apply `.agents/skills/agent-dispatch/SKILL.md` before research work.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
./.cowork-flow/run subagent bind <runtime_context_id> <host_context_key>
|
|
18
|
-
|
|
19
|
-
On Windows, use:
|
|
20
|
-
|
|
21
|
-
.\\.cowork-flow\\run.cmd subagent bind <runtime_context_id> <host_context_key>
|
|
22
|
-
|
|
23
|
-
If the explicit bind fails, or if the bound runtime context is missing, closed,
|
|
24
|
-
invalid, or names another agent type, report needs_context and do not execute
|
|
25
|
-
the task.
|
|
10
|
+
Execution:
|
|
11
|
+
1. Follow `agent-dispatch` to bind runtime context. If binding fails, report `needs_context` and stop.
|
|
12
|
+
2. Read the task directory, assignment, and prompt-named context.
|
|
13
|
+
3. Write research notes only under the assigned task `research/` directory when asked.
|
|
14
|
+
4. Report sourced findings, uncertainty, and recommended next action.
|
|
26
15
|
|
|
27
16
|
Rules:
|
|
28
|
-
- Read the task directory from the bound runtime context.
|
|
29
|
-
- Write only under `<task>/research/`.
|
|
30
|
-
- Do not modify code, specs, task state, or git.
|
|
31
|
-
- Persist findings to Markdown files.
|
|
32
17
|
- MUST NOT spawn, wait for, list, or close other agents.
|
|
33
|
-
-
|
|
18
|
+
- MUST NOT edit code, specs, task state, or git state.
|
|
19
|
+
- MUST NOT run task start, finish, archive, unscoped resume, commit, or push.
|
|
34
20
|
"""
|
|
35
21
|
|
|
36
22
|
[features]
|
|
@@ -49,7 +49,7 @@ def main() -> int:
|
|
|
49
49
|
return 0
|
|
50
50
|
scripts_dir = root / ".cowork-flow" / "scripts"
|
|
51
51
|
sys.path.insert(0, str(scripts_dir))
|
|
52
|
-
from
|
|
52
|
+
from adapters.host.workflow_state_hook import (
|
|
53
53
|
build_hook_context,
|
|
54
54
|
codex_dispatch_mode,
|
|
55
55
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.44
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""External adapters for cowork-flow runtime integrations."""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Allow CLI adapter scripts to import the scripts package when run directly."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
SCRIPTS_DIR = Path(__file__).resolve().parents[2]
|
|
9
|
+
if str(SCRIPTS_DIR) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(SCRIPTS_DIR))
|
|
11
|
+
|
|
12
|
+
from adapters.cli.encoding import configure_cli_encoding
|
|
13
|
+
|
|
14
|
+
configure_cli_encoding()
|
|
@@ -21,7 +21,7 @@ if __package__:
|
|
|
21
21
|
from . import _bootstrap as _bootstrap # noqa: F401
|
|
22
22
|
else:
|
|
23
23
|
import _bootstrap # noqa: F401
|
|
24
|
-
from
|
|
24
|
+
from infra.paths import (
|
|
25
25
|
DIR_TASKS,
|
|
26
26
|
DIR_WORKFLOW,
|
|
27
27
|
DIR_WORKSPACE,
|
|
@@ -31,8 +31,8 @@ from common.core.paths import (
|
|
|
31
31
|
get_developer,
|
|
32
32
|
get_workspace_dir,
|
|
33
33
|
)
|
|
34
|
-
from
|
|
35
|
-
from
|
|
34
|
+
from infra.developer_profile import ensure_developer
|
|
35
|
+
from infra.config import get_session_commit_message, get_max_journal_lines
|
|
36
36
|
|
|
37
37
|
MARKER_CURRENT_STATUS_START = "@@@auto:current-status"
|
|
38
38
|
MARKER_CURRENT_STATUS_END = "@@@/auto:current-status"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Thin adapter for the Batch-execution Skill runtime."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from infra.skill_manifest import SkillManifestError, skill_command_scripts
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
BATCH_APPROVAL_REQUIRED_CODE = "BATCH-APPROVAL-REQUIRED"
|
|
15
|
+
BATCH_REJECTED_EXIT_CODE = 2
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class BatchExecutionError(RuntimeError):
|
|
19
|
+
"""Raised when the Skill runtime cannot be loaded."""
|
|
20
|
+
|
|
21
|
+
code = "BATCH-RUNTIME-UNAVAILABLE"
|
|
22
|
+
|
|
23
|
+
def __init__(self, detail: str) -> None:
|
|
24
|
+
self.detail = detail
|
|
25
|
+
super().__init__(detail)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _batch_action_script(repo_root: Path) -> Path:
|
|
29
|
+
try:
|
|
30
|
+
script = skill_command_scripts(repo_root).get("batch-action")
|
|
31
|
+
except SkillManifestError as error:
|
|
32
|
+
raise BatchExecutionError(f"Skill manifest invalid: {error}") from error
|
|
33
|
+
if script is None:
|
|
34
|
+
raise BatchExecutionError("batch-action Skill command is missing")
|
|
35
|
+
return script
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _run_batch_action(
|
|
39
|
+
repo_root: Path,
|
|
40
|
+
*args: str,
|
|
41
|
+
) -> int:
|
|
42
|
+
script = _batch_action_script(repo_root)
|
|
43
|
+
try:
|
|
44
|
+
completed = subprocess.run(
|
|
45
|
+
[sys.executable, str(script), *args],
|
|
46
|
+
cwd=repo_root,
|
|
47
|
+
capture_output=True,
|
|
48
|
+
text=True,
|
|
49
|
+
encoding="utf-8",
|
|
50
|
+
errors="replace",
|
|
51
|
+
check=False,
|
|
52
|
+
)
|
|
53
|
+
except OSError as error:
|
|
54
|
+
raise BatchExecutionError(f"cannot execute batch-action: {error}") from error
|
|
55
|
+
if completed.stdout:
|
|
56
|
+
print(completed.stdout, end="")
|
|
57
|
+
if completed.stderr:
|
|
58
|
+
print(completed.stderr, end="", file=sys.stderr)
|
|
59
|
+
return int(completed.returncode)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def confirm_batch_eligible(
|
|
63
|
+
repo_root: Path,
|
|
64
|
+
task_dir: Path,
|
|
65
|
+
args: argparse.Namespace,
|
|
66
|
+
) -> tuple[bool, str]:
|
|
67
|
+
"""Require explicit approval before creating Batch runtime state."""
|
|
68
|
+
del repo_root, task_dir
|
|
69
|
+
if not getattr(args, "approved", False):
|
|
70
|
+
return False, "Batch mode requires --approved"
|
|
71
|
+
return True, ""
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def run_batch_entry(
|
|
75
|
+
repo_root: Path,
|
|
76
|
+
first_task_dir: Path,
|
|
77
|
+
args: argparse.Namespace,
|
|
78
|
+
) -> int:
|
|
79
|
+
"""Create or load Batch state and publish its next Host action."""
|
|
80
|
+
eligible, detail = confirm_batch_eligible(repo_root, first_task_dir, args)
|
|
81
|
+
if not eligible:
|
|
82
|
+
print(f"Error [{BATCH_APPROVAL_REQUIRED_CODE}]: {detail}", file=sys.stderr)
|
|
83
|
+
return BATCH_REJECTED_EXIT_CODE
|
|
84
|
+
try:
|
|
85
|
+
return _run_batch_action(repo_root, "start", first_task_dir.name)
|
|
86
|
+
except BatchExecutionError as error:
|
|
87
|
+
code = getattr(error, "code", "BATCH-RUNTIME-ERROR")
|
|
88
|
+
detail = getattr(error, "detail", str(error))
|
|
89
|
+
print(f"Error [{code}]: {detail}", file=sys.stderr)
|
|
90
|
+
return BATCH_REJECTED_EXIT_CODE
|
|
@@ -15,8 +15,8 @@ if __package__:
|
|
|
15
15
|
from . import _bootstrap as _bootstrap # noqa: F401
|
|
16
16
|
else:
|
|
17
17
|
import _bootstrap # noqa: F401
|
|
18
|
-
from
|
|
19
|
-
from
|
|
18
|
+
from infra.archive_utils import archive_directory_resumable
|
|
19
|
+
from infra.paths import (
|
|
20
20
|
DIR_ARCHIVE,
|
|
21
21
|
DIR_CHANGES,
|
|
22
22
|
DIR_WORKFLOW,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""CLI stream encoding setup."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import io
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _configure_stream(stream: object) -> object:
|
|
10
|
+
if hasattr(stream, "reconfigure"):
|
|
11
|
+
stream.reconfigure(encoding="utf-8", errors="replace") # type: ignore[union-attr]
|
|
12
|
+
return stream
|
|
13
|
+
if hasattr(stream, "detach"):
|
|
14
|
+
return io.TextIOWrapper(
|
|
15
|
+
stream.detach(), # type: ignore[union-attr]
|
|
16
|
+
encoding="utf-8",
|
|
17
|
+
errors="replace",
|
|
18
|
+
)
|
|
19
|
+
return stream
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def configure_cli_encoding() -> None:
|
|
23
|
+
"""Configure stdio for UTF-8 when CLI scripts run on Windows."""
|
|
24
|
+
if sys.platform != "win32":
|
|
25
|
+
return
|
|
26
|
+
sys.stdout = _configure_stream(sys.stdout) # type: ignore[assignment]
|
|
27
|
+
sys.stderr = _configure_stream(sys.stderr) # type: ignore[assignment]
|
|
28
|
+
sys.stdin = _configure_stream(sys.stdin) # type: ignore[assignment]
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""CLI argument adapters for execution context flags."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
|
|
7
|
+
from runtime.execution_context import (
|
|
8
|
+
MODE_COORDINATOR,
|
|
9
|
+
MODE_NONE,
|
|
10
|
+
MODE_SUBAGENT,
|
|
11
|
+
MODE_WORKER,
|
|
12
|
+
ExecutionContext,
|
|
13
|
+
ExecutionContextError,
|
|
14
|
+
execution_context_from_values,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
PUBLIC_CONTEXT_FLAGS = {
|
|
19
|
+
"--mode",
|
|
20
|
+
"--assignment",
|
|
21
|
+
"--task-dir",
|
|
22
|
+
"--prompt-file",
|
|
23
|
+
"--context-file",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _build_parser(
|
|
28
|
+
*,
|
|
29
|
+
add_help: bool,
|
|
30
|
+
mode_flag: str,
|
|
31
|
+
assignment_flag: str,
|
|
32
|
+
task_dir_flag: str,
|
|
33
|
+
prompt_file_flag: str,
|
|
34
|
+
context_file_flag: str,
|
|
35
|
+
) -> argparse.ArgumentParser:
|
|
36
|
+
parser = argparse.ArgumentParser(add_help=add_help)
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
mode_flag,
|
|
39
|
+
choices=[MODE_NONE, MODE_COORDINATOR, MODE_WORKER, MODE_SUBAGENT],
|
|
40
|
+
help=argparse.SUPPRESS,
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(assignment_flag, help=argparse.SUPPRESS)
|
|
43
|
+
parser.add_argument(task_dir_flag, help=argparse.SUPPRESS)
|
|
44
|
+
parser.add_argument(prompt_file_flag, help=argparse.SUPPRESS)
|
|
45
|
+
parser.add_argument(context_file_flag, help=argparse.SUPPRESS)
|
|
46
|
+
return parser
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def build_public_execution_context_parser(add_help: bool = False) -> argparse.ArgumentParser:
|
|
50
|
+
return _build_parser(
|
|
51
|
+
add_help=add_help,
|
|
52
|
+
mode_flag="--mode",
|
|
53
|
+
assignment_flag="--assignment",
|
|
54
|
+
task_dir_flag="--task-dir",
|
|
55
|
+
prompt_file_flag="--prompt-file",
|
|
56
|
+
context_file_flag="--context-file",
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def build_internal_execution_context_parser(add_help: bool = False) -> argparse.ArgumentParser:
|
|
61
|
+
return _build_parser(
|
|
62
|
+
add_help=add_help,
|
|
63
|
+
mode_flag="--execution-mode",
|
|
64
|
+
assignment_flag="--execution-assignment",
|
|
65
|
+
task_dir_flag="--execution-task-dir",
|
|
66
|
+
prompt_file_flag="--execution-prompt-file",
|
|
67
|
+
context_file_flag="--execution-context-file",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def parse_public_execution_context_args(argv: list[str]) -> tuple[ExecutionContext, list[str]]:
|
|
72
|
+
parser = build_public_execution_context_parser(add_help=False)
|
|
73
|
+
leading: list[str] = []
|
|
74
|
+
index = 0
|
|
75
|
+
while index < len(argv):
|
|
76
|
+
token = argv[index]
|
|
77
|
+
if token in PUBLIC_CONTEXT_FLAGS:
|
|
78
|
+
if index + 1 >= len(argv):
|
|
79
|
+
raise ExecutionContextError(f"missing value for {token}")
|
|
80
|
+
leading.extend([token, argv[index + 1]])
|
|
81
|
+
index += 2
|
|
82
|
+
continue
|
|
83
|
+
break
|
|
84
|
+
|
|
85
|
+
namespace, leftover = parser.parse_known_args(leading)
|
|
86
|
+
if leftover:
|
|
87
|
+
raise ExecutionContextError(f"unsupported execution context arguments: {' '.join(leftover)}")
|
|
88
|
+
context = execution_context_from_values(
|
|
89
|
+
mode=getattr(namespace, "mode", None),
|
|
90
|
+
assignment=getattr(namespace, "assignment", None),
|
|
91
|
+
task_dir=getattr(namespace, "task_dir", None),
|
|
92
|
+
prompt_file=getattr(namespace, "prompt_file", None),
|
|
93
|
+
context_file=getattr(namespace, "context_file", None),
|
|
94
|
+
)
|
|
95
|
+
return context, argv[index:]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def execution_context_from_namespace(namespace: argparse.Namespace) -> ExecutionContext:
|
|
99
|
+
return execution_context_from_values(
|
|
100
|
+
mode=getattr(namespace, "execution_mode", None),
|
|
101
|
+
assignment=getattr(namespace, "execution_assignment", None),
|
|
102
|
+
task_dir=getattr(namespace, "execution_task_dir", None),
|
|
103
|
+
prompt_file=getattr(namespace, "execution_prompt_file", None),
|
|
104
|
+
context_file=getattr(namespace, "execution_context_file", None),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def context_to_internal_cli_args(context: ExecutionContext) -> list[str]:
|
|
109
|
+
if context.is_default:
|
|
110
|
+
return []
|
|
111
|
+
if context.context_file:
|
|
112
|
+
return ["--execution-context-file", context.context_file]
|
|
113
|
+
|
|
114
|
+
args = ["--execution-mode", context.mode]
|
|
115
|
+
if context.task_dir:
|
|
116
|
+
args.extend(["--execution-task-dir", context.task_dir])
|
|
117
|
+
if context.assignment:
|
|
118
|
+
args.extend(["--execution-assignment", context.assignment])
|
|
119
|
+
if context.prompt_file:
|
|
120
|
+
args.extend(["--execution-prompt-file", context.prompt_file])
|
|
121
|
+
return args
|