dispatch

GitHub

作为并行工作调度器,将任务列表拆分为独立的工作简报并分发,跟踪工人进度与PR状态,并在审核通过后合并代码。专注于多代理协作流程编排,不直接执行工程任务。

.claude/skills/dispatch/SKILL.md s2b-dev/smart-second-brain

触发场景

需要并行处理多个任务 请求编排或分发工作流

安装

npx skills add s2b-dev/smart-second-brain --skill dispatch -g -y
更多选项

非标准路径

npx skills add https://github.com/s2b-dev/smart-second-brain/tree/main/.claude/skills/dispatch -g -y

不安装直接使用

npx skills use s2b-dev/smart-second-brain@dispatch

指定 Agent (Claude Code)

npx skills add s2b-dev/smart-second-brain --skill dispatch -a claude-code -g -y

安装 repo 全部 skill

npx skills add s2b-dev/smart-second-brain --all -g -y

预览 repo 内 skill

npx skills add s2b-dev/smart-second-brain --list

SKILL.md

Frontmatter
{
    "name": "dispatch",
    "description": "Turn this session into the parallel-work dispatcher — split Leo's task list into spawnable worker-session briefs (one slot each), collect their PR pings, and merge approved bot-clean PRs. Use when Leo provides a batch of tasks to run in parallel or asks to orchestrate\/dispatch work."
}

Dispatch — parallel-work orchestrator

This session becomes the dispatcher: it writes task briefs, spawns them as task chips, tracks worker pings, and merges PRs. It does NOT implement tasks itself. Workers do the engineering in the fixed agent slots (see AGENTS.md "Parallel agent slots" — read that section first if you haven't).

Setup (once per dispatcher session)

  1. Get this session's id: get_session with session_id self. Every brief embeds it so workers can ping back — the id changes per conversation, which is why it lives here and not in AGENTS.md.
  2. Create the fallback heartbeat (session-only CronCreate, hourly at an off-minute, e.g. 23 * * * *). Normal operation is event-driven via worker pings; the heartbeat only catches dropped pings: for each open task PR, if it is bot-clean + Leo-approved but unmerged → merge it; if its review finished with findings but the owning worker session has been idle >30 min → send_message that session to resume. Otherwise report in one line. Tell Leo the heartbeat is session-only (dies with this chat, 7-day expiry).

Spawning a task

For each task Leo gives:

  1. Spend a few tool calls anchoring it: grep/read enough to name the relevant files and one or two starting pointers. Don't solve it.
  2. Write a SELF-CONTAINED brief (workers start cold) and dispatch it. Default: a spawn_task chip (cwd = the main checkout) — Leo prefers workers as separate sidebar sessions he can inspect and chat with directly; the one click per chip is the accepted cost (sessions cannot be created programmatically). Use background Agent-tool workers (run_in_background: true, model per task) only when Leo explicitly asks for click-free dispatch and accepts that those workers are only reachable through the dispatcher. The brief must contain, in this order:
    • Slot protocol: claim a slot first (scripts/claim-slot.sh <label>), work on a branch from origin/main in the slot worktree, one-shot dev builds only, live-verify ONLY against the slot's own S2B WT<n> vault, release the slot when done — per AGENTS.md "Parallel agent slots".
    • The task: symptom/goal, concrete file pointers, relevant architecture context from AGENTS.md, expected verification (repro first for bugs; behavior matrix in the PR description for behavioral changes; tests).
    • PR + bot-review loop: run bun run check / format / lint / test, open a PR against main with gh, then drive the review bot (Greptile) to a clean state per AGENTS.md step 6 — fix or answer every finding, push, wait for the re-review of the newest commit. Never merge; merging is the dispatcher's job after Leo's live test.
    • Ping-back protocol: report to the dispatcher on: PR opened ("PR opened: …"), bot-clean ("PR bot-clean at "), or blocked (with reason). For background Agent workers: use the SendMessage tool with to: "main" for mid-run pings — the final report arrives automatically on completion. For chip-spawned sessions: use send_message with session_id <this session's id>. While a bot re-review is in flight, stay in the turn and poll (sleep 120 + gh pr view <n> --json comments, ~15 min max per round) — nothing wakes a worker that ends its turn mid-wait.

Handling incoming pings

  • "PR opened" → check the bot state once; tell Leo the PR exists and WHICH slot vault window (S2B WT<n>) has the build for his live test. His verdict is the one human gate per task.
  • "PR bot-clean" → verify independently (never trust the ping alone): Greptile's summary-comment footer must name the PR's newest commit as last reviewed, with no unresolved inline findings (gh pr view <n> --json comments,reviews,statusCheckRollup + gh api repos/s2b-dev/smart-second-brain/pulls/<n>/comments). If Leo has approved that PR in this conversation → gh pr merge <n> --squash, then git pull --ff-only origin dev in the main checkout, and report. If not yet approved → tell Leo it's ready for his live test.
  • "blocked" → surface to Leo with the worker's reason; relay his answer back via send_message.
  • Leo says a PR works live → record the approval; if the PR is already bot-clean, merge immediately, otherwise merge on the bot-clean ping.
  • Leo gives feedback/more context → relay verbatim-ish to the owning worker session; it re-claims a slot if it already released one.

Merge policy (hard rules)

  • Squash-merge only (matches repo history).
  • Merge ONLY when both are true: bot-clean on the newest commit AND Leo explicitly approved that specific PR in this conversation. Never infer approval, never merge on bot-clean alone.
  • If post-approval pushes materially changed behavior Leo tested, flag it to him instead of merging silently.

Notes

  • Parallelism caps at the slot count (3). If all slots are claimed, queue the chip anyway — the worker will fail to claim and should say so; stagger spawns when Leo hands over more than 3 tasks.
  • Model choice: the Agent tool takes a model param per worker; spawn_task chips cannot (those sessions use the app default, changeable in the UI). The dispatcher itself runs fine on a smaller model.
  • Background Agent workers live inside the dispatcher session: they die if it closes, Leo talks to them via the dispatcher (SendMessage by name), and permission prompts they hit surface here — the shared allowlist in .claude/settings.json covers the worker workflow (git push origin, gh pr create/view, bun/obsidian commands) precisely so they don't stall; force-pushes and branch deletions are explicitly denied.
  • Relaying: a background worker's report is invisible to Leo — always restate what matters in your reply.
  • Third-party PRs (not from worker sessions) are out of scope — never merge or manage them.

版本历史

  • 2.0.5 当前 2026-09-08 21:09

同 Skill 集合

.github/skills/obsidian-integration-test/SKILL.md
integration/S2B Test Vault/.obsidian/skills/bases/SKILL.md
integration/S2B Test Vault/.obsidian/skills/canvas/SKILL.md
integration/S2B Test Vault/.obsidian/skills/dataview/SKILL.md
integration/S2B Test Vault/.obsidian/skills/notebook-navigator/SKILL.md
integration/S2B Test Vault/.obsidian/skills/obsidian-charts/SKILL.md
integration/S2B Test Vault/.obsidian/skills/tasknotes/SKILL.md
integration/S2B Test Vault/.obsidian/skills/tasks/SKILL.md
integration/S2B Test Vault/Agents/Skills/bases/SKILL.md
integration/S2B Test Vault/Agents/Skills/canvas/SKILL.md
integration/S2B Test Vault/Agents/Skills/dataview/SKILL.md
integration/S2B Test Vault/Agents/Skills/explore-vault/SKILL.md
integration/S2B Test Vault/Agents/Skills/manage-notes/SKILL.md
integration/S2B Test Vault/Agents/Skills/manage-skills/SKILL.md
integration/S2B Test Vault/Agents/Skills/notebook-navigator/SKILL.md
integration/S2B Test Vault/Agents/Skills/obsidian-charts/SKILL.md
integration/S2B Test Vault/Agents/Skills/tasknotes/SKILL.md
integration/S2B Test Vault/Agents/Skills/tasks/SKILL.md
integration/S2B Test Vault/Agents/Skills/web/SKILL.md
src/skills/defaults/explore-vault/SKILL.md
src/skills/defaults/manage-notes/SKILL.md
src/skills/defaults/manage-skills/SKILL.md
src/skills/defaults/web/SKILL.md
src/skills/integrations/bases/SKILL.md
src/skills/integrations/canvas/SKILL.md
src/skills/integrations/dataview/SKILL.md
src/skills/integrations/obsidian-charts/SKILL.md
src/skills/integrations/tasknotes/SKILL.md
src/skills/integrations/tasks/SKILL.md

元信息

文件数
0
版本
2.1.0
Hash
e7feb67f
收录时间
2026-09-08 21:09

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-16 23:27
浙ICP备14020137号-1