agentleFS
ulises-jeremiasulises-jeremias/agent-toolkit/skills/ops/swarm-observer/SKILL.md

swarm-observer

Skill18 starsChanged 3 months agoMITView on GitHub

Observe, diagnose, and recover Agent Toolkit swarm runs via status, handoffs, logs, and attach

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run lives under .agent-toolkit/swarm/runs/<run-id>/state.json (filesystem is authoritative).

    line 31
  2. Very specific:

    Never edit .agent-toolkit/swarm/runs/<run-id>/state.json by hand.

    line 91
  3. Very specific:

    Never create new Herdr workspaces for headless — fix the backend fallback instead.

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Swarm Observer

Monitor any agent-toolkit swarm run, diagnose stuck handoffs or backend drift, and recover without losing windows. Works for both Herdr (tabs) and tmux (isolated socket agent-toolkit-swarm-<run-id>). Integrates with swarm's eager-window model (every role starts as Waiting for handoff: <pred> -> <role> with agent_waiting trace).

When to use

  • A swarm was launched and the user asks "is it done?", "what's the status?", "show logs", or "attach".
  • A handoff has been active for >5m (955be6f6e2c... pattern) or worktree_failed.
  • Herdr shows extra workspaces (w7-wA) for headless runs — the get_backend("headless") fallback case.
  • User wants to reuse the same run for a new request and needs to know if windows are still alive.

Prerequisites

  • Run lives under .agent-toolkit/swarm/runs/<run-id>/state.json (filesystem is authoritative).
  • Know run-id (20260807T...-xxxxxx) from swarm start --json or swarm list --json.
  • Shell is detected (_user_shell(): $SHELL → pwd.getpwuid → /usr/bin/zsh fallback, executed as <shell> -lc).

Workflow

1. List and pick the run

agent-toolkit swarm list --json | jq
agent-toolkit swarm status --run-id <run-id>
agent-toolkit swarm status --run-id <run-id> --json | jq '.handoffs,.worktrees,.trace'

2. Inspect handoffs and trace

agent-toolkit swarm handoffs --run-id <run-id>
agent-toolkit swarm handoffs --run-id <run-id> --json | jq '.[] | {id,from,to,status,artifact,auto}'
# Active that should have auto-completed:
#   where to==from_role and handoff create --to == that role -> auto:true

Trace keys to watch: agent_waiting, handoff_completed auto:true, worktree_failed, headless_fallback.

3. Tail logs and attach

agent-toolkit swarm logs --run-id <run-id> --follow
agent-toolkit swarm logs --run-id <run-id> --role reviewer --follow
agent-toolkit swarm attach --run-id <run-id>          # herdr: workspace focus; tmux: attach -L agent-toolkit-swarm-<run-id>
herdr workspace list --json 2>&1 | jq '.[] | {id,name,status}'
tmux -L agent-toolkit-swarm-<run-id> capture-pane -t <window> -p | tail -n 80

4. Diagnose

SymptomCauseFix
`Waiting for handoff: a -> brole: b` stuck >5mactive handoff never task completeagent-toolkit swarm task next --role b --run-id <run-id> then task complete --task-id <id> or handoff create --from a --to b ... which auto-completes active where to==a
worktree_failedfind_repo_root failed (git rev-parse --git-common-dir on .git file)Re-run handoff create — fixed via AGENT_TOOLKIT_SWARM_RUN_ID export + path extract
Extra Herdr workspaces w7-wA with headlessget_backend("headless") returned HerdrBackendPatch backends/__init__.py to return headless/noop backend; then herdr workspace delete <id> for orphans
Shell shows bash while user uses zshHardcoded bash -lcFixed via _user_shell() / _shell_base() — verify ps -o comm= -p <pid> shows zsh

5. Recover or reuse

# Complete stuck handoff and provision next role (worktree/tab + agent start)
agent-toolkit swarm handoff create --type artifact --from implementer --to reviewer --artifact artifacts/fix.md --run-id <run-id>

# Reuse same windows for a new request (no new run needed)
agent-toolkit swarm handoff create --type artifact --from implementer --to reviewer --artifact artifacts/new-task.md --run-id <run-id>
# Chain re-triggers: implementer -> reviewer -> integrator via file handoffs

# Only create a new run when isolated branch is required
agent-toolkit swarm start --recipe pair --ui herdr --runner opencode --model-profile balanced --attach "new isolated task"

Boundaries

  • Never edit .agent-toolkit/swarm/runs/<run-id>/state.json by hand; use handoff create / task complete / promote.
  • Never create new Herdr workspaces for headless — fix the backend fallback instead.
  • For tmux, always use isolated socket -L agent-toolkit-swarm-<run-id>; never the default server.

Delegates to

NeedSkill/Command
Show failure snippet before fixingswarm-handoff
Recreate worktreeagent-toolkit swarm handoff create (auto-provisions)
Review code produced by swarmcode-reviewer, security-reviewer
Create PR after promotiongithub-cli-workflow

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.