[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CS1H1F3EG4MWA5BDD41890":3,"skill-same:01M6CS1H1F3EG4MWA5BDD41890":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":6,"updatedAt":50,"install":51,"resources":63},"01M6CS1H1F3EG4MWA5BDD41890","shepherd",null,"Shepherd, start, manage, coordinate a fleet of coding agents — spawn agents as separate processes in tmux windows, assign tasks, monitor progress, handle rate limits, and coordinate merges.","kfet\u002Ffir","kfet","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F14585?v=4","01M6CRZCB8P1V37WM3X0GB2DA6","Kalin Fetvadjiev","01M6CRZCFG1EW1WEN4RK84W1N5",1,"MIT","https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fshepherd\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],"coordinate","limits","assign","rate","fleet","true","processes","progress","as","tmux","manage","spawn","coding","start","tasks","monitor","windows","coding agents","2026-11-10 10:12:30",false,"---\nbuiltin: true\nname: shepherd\ndescription: Shepherd, start, manage, coordinate a fleet of coding agents — spawn agents as separate processes in tmux windows, assign tasks, monitor progress, handle rate limits, and coordinate merges.\noverride: true\n---\n\n# Shepherd\n\nYou run the outer loop. You don't write code — you make sure the agents who do are effective.\n\n## Scripts\n\nSource at the top of every shell block:\n\n```bash\nsource \"$SKILL_DIR\u002Fscripts\u002Fauto-helpers.sh\"   # gives tm-* commands (tmux or built-in PTY)\n```\n\n| Command | Purpose |\n|---------|---------|\n| `tm-new NAME [WINDOW]` | Create session |\n| `tm-win NAME WINNAME` | Add window to session |\n| `tm-send TARGET TEXT` | Send text + Enter |\n| `tm-sendraw TARGET KEYS...` | Send raw keys (e.g. `Escape`) |\n| `tm-capture TARGET [LINES]` | Capture pane output |\n| `tm-wait TARGET PATTERN [TIMEOUT]` | Poll until pattern matches |\n| `tm-list [SESSION]` | List sessions or windows |\n| `tm-kill NAME` | Kill session |\n| `tm-killwin NAME WINNAME` | Kill window |\n| `tm-renamewin NAME OLDNAME NEWNAME` | Rename window |\n\n## Setup\n\n### Worktree — One Per Fleet\n\n**Ask the user first** whether work should happen in the current directory or a new worktree. If the user says \"we're already in the right worktree,\" use it as-is — don't create another one.\n\nIf a new worktree is needed, follow the worktree convention in `AGENTS.md` to create one. Use `fleet\u002F` as the branch prefix instead of `work\u002F`:\n\n```bash\nPROJECT=\"$PWD\"\nSESSION=\"\u003Cproject>-\u003Cfeature>\"        # e.g. myproject-auth\nFEATURE=${SESSION#*-}\nBRANCH=\"fleet\u002F${SESSION}\"\nWORKTREE=\"${PROJECT}-wt-${FEATURE}\"\n\ngit -C \"$PROJECT\" worktree add \"$WORKTREE\" -b \"$BRANCH\"\n```\n\nAll commands use `$WORKTREE`. **Never send agents to a different project's worktree.**\n\nWhen done: merge the branch (or open a PR), then `git worktree remove` and `git branch -d`.\n\n### Session — One Session, Many Windows\n\nExample:\n```bash\ntm-new \"$SESSION\" worker-1\ntm-win \"$SESSION\" worker-2\ntm-win \"$SESSION\" reviewer\n_tm set-option -t \"$SESSION\" -g automatic-rename off\n```\n\n**Model selection:** Workers must use the **same provider** as the shepherd. Default to **Anthropic** unless the user says otherwise. Ask the user if you're unsure.\n\nSelect model according to the tasks.\n\n| Provider | Coding workers (cheaper) | Review\u002Fdesign (expensive) |\n|----------|---------------|---------------|\n| Anthropic | `sonnet` | `opus` |\n| OpenAI | `gpt-mini` | `gpt-pro` |\n| Google | `gemini-flash` | `gemini-pro` |\n\n**Always pass `--provider` explicitly** to workers so they don't get routed to a different provider by auto-server:\n\n```bash\nPROVIDER=\"anthropic\"         # default — ask user if different\nCHEAP_MODEL=\"sonnet\"\n\ntm-send \"$SESSION:$WINDOW\" \"cd $WORKTREE && fir --session-name $WINDOW --provider $PROVIDER --model $CHEAP_MODEL -d auto-namer -d notify -d provider-usage -d tmuxspinner\"\n```\n\n`--session-name $WINDOW` makes the worker addressable by name from `fir observe` \u002F `fir send` (see *Talk to workers through fir* below).\n\nThe four `-d` flags disable builtin extensions that fight with tmux-driver — see the tmux-driver skill \"Spawning `fir` Inside a Window\" section for why.\n\nAddress agents as `SESSION:WINDOW`.\n\n**Never repurpose agents from another project.** `\u002Fnew` wipes context. If a session belongs to a different project\u002Fworktree, leave it alone.\n\n## Talk to workers through fir, not the screen\n\ntmux is only the process holder. Read and steer workers with fir's own\nCLI — structured, no ANSI scraping, no paste\u002FINSERT-mode traps:\n\n```bash\nfir observe                          # all sessions: STATUS idle | running | error | no-model\nfir observe $WINDOW --status         # one worker: status, model, current tool, last error\nfir observe $WINDOW -n 30            # its last 30 transcript entries (snapshot, exits)\nfir send $WINDOW \"$TASK\"             # send a task (multi-line safe; piped stdin = one message)\nfir send $WINDOW --wait --timeout 5m \"status?\"  # ask and block for the reply (124 = still busy)\nfir send $WINDOW '!stop, do X'       # steer;  fir send $WINDOW --abort  cancels the turn\n```\n\n`--status` reports what the TUI shows but the transcript may not:\n`no-model` (\"No models available…\"), an auth failure, a crashed process.\n\n**Workers on another host:** start them in tmux there the same way, then\nrun the same `fir observe` \u002F `fir send` commands on that host over ssh\n(`rexec`). The `observe_session` \u002F `send_session` tools are local-only.\n\nUse `tm-capture` only as a fallback — e.g. to see a TUI dialog, or a\nworker running a fir too old for these flags.\n\n## Plan Tracking\n\nIf the `plan` tool is available, use it to track overall project progress across the fleet. Create it once at fleet setup, and update it every loop cycle.\n\n**At setup:** Create one entry per major task\u002Fmilestone (not per agent). Set the first active task to `in_progress`, the rest to `pending`. **You must include `metadata` and `title`** in every plan call so the user can find the fleet:\n\n```json\n{\n  \"title\": \"Refactor pkg\u002Fcore\",\n  \"metadata\": {\n    \"session\": \"fir-refactor\",\n    \"worktree\": \"\u002Fpath\u002Fto\u002Fproject-wt-refactor\",\n    \"attach\": \"tmux -S \u003Csocket> attach -t fir-refactor  (tmux only)\",\n    \"branch\": \"fleet\u002Ffir-refactor\"\n  },\n  \"entries\": [\n    {\"content\": \"Analyze and design\", \"priority\": \"high\", \"status\": \"in_progress\"},\n    {\"content\": \"Implement feature X\", \"priority\": \"high\", \"status\": \"pending\"}\n  ]\n}\n```\n\nThe `attach` value must use the **actual socket path** from `tm-new` output (look for the `Monitor:` line). Without it the user can't connect to the fleet session.\n\n**Each cycle:** Reflect actual state — mark completed tasks `completed`, the currently running task `in_progress`, and future tasks `pending`. Keep entries coarse (milestones, not individual file edits).\n\n**Include per-worker status in the plan.** After capturing each worker's output during the loop, add a plan entry per worker summarizing what they're doing. Format: `\"[worker-N] \u003Cstatus summary>\"`. This makes worker state visible alongside milestones:\n\n```\nplan:\n  - Move export.go (high, in_progress)\n  - Move bashexec.go (high, in_progress)\n  - Move footerdataprovider.go (high, pending)\n  - [worker-1] reading bashexec.go, planning move (medium, in_progress)\n  - [worker-2] rate-limited, waiting for reset (medium, in_progress)\n  - [worker-3] idle, unassigned (low, pending)\n```\n\nUpdate worker entries every cycle from `fir observe \u003Cworker> --status` (idle \u002F running \u002F error + last error) and `fir observe \u003Cworker> -n 20` (last actions); fall back to `tm-capture` for context % or a TUI dialog.\n\n**Worker self-reported progress:** Workers also have access to the `plan` tool and may use it to report their own progress on sub-tasks. To check a worker's current plan, send `\u002Fplan` to their tmux window and capture the output:\n\n```bash\ntm-send \"$SESSION:$WINDOW\" \"\u002Fplan\"\nsleep 2\ntm-capture \"$SESSION:$WINDOW\" 30\n```\n\nThis prints the worker's plan entries with their statuses. Incorporate what they report into your top-level plan: if a worker marks their sub-task complete, update the corresponding milestone. This is faster and more reliable than inferring progress from git logs alone.\n\n**Encouraging workers to use the plan tool:** When assigning a task, tell agents to use the `plan` tool to track their sub-steps and mark them as they go. Example instruction: *\"Use the plan tool to break this into steps and update progress as you work.\"* This gives you live visibility without having to poll `tm-capture` for context clues.\n\n**At close-out:** Mark all entries `completed` before stopping the fleet.\n\n## FLEET.md — Persist and Restore\n\nMaintain `FLEET.md` in the worktree root. Include session name, project\u002Fworktree paths, branch, and an agents table (Window, Role, Current Task, Status).\n\n**Write it:** on fleet creation, every cycle, on agent spawn\u002Fkill\u002Freset, and on rate-limit pause.\n\nAdd `FLEET.md` to `.gitignore`. On restart: read the file, check `tm-list`, recreate missing windows, resume the loop.\n\n## Sending Tasks\n\nPrefer `fir send \u003Cworker> \"$TASK\"` (or `fir send \u003Cworker> \u003C task.md`): it\ndelivers the whole task as one message straight into the session — no\npaste buffer. Confirm with `fir observe \u003Cworker> --status` (→ `running`).\n\nIf you do type into the pane instead, multi-line pastes land in the input buffer and may not auto-submit:\n\n1. Wait 2–3 seconds, then check `tm-capture` for `[Pasted text #N +M lines]` and `-- INSERT --`.\n2. If stuck in INSERT mode: `tm-sendraw Escape`, `sleep 0.5`, `tm-sendraw Enter`.\n3. Verify the agent started (look for spinner or tool calls).\n\n**Don't walk away after sending a task.** Confirm it's running before moving on.\n\n## Research First, Code Later\n\nIf a feature needs design work, launch a researcher first with a clear goal (produce a plan doc and task breakdown). Wait for the plan, read it yourself, verify it names which files and interfaces, then spawn workers with concrete tasks from it.\n\n## The Loop\n\nPoll every 10 seconds. Each cycle:\n\n```bash\ntm-loop-tick \"$SESSION\" \"$WORKTREE\"\n```\n\nThis single command does: `git log`, per-worker status (context % + last activity), and auto-renames all windows. Parse its output to decide next actions.\n\nAdditional checks each cycle:\n\n1. **Is anyone stuck?** — Look for high context % or `idle` in `tm-loop-tick` output.\n2. **Is the build green?** — Run the project's test command in `$WORKTREE`.\n3. **Update the plan** — Reflect completed\u002Factive milestones if the plan tool is available.\n\n### Rate Limits — Check Every 5 Cycles\n\n```bash\nUSAGE_OUT=$(tm-check-usage)\nFIVE_HR=$(echo \"$USAGE_OUT\"  | awk '\u002FFive Hour\u002F      {gsub(\u002F%\u002F,\"\",$3); print int($3)}')\nSEVEN_DAY=$(echo \"$USAGE_OUT\" | awk '\u002FSeven Day[^a-zA-Z]\u002F {gsub(\u002F%\u002F,\"\",$3); print int($3)}')\n```\n\n**If `FIVE_HR >= 85` or `SEVEN_DAY >= 99`:**\n\n1. Stop all agents: `tm-sendraw \"$SESSION:$WINDOW\" Escape`\n2. Build and test in `$WORKTREE`. Commit dirty tracked files with a checkpoint message.\n3. Print a progress report. Update FLEET.md statuses to `paused`.\n4. Parse reset times from `$USAGE_OUT`, sleep until earliest reset + 2 min.\n5. Verify usage dropped, then resume: `tm-send \"$SESSION:$WINDOW\" \"Continue.\"`\n\n## When to Intervene\n\n**Idle agent** — Assign the next task (check review issue files, then the plan). **Do not let agents self-assign** — they may grab work already owned by another agent. If there's nothing to give, stop them with Escape.\n\n**Agent self-prompting** — Agents sometimes type \"now implement task N\" after finishing. If another agent owns that task, interrupt with Escape immediately before conflicting edits begin.\n\n**Bloated context:**\n\n| Context % | Action |\n|-----------|--------|\n| 30–50% | Let it work. `\u002Fcompact` only if stuck. |\n| >50% | `\u002Fcompact` — frees ~60-70% while retaining continuity. |\n| >70% or looping | `\u002Fnew` — full reset with a fresh, precise task. |\n\n`\u002Fcompact` flow:\n```bash\ntm-sendraw \"$SESSION:$WINDOW\" Escape && sleep 1\ntm-send \"$SESSION:$WINDOW\" \"\u002Fcompact\"\ntm-wait \"$SESSION:$WINDOW\" '^\\s*>\\s*$|waiting for input|\\$' 60\ntm-send \"$SESSION:$WINDOW\" \"Continue.\"\n```\n\n`\u002Fnew` flow:\n```bash\ntm-sendraw \"$SESSION:$WINDOW\" Escape && sleep 0.5\ntm-send \"$SESSION:$WINDOW\" \"\u002Fnew\" && sleep 1\ntm-send \"$SESSION:$WINDOW\" \"THE NEW TASK\"\n```\n\nOnly create a new tmux session if the agent process is dead or the window is gone.\n\n**Two agents on the same file** — Redirect the one with less progress.  \n**Build broken** — Fix or assign immediately. Nothing else matters until green.  \n**Deleted files in `git status`** — Restore from git.  \n**Agent going in circles** — `\u002Fnew` with a smaller, more concrete task.  \n**Read-without-edit loop** — If `tm-capture` shows the agent repeatedly reading the same file without any `edit` or `write` tool calls appearing, it has analysis paralysis. `\u002Fnew` naming the exact file to rewrite: *\"Rewrite `\u003Cfile>` completely from scratch to match the new API. Do not read it first. Here is what it needs to do: ...\"*\n\n## Git Conflicts in Shared Worktrees\n\nMultiple agents on one worktree **will** collide on git operations.\n\n**Best practice: the shepherd does all commits.** Tell agents: \"Do NOT run `git add` or `git commit`. Make your changes and run tests. I will commit.\" After each agent reports success, commit their files yourself:\n\n```bash\ncd \"$WORKTREE\"\ngit add \u003Cspecific files> && GIT_EDITOR=true git commit -m \"message\"\n```\n\nThis prevents two problems: (1) **index lock collisions** — concurrent `git` commands cause `index.lock` errors and crash the second agent; (2) **staged file leaks** — agent B's commit accidentally picks up files staged by agent A.\n\nIf you see an index lock error:\n```bash\nrm -f \"$PROJECT\u002F.git\u002Fworktrees\u002F$(basename $WORKTREE)\u002Findex.lock\"\n```\nThen restart the crashed agent.\n\nAssign tasks that touch **completely different files** to minimize conflicts.\n\n## Close-Out — Before Declaring Done\n\nWhen all tasks appear complete and the build is green, do NOT stop. Run the reviewer one final time (or re-read REVIEW.md). Fix every finding. Then re-read the original task prompt and verify each stated requirement is met — not just compiling, but actually functional. Mark all plan entries `completed`. Only stop the fleet when every requirement is checked off and every review finding is fixed.\n\n## What Makes a Good Task\n\nShort. One commit's worth. Name the files. Say what to test. Say what to commit as.\n\n- **Bad:** \"Improve the client\"\n- **Good:** \"Read pkg\u002Ffoo\u002Fclient.go. Add an OnReconnect callback field. When reconnectLoop spawns a new process, call it. Add a test. Run the test suite. Commit as 'foo: add OnReconnect hook'.\"\n","# Shepherd\n\nYou run the outer loop. You don't write code — you make sure the agents who do are effective.\n\n## Scripts\n\nSource at the top of every shell block:\n\n```bash\nsource \"$SKILL_DIR\u002Fscripts\u002Fauto-helpers.sh\"   # gives tm-* commands (tmux or built-in PTY)\n```\n\n| Command | Purpose |\n|---------|---------|\n| `tm-new NAME [WINDOW]` | Create session |\n| `tm-win NAME WINNAME` | Add window to session |\n| `tm-send TARGET TEXT` | Send text + Enter |\n| `tm-sendraw TARGET KEYS...` | Send raw keys (e.g. `Escape`) |\n| `tm-capture TARGET [LINES]` | Capture pane output |\n| `tm-wait TARGET PATTERN [TIMEOUT]` | Poll until pattern matches |\n| `tm-list [SESSION]` | List sessions or windows |\n| `tm-kill NAME` | Kill session |\n| `tm-killwin NAME WINNAME` | Kill window |\n| `tm-renamewin NAME OLDNAME NEWNAME` | Rename window |\n\n## Setup\n\n### Worktree — One Per Fleet\n\n**Ask the user first** whether work should happen in the current directory or a new worktree. If the user says \"we're already in the right worktree,\" use it as-is — don't create another one.\n\nIf a new worktree is needed, follow the worktree convention in `AGENTS.md` to create one. Use `fleet\u002F` as the branch prefix instead of `work\u002F`:\n\n```bash\nPROJECT=\"$PWD\"\nSESSION=\"\u003Cproject>-\u003Cfeature>\"        # e.g. myproject-auth\nFEATURE=${SESSION#*-}\nBRANCH=\"fleet\u002F${SESSION}\"\nWORKTREE=\"${PROJECT}-wt-${FEATURE}\"\n\ngit -C \"$PROJECT\" worktree add \"$WORKTREE\" -b \"$BRANCH\"\n```\n\nAll commands use `$WORKTREE`. **Never send agents to a different project's worktree.**\n\nWhen done: merge the branch (or open a PR), then `git worktree remove` and `git branch -d`.\n\n### Session — One Session, Many Windows\n\nExample:\n```bash\ntm-new \"$SESSION\" worker-1\ntm-win \"$SESSION\" worker-2\ntm-win \"$SESSION\" reviewer\n_tm set-option -t \"$SESSION\" -g automatic-rename off\n```\n\n**Model selection:** Workers must use the **same provider** as the shepherd. Default to **Anthropic** unless the user says otherwise. Ask the user if you're unsure.\n\nSelect model according to the tasks.\n\n| Provider | Coding workers (cheaper) | Review\u002Fdesign (expensive) |\n|----------|---------------|---------------|\n| Anthropic | `sonnet` | `opus` |\n| OpenAI | `gpt-mini` | `gpt-pro` |\n| Google | `gemini-flash` | `gemini-pro` |\n\n**Always pass `--provider` explicitly** to workers so they don't get routed to a different provider by auto-server:\n\n```bash\nPROVIDER=\"anthropic\"         # default — ask user if different\nCHEAP_MODEL=\"sonnet\"\n\ntm-send \"$SESSION:$WINDOW\" \"cd $WORKTREE && fir --session-name $WINDOW --provider $PROVIDER --model $CHEAP_MODEL -d auto-namer -d notify -d provider-usage -d tmuxspinner\"\n```\n\n`--session-name $WINDOW` makes the worker addressable by name from `fir observe` \u002F `fir send` (see *Talk to workers through fir* below).\n\nThe four `-d` flags disable builtin extensions that fight with tmux-driver — see the tmux-driver skill \"Spawning `fir` Inside a Window\" section for why.\n\nAddress agents as `SESSION:WINDOW`.\n\n**Never repurpose agents from another project.** `\u002Fnew` wipes context. If a session belongs to a different project\u002Fworktree, leave it alone.\n\n## Talk to workers through fir, not the screen\n\ntmux is only the process holder. Read and steer workers with fir's own\nCLI — structured, no ANSI scraping, no paste\u002FINSERT-mode traps:\n\n```bash\nfir observe                          # all sessions: STATUS idle | running | error | no-model\nfir observe $WINDOW --status         # one worker: status, model, current tool, last error\nfir observe $WINDOW -n 30            # its last 30 transcript entries (snapshot, exits)\nfir send $WINDOW \"$TASK\"             # send a task (multi-line safe; piped stdin = one message)\nfir send $WINDOW --wait --timeout 5m \"status?\"  # ask and block for the reply (124 = still busy)\nfir send $WINDOW '!stop, do X'       # steer;  fir send $WINDOW --abort  cancels the turn\n```\n\n`--status` reports what the TUI shows but the transcript may not:\n`no-model` (\"No models available…\"), an auth failure, a crashed process.\n\n**Workers on another host:** start them in tmux there the same way, then\nrun the same `fir observe` \u002F `fir send` commands on that host over ssh\n(`rexec`). The `observe_session` \u002F `send_session` tools are local-only.\n\nUse `tm-capture` only as a fallback — e.g. to see a TUI dialog, or a\nworker running a fir too old for these flags.\n\n## Plan Tracking\n\nIf the `plan` tool is available, use it to track overall project progress across the fleet. Create it once at fleet setup, and update it every loop cycle.\n\n**At setup:** Create one entry per major task\u002Fmilestone (not per agent). Set the first active task to `in_progress`, the rest to `pending`. **You must include `metadata` and `title`** in every plan call so the user can find the fleet:\n\n```json\n{\n  \"title\": \"Refactor pkg\u002Fcore\",\n  \"metadata\": {\n    \"session\": \"fir-refactor\",\n    \"worktree\": \"\u002Fpath\u002Fto\u002Fproject-wt-refactor\",\n    \"attach\": \"tmux -S \u003Csocket> attach -t fir-refactor  (tmux only)\",\n    \"branch\": \"fleet\u002Ffir-refactor\"\n  },\n  \"entries\": [\n    {\"content\": \"Analyze and design\", \"priority\": \"high\", \"status\": \"in_progress\"},\n    {\"content\": \"Implement feature X\", \"priority\": \"high\", \"status\": \"pending\"}\n  ]\n}\n```\n\nThe `attach` value must use the **actual socket path** from `tm-new` output (look for the `Monitor:` line). Without it the user can't connect to the fleet session.\n\n**Each cycle:** Reflect actual state — mark completed tasks `completed`, the currently running task `in_progress`, and future tasks `pending`. Keep entries coarse (milestones, not individual file edits).\n\n**Include per-worker status in the plan.** After capturing each worker's output during the loop, add a plan entry per worker summarizing what they're doing. Format: `\"[worker-N] \u003Cstatus summary>\"`. This makes worker state visible alongside milestones:\n\n```\nplan:\n  - Move export.go (high, in_progress)\n  - Move bashexec.go (high, in_progress)\n  - Move footerdataprovider.go (high, pending)\n  - [worker-1] reading bashexec.go, planning move (medium, in_progress)\n  - [worker-2] rate-limited, waiting for reset (medium, in_progress)\n  - [worker-3] idle, unassigned (low, pending)\n```\n\nUpdate worker entries every cycle from `fir observe \u003Cworker> --status` (idle \u002F running \u002F error + last error) and `fir observe \u003Cworker> -n 20` (last actions); fall back to `tm-capture` for context % or a TUI dialog.\n\n**Worker self-reported progress:** Workers also have access to the `plan` tool and may use it to report their own progress on sub-tasks. To check a worker's current plan, send `\u002Fplan` to their tmux window and capture the output:\n\n```bash\ntm-send \"$SESSION:$WINDOW\" \"\u002Fplan\"\nsleep 2\ntm-capture \"$SESSION:$WINDOW\" 30\n```\n\nThis prints the worker's plan entries with their statuses. Incorporate what they report into your top-level plan: if a worker marks their sub-task complete, update the corresponding milestone. This is faster and more reliable than inferring progress from git logs alone.\n\n**Encouraging workers to use the plan tool:** When assigning a task, tell agents to use the `plan` tool to track their sub-steps and mark them as they go. Example instruction: *\"Use the plan tool to break this into steps and update progress as you work.\"* This gives you live visibility without having to poll `tm-capture` for context clues.\n\n**At close-out:** Mark all entries `completed` before stopping the fleet.\n\n## FLEET.md — Persist and Restore\n\nMaintain `FLEET.md` in the worktree root. Include session name, project\u002Fworktree paths, branch, and an agents table (Window, Role, Current Task, Status).\n\n**Write it:** on fleet creation, every cycle, on agent spawn\u002Fkill\u002Freset, and on rate-limit pause.\n\nAdd `FLEET.md` to `.gitignore`. On restart: read the file, check `tm-list`, recreate missing windows, resume the loop.\n\n## Sending Tasks\n\nPrefer `fir send \u003Cworker> \"$TASK\"` (or `fir send \u003Cworker> \u003C task.md`): it\ndelivers the whole task as one message straight into the session — no\npaste buffer. Confirm with `fir observe \u003Cworker> --status` (→ `running`).\n\nIf you do type into the pane instead, multi-line pastes land in the input buffer and may not auto-submit:\n\n1. Wait 2–3 seconds, then check `tm-capture` for `[Pasted text #N +M lines]` and `-- INSERT --`.\n2. If stuck in INSERT mode: `tm-sendraw Escape`, `sleep 0.5`, `tm-sendraw Enter`.\n3. Verify the agent started (look for spinner or tool calls).\n\n**Don't walk away after sending a task.** Confirm it's running before moving on.\n\n## Research First, Code Later\n\nIf a feature needs design work, launch a researcher first with a clear goal (produce a plan doc and task breakdown). Wait for the plan, read it yourself, verify it names which files and interfaces, then spawn workers with concrete tasks from it.\n\n## The Loop\n\nPoll every 10 seconds. Each cycle:\n\n```bash\ntm-loop-tick \"$SESSION\" \"$WORKTREE\"\n```\n\nThis single command does: `git log`, per-worker status (context % + last activity), and auto-renames all windows. Parse its output to decide next actions.\n\nAdditional checks each cycle:\n\n1. **Is anyone stuck?** — Look for high context % or `idle` in `tm-loop-tick` output.\n2. **Is the build green?** — Run the project's test command in `$WORKTREE`.\n3. **Update the plan** — Reflect completed\u002Factive milestones if the plan tool is available.\n\n### Rate Limits — Check Every 5 Cycles\n\n```bash\nUSAGE_OUT=$(tm-check-usage)\nFIVE_HR=$(echo \"$USAGE_OUT\"  | awk '\u002FFive Hour\u002F      {gsub(\u002F%\u002F,\"\",$3); print int($3)}')\nSEVEN_DAY=$(echo \"$USAGE_OUT\" | awk '\u002FSeven Day[^a-zA-Z]\u002F {gsub(\u002F%\u002F,\"\",$3); print int($3)}')\n```\n\n**If `FIVE_HR >= 85` or `SEVEN_DAY >= 99`:**\n\n1. Stop all agents: `tm-sendraw \"$SESSION:$WINDOW\" Escape`\n2. Build and test in `$WORKTREE`. Commit dirty tracked files with a checkpoint message.\n3. Print a progress report. Update FLEET.md statuses to `paused`.\n4. Parse reset times from `$USAGE_OUT`, sleep until earliest reset + 2 min.\n5. Verify usage dropped, then resume: `tm-send \"$SESSION:$WINDOW\" \"Continue.\"`\n\n## When to Intervene\n\n**Idle agent** — Assign the next task (check review issue files, then the plan). **Do not let agents self-assign** — they may grab work already owned by another agent. If there's nothing to give, stop them with Escape.\n\n**Agent self-prompting** — Agents sometimes type \"now implement task N\" after finishing. If another agent owns that task, interrupt with Escape immediately before conflicting edits begin.\n\n**Bloated context:**\n\n| Context % | Action |\n|-----------|--------|\n| 30–50% | Let it work. `\u002Fcompact` only if stuck. |\n| >50% | `\u002Fcompact` — frees ~60-70% while retaining continuity. |\n| >70% or looping | `\u002Fnew` — full reset with a fresh, precise task. |\n\n`\u002Fcompact` flow:\n```bash\ntm-sendraw \"$SESSION:$WINDOW\" Escape && sleep 1\ntm-send \"$SESSION:$WINDOW\" \"\u002Fcompact\"\ntm-wait \"$SESSION:$WINDOW\" '^\\s*>\\s*$|waiting for input|\\$' 60\ntm-send \"$SESSION:$WINDOW\" \"Continue.\"\n```\n\n`\u002Fnew` flow:\n```bash\ntm-sendraw \"$SESSION:$WINDOW\" Escape && sleep 0.5\ntm-send \"$SESSION:$WINDOW\" \"\u002Fnew\" && sleep 1\ntm-send \"$SESSION:$WINDOW\" \"THE NEW TASK\"\n```\n\nOnly create a new tmux session if the agent process is dead or the window is gone.\n\n**Two agents on the same file** — Redirect the one with less progress.  \n**Build broken** — Fix or assign immediately. Nothing else matters until green.  \n**Deleted files in `git status`** — Restore from git.  \n**Agent going in circles** — `\u002Fnew` with a smaller, more concrete task.  \n**Read-without-edit loop** — If `tm-capture` shows the agent repeatedly reading the same file without any `edit` or `write` tool calls appearing, it has analysis paralysis. `\u002Fnew` naming the exact file to rewrite: *\"Rewrite `\u003Cfile>` completely from scratch to match the new API. Do not read it first. Here is what it needs to do: ...\"*\n\n## Git Conflicts in Shared Worktrees\n\nMultiple agents on one worktree **will** collide on git operations.\n\n**Best practice: the shepherd does all commits.** Tell agents: \"Do NOT run `git add` or `git commit`. Make your changes and run tests. I will commit.\" After each agent reports success, commit their files yourself:\n\n```bash\ncd \"$WORKTREE\"\ngit add \u003Cspecific files> && GIT_EDITOR=true git commit -m \"message\"\n```\n\nThis prevents two problems: (1) **index lock collisions** — concurrent `git` commands cause `index.lock` errors and crash the second agent; (2) **staged file leaks** — agent B's commit accidentally picks up files staged by agent A.\n\nIf you see an index lock error:\n```bash\nrm -f \"$PROJECT\u002F.git\u002Fworktrees\u002F$(basename $WORKTREE)\u002Findex.lock\"\n```\nThen restart the crashed agent.\n\nAssign tasks that touch **completely different files** to minimize conflicts.\n\n## Close-Out — Before Declaring Done\n\nWhen all tasks appear complete and the build is green, do NOT stop. Run the reviewer one final time (or re-read REVIEW.md). Fix every finding. Then re-read the original task prompt and verify each stated requirement is met — not just compiling, but actually functional. Mark all plan entries `completed`. Only stop the fleet when every requirement is checked off and every review finding is fixed.\n\n## What Makes a Good Task\n\nShort. One commit's worth. Name the files. Say what to test. Say what to commit as.\n\n- **Bad:** \"Improve the client\"\n- **Good:** \"Read pkg\u002Ffoo\u002Fclient.go. Add an OnReconnect callback field. When reconnectLoop spawns a new process, call it. Add a test. Run the test suite. Commit as 'foo: add OnReconnect hook'.\"\n",{"name":5,"builtin":42,"override":42,"description":7},true,"main","76b360b35f87ec18e1776cf6feafc7a025bdea64","pkg\u002Fresources\u002Fbuiltin_skills\u002Fshepherd",0,"https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir","https:\u002F\u002Fgithub.com\u002Fkfet","https:\u002F\u002Fgithub.com\u002Fkalin-sa","2026-11-15 03:16:15",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":42},[53,56,59],{"tool":54,"command":55},"npx","npx skills add kfet\u002Ffir --skill shepherd",{"tool":57,"command":58},"bunx","bunx skills add kfet\u002Ffir --skill shepherd",{"tool":60,"command":61},"pnpm","pnpm dlx skills add kfet\u002Ffir --skill shepherd","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fshepherd\u002FSKILL.md",[64,70,74,78],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"scripts\u002Fauto-helpers.sh","SCRIPT","脚本",568,"https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fshepherd\u002Fscripts\u002Fauto-helpers.sh",{"path":71,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":72,"sourceHtmlUrl":73},"scripts\u002Fpty-helpers.sh",3219,"https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fshepherd\u002Fscripts\u002Fpty-helpers.sh",{"path":75,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":76,"sourceHtmlUrl":77},"scripts\u002Ftmux-helpers.sh",3098,"https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fshepherd\u002Fscripts\u002Ftmux-helpers.sh",{"path":79,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":80,"sourceHtmlUrl":81},"scripts\u002Fusage.sh",1828,"https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fshepherd\u002Fscripts\u002Fusage.sh",[83,105,125,148,166,192],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":37},"01M6CS290490SZNX8V35TF3N6X","wt","Spawn a fresh fir agent in its own tmux session on its own git worktree. Use whenever the user wants the work — or the conversation about the work — to happen over there, not here. If the user points at this skill, or has directly loaded it in the context, that alone is the cue — spawn, don't inline.","https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fwt\u002FSKILL.md",[],[85,28,90,91,92,93,94,95,30,96,97,98,99,100,101,102,24,103,104],"git","worktree","git worktree","work","context","user","session","use","conversation","cue","fresh","it","about","at","inline",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":37},"01M6CS26KAKJ7VYRQ3RJ31SJ6S","wrap-up","Wrap up work on a project branch — review, fix, and simplify in a loop until clean, then ff-merge to main.","https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fwrap-up\u002FSKILL.md",[],[112,113,114,115,116,117,118,119,93,120,121,122,43,123,124,24],"wrap up","up","wrap","review","merge","simplify","loop","work on","branch","fix","clean","merge to main","project",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":37},"01M6CS23P85MSVBX11XMFB29PF","tmux-observer","Attach a tmux window to an already-running fir session — observe its transcript and drive its input via tmux send-keys. Use when you need to watch or steer another fir agent.","https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Ftmux-observer\u002FSKILL.md",[],[28,132,133,134,96,97,135,136,137,138,139,140,141,24,142,143,144,145,146,147],"tmux observer","observer","transcript","drive","observe","attach","watch","input","via","you","keys","steer","window","send","when","running",{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":37},"01M6CS21ENQ3D7Z08TDKXHJRR6","tmux-driver","Drive interactive CLIs (python, gdb, etc.) via named tmux sessions with multi-window support. Falls back to fir's built-in PTY driver when tmux is unavailable.","https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Ftmux-driver\u002FSKILL.md",[],[28,155,156,157,158,159,160,161,135,162,163,140,164,165,24,144,146],"tmux driver","driver","python","support","sessions","interactive","PTY","back","gdb","multi","with",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":37},"01M6CS1YWSAH2TQ7S4VK7VKJT6","telegram-bot-setup","Set up a new Telegram bot channel for a fir project — install the telegram MCP, create a per-project state dir, drop in the bot token, wire .fir\u002Fmcp.json with TELEGRAM_STATE_DIR, pair the user, and verify. Use when the user asks to add, configure, or onboard a Telegram bot for a fir worktree\u002Fproject.","https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Ftelegram-bot-setup\u002FSKILL.md",[],[173,174,175,176,177,178,179,180,91,181,182,183,184,185,186,187,188,97,113,189,124,165,24,190,146,191],"bot","setup","telegram bot","telegram","telegram bot setup","MCP","create","state","SET","verify","onboard","configure","json","pair","install","channel","drop","for","new",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":196,"categories":197,"keywords":198,"publishedAt":37},"01M6CS1VSW4C1W1QED8NDHBHZ9","sync","Sync with an upstream source repo — detect changed files, apply equivalent downstream edits, update the baseline, and report any new features or non-trivial changes picked up.","https:\u002F\u002Fgithub.com\u002Fkfet\u002Ffir\u002Fblob\u002Fmain\u002Fpkg\u002Fresources\u002Fbuiltin_skills\u002Fsync\u002FSKILL.md",[],[194,199,200,201,202,113,203,204,205,165,24,206,207,208,209,191],"update","report","baseline","repo","files","upstream","detect","source","changes","features","apply"]