Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Dsh Playbook?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/xiaobaijiadepugongyingpai-coder-dsh-playbook)
---
name: dsh-playbook
description: How to dispatch well — choosing flash vs pro, writing self-contained briefs, parallelism, verifying results, and guardrails
---
# DSH Crew — Dispatch Playbook
Decision layer only — the mechanics live in the tool schemas. Every default below is a starting point the main session may override in flight.
## 1. The seven tools and the orthogonal primitives
| Tool | Signature |
|---|---|
| `dsh_swarm_worker` | Dispatch one task (`task`) or a batch (`tasks[]`); `wait: false` (default) returns `{ ok, jobs, job_ids, watch_cmd }`, `wait: true` blocks in ≤60 s slices and returns results. `persistent: true` / `session_id` are single-task, hub-only and blocking. |
| `dsh_worker_status` | Live jobs plus the cwd advisory locks (`kind: "cwd-lock"` rows name the holder). |
| `dsh_worker_result` | Purely instantaneous read: `job_id`, `inline_limit`, `inline_max_chars`, `full_reply`. Never waits, never polls. |
| `dsh_worker_cancel` | Terminate a job or in-flight turn and release its lock. |
| `dsh_worker_config` | Read/set defaults (`default_effort`, `default_tier`, `report_dir`, `persistent_sessions`, …). |
| `dsh_worker_probe` | No-op probe of a `provider`/`model` pair already configured for dsh-crew-x, or of a `tier`. |
| `dsh_session_close` | Destroy one persistent session; the id is tombstoned (`SESSION_CLOSED`). |
`dsh_swarm_worker` is one tool with orthogonal axes — combine them freely:
| Axis | Values | Behaviour |
|---|---|---|
| `task` / `tasks[]` | one string / one array | Mutually exclusive. A batch item may override the shared dispatch defaults (tier, effort, cwd, permission, preset, budgets, inline settings). |
| `wait` | `false` (default) / `true` | `false` enqueues and returns `job_ids` + a ready `watch_cmd`; `true` waits for settlement. Fully orthogonal to the task shape. |
| `persistent` / `session_id` | single task only | A reusable hub session across turns. Always blocking; refused on `tasks[]` (`PERSISTENT_BATCH_UNSUPPORTED`) and with an explicit `wait: false` (`PERSISTENT_ASYNC_UNSUPPORTED`). |
| `stall_timeout_sec` | `120` | `0` disables. No session/event progress → fast `stalled` snapshot instead of an indefinite hang. |
| `on_approval` | `'abort'` | Returns `approval_required` + `blockedAction` immediately; `'wait'` keeps waiting for the approval. |
| `max_steps` / `max_output_tokens` | `null` | No cap. On trip → `budget_exceeded`, workspace left intact for triage. |
| `inline_max_chars` | `20000` | Plain in-band pass-through; `0` forces offload with exact line numbers in `report_index`; `-1` forbids offload. |
| `allow_concurrent_cwd` | `false` | Read-only only: it defaults `permission` to `"read-only"` and rejects anything higher. |
| `permission` / `preset` / `worker` / `cwd` | per dispatch | `worker=` names an explicit external CLI and bypasses model tiers. |
**Physical invariants the tool enforces (not preferences):**
- One writer per workspace. A second writer on the same `cwd` is refused and the error names the live holder; reads may share a cwd only via `allow_concurrent_cwd: true`.
- A persistent session is one task at a time: a concurrent turn returns `SESSION_BUSY`, and a different `cwd` needs a new session (`SESSION_CWD_MISMATCH`).
- Every route must be in the globally configured allow list. `provider`/`model` may only name a `(provider, model)` pair already bound in dsh-crew-x; anything else is refused with `MODEL_NOT_ALLOWED` before a request is sent. `available_providers` describes the host, it is not permission to use them.
- A batch is all-or-nothing: every item is validated and its cwd lock reserved before any item starts, so a bad item or a same-cwd double-write refuses the whole batch.
- No output path ever truncates a job id.
## 2. Background follow mode (zero polling)
```text
dsh_swarm_worker({ tasks: [...], wait: false })
-> { ok, jobs, job_ids, watch_cmd }
run_command (native background)
-> node <repo>/scripts/dsh-watch.mjs --job <id1[,id2...]> --mode any|all --coalesce <sec> --deadline 0
watcher exits
-> ONE single-line JSON, complete ids, on stdout:
{ ok, r, settled: [{ id, st, sr, s, summary, report_path, report_index }], run: [...], next_watch_cmd }
run still non-empty? -> re-arm exactly the returned next_watch_cmd
otherwise -> dsh_worker_result only if a payload needs it (or full_reply: true)
```
The watcher is event-driven: it consumes the hub's multi-job long-poll `/jobs/wait` (≤60 s slices), so it wakes on settlement instead of on a cadence, and it falls back to per-job polling only against a hub too old to serve that route. `--deadline 0` (the default) means no wall-clock deadline — a stuck worker is the hub's `stall_timeout_sec` business, not this process's. A positive `--deadline` bounds the wait and exits `2` with `next_watch_cmd`, so a timeout is a re-arm, not a lost round.
`dsh_worker_result` is purely instantaneous — it has no waiting parameter and never blocks or polls. Use it for Standalone/CLI jobs (which have no hub route to watch), in an environment without a shell to run the watcher, or with `full_reply: true` to re-read a body that was offloaded.
## 3. Strategy reference (main session decides in flight)
- **Single task vs batch** — `task` for one dispatch, `tasks[]` for a fan-out that shares validation and returns one `watch_cmd` for all ids.
- **Blocking vs async** — `wait: true` when the next step needs the result now; `wait: false` + the watcher when you want the main conversation free.
- **Tier** — `flash` for mechanical, well-scoped work; `pro` for multi-file change, debugging, design judgment. In doubt start on flash: `escalate_on_failure` retries a failed blocking single-task run once on pro, so evidence decides. Persistent turns never auto-escalate, and a batch never auto-escalates individual flash failures.
- **Large deliverables** → `inline_max_chars: 0`: the worker writes its report to the blackboard and returns `report_index`; read only the cited slices.
- **After `stalled` / `approval_required` / `budget_exceeded` / `dispose_timed_out: true`** you hold a workspace snapshot, not a verdict. Choose: accept the files already changed, re-brief and continue, or hand back to the human. Never blindly retry into the same lock.
- **Persistent sessions** — 1:1 binding (one subagent ↔ one session), `dsh_session_close` before that subagent ends, rotate near 10 turns. Review and audit work is always one-shot: a fresh context per verdict.
- **`cwd-lock`** — writes are exclusive; `allow_concurrent_cwd: true` is read-only only, never two writers. Locks self-heal by reverse lookup, so a refusal names a live holder rather than a dead one.
- **Brief** — absolute paths, exact acceptance criteria, what not to touch, explicit `effort` + `permission`, and no commit/push unless authorised. Read-only briefs end in `VERDICT/FINDINGS`; write briefs in `CHANGED/VERIFIED/UNVERIFIED`.
- **Windows fact** — `node --test` under the DSH Windows sandbox can hit `spawn EPERM` with default multi-process isolation; use `node --test --test-isolation=none` for a single process.