[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111095":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":12,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":13,"stars30d":14,"stars90d":13,"forks30d":13,"starsTrendScore":13,"compositeScore":15,"rankGlobal":10,"rankLanguage":10,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":10,"pushedAt":32,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":13,"starSnapshotCount":13,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},111095,"skill-wb-exec","Luminousyyh\u002Fskill-wb-exec","Luminousyyh","Delegate bounded coding tasks to a headless WorkBuddy\u002FCodeBuddy CLI agent from DeepSeek Harness — structured result, real diff, path whitelist and worktree isolation.","",null,"Python",82,0,15,41.5,"MIT License",false,"main",true,[21,22,23,24,25,26,27,28,29,30,31],"agent-orchestration","ai-agents","cli-agent","code-review","deepseek-harness","dsh","dsh-plugin","python","skill","subagent","worktree","2026-11-08 16:48:57","2026-11-21 01:28:46","# wb-exec\n\n> Delegate bounded implementation work to another CLI agent; keep planning, supervision and review for yourself.\n\n`wb-exec` is a **DeepSeek Harness plugin (skill bundle)**: the host agent hands **coding \u002F refactoring \u002F test-writing** subtasks to a **headless CLI executor** and gets back a **structured result** plus the **real diff**.\n\nThe default executor is **WorkBuddy \u002F CodeBuddy (DeepSeek V4.1 Flash, effort `max`)**, pinned on purpose. If you do not have it, switch backends with `--executor` — `codex`, `claude`, `aider`, or `custom` (any CLI, via an argument template). Isolation, supervision, structured capture and the out-of-scope check are identical on every backend.\n\n> ⚠️ **Prerequisite.** Whichever backend you pick must be installed on the same machine. Without it the plugin installs but the skill cannot do anything: its first step, `doctor`, reports `ok=false` and stops. It never installs dependencies or rewrites configuration on its own.\n\n**Fits:** tasks with a clear boundary that can be finished independently, with an enumerable set of files; using a cheaper executor for volume while the host only plans and reviews; work that deserves an isolated worktree, reviewed by a human before it lands.\n\n**Does not fit:** exploratory work, requirements still moving, cross-module rewrites, or anything that needs architectural judgement. Keep those in the host.\n\n![Figure 1](docs\u002Ffigures\u002Ffig1-architecture.png)\n\n*Figure 1. Install-time registration, run-time delegation to the executor, and the audit path that returns artifacts to the review gate — drawn as three columns, read left to right: installation, execution, audit. The execution column shows the ordering that matters: `dispatch` claims the paths from the lock *before* it spawns the CLI executor, and the executor edits only the worktree `wt\u002F`, bounded by the `owned_paths` whitelist. The footnote restates that bound and records that a corrupt lock is refused rather than treated as empty.*\n\n---\n\n## Features\n\n| Feature | What it does |\n|---|---|\n| **Path whitelist** | `owned_paths` in the task package is the set of paths the executor may touch. Changes outside it are detected and reported in `result.violations` rather than silently accepted. An empty list is enforced as **additions only**, not as \"no check\" |\n| **Failures stay collectable** | If dispatch or the supervisor fails, `exit.json` and `result.json` are still written, so the job arrives as `failed` with a blocker instead of vanishing. The CLI is probed before any claim is taken, so a missing executor leaves no live lock |\n| **Directory isolation** | On a Git repository the run happens in a dedicated worktree on a `wb-exec\u002F\u003Cid8>` branch: no commit, no push, no auto-merge |\n| **Real diff first** | The executor's `summary` is only its own account. `change.patch` and `changed_files_git` come from the actual `git diff`; when the two disagree, the diff wins |\n| **Structured capture** | A `--json-schema` constraint forces structured output; the script then adds the git diff and the out-of-scope check to produce a machine-readable `result.json` |\n| **Recursion guard** | The child process gets `WB_SUBAGENT=1`; the script refuses to dispatch when it sees that variable (exit code 3), so an executor cannot spawn another executor |\n| **Path-level dispatch lock** | A second dispatch whose `owned_paths` overlap a running job is refused (`PATHS_LOCKED`, exit code 4) instead of racing it. Disjoint paths still run in parallel. Whether a claim is still alive is decided by the recorded **pid**, not by a heartbeat age: a supervisor that died before writing its first heartbeat leaves no heartbeat while the executor it spawned may still be editing the claimed paths |\n| **Failed-closed lock** | A `dispatch.lock` that exists but cannot be parsed is refused rather than treated as \"no claims\". Coercing a damaged lock to empty would admit every job and then rewrite the file with only the new claim, discarding live holds silently |\n| **Bounded output** | `stdout.jsonl` plus `stderr.log` are capped (64 MiB, `WB_EXEC_LOG_CAP` overrides). Crossing the cap kills the child, marks the job `failed` and adds a blocker naming the limit, so a truncated transcript can never be read as a finished run |\n| **`jobs`, read-only** | One command prints the live claims (paths, pid, liveness, age) and the recent job history. It never prunes or releases anything, so a refused user has a way to see what is holding the paths instead of deleting the lock by hand |\n| **`needs_human`, not prose** | Every result carries a structured `needs_human` (`{\"required\": bool, \"reasons\": [...]}`) derived from status, `blockers`, failing tests and `violations`. \"A person must decide something\" is no longer something you infer by reading `summary` |\n| **Non-blocking long runs** | `dispatch` returns a `job_id` immediately; `status` polls, `collect` retrieves, and both heartbeat and timeout are observable |\n| **No dependencies** | Python standard library only, Python 3.10+ |\n\n---\n\n## How it works\n\n![Figure 2](docs\u002Ffigures\u002Ffig2-workflow.png)\n\n*Figure 2. One delegation, drawn as a single unidirectional pass: task authoring, path claim, CLI spawn, worktree edit and `git diff`, with the observable outputs collected alongside. No cycle is drawn on purpose — a failed review does not re-run the same executor, it re-splits into a smaller package, which is the `re-split task` edge in Figure 1. The host never merges on its own: review is a separate, mandatory step.*\n\n1. The host writes the task package to disk as JSON (`goal`, `owned_paths`, `acceptance`, ...)\n2. `dispatch` (background) or `run` (foreground) starts the call; Git repositories get a dedicated worktree by default\n3. The executor works and emits stream-json events; the supervisor writes a heartbeat every 5 seconds\n4. `collect` parses the structured result and merges in the real diff and the out-of-scope check\n5. **The host reads the patch and runs the acceptance commands itself before integrating anything.** `wb-exec` never integrates for you\n\n---\n\n## Requirements\n\n- **Python 3.10+** (standard library only, no `pip install`)\n- **One supported CLI executor** — pick with `--executor` or `WB_EXECUTOR`:\n  - `workbuddy` (default): the script probes for a `codebuddy` executable and for the CLI embedded in a local WorkBuddy install; set `WB_CLI` to point at one explicitly\n  - `codex`, `claude`, `aider`: found on `PATH`, or via `WB_CLI`\n  - `custom`: `WB_CLI` (the executable) plus `WB_CLI_ARGV` (a JSON array argument template, see below)\n- **Git** — optional. Used for worktree isolation and diff capture; a non-Git directory degrades to in-place execution\n- On the `workbuddy` backend, an account or plan that is allowed to use `deepseek-v4.1-flash`\n\nCheck the environment first:\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py doctor\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py doctor --executor codex   # check another backend\n```\n\nIt returns JSON with `ok` \u002F `cli` (the resolved entry point) \u002F `cli_version` \u002F `executor` \u002F `available_executors` \u002F `git` \u002F `is_git_repo` \u002F `state_root`. When `ok=false` or `cli_error` is non-empty, stop and hand the raw output to the user — do not install anything or change configuration.\n\n---\n\n## Install\n\nThis repository is a **DSH plugin package** (`package.json` declares `dsh.bundle`). Once installed, a `ctx.skills` provider publishes `skills\u002Fwb-exec\u002F` as a skill.\n\n**Option 1 — plugin market or CLI (recommended)**\n\nInstall it from **Plugins → Plugin Market** in DSH Desktop, or from a terminal:\n\n```bash\ndsh plugin --profile \u003Cprofile> add github:Luminousyyh\u002Fskill-wb-exec\n```\n\n> DSH Desktop manages its own profile. A CLI install may land in `profiles\u002Fweb` instead of the profile the desktop app uses; on the desktop, install through **Settings → Plugins**.\n\n**Option 2 — use it as a plain skill (no plugin)**\n\nCopy `skills\u002Fwb-exec\u002F` into your agent's skills directory. The loader discovers a skill at `\u003Cskills-root>\u002F\u003Cname>\u002FSKILL.md`:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FLuminousyyh\u002Fskill-wb-exec.git\ncp -r skill-wb-exec\u002Fskills\u002Fwb-exec ~\u002F.agents\u002Fskills\u002Fwb-exec\n```\n\nAlways invoke the script through **this skill's absolute path** rather than the terminal's current directory:\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py \u003Csubcommand> ...\n```\n\nOn Windows, if `python` is not on `PATH`, use `py -3` or the absolute path of a local Python.\n\n---\n\n## Quick start\n\n### 1. Write the task package (the most important step)\n\nSave it as a file, for example `.wb-exec\u002Ftasks\u002F001.json`:\n\n```json\n{\n  \"goal\": \"Rate-limit failed logins on \u002Flogin: lock an account for 10 minutes after 5 consecutive failures within 5 minutes, and return 429\",\n  \"context\": \"The rate-limiting middleware lives in src\u002Fauth\u002Fmw.py. A Redis client wrapper already exists in src\u002Fcommon\u002Fredis.py; reuse it and do not create a new connection pool.\",\n  \"inputs\": [\"src\u002Fauth\u002Fmw.py\", \"src\u002Fcommon\u002Fredis.py\", \"tests\u002Ftest_auth.py\"],\n  \"owned_paths\": [\"src\u002Fauth\u002F\", \"tests\u002Ftest_auth.py\"],\n  \"acceptance\": [\"pytest -q tests\u002Ftest_auth.py\"],\n  \"notes\": \"Do not add dependencies. Count failures with Redis INCR + EXPIRE under the key auth:fail:\u003Caccount>.\"\n}\n```\n\nThree hard rules:\n\n1. `goal` says what changed once the work is done, in one sentence — **no implementation steps**\n2. `owned_paths` must be enumerable; **an empty list means the executor may only create new files**\n3. `acceptance` holds executable commands, never \"make sure it works\"\n\n### 2. Inspect the call before making it (optional)\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py dispatch --task .wb-exec\u002Ftasks\u002F001.json --cwd \u003Crepo> --dry-run\n```\n\n`--dry-run` prints the argv and starts nothing, which is how you check paths and flags.\n\n### 3. Dispatch\n\nLong jobs — most of them — go to the background:\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py dispatch --task .wb-exec\u002Ftasks\u002F001.json --cwd \u003Crepo>\n```\n\nShort jobs can be waited on in the foreground:\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py run --task .wb-exec\u002Ftasks\u002F001.json --cwd \u003Crepo> --timeout 600\n```\n\n### 4. Supervise\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py status --job \u003CJOB_ID>\n```\n\n- `running` — normal; look again in 30–60 seconds, never in a tight loop\n- `stalled` — the heartbeat is more than 90 seconds old. `collect` first to see where it stopped, then decide whether to `cancel` and re-dispatch a smaller package\n- `cancel_requested` — the cancellation flag is written; waiting for the process to exit\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py cancel --job \u003CJOB_ID>\n```\n\n### 5. Collect and review\n\n```bash\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py collect --job \u003CJOB_ID> --wait\n```\n\nThe result (excerpt):\n\n```json\n{\n  \"protocol\": 1,\n  \"ok\": true,\n  \"job_id\": \"3f9c1a7b2e04\",\n  \"status\": \"done\",\n  \"exit_code\": 0,\n  \"elapsed_s\": 42.1,\n  \"isolated\": true,\n  \"executor\": \"workbuddy\",\n  \"worktree\": \"...\u002Fwt\",\n  \"result\": {\n    \"summary\": \"Added token validation middleware and 3 tests\",\n    \"changed_files\": [\"src\u002Fauth\u002Fmw.py\", \"tests\u002Ftest_mw.py\"],\n    \"tests\": [{\"cmd\": \"pytest -q tests\u002Ftest_mw.py\", \"status\": \"pass\", \"detail\": \"12 passed\"}],\n    \"blockers\": [],\n    \"artifacts\": {\"patch\": \"...\u002Fchange.patch\", \"stdout\": \"...\u002Fstdout.jsonl\", \"stderr\": \"...\u002Fstderr.log\"},\n    \"changed_files_git\": [\"src\u002Fauth\u002Fmw.py\"],\n    \"violations\": [],\n    \"needs_human\": {\"required\": false, \"reasons\": []}\n  }\n}\n```\n\n`needs_human` is the field to route on. It is `false` here because the status is\n`done`, there are no blockers, no failing tests and no out-of-scope writes. It\nbecomes `true` with a reason list such as `[\"failed\"]`, `[\"out_of_scope_writes\"]`,\n`[\"blocked\"]` or `[\"failing_tests\"]` — never by reading the summary's wording.\n\n`protocol` is the envelope version. It is a plain integer that only changes when\nthe shape of this envelope changes, so a host written against an older release\ncan tell what it is reading instead of failing deep inside its own logic after\nan upgrade. Unknown keys are safe to ignore; this one is not inferred from text.\n\n**Review discipline — none of these is optional:**\n\n1. **Read the patch yourself before judging.** `artifacts.patch` is the real diff; `summary` is only the executor's account. When they disagree, the diff wins\n2. A non-empty `violations` means the executor wrote outside its assignment. Do not quietly accept it and do not revert it yourself — report it to the user first\n3. A `pass` inside `tests` **is not independent verification**. After integrating, run the acceptance commands yourself in the main working tree\n4. Integration belongs to the host: `git apply --check` → `git apply` → run acceptance → report. **Do not run `git commit` or `git push`** unless the user explicitly asks for it\n\n---\n\n## Command reference\n\n| Subcommand | Arguments | Purpose |\n|---|---|---|\n| `doctor` | `[--cwd]` `[--executor]` | Self-check: CLI, git, environment, state directory, available backends |\n| `dispatch` | `--task` `[--cwd]` `[--timeout 1800]` `[--worktree auto\\|off]` `[--executor]` `[--dry-run]` | Dispatch in the background, return a `job_id` immediately |\n| `run` | same, minus `--dry-run` | Run in the foreground and wait for collection |\n| `status` | `--job` | Query the job state |\n| `collect` | `--job` `[--wait]` `[--wait-timeout 1800]` | Collect the result; `--wait` blocks until the job ends |\n| `cancel` | `--job` | Request cancellation (writes a flag file; the supervisor reacts within 0.5 s) |\n| `jobs` | `[--limit 20]` | Read-only listing of the live claims (paths, pid, liveness, age) and the recent job history. It prunes and releases nothing |\n\nGeneral notes:\n\n- `--timeout` is in seconds and defaults to `1800`\n- `--worktree auto` (default) creates a dedicated worktree on a Git repository; `off` runs in place\n- `--executor` selects the backend (`workbuddy` by default; also `codex`, `claude`, `aider`, `custom`). `WB_EXECUTOR` sets the same default through the environment\n- **The `workbuddy` backend is pinned**: DeepSeek V4.1 Flash at effort `max`, hard-coded, with no `--model` or `--effort` flag (passing one is rejected by argparse on purpose). When the account refuses that model the run fails; **do not retry with a different model**, hand `stderr.log` to the user. Other backends use whatever model their own CLI is configured with — `wb-exec` injects no model or effort flag for them\n- **On this backend the prompt travels on stdin, not on argv.** A multi-line argv prompt is truncated to its first line by the CLI, and the task package is always multi-line, so `-p` acts as the read-from-stdin switch. `job.json` therefore stores the prompt itself: `argv` alone no longer reproduces a run\n\n### Choosing a backend\n\n```bash\n# default: WorkBuddy \u002F CodeBuddy\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py dispatch --task t.json --cwd \u003Crepo>\n\n# any other supported CLI\npython \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py dispatch --task t.json --cwd \u003Crepo> --executor claude\n\n# anything else, through an argument template\nWB_CLI=my-agent WB_CLI_ARGV='[\"run\",\"--prompt\",\"{prompt}\",\"--dir\",\"{cwd}\"]' \\\n  python \u003CSKILL_DIR>\u002Fscripts\u002Fwb_exec.py dispatch --task t.json --cwd \u003Crepo> --executor custom\n```\n\nThe `custom` template may use `{prompt}`, `{cwd}`, `{schema}`, `{session}`, `{model}` and `{effort}`; each placeholder is expanded for the job before the process starts. A backend name that does not exist fails loudly rather than silently falling back to WorkBuddy.\n\n---\n\n## Task package protocol\n\n| Field | Required | Meaning |\n|---|---|---|\n| `goal` | yes | The objective, without implementation steps; the script renders it into the executor prompt |\n| `context` | no | Background and known constraints |\n| `inputs` | no | Read-only reference material; paths are passed to the executor with `--add-dir` |\n| `owned_paths` | no | **Whitelist of writable paths**; when empty only new files may be created, and edits or deletions of existing files are reported. Always use `\u002F` as the separator. Entries are resolved against `--cwd`; one that escapes it, or the repository root itself, is rejected |\n| `acceptance` | no | Executable commands; the executor should run them and record the outcome in `tests` |\n| `notes` | no | Catch-all constraints |\n\n`owned_paths` matching: a path qualifies when it is **exactly equal, or starts with the entry plus `\u002F`**. `src\u002Fauth\u002F` covers `src\u002Fauth\u002Fmw.py`; `src\u002Fauth` covers it too. Anything outside the whitelist is recorded in `result.violations`. An empty list is not \"no check\": additions pass, but a run that modifies or deletes an existing file shows up there, which is what \"new files only\" has always meant.\n\nThe task file is read as `utf-8-sig`, so a package written by Windows PowerShell with a BOM loads instead of failing on a stray character.\n\nFull field definitions and the state machine live in [protocol.md](skills\u002Fwb-exec\u002Freferences\u002Fprotocol.md); a ready-to-edit template is [task.example.json](skills\u002Fwb-exec\u002Fassets\u002Ftask.example.json).\n\n---\n\n## States and failure handling\n\n![Figure 3](docs\u002Ffigures\u002Ffig3-states.png)\n\n*Figure 3. State classification. The decision sequence — spawn, heartbeat write, staleness check, `exit.json` probe, classify — points at the persisted state it selects; branches are listed beside the sequence rather than drawn as a fan-out. The footnote gives the criteria for the four terminal states and records that `stalled` is derived at read time from heartbeat age, never stored as a sixth state, and is not reported by the executor.*\n\nState machine: `running` → `done` | `failed` | `timeout` | `cancelled` | `stalled`\n\n`stalled` is derived (`exit.json` absent and the heartbeat older than 90 seconds). The process may still be alive or already dead — `collect` first and read the tail of the output.\n\n| Symptom | Action |\n|---|---|\n| `exit_code != 0` with a non-empty `blockers` | Carry the blocker back into planning, narrow or split the package, re-dispatch **once** |\n| `ok=false, blockers=[\"could not parse structured result\"]` | Read the tail of `artifacts.stdout`; usually the executor did not follow the schema. Add \"the last message must be JSON\" to `notes` |\n| `status=timeout` | The package is too large. Split it into 2–3 packages whose `owned_paths` do not overlap |\n| `status=stalled` | `collect`, then `cancel`; re-dispatch with `--worktree auto` |\n| `cli_error` | Stop and report to the user; do not install dependencies |\n\nExit codes:\n\n| Code | Meaning |\n|---|---|\n| 0 | Success |\n| 1 | Execution failed, or the result could not be parsed (`collect` returns `ok=false`) |\n| 3 | Recursion refused (this process is already an executor) |\n\n---\n\n## Safety boundaries\n\n![Figure 4](docs\u002Ffigures\u002Ffig4-isolation.png)\n\n*Figure 4. The whitelist and the worktree are enforced in code rather than requested in the prompt. Left: the worktree is cut from `HEAD` at dispatch, so uncommitted changes do not carry over. Right: every changed path is classified — in-scope paths land in `changed_files_git`, out-of-scope paths in `violations`, and they are reported rather than auto-reverted. The footnote states the three hard constraints: no commit, no push, no auto-merge. This is isolation, not confinement: a process that ignores the boundary is not stopped by it.*\n\n- **Directory isolation and `owned_paths` are the real security boundary, not optional extras.** On the `workbuddy` backend the child command passes both `-y` and `--permission-mode bypassPermissions`. `-y` alone is documented as \"HIGH\u002FCRITICAL still ask\", and a non-interactive run has no prompt to answer, so `Write`\u002F`Edit`\u002F`Bash` were refused and every task came back with blockers and an untouched worktree at exit code 0. Isolation plus a whitelist is what actually constrains the run\n- **Never recurse**: the executor is already forbidden to dispatch. The dispatch lock also refuses a second job whose paths overlap a running one, so the old \"do not do this\" convention is now enforced rather than remembered\n- **Isolation failure aborts the dispatch**: if the worktree cannot be created, nothing runs. There is no silent fallback to editing the source tree in place, because that would quietly turn an isolation guarantee into no isolation\n- **An unusable CLI fails loudly**: the executor is found and probed before any path is claimed, and an explicit `WB_CLI` is authoritative — a broken one fails the run rather than falling back to another installation. A missing CLI therefore leaves no live lock\n- **Never trigger `dispatch` from inside a WorkBuddy \u002F CodeBuddy session**: the child process collides with that session's daemon and hangs silently — measured at 45–300 seconds with no stdout or stderr at all. Call the script from the host agent or a normal terminal\n- **Overlapping work is refused, not queued**: `dispatch` exits `4` with `error: PATHS_LOCKED` and names the holding job. Run `jobs` to see what is holding the paths, then widen the split, wait, or cancel the other job — do not work around it by clearing the lock file\n- **A runaway executor is stopped, not tolerated**: the combined `stdout.jsonl` and `stderr.log` size is checked in the same supervision loop as cancel and timeout. Crossing the cap kills the child and records the cap in `blockers`, so a truncated transcript is never mistaken for a completed run\n- **Never dump full logs at the user**: give `summary`, the relevant `tests` and `violations`; the logs stay in the `artifacts` paths for on-demand reading\n- **Never re-run by hand with `-y`**: the script already handles the permission flags; bypassing it bypasses isolation and the out-of-scope check\n- **Never clean up the user's worktree**: after `collect` the directory stays in place for review, and removal is the user's decision\n- **In-place execution on a non-Git directory** (`isolated=false`, no diff capture) leaves `owned_paths` as the only defence — **it must be written**\n- **The lock is not a security boundary either**: it stops two cooperating jobs from colliding, not a process that ignores it. Two projects with separate `WB_EXEC_HOME` do not see each other's claims\n\n---\n\n## What it deliberately does not do\n\nEleven features were considered and dropped on purpose; the reasoning is in\n[rejected-designs.md](skills\u002Fwb-exec\u002Freferences\u002Frejected-designs.md). The short\nversion:\n\n| Not a | Because |\n|---|---|\n| Scheduler | Retrying is a judgement about whether the work is still wanted; a silent retry can duplicate a change you already rejected |\n| Auto-merger | An agent that both writes and grades the change has verified nothing |\n| Sandbox | A process running as your OS user can reach anything you can. This is isolation, not confinement |\n| Model switcher | A pinned executor keeps results comparable, and removes the temptation to \"try another model\" instead of reading `stderr.log` |\n| Mind reader | `needs_human` comes from structured fields only, never from the wording of `summary` |\n\n---\n\n## State directory layout\n\n```\n~\u002F.wb-exec\u002F\n  dispatch.lock   claims of every running job: job_id, owned_paths, pid, since\n  dispatch.guard  transient mutex held only while dispatch.lock is rewritten\n  jobs\u002F\u003Cjob_id>\u002F\n    job.json        task package snapshot, actual argv, cwd, worktree, timeout,\n                    the prompt itself and the log cap in force at dispatch time\n    heartbeat.json  updated by the supervisor every 5 seconds\n    stdout.jsonl    raw executor output (stream-json), capped with stderr.log\n    stderr.log      executor log; model and permission errors usually land here\n    change.patch    the real diff (Git repository with isolation enabled)\n    result.json     parsed structured result\n    exit.json       state, exit code, elapsed time\n    cancel.request  cancellation flag\n    wt\u002F             the dedicated worktree (--worktree auto on a Git repository)\n```\n\nOverride the state root with the `WB_EXEC_HOME` environment variable.\n\n`dispatch.lock` is advisory between cooperating jobs and scoped to a single `WB_EXEC_HOME`. It is **not** a security boundary: a process that ignores it is not stopped by it.\n\nTwo properties of the lock are worth knowing before you rely on it. A claim is\nconsidered live while its job has no `exit.json` **and** either has a heartbeat\nor its recorded pid can still be probed as running; liveness is a fact about the\nprocess, not a guess from a missing file. A lock that cannot be parsed is\nrefused, never silently replaced — a safety file that disables itself on\ncorruption is worse than one that blocks and tells you where it is.\n\n**Isolation semantics**: `--worktree auto` (default) on a Git repository creates a `wb-exec\u002F\u003Cid8>` branch and a `wt\u002F` worktree from the `HEAD` at dispatch time. Nothing is committed, pushed or auto-merged, and the user's uncommitted changes are **not** carried over. Removing the worktree is the user's decision; the script never deletes it.\n\n---\n\n## Development and testing\n\nThe tests stub the CLI, so **they run offline without WorkBuddy installed**:\n\n```bash\npython -m unittest discover -s skills\u002Fwb-exec\u002Ftests -v\n# or one file\npython skills\u002Fwb-exec\u002Ftests\u002Ftest_wb_exec.py\n```\n\nNothing calls a model. `tests\u002Ffake_cli.py` replays a stream-json transcript, so the suite runs offline.\n\n- **Unit tests** cover environment injection, a standalone CLI entry taking precedence over the embedded one, a native error result never being reported as success, plain prose never counting as a structured success, and the executor backends — including a test that pins the WorkBuddy argv so a refactor cannot change it silently.\n- **Lock tests** pin both directions: overlapping and nested paths are refused, a path prefix is not treated as a boundary (`src\u002Fauth` ≠ `src\u002Fauthz`), Windows separators normalise, disjoint paths still run. Claim liveness is tested from the side that matters: a job directory with **no heartbeat but a live pid** must still block (that was the crash window where an orphan kept writing), a provably dead pid must be pruned, and an unprobeable pid falls back to the old heuristic so the lock cannot wedge forever. A corrupt lock is asserted to refuse and to be left byte-identical on disk.\n- **`jobs` tests** pin that the listing reports claims and history, that it is strictly read-only (the lock file is byte-identical before and after), that a dead claim is shown but not removed, and that a corrupt lock is reported with exit code 0.\n- **Desktop-regression tests** pin what the Windows installation made easy to get wrong: a UTF-8 BOM package loads, `owned_paths` escaping the working directory is refused, a missing CLI leaves no live claim, an isolation failure never falls back to in-place editing, a spawn failure still produces a collectable terminal result, and a timeout still fires when the executor never reads its stdin\n- **`needs_human` tests** pin the derivation: a clean success needs nobody, while failure, out-of-scope writes, blockers and failing tests each raise it — and passing tests alone do not.\n- **End-to-end tests** drive the real script through `dispatch` → `status` → `collect` against a temporary Git repo: a run produces a patch, the main working tree is left alone, an out-of-scope write is reported in `violations`, `--dry-run` leaves no job directory behind, a dispatched executor cannot dispatch again (exit code 3), and a chatty executor that exceeds the output cap is stopped with the cap named in `blockers` rather than reported as done.\n\n## Project layout\n\n```\nskill-wb-exec\u002F\n├── package.json               # plugin manifest: dsh.bundle.patch -> dsh\u002Fcordis.patch.yml\n├── dsh\u002F\n│   ├── index.js               # server entry: publishes skills\u002Fwb-exec\u002F on ctx.skills (plain ESM, no build)\n│   └── cordis.patch.yml       # inserts one row into the profile plugin tree (by package name, no relative path)\n├── skills\u002F\n│   └── wb-exec\u002F\n│       ├── SKILL.md           # skill instructions: self-check, package, dispatch, supervise, collect, boundaries\n│       ├── assets\u002F\n│       │   └── task.example.json     # task package template\n│       ├── references\u002F\n│       │   ├── protocol.md           # fields, result shape, state machine, isolation, exit codes\n│       │   └── rejected-designs.md   # 11 features considered and dropped, with reasons\n│       ├── scripts\u002F\n│       │   └── wb_exec.py            # every subcommand (standard library only)\n│       └── tests\u002F\n│           ├── fake_cli.py                   # stubbed CLI, replays a stream-json transcript\n│           ├── test_wb_exec.py               # unit tests\n│           ├── test_executor_backends.py     # backend registry, argv pinning\n│           ├── test_end_to_end.py            # dispatch -> status -> collect, against a real repo\n│           ├── test_repair_regressions.py    # Windows-installation regressions: BOM, spawn, isolation\n│           └── test_lock_and_needs_human.py  # lock claims, liveness, jobs listing, needs_human\n├── docs\u002F\n│   ├── figures\u002F\n│   │   ├── pixel_gate.py      # geometric validation: blank-band and ink of the committed PNGs\n│   │   └── fig*.{svg,pdf,png} # SVG is the source; PDF to print, PNG (1248 px) to preview\n│   ├── design\u002F                # the reasoning behind the mechanism, not a sales page\n│   │   ├── protocol.md        #   communication layer: what the contract can and cannot see\n│   │   ├── coordination.md    #   concurrency, path granularity, the stated refusals\n│   │   ├── stability.md       #   crash, hang, cancel, orphans\n│   │   └── rfc.md             #   the three analyses synthesised and ranked\n│   └── launch-drafts.md       # ready-to-post copy per channel, with its own fact-check\n├── assets\u002F\n│   └── icon.png               # plugin-market storefront icon\n├── screenshots.json           # market screenshot manifest\n├── LICENSE                    # MIT\n└── README.md\n```\n\n## Design notes\n\nThe mechanism is documented layer by layer, including what it refuses to do:\n`docs\u002Fdesign\u002Fprotocol.md` (host to executor and back), `coordination.md`\n(concurrency and the stated refusals), `stability.md` (crash, hang, cancel,\norphans) and `rfc.md`, which ranks the findings and records what was rejected\nand why. Several of those notes describe defects that were measured rather than\nguessed at, including two hypotheses that the measurement disproved.\n\n## Figures\n\nThe diagrams are code-native vector files: editable SVG, PDF for print, PNG for\npreview. The SVG is the source of truth: each figure is edited directly and\nre-rendered to PDF and to a 1248 px PNG with the architecture renderer.\n\n```bash\npython docs\u002Ffigures\u002Fpixel_gate.py      # blank-band and ink check, no rendering\n```\n\n`pixel_gate.py` exists because a diagram can be wrong in ways only an eye would\nnormally catch. The defect that motivated it was a two-panel figure whose panels\nwere meant to be stacked but never moved: the canvas height had doubled, every\nlabel stayed inside the canvas and the renderer reported zero errors, while 59%\nof the image was empty and the panels were still side by side. The check\ntherefore measures the bounding box of the non-white pixels and refuses a figure\nwhose blank margin exceeds 35% on any side, or whose content covers less than 55%\nof either axis.\n\nThey describe the implemented mechanism; they are not a benchmark or a proof of\nanything.\n\n## License\n\nMIT — see [LICENSE](LICENSE).","wb-exec 是一个 DeepSeek Harness 插件，用于将边界明确的编码子任务（如代码重构、单元测试编写）委托给本地 CLI 形式的 AI 代理（如 WorkBuddy\u002FCodeBuddy）执行，并返回结构化结果与真实 Git 差分。其核心特性包括路径白名单控制、工作树隔离、执行失败可审计、真实 diff 优先校验及结构化输出约束。项目不替代主代理的规划与评审职责，仅承担受控范围内的实施工作，适用于需人工复核的批量小粒度开发任务，如模块内函数级重构或测试补全。",2,"2026-11-24 04:40:06","CREATED_QUERY"]