Spawn 标志

Spawn

社区
scdenney
spawn

Spawn full peer Codex or Claude sessions in their own panes and git worktrees — real sessions, not subagents — briefed by the lead and merged back. Not for bounded consults a subagent covers. Use when work must outlive or run beside this session, needs its own worktree, or must stay user-steerable.

Add to TypingMind

概览

发布者scdenney
代码仓库open-science-skills
技能名称spawn
星标数
69
复刻数
3
附带文件
1
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 scdenney 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Spawn AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/scdenney/open-science-skills/tree/main/archive/codex/spawn
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/scdenney/open-science-skills.git /tmp/open-science-skills
mkdir -p .claude/skills
cp -r /tmp/open-science-skills/archive/codex/spawn .claude/skills/spawn
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Spawn,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Spawn。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Spawn 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Spawn

You are the lead. A spawned peer is a full agent session — its own context window, its own approval flow, its own lifetime, steerable by the user in a visible pane. That makes it a third kind of delegate, above the two the Codex library already has:

TierWhat it isLifetimeReach it via
subagentspawn_agent child — context isolation, same modeldies with the thread$orchestrate
one-shotfresh codex exec / claude -p processone turn, deliberately not resumableadvisor and peer scripts
spawned peerfull interactive session, own pane + worktreesurvives you; user-steerablethis skill

Preflight — the sandbox gate

Everything here drives the herdr socket through the herdr CLI, and the socket lives outside the workspace (~/.config/herdr/herdr.sock). Gate first, fail closed:

  1. HERDR_ENV=1? If not, you are not inside herdr — jump to Fallbacks.
  2. herdr status — if it answers, you have socket access; proceed.
  3. Operation not permitted or PermissionDenied under workspace-write means the Codex sandbox blocks the out-of-workspace socket (both directions verified 2026-08-06). Two honest paths, both routed through the user: switch to Full Access (/permissions in a live interactive session, or a relaunch with --sandbox danger-full-access, either only with their explicit authorization — a custom permissions profile can also allowlist this one socket), or print the exact command sequence below for them to run in a normal shell. At danger-full-access, Codex does not block the socket. A failure there instead points to Herdr not running, a missing socket, or ordinary host permissions. Preserve and report the actual error. Never silently skip the spawn and never pretend a peer exists.

When to spawn — and when not

Fire on any one signal:

  • the work must survive this session or run long beside it
  • it needs its own git worktree (a separate working copy of the repository on its own branch, so nothing it edits collides with yours) — large parallel edits where sessions would otherwise keep touching the same files
  • the user should watch and steer it live in its own pane
  • it needs a different agent, model, or permission surface than your session — including a genuinely decorrelated Claude peer with a lifetime

Do not spawn for a bounded consult ($advisor), mechanical bounded work (a spawn_agent child or a Luna one-shot), or a read-only question. A peer costs a worktree, a pane, and a merge — spend that only when the lifetime, the pane, or the isolation is the point.

Spawn a peer

Each command emits JSON carrying the ids the next one needs. worktree create returns the workspace id, the checkout path, and a root pane already open at a shell prompt, so a fresh spawn needs no tab create at all (herdr tab create --workspace <WS_ID> --cwd <WT_PATH> --no-focus is for additional tabs, each with its own root pane). If you lose an id, re-find it with herdr worktree list, herdr agent list, or herdr api snapshot. Parse the JSON — never scrape human-readable output, since the CLI drifts across stable and preview channels. The command tool also runs each call in a fresh shell: $slug and captured ids do not persist between calls, so redeclare them per call or substitute literally.

bash
slug=fix-ingest    # short dashed name, 2–4 lowercase words, e.g. fix-ingest — names the branch, the workspace label, and the agent
herdr worktree create --cwd "$PWD" --branch "spawn/$slug" --label "$slug"   # JSON — workspace_id, checkout path, root pane_id
# write the brief before starting the agent (next section) → <WT_PATH>/.spawn/brief.md
herdr agent start "$slug" --kind codex --pane <PANE_ID>        # the root pane; or --kind claude; agent flags go after --
herdr agent prompt "$slug" "Read .spawn/brief.md and begin. Reply here when the acceptance checks pass."

--base <ref> on worktree create pins the baseline when main is moving under you.

Permissions match yours, not a hardcoded default. Before starting the peer, read your own pane to see your live approval setting, and read wide enough to actually find it:

bash
herdr agent read "$HERDR_PANE_ID" --lines 30 | grep -iE "bypass permissions|accept edits|plan mode|auto|manual|don.t ask" | tail -1

The status line names the mode directly (for example, ⏵⏵ bypass permissions on (shift+tab to cycle); verified live on herdr 0.7.5). The tail -1 is load-bearing: the mode strings also match the command you just ran, which is sitting in the same scrollback, so an untailed grep can hand you a mode read off your own command line. Match whichever mode phrase the status line shows — the modes render as distinct phrases and the exact strings beyond the verified ones may differ by version, one more reason never to guess. A tight read such as --lines 3 is unreliable here: it works only when the status line is the last thing rendered, and this skill is routed to from leads with background work running — exactly the state whose task list pushes the status line out of the last few rows. If the grep returns nothing, widen it with --source visible before concluding anything. Do not pass a mode you did not actually read — guessing reintroduces the default-fallback bug this self-read exists to prevent. A Claude peer takes -- --permission-mode <mode> with the matching value (acceptEdits | auto | bypassPermissions | manual | dontAsk | plan); a Codex peer takes its own equivalent sandbox or approval flags after --. Skip this and the peer falls back to its own tool's configured default, which can silently diverge from what you're actually running — check, don't assume. The visible pane is still the safety net either way, since herdr surfaces blocked the moment a peer asks for something its mode doesn't cover. If your own mode already grants broad access, the peer inherits that same exposure: worktree isolation confines its file edits, never its shell commands.

Write the brief first

The brief is a file (<WT_PATH>/.spawn/brief.md), not an inline prompt. It survives the peer's own compaction and sits in the worktree at merge-review time as the audit record. The kickoff prompt is one line pointing at it. Use this library's own delegation contract, the same fields $orchestrate gives any worker: Objective · Inputs and authoritative paths · In scope · Out of scope · Constraints and invariants · Write ownership · Expected artifact · Acceptance checks · Return format (conclusion, evidence, changed files, residual risk). Then three spawn-specific lines:

markdown
Branch etiquette — commit to spawn/<slug>; never merge, never push; do not commit .spawn/.
Suggested skills — list each Codex sibling as `$name`; for a Claude peer, use `/oss:name` only for the corresponding Claude-side skill.
Baseline — the commit this worktree was cut from. Reference artifacts by path at that commit; never paste secrets into the brief.

Once per repo, add .spawn/ to .git/info/exclude — worktrees share it, so every peer's brief stays untracked with no .gitignore churn.

Monitor without babysitting

Run the two-step wait as a foreground command with output to a file. Let the Codex command tool yield a live process handle, poll that handle, and read the file when it settles — your context never grows from polling. Do not append shell &: detached jobs are not preserved reliably by the Codex sandbox harness.

bash
( herdr agent wait "$slug" --until working --timeout 15000 || true
  herdr agent wait "$slug" --timeout 3600000 ) > /tmp/spawn-$slug.wait 2>&1

Then judge the true state, since the agent's word is not the artifact: herdr agent read "$slug" --lines 60, plus git -C <WT_PATH> status --porcelain and git -C <WT_PATH> log --oneline -3. A blocked peer: agent read first. A question you can answer → herdr agent prompt. A TUI dialog → herdr agent send-keys. A judgment call → herdr agent focus and tell the user which pane and why.

Fold back in

Run this checklist per peer, in order. Skipping the last two steps is how orphaned checkouts accumulate under ~/.herdr/worktrees/<repo>/.

  1. Peer commits and stops. It commits on spawn/<slug> and never merges (the brief says so). Confirm: git -C <WT_PATH> status --porcelain is empty and git -C <WT_PATH> log --oneline -3 shows its work.
  2. Review from the main checkout. git log main..spawn/<slug> and git diff main...spawn/<slug>; worktree branches are visible with no fetch. Substitute the repo's integration branch when it is not main.
  3. If main moved, the peer rebases and re-runs its acceptance checks: herdr agent prompt "$slug" "Rebase onto main, re-run the acceptance checks, and report." It holds the conflict context; you do not.
  4. Merge from the main checkout and run the acceptance checks yourself. You retain integration ownership, of correctness and of rigor.
  5. Remove the checkout. herdr worktree remove --workspace <WS_ID>. --force only when the agent is idle or done AND the checkout is clean, or the work is deliberately abandoned. A checkout that holds submodules cannot be removed by git worktree remove; delete the directory and run git worktree prune in the main checkout.
  6. Delete the branch. git branch -d spawn/<slug> from the main checkout, after the worktree is gone (the same branch cannot be checked out twice, and -d refuses an unmerged branch, which is the safety you want).
  7. Confirm nothing is left, in three places: git worktree list (main checkout only), ls ~/.herdr/worktrees/<repo>/ (no directory for this slug; rmdir the parent if empty), and herdr worktree list plus herdr workspace list (close the source workspace with herdr workspace close <id>, positional, if the spawn opened one; since herdr 0.9 that close is refused while worktree workspaces of the repo are still open, and --group closes them all at once without removing their checkouts, so remove checkouts first and close the source last).

With several peers, merge one at a time and rebase the next between merges: worktrees prevent write collisions, not merge collisions.

Sweep orphans

Run at the start of a spawn session, or whenever ~/.herdr/worktrees/ looks crowded:

bash
for wt in ~/.herdr/worktrees/*/*/; do
  b=$(git -C "$wt" branch --show-current 2>/dev/null) || { echo "$wt: not a checkout"; continue; }
  main=$(git -C "$wt" worktree list --porcelain | head -1 | sed 's/^worktree //')
  echo "$wt  branch=$b  dirty=$(git -C "$wt" status --porcelain | wc -l | tr -d ' ')  unmerged=$(git -C "$main" log --oneline main..$b | wc -l | tr -d ' ')"
done

A checkout with dirty=0 and unmerged=0 is done: remove it (herdr worktree remove, or git worktree remove from the main checkout) and delete its branch. A checkout with dirty files or unmerged commits is not yours to delete; put it to the user with the branch name and the counts. A directory that is no longer a checkout at all (.git file pointing at a pruned worktree) is a leftover: git worktree prune in the main repo, then delete the directory. Finish with herdr worktree list so herdr's own workspace records agree with git.

Fallbacks

$TMUX set: git worktree add ../<repo>-spawn-<slug> -b spawn/<slug>, then tmux split-window -P -F '#{pane_id}' -c <WT_PATH>, then send-keys the agent command (codex or claude) followed by the kickoff line. Monitor with capture-pane -p | tail -30. There is no state detection here — the human is the blocked detector.

Plain terminal: Claude peers only, ( cd <WT_PATH> && claude --bg --name "$slug" "Read .spawn/brief.md and begin." ), managed with claude agents.

Under a restricted sandbox, both fallbacks are user-run too. The tmux socket and sibling-directory worktree writes may be equally blocked.

Gotchas

  • --cwd "$PWD" on worktree create and worktree open is mandatory: herdr resolves the repository from the calling workspace, not the shell directory. A fresh Claude peer's first state is blocked on Claude Code's workspace-trust dialog; on herdr 0.9 agent start reports it as agent_not_ready (exit 1) while the peer is running. Clear it with herdr agent send-keys "$slug" Down Enter, not agent prompt, then poll agent explain for idle before prompting (the agent record lags the screen for a few seconds). wait can settle on done while explain reports idle; judge from git.

  • agent prompt --wait from an idle agent demands an observed state change within 5000 ms or returns agent_prompt_stalled — and it matches states, not turns. Use the two-step wait.

  • agent wait is indefinite without --timeout. Always bound it.

  • A worktree sees only committed state. Uncommitted lead-side edits are invisible to the peer — commit first, and name the baseline commit in the brief.

  • A peer with an interactive approval policy sits blocked at an approval or question UI until someone answers; a peer running with approvals disabled rejects disallowed actions instead. Attend its first minute, or pass the lead's own live mode (see Permissions above) so the peer starts already matched to what you're running.

  • Forgot to pass a mode? The peer used its own tool's configured default, not yours — check with herdr agent read <name> --lines 30 (grep for the mode string as above) and restart it with the right flag if the two diverge.

  • agent prompt submits a turn; TUI dialogs need agent send-keys.

  • A peer starts on the user's default model and effort, not yours — pin with agent flags after -- when the tier matters (observed 2026-08-06: a Fable lead spawned a Sonnet-default peer).

  • HERDR_* variables exist only inside herdr — and spawned tabs inherit them, so peers can themselves spawn.

  • The same branch cannot be checked out in two worktrees. Merge from the main checkout; delete the branch only after worktree remove.

Notes

  • Heritage: generalizes Matt Pocock's claude-handoff (MIT, mattpocock/skills). See RECOMMENDED.md. The Claude-side twin is /oss:spawn.
  • The herdr surface (worktree, tab, and agent commands; state detection) was verified 2026-08-06 on herdr 0.7.5 and re-verified 2026-09-08 on herdr 0.9.0 (protocol 22; Codex hook v8). On 0.9 checkouts are named spawn-<slug> under ~/.herdr/worktrees/<repo>/, and herdr machine add aggregates remote servers in the client while the agent/worktree/workspace CLI still target only the local server. Codex-lead socket access depends on the sandbox, hence the preflight gate. When the gate fails, the user-runs-commands path always works.
  • The library's other cross-model calls (sol-advisor.sh, claude-peer.sh, committee members) are deliberately isolated one-shots; a spawned peer is the opposite — persistent, steerable, resumable. Choose by whether the work needs a lifetime.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Spawn AI 技能有什么作用?

Spawn full peer Codex or Claude sessions in their own panes and git worktrees — real sessions, not subagents — briefed by the lead and merged back. Not for bounded consults a subagent covers. Use when work must outlive or run beside this session, needs its own worktree, or must stay user-steerable.

为什么在 TypingMind 中使用 Spawn?

因为您只需安装一次,就能搭配任何模型使用。Spawn 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Spawn?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/scdenney/open-science-skills/tree/main/archive/codex/spawn。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Spawn?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Spawn 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Spawn 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Spawn AI 技能免费吗?

scdenney 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇