cowork-harness
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 3
- Forks
- 1
02 资源文件 40
- 参考文档.claude-plugin/plugin.json535 B
- 参考文档references/assertion-catalog-agents-skills-budgets.md12.1 KB
- 参考文档references/assertion-catalog-gates-hooks-modifiers.md19.3 KB
- 参考文档references/assertion-catalog-outcome-files-tools.md17.0 KB
- 参考文档references/assertion-catalog.md16.1 KB
- 参考文档references/assertions-guide.md11.0 KB
- 参考文档references/authoring.md35.1 KB
- 参考文档references/ci-recipe.md40.7 KB
- 参考文档references/critique.md21.5 KB
- 参考文档references/debugging.md19.8 KB
- 参考文档references/eval.md12.0 KB
- 参考文档references/fidelity-and-answers.md29.8 KB
- 参考文档references/gotchas.md29.1 KB
- 参考文档references/hillclimb-recipe.md22.4 KB
- 参考文档references/hillclimb.md46.7 KB
- 参考文档references/measurement.md5.1 KB
- 参考文档references/run-record-replay.md43.4 KB
- 参考文档references/scenario-schema.md52.8 KB
- 参考文档references/semantic-judging.md8.5 KB
- 参考文档references/task-recipes.md50.5 KB
- 脚本scripts/_vendor/yaml/__init__.py12.0 KB
- 脚本scripts/_vendor/yaml/composer.py4.8 KB
- 脚本scripts/_vendor/yaml/constructor.py28.0 KB
- 脚本scripts/_vendor/yaml/cyaml.py3.8 KB
- 脚本scripts/_vendor/yaml/dumper.py2.8 KB
- 脚本scripts/_vendor/yaml/emitter.py42.0 KB
- 脚本scripts/_vendor/yaml/error.py2.5 KB
- 脚本scripts/_vendor/yaml/events.py2.4 KB
- 许可证scripts/_vendor/yaml/LICENSE1.1 KB
- 脚本scripts/_vendor/yaml/loader.py2.0 KB
- 脚本scripts/_vendor/yaml/nodes.py1.4 KB
- 脚本scripts/_vendor/yaml/parser.py24.9 KB
- 脚本scripts/_vendor/yaml/reader.py6.6 KB
- 脚本scripts/_vendor/yaml/representer.py13.9 KB
- 脚本scripts/_vendor/yaml/resolver.py8.8 KB
- 脚本scripts/_vendor/yaml/scanner.py50.1 KB
- 脚本scripts/_vendor/yaml/serializer.py4.1 KB
- 脚本scripts/_vendor/yaml/tokens.py2.5 KB
- 脚本scripts/assertion-keys.json12.5 KB
- 脚本scripts/scenario.py268.4 KB
03 SKILL.md 正文
cowork-harness
This skill teaches you to drive the cowork-harness CLI — a fixture that runs a Claude Code
skill the way Claude Cowork runs it (sandboxed agent, default-deny egress, the permission /
AskUserQuestion control protocol). It is not the CLI itself: you still invoke cowork-harness …
in the shell; this skill tells you how to author scenarios, pick a fidelity tier, choose an answer
path, place assertions in the right CI lane, and avoid the harness's "✓ passed ≠ actually correct"
traps.
cowork-harness is an unofficial, independent project — not affiliated with or endorsed by
Anthropic. Say so if a user asks what it is.
The single most important idea: a green run is not automatically a correct run. The harness has
several ways to no-op a check while still producing a green run (skip an assertion on replay — now
flagged with a loud ::warning::, not silent — auto-answer a gate, observe an empty egress
allowlist). This skill exists mostly to keep you out of those traps — the Invariants below and the
full landmine catalog in references/gotchas.md are the highest-value part.
Read them.
Version note: the facts and
file:linepointers here trackcowork-harness 5.0.0(baselinedesktop-4.23118.0). If your checkout is newer, prefer the live--helpand — in a repo checkout —SPEC.md/docs/*.mdover this snapshot, and re-run the bundled linter.
Preflight — make sure the harness can actually run
The 10-second inner loop, once the CLI is on PATH:
cowork-harness doctor # prerequisites OK? (Docker, agent, token, baseline, device image)
cowork-harness skill ./my-skill "do X" --model claude-sonnet-5 # run once (or set COWORK_HARNESS_MODEL)
Before the first command, confirm the CLI is reachable and fail loud (never fake a pass) when a tier's dependencies are missing:
-
One-shot check. Run
cowork-harness doctor [--tier <tier>]first — a read-only prerequisite check that inspects Docker, the staged agent, the token, the baseline and thedevice_bridgeimage (built, or built on the first bridge run) in one pass. The bullets below explain each thing it checks (and how to fix it). -
Replay-only? Skip
doctor. Replaying committed cassettes needs no Docker, no staged agent, and no token — and every tier'sdoctorvalidates the auth token (the live tiers also Docker + the staged agent), so a ✗ there is expected, not a blocker. Go straight tocowork-harness replay <cassette>. -
CLI on PATH, recent enough? Run
cowork-harness --version— this skill needs ≥ 5.0.0. If it's missing or older, prefix every command with the version floornpx "cowork-harness@^5.0.0" <cmd>(Node ≥ 22), or install once withnpm i -g "cowork-harness@^5.0.0". Pin@^5.0.0, never@latest—@latestcan silently fetch an older CLI and the new commands fail as "unknown command", whereas the floor fails loud if no compatible version is published.This skill documents the CURRENT surface, not release history. If
cowork-harness --versionis OLDER than the floor, the per-release record of what you are missing is CHANGELOG.md — upgrade rather than work around it, since this skill'sfile:linepointers and flag names track the floor. -
Agent binary (sandboxed live tiers —
container/microvm/hostloop/cowork). The staged Claude Code agent is bind-mounted from a local Claude Desktop install, or pointCOWORK_AGENT_BINARYat aclaude-code-vm/<ver>/claudeELF. Nothing is bundled.protocol(L0) andreplayneed no staged agent; for the sandboxed tiers, no agent → no run; report that, don't skip silently. -
Docker / Lima. Only
--fidelity protocol(L0) runs without them.container/microvm/hostloop/coworkneed Docker (Lima for L2). If they're absent, drop to--fidelity protocoland say so — a green that never exercised the sandbox is not a sandbox pass. Atprotocolthe plugin under test is delivered (--plugin-dir), but its hooks then run as native host processes — so a plugin declaring hooks is refused there until you pass--allow-host-hooks/allow_host_hooks: true. -
Auth.
CLAUDE_CODE_OAUTH_TOKEN(preferred) orANTHROPIC_API_KEY(ANTHROPIC_AUTH_TOKEN:protocolonly), via env or.env— at every tier,protocolincluded (a Keychain or/loginsession is never used). With the token set, the agent gets it alone atcontainer/microvm/hostloop(athostloopit gets only Desktop's named shell vars plusagent_env.passthrough; atprotocol, withANTHROPIC_API_KEYset, the agent gets the key and not the token, since the harness passes the token there only when no key is set), and the graders (judge, LLM decider, evaluator) get it alone —COWORK_HARNESS_GRADER_AUTH=inheritpasses every key (semantic-judging). Minting an OAuth token needs theclaudeCLI (npm i -g @anthropic-ai/claude-code, thenclaude setup-token). -
Point at another
.envwith--dotenv <path>, and relocate run output with--run-dir <path>; both work before or after the subcommand.
Orient — the three loops
Everything you do with the harness is one of three loops, and the detail lives in one reference
file per loop: author a scenario (references/authoring.md), run /
record / lock it into a reproducible regression (references/run-record-replay.md),
and debug a run that misbehaved or greened when it shouldn't (references/debugging.md).
Pick the entry point you need. The first three are the everyday path — a quick liveness check, the CI-grade scenario, and the post-hoc debug loop; the rest are narrower tools that hang off them:
- "Is it even alive?" (inner loop) →
cowork-harness skill <folder> "<prompt>" --model <id>. Fastest; no scenario file. - Repeatable, asserted regression → author a
scenarios/*.yamland runcowork-harness run. This is the CI-grade path and most of this skill. - Against the plugins and skills you have installed →
plugins.from_host(schema). - A run failed — or greened and you don't trust it (the debugging loop) → Read
references/debugging.mdbefore touching the run. Its Triage table first splits "the skill misbehaved" from "a green you don't trust" — they need different tools — then names the tool for each, all token-free over the kept run dir (~/.cowork-harness/runs/…;--keepprints the path,trace <run-id>finds it). Don't re-run and hope. "Evidence" here means the RUN's own record — events, trace, transcript.critique's evaluator grades against a different artifact,critique-evidence-package.txt, which none of these tools surface; seereferences/critique.md. - Regression-test your skill's ANSWER quality (not just its behavior — does its guidance still lead to
correct answers after you edit it?) → author
semantic_matchesscenarios, then compare the version before your edit with the one after usingcowork-harness eval(EXPERIMENTAL, live: 10 runs per scenario at the defaults). See Recipe 5 step 6 inreferences/task-recipes.md(validity, discrimination — the traps) andreferences/eval.md.evalcompares two versions you already have;hillclimbruns each round of the loop that produces them;critiquefinds what is wrong;skill/runchecks it works. - Improve a skill round by round with Claude Code's
/claude-api hillclimb→cowork-harness hillclimb runis the loop's runner. Followreferences/hillclimb-recipe.md(the procedure, step by step); every flag, refusal and exit code is inreferences/hillclimb.md. - "What is WRONG with this skill?" (a graded critique, not a pass/fail) →
cowork-harness critique <folder> --prompt "<probe>". Up to four model workloads (zero with--corpus-only; pass 2 is skipped with no self-report) and 10–20 minutes; budget fromreport.costUsd.totalUsd. Reach for it when you want findings. For "what does this skill DO" — routing, artifact location, narration — useskillinstead: no evaluator, a fraction of the cost, and it answers that question directly. Report and evidence-package shapes:references/critique.md— which also covers grading a commit (git:<ref>:<path>), the "has the skill changed?" hashes, the public--summary-outfile, andcritique --comparefor reading several critiques side by side. - Multi-turn / interactive reproduction →
cowork-harness chat(interactive; gates answered at the TTY, not an asserted test — see Debugging withchatinreferences/debugging.md). "Interactive" splits two ways — don't take the wrong branch. Want to answer gates yourself and still get an asserted,assert:-checked run? That is--decider-dir(Choose an answer path inreferences/authoring.md), notchat. Reach forchatonly when you are exploring by hand and do NOT want a verdict.
"repo-only" in this skill means "not bundled with the installed SKILL" — not "unavailable". An npm install ships
docs/,README.mdandSPEC.mdin the tarball, so trynode_modules/cowork-harness/docs/<name>.mdbefore assuming a pointer dangles. A plugin install loads a trimmed source-only cache where those pointers genuinely do dangle.
Full command set: skill · run · chat · record · replay · verify-cassettes · rehash · prune · lint · lint-skill · analyze-skill · probe-dispatch · verify-run · regrade · fixture · search-pool <build|export|import> · ref <freeze|verify> · trace · inspect · diff · critique · eval · eval report · hillclimb <run|check|state-template|freeze-ref|regrade|seed> · stats · decide · gates · answer · scaffold · assertions --list · sync · list · boundary-check · status · vm <init|status|delete|prune> · doctor · init-redact. Always check cowork-harness <cmd> --help.
Invariants — how a green run lies
Each of these has produced a green run that tested nothing. The full catalog, with the reasoning
behind each, is references/gotchas.md.
result: successis not "the task completed". It means the agent didn't error. Assert the deliverable (file_exists/artifact_json/transcript_matches). Askill-lanePASSonly means no guard fired: readskillsInvoked(plusslashInvokedSkills— a/<skill>prompt runs the skill with noSkillcall),modelsandablatedbefore concluding anything from it.replayskips live-only keys. Filesystem and egress keys are skipped on replay (loudly), so a mixed item like{result, egress_denied}greens on its content half. Keep one concern perassert:item, put live-only checks on a live gate, and runcowork-harness lint.- Only scripted answers reproduce. Scripted
answers:+on_unanswered: failis the CI channel.first, an LLM decider and--decider-dirall flag the runnonDeterministic, andfirstmasks the gate it answers. replayevaluates the FROZEN scenario. Editingscenarios/*.yamlchanges nothing on a plainreplay: re-check anassert:edit withreplay --assert-from <file>, and re-record for any other key.- Some keys pass on absence.
gate_answers_deliveredandgates_all_scriptedpass when no gate fired — pair either withgate_answer_count_min: 1(or declarequestions_count_max: 0).tool_calledproves a tool ran, not that it was attempted. - An untracked skill mounts empty.
git adda new skill before testing it, and commit before recording the cassette that locks it. - The tier decides what exists.
protocolhas no sandbox and no egress, tool names differ per tier (containerservesmcp__workspace__web_fetch, notWebFetch), and every tier models Cowork's local lane only; new Pro and Max tasks do not use it from 2026-10-06. Behaviour-shaped results transfer; path, mount, delivery and egress results do not.device_bridge: trueonlane: remoteserves the cloud task'sdevice_bash(seereferences/authoring.md). - A WARN signal never blocks a green. Read the verdict signals after every run
(
prompt_asset_missing,undelivered_deliverables,model_fallback, …).
Short workflows
- Author, then lock:
cowork-harness scaffold --name … --prompt …→cowork-harness lint scenarios/→cowork-harness record <file.yaml> --dry-run(free) →recordonce, with--outat a tracked path (a cassette cannot be moved) →replayon the PR gate. - Fix answers without paying:
--keepone run →trace <run-dir> --view questions→ editanswers:→verify-run <run-dir> <scenario.yaml>→ record once. - Debug: Read
references/debugging.mdfirst — its triage table picks the tool (inspect,trace --view …,verify-run,diff,replay --explain). - Measure:
--repeat Nfor flakiness.--ablate-skillruns the control arm only; run the treatment arm yourself, with the model pinned and a recoverable source frozen.
References — where the detail lives
| File | Read it for |
|---|---|
references/authoring.md |
session vs scenario, discovery, fidelity tier, the answer-channel decision tree, web_fetch, a skill that resumes in a later session (legs:), scaffold + lint |
references/assertions-guide.md |
the two assertion axes, the goal → key map |
references/run-record-replay.md |
run / verify-run, multi-leg runs and --leg, recording and cassette placement, real-document validation, verdict signals (incl. where a relative or outputs/ path lands per tier), background-run liveness, CI lanes |
references/measurement.md |
--repeat, --ablate-skill, measurement hygiene |
references/debugging.md |
triage, result.json fields and trace views, chat |
references/gotchas.md |
the full "✓ passed ≠ correct" landmine catalog |
references/task-recipes.md |
start here for "how do I X": evolve assert:, audit tier drift, redaction, budgets, answer quality, and goals with no flag (force a compaction, ablate a section, a form reply, resume in a new conversation, hook JSON decisions, schema checks, unattended runs), keeping a skill's web searches (search-pool) and serving a run's searches from them (--search-corpus), and a skill that parks and resumes in a later session (legs:) |
references/assertion-catalog.md |
the assertion catalog's index: conventions shared by every key, the verdict-signal table, and links to the per-family files below |
references/assertion-catalog-outcome-files-tools.md |
per-key rows: outcome, transcript, files and artifacts, tools |
references/assertion-catalog-agents-skills-budgets.md |
per-key rows: sub-agents, skills and connectors, budgets, tasks, delivery |
references/assertion-catalog-gates-hooks-modifiers.md |
per-key rows: gates, hooks, path denial, verdict modifiers, egress, judged keys |
references/semantic-judging.md |
semantic_matches in full: what the judge reads, fork results, refusal reasons, provenance |
references/scenario-schema.md |
every YAML field, the multi-leg (legs:, host_action, workdir) form, which keys survive replay, the web_fetch model |
references/fidelity-and-answers.md |
tier semantics, answer paths, the determinism contract |
references/ci-recipe.md |
the GitHub Action, replay-vs-live lanes, the four-stage pipeline |
references/critique.md |
critique report and evidence-package shapes |
references/eval.md |
eval: paired before/after of two plugin versions — labels, metric rows, refusals, exit codes, files |
references/hillclimb.md |
hillclimb run / check / state-template / freeze-ref / regrade for a /claude-api hillclimb loop — pass --flow to each, the harness gate, resume, pairwise references, re-grading, refusals, exit codes |
references/hillclimb-recipe.md |
Recipe 7: the /claude-api hillclimb loop with the harness as its runner, step by step — the runner command, Step 0.5 checks, metrics, spend, rounds, stalls |
scripts/scenario.py |
scaffold, lint, lint-skill, resolve-agent-types <plugin-dir> (validates a pinned subagent_type against plugin.json + agents/*.md) |
04 同仓库更多 Skills
standalone-skill
fixture skill for collectArtifactSources — proves scripts/ is reached
skill-b
fixture skill B — sibling of skill-a, must be excluded when the target is skill-a directly
skill-a
fixture skill A — has a candidate source under scripts/
csv-report
Profile an uploaded CSV and write a metrics file, a summary and a short insights note. Use when the user asks to analyze, summarize or report on a CSV / tabular dataset.
csv-audit
Audit outputs/metrics.json for data-quality problems and return a findings list. Use when asked to audit CSV metrics.
my-pdf-skill
Example skill under test. Summarize a PDF and write action items.