herdr-tui-orchestrator
Skill4 starsChanged 5 days agoMITView on GitHub
Coordinate coding agents inside the Herdr TUI multiplexer (`herdr` CLI: `herdr workspace`, `herdr tab`, `herdr pane`, `herdr agent`). Use only when the user explicitly requests `herdr-tui-orchestrator` or asks to orchestrate workers inside a Herdr TUI (`HERDR_PANE_ID`) session; never activate merely because parallel work is useful.
- Commits and pushes
In this repository3 other files it gives its agents.
- herdr-orchestratorSkill
- herdr-tui-workerSkill
- herdr-workerSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 25
Use the resolved IDs as literal arguments in later tool calls when the shell is fresh.
- Very specific: line 36
One centralized worktree + branch per worker: Create every worker's isolated git worktree under the standardized XDG state directory …
- Distinctive: line 43
No unprompted merges: Never merge worker branches into main or fold separate worktrees into one catch-all branch/PR unless the user …
- Very specific: line 44
Preflight shared blockers once: Run quick read-only checks on credentials, remote access (git ls-remote), and gh auth status before …
- Very specific: line 62
Do not: use herdr tab create in your own workspace for workers.
- Very specific: line 84
End your turn immediately after dispatch (
idle): All four CLIs (claude, omp, codex, agy) wake automatically via PTY input when herdr … - Very specific: line 94
Inspect & steer when woken: Start with read / tail. Go deeper only when needed: herdr agent get <name>, herdr agent read <name> --source …
- Very specific: line 95
Verify every worker claim: Always verify <state-dir>/reports/<worker-name>.md, git status --short, git diff <base> --stat, test/link/row …
- Very specific: line 110
If authenticated: create (gh pr create --base <base> --head <branch> --title "<clear title>" --body "<concise summary + verification>") or …
- Very specific: line 111
If gh is unavailable or unauthenticated: push the branch and report the compare URL plus a ready-to-paste PR title and concise summary.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
Herdr TUI Orchestrator (herdr CLI)
Opt-in per request for the Herdr TUI (herdr multiplexer CLI — for herdr-core hc + herdr-app, use herdr-orchestrator instead).
Before acting, resolve your pane and workspace with the read-only herdr-tui-context.sh helper. It uses an exact Codex thread match from Herdr's agent registry when available and otherwise validates the inherited HERDR_PANE_ID. If both are missing, the helper looks up the current thread title in the local Codex session index and requires one unregistered Codex pane with that title and foreground directory. Confirm a title-based match against recent conversation text with herdr pane read <pane_id> --lines 40 before dispatch.
context=$("<skills-dir>/herdr-tui-orchestrator/scripts/herdr-tui-context.sh") || exit 1
ORCHESTRATOR_PANE=$(jq -er .pane_id <<< "$context")
ORCHESTRATOR_WORKSPACE=$(jq -er .workspace_id <<< "$context")Codex command tools can lose Herdr's environment when the app-server daemon is shared. Launch Codex from its Herdr pane with codex --no-daemon, keeping any model and effort flags. If the resolver still can't identify the pane or the inherited value looks stale, have the user run herdr pane current from the shell in the intended pane and pass the confirmed pane_id as the helper's first argument. A command tool without a pane ID may see whichever pane is focused, even when it belongs to another session. If the identity or server remains unresolved, stop. Never open, attach to, or stop user sessions unprompted. For a named Herdr session, preserve its HERDR_SOCKET_PATH in tool calls.
Use the resolved IDs as literal arguments in later tool calls when the shell is fresh. Never run bare herdr without subcommands. Inspect capabilities via herdr --help and herdr <workspace|tab|pane|agent> --help.
Core Workflow
0. Pragmatic Orchestrator Role & User Communication
- Delegate substantive & worker-owned work; handle quick/meta tasks directly:
- Delegate to workers: Multi-step feature/experiment code, heavy builds/test suites/trainings, parallel workstreams, and follow-up edits inside an existing worker's isolated worktree/branch (
herdr agent prompt <name> "...") so your context stays lean and you never collide with aworkingagent. - Do directly yourself (don't spawn a worker for 5-second chores): Orchestration/skill/tooling setup, git/worktree/PR housekeeping, quick read-only checks, tiny standalone config/doc tweaks when no worker owns that branch, and anything the user explicitly asks you to do directly.
- Delegate to workers: Multi-step feature/experiment code, heavy builds/test suites/trainings, parallel workstreams, and follow-up edits inside an existing worker's isolated worktree/branch (
- Use worker
<name>with the user: In all user-facing messages, refer to workers by their descriptive agent name (e.g.docs-update-readme-status), never raw pane IDs (e.g.w1:p4).
1. Centralized Worktree Isolation, Branch Discipline & Preflight
- One centralized worktree + branch per worker: Create every worker's isolated git worktree under the standardized XDG state directory
${XDG_STATE_HOME:-$HOME/.local/state}/herdr/<project-slug>/worktrees/<worker-name>(never pollute../parent workspace folders or share the main checkout):STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/herdr/<project-slug>" mkdir -p "$STATE_DIR"/{worktrees,tasks,reports,assets,locks,logs,status} git worktree add "$STATE_DIR/worktrees/<type>-<topic>" -b <type>/<topic> <base> - Gitignored dependencies in fresh worktrees:
git worktree addomits gitignored directories (.venv,upstream/,data/). Check if tests/scripts need them; symlink read-only shared directories (ln -s) or document setup in the handoff spec (never symlink writable output directories back into the main checkout). - No unprompted merges: Never merge worker branches into
mainor fold separate worktrees into one catch-all branch/PR unless the user explicitly asks. Use stacked branches or ask first when tasks depend on unmerged work. - Preflight shared blockers once: Run quick read-only checks on credentials, remote access (
git ls-remote), andgh auth statusbefore spawning workers.
2. Naming & Centralized XDG State Layout
- Naming rules (
/in git branches,-in agent, workspace & worktree folder names):- Git branch:
<type>/<topic>(e.g.docs/update-readme-status) - Herdr agent
<name>& worktree directory:<type>-<topic>—1–32chars ofa-z 0-9 - _ ., starting with[a-z0-9], no/. - Worker workspace label:
└ <type>-<topic>(set byherdr-tui-spawn.sh; the└prefix marks it as a child of the orchestrator's workspace in the sidebar).
- Git branch:
- Centralized project state & worktree root (
${XDG_STATE_HOME:-$HOME/.local/state}/herdr/<project-slug>/):worktrees/<worker-name>/— isolatedgit worktreecheckouts (1:1 match with agent<name>).tasks/<worker-name>.md— durable handoff specs (see handoff-template.md).reports/<worker-name>.md— verified worker completion summaries.assets/<worker-name>-*.png— user-provided screenshots/reference images. Always copy user images here (never into a git worktree) and pass the path in the handoff spec or prompt.status/— worker status inbox written byherdr-tui-inbox.sh:roster.json,<worker-name>.json(current state),<worker-name>.log(append-only, tail-friendly).locks/<resource>.lockandlogs/— shared GPU/resource locks and detached logs.
3. Spawn Worker Subtree Workspaces & Start Tracked Agents
Unlike hc run --bg, herdr TUI first provisions a shell pane and then attaches lifecycle tracking via herdr agent start:
- One child workspace per worker, nested under yours (default): Use the bundled herdr-tui-spawn.sh. It runs
herdr workspace create --no-focuswith label└ <worker-name>, then reorders it directly below the orchestrator's workspace ($ORCHESTRATOR_WORKSPACE, after any existing└siblings) via the raw-socketworkspace.moverequest (the CLI has noworkspace move). Focus is never stolen. If the move fails (herdr protocol < 16), the worker still runs at the end of the sidebar and a warning is printed. - Do not use
herdr tab createin your own workspace for workers. Only useherdr pane split "$ORCHESTRATOR_PANE" --direction right --no-focuswhen the user explicitly asks for side-by-side splits.
(Pass the exact installed path to# 1. Create the child workspace rooted at the centralized worktree (prints JSON: workspace_id, tab_id, pane_id, label, moved) SPAWN_JSON=$("<skills-dir>/herdr-tui-orchestrator/scripts/herdr-tui-spawn.sh" <type>-<topic> "$STATE_DIR/worktrees/<type>-<topic>" "$ORCHESTRATOR_WORKSPACE") PANE_ID=$(printf '%s' "$SPAWN_JSON" | jq -r .pane_id) # 2. Start the interactive coding agent inside that shell pane (never pass -p print mode) # Codex: --kind codex, then -- --no-daemon followed by requested flags # Claude: --kind claude, then -- --model sonnet --effort medium # Codex linked worktrees share Git metadata outside the sandbox working directory. GIT_COMMON=$(git -C "$STATE_DIR/worktrees/<type>-<topic>" rev-parse --path-format=absolute --git-common-dir) herdr agent start <type>-<topic> --kind codex --pane "$PANE_ID" -- --no-daemon \ --add-dir "$GIT_COMMON" --add-dir "$STATE_DIR/status" --add-dir "$STATE_DIR/reports" <agent-flags> # 3. Wait briefly ONLY for startup readiness (idle; accept workspace trust prompt via send-keys enter if blocked), then submit herdr agent wait <type>-<topic> --until idle --timeout 30000 herdr agent prompt <type>-<topic> "Use the herdr-tui-worker skill (<skills-dir>/herdr-tui-worker/SKILL.md, e.g. ~/.agents/skills or ~/.gemini/.../skills). Execute $STATE_DIR/tasks/<type>-<topic>.md. No subagents."herdr-tui-worker/SKILL.md. Pass--machine "<label-or-id>"before subcommands when targeting a saved remote SSH machine, and inlineherdr-tui-workerrules if the remote host lacks the skill file.)
4. Non-Blocking Monitoring ("Release-to-Idle" Across claude, omp, codex, agy)
- NEVER block your turn on completion waits: Running
herdr agent wait <name>orherdr pane wait-outputin a foreground tool call—or inside anompbackground bash job (bg_*keepsompstuck inwaiting on 1 job/working!) or an open-FD&command incodex—locks your pane status inworkingand blocks the user from chatting (only useherdr agent wait --until idle --timeout <ms>for the brief 1–5s startup readiness step above, never--waitonherdr agent prompt). - End your turn immediately after dispatch (
idle): All four CLIs (claude,omp,codex,agy) wake automatically via PTY input whenherdr agent promptsubmits text whileidle:- Default: status inbox + LLM-free watcher (herdr-tui-inbox.sh). Workers write their status to files and never prompt you for progress. A detached shell watcher decides when you need to wake. Start both once at dispatch, after the handoff specs exist and before ending your turn:
The watcher checksINBOX="<skills-dir>/herdr-tui-orchestrator/scripts/herdr-tui-inbox.sh" "$INBOX" init "$STATE_DIR" "$ORCHESTRATOR_PANE" <worker-1> <worker-2> # roster + status/<worker>.{json,log} "$INBOX" watch "$STATE_DIR" --detach # nohup setsid, closed FDs; returns at once in every CLIstatus/*.jsonandherdr agent getevery 15s. It sends you one line only when a worker isblockedor setsneeds, a worker pane waits on a permission prompt, a worker is idle 20m+ while its status still says working (stalled, interrupted, or never wrote status), a worker agent remains missing for the stall threshold (20m by default, even if its last status wascomplete), or every worker iscompleteand idle (--eachalso wakes per completed worker). Wakes queue while you are busy and are delivered once you are idle. Progress never wakes you. The watcher exits after the all-complete wake; restart it after a follow-up. - Reading updates (cheap):
"$INBOX" read "$STATE_DIR"prints one line per worker that changed since your last read, orno changes."$INBOX" tail "$STATE_DIR" [worker] -n 3prints the last status lines (working [at=<epoch>] rev=abc123: <summary>), liketail -3 status/<worker>.log | cut -c1-300. Useread --allfor a full snapshot. Never poll in a loop yourself. - CLI-Native Timers (
agy&claudeonly — neverompbg_*orcodex): Inagy(schedule) orclaude(ScheduleWakeup/CronCreate/run_in_background), you may add a native out-of-turn timer that lets your turn finish toidle. It is optional; the watcher already works in every CLI.
- Default: status inbox + LLM-free watcher (herdr-tui-inbox.sh). Workers write their status to files and never prompt you for progress. A detached shell watcher decides when you need to wake. Start both once at dispatch, after the handoff specs exist and before ending your turn:
- Inspect & steer when woken: Start with
read/tail. Go deeper only when needed:herdr agent get <name>,herdr agent read <name> --source recent, orherdr pane read "<pane_id>" --lines 80(herdr agent explain <name>to debug state detection). For long-running builds/GPU jobs andescmid-flight steering, follow long-running-jobs.md. - Verify every worker claim: Always verify
<state-dir>/reports/<worker-name>.md,git status --short,git diff <base> --stat, test/link/row counts, and remote SHAs before reporting completion.
Worker reports and user updates
- At dispatch, record each named worker, its acceptance checks, and who owns verification on the integrated revision. Put the inbox path and
writecommand in each handoff. For a follow-up, update the handoff, run"$INBOX" reopen "$STATE_DIR" <worker> "<reason>"before prompting the worker, and restart the watcher. - Workers record
working,blocked(with--needs), orcompletewith their tested revision, checks, pending items, and a one-line summary.write completerefuses while checks are pending or failed, tracked files are uncommitted, or the report is missing or older than the current round. On a handoff between workers, name the receiving owner and keep the check pending until that owner acknowledges it. A worker'scompletecovers its assigned scope only. - Readiness gate (mandatory): Before any user-facing "done", "ready", or "complete" claim, run
"$INBOX" gate "$STATE_DIR". It exits 0 only when every assigned worker iscomplete, its agent is idle, its statusrevis the worktree HEAD with no uncommitted tracked changes, nothing is pending, and its report is current. If it fails, report verification as pending and ask the failing workers what remains. A passing gate covers worker scope only; integrated checks below still apply. - Track delivery separately: local commit, pushed branch, open PR, and merge are observable milestones. Publishing a PR while checks run is fine when authorized. Say which revision was published, which checks passed, and which checks are pending, failed, or blocked with their owners.
- Call the result ready for review or complete only after verifying all assigned reports, the integrated revision and required checks, and any requested remote delivery. Match evidence to the delivered SHA (or verified identical tree for content checks). Report baseline failures and explicit user-accepted exceptions. When the integrated code changes, rerun affected checks before closing them.
Example user update: “PR #42 was updated to abc123. Production build passed. The workspace worker is checking mobile dialogs on that build. Review readiness is pending.”
5. Remote Sync, Conflict Resolution, PR Creation & Cleanup
- Always
git fetch originbefore any remote git or PR action: Have the worker fetchoriginfirst, check for and resolve any conflicts againstorigin/<base>cleanly inside its isolated worktree, re-run verification checks, and push. - PR creation (
ghvs. fallback): Have the worker checkgh auth statusandgh pr list --head <branch> --state all:- If authenticated: create (
gh pr create --base <base> --head <branch> --title "<clear title>" --body "<concise summary + verification>") or update an existingOPENPR and report its URL + mergeability. - If
ghis unavailable or unauthenticated: push the branch and report the compare URL plus a ready-to-paste PR title and concise summary.
- If authenticated: create (
- Release compute & keep workers warm: Immediately stop billable remote compute (
colab stop, cloud VMs), cancel active timers, and stop any leftover inbox watcher ("$INBOX" stop "$STATE_DIR"), but leave completed worker workspaces open (idle) so revisions can be sent instantly viaherdr agent prompt <name> "<feedback>". - Proactive cleanup prompt: Closing a worker workspace (
herdr workspace close "<workspace_id>") does not delete git worktrees, branches, caches, or state files. When work finishes, list the completed workers, their└ <name>workspaces, worktrees ($STATE_DIR/worktrees/<name>), branches, and state/asset files and ask user confirmation before runninggit worktree remove "$STATE_DIR/worktrees/<name>"+git worktree prune,herdr workspace close "<workspace_id>"(orherdr pane close "<pane_id>"for user-requested splits), and state cleanup (never stoppingherdr serveror closing user-owned workspaces/panes — only close└workspaces you spawned).
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
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.

