Herdr issue coordination
Use this session as the coordinator. Give each dispatched GitHub issue its own
git worktree, branch, Herdr tab, and Claude Code session. Sequence the work.
Keep implementation context in workers and all durable state in GitHub.
This skill is experimental. It depends on the herdr CLI and its API changes
between versions. Verify the commands below against the installed binary before
relying on them.
Explicitly naming /herdr-issue-coordinator, or explicitly telling the
coordinator that agents may merge, authorizes in-scope workers to merge their
own pull requests after every merge gate below passes. An implicit skill match
does not grant merge authority: run in no-merge mode unless the user's words
grant it. Neither mode authorizes deployment, release publication, destructive
operations, branch-protection bypasses, or changes outside the supplied batch.
Preconditions
Stop if any of these fail. Do not substitute hidden subagents for workers.
test "${HERDR_ENV:-}" = 1. You must be running inside a Herdr pane.
herdr --version reports 0.8.0 or later. Earlier versions have no
agent prompt and no agent start --pane, and this skill will not work.
herdr agent lists prompt, and agent start accepts --kind and
--pane. The binary is the authority, not this document.
- The working directory is a git repository with a GitHub remote and
gh
authenticated.
- Read the repository instructions, parent issue, sub-issues, declared
dependencies, project board, issue state, and linked open or merged pull
requests. A merged pull request is only evidence of completion when it
closes or explicitly references the issue and its final change and proof
satisfy the issue scope. Reconcile that state instead of dispatching again.
- Make every issue a complete task before dispatch. If a missing product or
technical decision could change behavior, data, security, compatibility,
operations, cost, or proof, mark that issue as needing human input.
- Build a dependency graph. Stop for human correction on a dependency cycle.
State rules
The coordinator is the only writer of batch state. These rules exist because a
sequenced batch runs for hours and this session's context is not durable.
- GitHub holds issue, pull request, review, and merge state. Re-read it at the
start of every cycle. Never cache it across cycles.
- Never create a second tracker: no local state file, no notes file, no
in-context list treated as authoritative.
- Workers never write batch state. They own one issue and report back.
- Workers never write their own tab status. The coordinator pushes it.
- If your own context is compacted mid-batch, re-derive the whole graph from
GitHub before dispatching anything.
Concurrency and tabs
- Default to 1 active worker. Use 2 only when two issues are independent and
the user asked for speed. Use another limit only when the user asks.
- One tab per active issue. Close it after its merge is verified.
- Never leave finished tabs open. A long batch must not accumulate tabs.
- Keep the user's focus in the coordinator tab.
Coordinator workflow
Name this tab for the batch.
herdr tab rename "$HERDR_TAB_ID" "Coordinator"
tab rename has no --clear. Record the original label and restore it
verbatim when the batch ends.
Dispatch only issues whose prerequisites are merged. For each one, create
the worktree first, then the tab, then the agent.
# 1. worktree, from the updated remote default branch
git worktree add -b <branch> <worktree-path> origin/<default-branch>
# 2. tab, in this workspace, rooted in the worktree
herdr tab create --workspace "$HERDR_WORKSPACE_ID" \
--cwd <worktree-path> --label "#<issue> <short title>" --no-focus
# read .result.tab.tab_id and .result.root_pane.pane_id from the response
# 3. agent, in that tab's root pane
herdr agent start issue-<issue> --kind claude --pane <root-pane-id>
# 4. reclaim focus; agent start has no --no-focus and takes it
herdr tab focus "$HERDR_TAB_ID"
Agent names must match [a-z][a-z0-9_-]{0,31} and be unique among live
agents, so #123 is not a legal name. Use issue-123 as the agent name and
#123 <short title> as the tab label. Parse every id from the JSON
response. Do not predict ids.
If the issue already has an open pull request, use that pull request's exact
head branch instead of creating a new one, and pass the branch and pull
request URL in the worker prompt.
agent start returns only once Herdr sees the agent ready. It reports
agent_status and interactive_ready. Do not add a separate wait.
Send the worker its task and wait for it to settle.
herdr agent prompt issue-<issue> "<worker prompt>" --wait --timeout <ms>
agent prompt submits text and Enter atomically. --wait returns on the
first settled idle, done, or blocked state. Do not use agent send
followed by a separate Enter.
Read a worker only when it needs help or reports completion.
herdr agent get issue-<issue>
herdr agent read issue-<issue> --source recent-unwrapped --lines 200
agent read returns plain text, not JSON. If a completed response is longer
than the pane can return, ask the worker to write its full response to a
temporary file and reply with only the path, then read that file.
On blocked, inspect before answering. Send a decision or corrected scope
with agent prompt. Never edit a worker's files from the coordinator.
Push the current stage into the worker's tab after every state change.
herdr pane report-metadata <pane-id> --source coordinator \
--title "#<issue> <stage>" --ttl-ms 900000
Stages are pipeline stages a human can act on, such as implementing,
tests running, PR open, awaiting CI, in review, blocked: <reason>.
Derive each one from GitHub, not from what the worker claimed. Refresh it
every cycle so the TTL never lapses on a live worker.
After three failed attempts at the same check or review finding, stop that
issue, record the evidence on the GitHub issue, and request human input.
Continue other independent work.
When a worker reports completion, verify on GitHub before touching the tab.
In merge mode: confirm the pull request is merged, the issue holds final
proof, and the issue is closed. Close it explicitly if the merge did not.
Mark it Done when the project supports it. Only then clean up:
herdr tab close <tab-id>
git worktree remove <worktree-path>
Verify first, then close. Closing kills the worker process and its pane
transcript. Never close a tab to end a problem you have not resolved.
In no-merge mode: stop the worker once its pull request passes every
agent-completable gate, leave the issue in Review, record the pending human
merge as its blocker, and leave the tab open for the user.
Refresh the dependency graph from GitHub after every merge and dispatch the
next ready issue from the updated default branch. Never start dependent
work from an unmerged branch. In no-merge mode, record a blocked dependent
as waiting on a human merge rather than waiting indefinitely.
Finish when every in-scope issue is merged and closed, or has a recorded
blocker needing human action. In no-merge mode, finish when every in-scope
issue has a ready pull request or a recorded blocker. Restore the
coordinator tab label and confirm no worker tabs or worktrees remain.
Worker contract
Each worker owns one issue and follows this order:
- Read the issue, repository instructions, relevant design, code, tests, and
dependency pull requests. Move the issue to In Progress when possible.
- Work in the worktree it was started in. Do not create another worktree, do
not change branch, and do not touch another issue's files.
- Implement only the issue. Add or update tests for every acceptance
criterion, affected failure path, regression risk, and named edge case.
- Prove the change. Browser-facing work requires a real browser check of the
affected success and failure flows, responsive widths, keyboard behavior,
console errors, and failed requests when relevant.
- Commit and push. Open a draft pull request if one is not already open, with
a short summary and current proof.
- Mark the pull request ready for review and move the issue to Review before
requesting independent review.
- Run an independent review with a fresh subagent that did not write the
change. Wait for required CI and automated review. In merge mode, also wait
for every repository-required approval. In no-merge mode, record a pending
required approval as a human blocker rather than waiting indefinitely.
- Address every valid in-scope finding. Reply to review threads with the fix
or the evidence for making no change. Resolve a thread only when it is fully
addressed.
- After any code change, repeat the affected proof and a fresh review, push,
update the pull request evidence, and wait for CI again. Iterate until the
mode's gates pass. Do not manufacture extra rounds.
- In merge mode, merge after every gate passes, using the repository's
preferred method and never an admin bypass. Wait until GitHub reports the
merge, record final proof, and verify the issue is closed. In no-merge
mode, leave the passing pull request open. Report the final state.
Merge gates
A worker may merge only when all of these are true:
- The pull request is ready for review, not draft.
- The complete issue scope and acceptance criteria have recorded proof.
- Focused and required wider tests pass on the final commit.
- An independent review verdict is
Approve on the final code.
- Every required GitHub check passes.
- Every actionable automated or human review thread is resolved.
- Every repository-required approval is present.
- The pull request is mergeable and current with its required base.
- No security, data-loss, compatibility, operational, or product decision is
unresolved.
- The pull request changes only the worker's issue.
If a gate cannot pass, do not merge. Record the blocker and continue other
independent work.
Worker prompt
Use this shape and replace every placeholder:
Complete <issue URL> in this worktree. It is already checked out on the
branch you should use.
You own only this issue, worktree, branch, and pull request.
Branch state: <reuse PR head branch and PR URL, or the new branch name>.
Delivery mode: <merge after all gates pass, or leave the passing PR open>.
Read the issue and repository instructions as the source of truth.
Implement the smallest complete change and prove acceptance criteria, edge
cases, failure paths, and regressions.
After local proof passes, commit, push, open or update the pull request, and
mark it ready for review. Only then run an independent review with a fresh
subagent and wait for CI and GitHub review. Address valid findings and repeat
proof and review after every code change.
Do not report your own status anywhere outside this session. The coordinator
tracks state from GitHub.
<If merge mode: The user explicitly authorized this run to merge this issue's
pull request after every merge gate passes. Wait until GitHub reports the
merge, update and close the issue, and return the result.>
<If no-merge mode: Leave the passing pull request open for human merge and
return its URL and proof.>
Do not deploy, publish a release, bypass repository rules, or change unrelated
work.
Boundaries
- Use visible Herdr tabs for workers. Fresh subagents are only for the
independent review inside a worker.
- Never dispatch two workers for one issue, or let two workers share a worktree.
- Never replace or duplicate an existing pull request for the issue. Resume it.
- Never start dependent work from an unmerged pull request.
- Never merge an unrelated pull request merely because it blocks the batch.
- Never infer deployment or release authority from merge authority.
- Never close a tab, pane, workspace, or worktree you did not create.
- Never run
herdr server stop. It would kill this session.
Known Herdr behavior
Verified against herdr 0.8.0, protocol 19.
agent start has no --no-focus and takes focus. Follow it with
herdr tab focus "$HERDR_TAB_ID".
tab rename has no --clear, unlike agent rename. Restore labels by hand.
agent read returns plain text. Other commands return JSON.
herdr worktree create creates a whole workspace per worktree, and
herdr worktree remove is workspace-scoped. It does not fit one tab per
issue in a single workspace. Use git worktree add instead.
pane report-metadata --title is stored on the pane, not on the tab, and
tab list does not return it.
1---2name: herdr-issue-coordinator3description: Coordinates a batch of GitHub issues through separate Claude Code sessions running in visible Herdr tabs, with tested pull requests, review loops, and gated merges. Use when the user asks one Claude session to sequence several coding sessions, or to complete a parent issue, milestone, or issue batch inside Herdr.4---56# Herdr issue coordination78Use this session as the coordinator. Give each dispatched GitHub issue its own9git worktree, branch, Herdr tab, and Claude Code session. Sequence the work.10Keep implementation context in workers and all durable state in GitHub.1112This skill is experimental. It depends on the `herdr` CLI and its API changes13between versions. Verify the commands below against the installed binary before14relying on them.1516Explicitly naming `/herdr-issue-coordinator`, or explicitly telling the17coordinator that agents may merge, authorizes in-scope workers to merge their18own pull requests after every merge gate below passes. An implicit skill match19does not grant merge authority: run in no-merge mode unless the user's words20grant it. Neither mode authorizes deployment, release publication, destructive21operations, branch-protection bypasses, or changes outside the supplied batch.2223## Preconditions2425Stop if any of these fail. Do not substitute hidden subagents for workers.26271. `test "${HERDR_ENV:-}" = 1`. You must be running inside a Herdr pane.282. `herdr --version` reports 0.8.0 or later. Earlier versions have no29 `agent prompt` and no `agent start --pane`, and this skill will not work.303. `herdr agent` lists `prompt`, and `agent start` accepts `--kind` and31 `--pane`. The binary is the authority, not this document.324. The working directory is a git repository with a GitHub remote and `gh`33 authenticated.345. Read the repository instructions, parent issue, sub-issues, declared35 dependencies, project board, issue state, and linked open or merged pull36 requests. A merged pull request is only evidence of completion when it37 closes or explicitly references the issue and its final change and proof38 satisfy the issue scope. Reconcile that state instead of dispatching again.396. Make every issue a complete task before dispatch. If a missing product or40 technical decision could change behavior, data, security, compatibility,41 operations, cost, or proof, mark that issue as needing human input.427. Build a dependency graph. Stop for human correction on a dependency cycle.4344## State rules4546The coordinator is the only writer of batch state. These rules exist because a47sequenced batch runs for hours and this session's context is not durable.4849- GitHub holds issue, pull request, review, and merge state. Re-read it at the50 start of every cycle. Never cache it across cycles.51- Never create a second tracker: no local state file, no notes file, no52 in-context list treated as authoritative.53- Workers never write batch state. They own one issue and report back.54- Workers never write their own tab status. The coordinator pushes it.55- If your own context is compacted mid-batch, re-derive the whole graph from56 GitHub before dispatching anything.5758## Concurrency and tabs5960- Default to 1 active worker. Use 2 only when two issues are independent and61 the user asked for speed. Use another limit only when the user asks.62- One tab per active issue. Close it after its merge is verified.63- Never leave finished tabs open. A long batch must not accumulate tabs.64- Keep the user's focus in the coordinator tab.6566## Coordinator workflow67681. Name this tab for the batch.6970 ```bash71 herdr tab rename "$HERDR_TAB_ID" "Coordinator"72 ```7374 `tab rename` has no `--clear`. Record the original label and restore it75 verbatim when the batch ends.76772. Dispatch only issues whose prerequisites are merged. For each one, create78 the worktree first, then the tab, then the agent.7980 ```bash81 # 1. worktree, from the updated remote default branch82 git worktree add -b <branch> <worktree-path> origin/<default-branch>8384 # 2. tab, in this workspace, rooted in the worktree85 herdr tab create --workspace "$HERDR_WORKSPACE_ID" \86 --cwd <worktree-path> --label "#<issue> <short title>" --no-focus87 # read .result.tab.tab_id and .result.root_pane.pane_id from the response8889 # 3. agent, in that tab's root pane90 herdr agent start issue-<issue> --kind claude --pane <root-pane-id>9192 # 4. reclaim focus; agent start has no --no-focus and takes it93 herdr tab focus "$HERDR_TAB_ID"94 ```9596 Agent names must match `[a-z][a-z0-9_-]{0,31}` and be unique among live97 agents, so `#123` is not a legal name. Use `issue-123` as the agent name and98 `#123 <short title>` as the tab label. Parse every id from the JSON99 response. Do not predict ids.100101 If the issue already has an open pull request, use that pull request's exact102 head branch instead of creating a new one, and pass the branch and pull103 request URL in the worker prompt.1041053. `agent start` returns only once Herdr sees the agent ready. It reports106 `agent_status` and `interactive_ready`. Do not add a separate wait.1071084. Send the worker its task and wait for it to settle.109110 ```bash111 herdr agent prompt issue-<issue> "<worker prompt>" --wait --timeout <ms>112 ```113114 `agent prompt` submits text and Enter atomically. `--wait` returns on the115 first settled `idle`, `done`, or `blocked` state. Do not use `agent send`116 followed by a separate Enter.1171185. Read a worker only when it needs help or reports completion.119120 ```bash121 herdr agent get issue-<issue>122 herdr agent read issue-<issue> --source recent-unwrapped --lines 200123 ```124125 `agent read` returns plain text, not JSON. If a completed response is longer126 than the pane can return, ask the worker to write its full response to a127 temporary file and reply with only the path, then read that file.1281296. On `blocked`, inspect before answering. Send a decision or corrected scope130 with `agent prompt`. Never edit a worker's files from the coordinator.1311327. Push the current stage into the worker's tab after every state change.133134 ```bash135 herdr pane report-metadata <pane-id> --source coordinator \136 --title "#<issue> <stage>" --ttl-ms 900000137 ```138139 Stages are pipeline stages a human can act on, such as `implementing`,140 `tests running`, `PR open`, `awaiting CI`, `in review`, `blocked: <reason>`.141 Derive each one from GitHub, not from what the worker claimed. Refresh it142 every cycle so the TTL never lapses on a live worker.1431448. After three failed attempts at the same check or review finding, stop that145 issue, record the evidence on the GitHub issue, and request human input.146 Continue other independent work.1471489. When a worker reports completion, verify on GitHub before touching the tab.149 In merge mode: confirm the pull request is merged, the issue holds final150 proof, and the issue is closed. Close it explicitly if the merge did not.151 Mark it Done when the project supports it. Only then clean up:152153 ```bash154 herdr tab close <tab-id>155 git worktree remove <worktree-path>156 ```157158 Verify first, then close. Closing kills the worker process and its pane159 transcript. Never close a tab to end a problem you have not resolved.160161 In no-merge mode: stop the worker once its pull request passes every162 agent-completable gate, leave the issue in Review, record the pending human163 merge as its blocker, and leave the tab open for the user.16416510. Refresh the dependency graph from GitHub after every merge and dispatch the166 next ready issue from the updated default branch. Never start dependent167 work from an unmerged branch. In no-merge mode, record a blocked dependent168 as waiting on a human merge rather than waiting indefinitely.16917011. Finish when every in-scope issue is merged and closed, or has a recorded171 blocker needing human action. In no-merge mode, finish when every in-scope172 issue has a ready pull request or a recorded blocker. Restore the173 coordinator tab label and confirm no worker tabs or worktrees remain.174175## Worker contract176177Each worker owns one issue and follows this order:1781791. Read the issue, repository instructions, relevant design, code, tests, and180 dependency pull requests. Move the issue to In Progress when possible.1812. Work in the worktree it was started in. Do not create another worktree, do182 not change branch, and do not touch another issue's files.1833. Implement only the issue. Add or update tests for every acceptance184 criterion, affected failure path, regression risk, and named edge case.1854. Prove the change. Browser-facing work requires a real browser check of the186 affected success and failure flows, responsive widths, keyboard behavior,187 console errors, and failed requests when relevant.1885. Commit and push. Open a draft pull request if one is not already open, with189 a short summary and current proof.1906. Mark the pull request ready for review and move the issue to Review before191 requesting independent review.1927. Run an independent review with a fresh subagent that did not write the193 change. Wait for required CI and automated review. In merge mode, also wait194 for every repository-required approval. In no-merge mode, record a pending195 required approval as a human blocker rather than waiting indefinitely.1968. Address every valid in-scope finding. Reply to review threads with the fix197 or the evidence for making no change. Resolve a thread only when it is fully198 addressed.1999. After any code change, repeat the affected proof and a fresh review, push,200 update the pull request evidence, and wait for CI again. Iterate until the201 mode's gates pass. Do not manufacture extra rounds.20210. In merge mode, merge after every gate passes, using the repository's203 preferred method and never an admin bypass. Wait until GitHub reports the204 merge, record final proof, and verify the issue is closed. In no-merge205 mode, leave the passing pull request open. Report the final state.206207## Merge gates208209A worker may merge only when all of these are true:210211- The pull request is ready for review, not draft.212- The complete issue scope and acceptance criteria have recorded proof.213- Focused and required wider tests pass on the final commit.214- An independent review verdict is `Approve` on the final code.215- Every required GitHub check passes.216- Every actionable automated or human review thread is resolved.217- Every repository-required approval is present.218- The pull request is mergeable and current with its required base.219- No security, data-loss, compatibility, operational, or product decision is220 unresolved.221- The pull request changes only the worker's issue.222223If a gate cannot pass, do not merge. Record the blocker and continue other224independent work.225226## Worker prompt227228Use this shape and replace every placeholder:229230```text231Complete <issue URL> in this worktree. It is already checked out on the232branch you should use.233234You own only this issue, worktree, branch, and pull request.235Branch state: <reuse PR head branch and PR URL, or the new branch name>.236Delivery mode: <merge after all gates pass, or leave the passing PR open>.237Read the issue and repository instructions as the source of truth.238Implement the smallest complete change and prove acceptance criteria, edge239cases, failure paths, and regressions.240241After local proof passes, commit, push, open or update the pull request, and242mark it ready for review. Only then run an independent review with a fresh243subagent and wait for CI and GitHub review. Address valid findings and repeat244proof and review after every code change.245246Do not report your own status anywhere outside this session. The coordinator247tracks state from GitHub.248249<If merge mode: The user explicitly authorized this run to merge this issue's250pull request after every merge gate passes. Wait until GitHub reports the251merge, update and close the issue, and return the result.>252<If no-merge mode: Leave the passing pull request open for human merge and253return its URL and proof.>254Do not deploy, publish a release, bypass repository rules, or change unrelated255work.256```257258## Boundaries259260- Use visible Herdr tabs for workers. Fresh subagents are only for the261 independent review inside a worker.262- Never dispatch two workers for one issue, or let two workers share a worktree.263- Never replace or duplicate an existing pull request for the issue. Resume it.264- Never start dependent work from an unmerged pull request.265- Never merge an unrelated pull request merely because it blocks the batch.266- Never infer deployment or release authority from merge authority.267- Never close a tab, pane, workspace, or worktree you did not create.268- Never run `herdr server stop`. It would kill this session.269270## Known Herdr behavior271272Verified against herdr 0.8.0, protocol 19.273274- `agent start` has no `--no-focus` and takes focus. Follow it with275 `herdr tab focus "$HERDR_TAB_ID"`.276- `tab rename` has no `--clear`, unlike `agent rename`. Restore labels by hand.277- `agent read` returns plain text. Other commands return JSON.278- `herdr worktree create` creates a whole workspace per worktree, and279 `herdr worktree remove` is workspace-scoped. It does not fit one tab per280 issue in a single workspace. Use `git worktree add` instead.281- `pane report-metadata --title` is stored on the pane, not on the tab, and282 `tab list` does not return it.