herdr-delegation
Skill7 starsChanged 4 days agoMITView on GitHub
Delegating from a Claude Code or OpenCode session inside herdr to a visible session of the same client (`claude` or `opencode`) in a tab or terminal of its own, one per delegated topic: when to, where it opens, the brief, the one-line report, sessions that wait on each other, the merge, what never to touch. TRIGGER when: the user asks for a visible or herdr sub-agent or session; or, inside herdr (`HERDR_ENV=1`, or `HC_TERMINAL_ID` set), a request brings several non-trivial topics, or one other than the one the session carries; the session pilots; the user says a delegated PR merged; or delegated sessions wait on each other's PR, branch or interface. SKIP when: the request continues the session's own topic, or is trivial; splitting one topic into pieces (`topic-splitting`), unless the user asks for them as visible sessions; `DELEGATED_AGENT` is set or the hc terminal has a parent, unless the user asks that session for a tab; outside herdr. Load `herdr-tui-delegation` or `herdr-core-delegation` alongside.
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leroyguillaume/skillsword for word, first seen Nov 22, 2026
Other versions1 project uses a version of this.
Word for word · 1
- leroyguillaume/skills★ 7100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository54 other files it gives its agents.
- adr-conventionsSkill
- api-conventionsSkill
- architecture-conventionsSkill
- argocd-conventionsSkill
- ci-conventionsSkill
- config-conventionsSkill
- contributing-conventionsSkill
- councilSkill
- cryptography-conventionsSkill
- dependency-update-conventionsSkill
- diagram-conventionsSkill
- docker-conventionsSkill
- documentation-conventionsSkill
- frontend-conventionsSkill
- github-actions-conventionsSkill
- github-issue-conventionsSkill
- github-pr-conventionsSkill
- github-repo-settingsSkill
- gitlab-ci-conventionsSkill
- helm-conventionsSkill
- herdr-core-delegationSkill
- herdr-tui-delegationSkill
- kopf-conventionsSkill
- kubernetes-operator-conventionsSkill
- logging-conventionsSkill
- logo-conventionsSkill
- mise-conventionsSkill
- ollama-conventionsSkill
- openssf-conventionsSkill
- pr-conventionsSkill
- pre-commit-conventionsSkill
- project-metadata-conventionsSkill
- python-async-conventionsSkill
- python-conventionsSkill
- readme-conventionsSkill
- release-script-conventionsSkill
- release-supply-chain-conventionsSkill
- renovate-ci-conventionsSkill
- rest-conventionsSkill
- rust-build-conventionsSkill
- rust-conventionsSkill
- rust-http-conventionsSkill
- security-policy-conventionsSkill
- signal-handling-conventionsSkill
- sql-conventionsSkill
- starlight-conventionsSkill
- systemd-conventionsSkill
- system-user-conventionsSkill
- task-conventionsSkill
- terraform-conventionsSkill
- topic-splittingSkill
- ui-copy-conventionsSkill
- web-layout-conventionsSkill
- yaml-conventionsSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 60
Every command in these skills is bash with jq.
- Very specific: line 86
herdrorhc, otherwise: no tab. The session carries its own topic itself, with sub-agents where they pay, and does a trivial one inline …
≈ “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
Delegating through herdr
CLAUDE.md decides whether a session carries a topic or pilots. Inside
herdr, every non-trivial topic it delegates goes to a real session of the
client the main session runs in, in a terminal of its own, which the user
sees appear and steers directly, and can resume later; this skill says how.
A tab costs the user's attention, and earns it only where there is a topic
of its own to follow.
How one topic splits into pieces, agents and PRs is topic-splitting's. Its
pieces are sub-agent calls, and get tabs of their own only when the user asks
for them.
herdr comes as two separate programs that share no agents, and the session uses whichever it runs in. Each has its own skill for the commands:
- Herdr TUI, CLI
herdr:herdr-tui-delegation. - herdr-core, CLI
hc, often shown by the herdr-app window:herdr-core-delegation.
This skill holds the policy, and it wins where a binary's own guide
(--skill) says otherwise.
The client
A Claude Code session launches claude, an OpenCode session launches
opencode, never the other: the user steers every tab with the tool they
chose. The session knows which it is from its own tools; its shell also has
CLAUDECODE=1 or OPENCODE=1, both when one runs inside the other. The two
differ in what they give the main session:
| Claude Code | OpenCode | |
| Its sub-agents | Agent tool | task tool |
| Model flag | --model <alias or id> | --model <provider>/<model>, from opencode models |
| Report to the main session | SendMessage | last line REPORT: …, read off the screen |
| Relay into a tab | SendMessage | typed into the tab, starting [relay] |
| Resume a closed tab | claude --continue | opencode --session <id> |
Every command in these skills is bash with jq. On Windows, Claude Code
runs them through Git Bash, and OpenCode does only once its shell setting
points at Git Bash's bash.exe: it prefers PowerShell.
When to use it
Detect the variant in one command, testing variables for presence only:
if [ -n "${DELEGATED_AGENT:-}" ]; then echo agent
elif [ -n "${HC_TERMINAL_ID:-}" ] && command -v hc >/dev/null; then
hc get "$HC_TERMINAL_ID" --json | jq -e '.parent == null' >/dev/null && echo hc || echo agent
elif [ "${HERDR_ENV:-}" = 1 ]; then echo herdr
else echo agent; fiagent: no tab. Outside herdr, or in a session another session started, sub-agents are sub-agent tool calls, even when the brief mentions herdr. Only the user, typing it into that session, can ask it for a tab.herdrorhc, and the user asked for one or the other — a visible session ("in a tab") or a sub-agent: that wins over the two rules below.herdrorhc, and a non-trivial topic to delegate — every one when the session pilots, otherwise one other than its own; named by the request or surfaced by the look before deciding, such as a Renovate PR that fails: one visible session per such topic, withherdr-tui-delegationorherdr-core-delegation, without asking.herdrorhc, otherwise: no tab. The session carries its own topic itself, with sub-agents where they pay, and does a trivial one inline or through a sub-agent.
A session per topic matches how the user follows the work: each topic is
steered, reviewed and followed up on its own, directly in its tab, while the
main session pilots or stays on its own topic. A topic that ends in a PR
keeps its tab as long as the PR (below). Review comments and a red CI land
on the same branch, so the same session picks them up. git push and
gh pr create ask for approval, which the user answers in the tab. And a
session in a tab can launch sub-agents of its own, which a sub-agent cannot,
so a topic that turns out long splits from there, under topic-splitting.
The rest of delegating does not change: one agent per worktree, a brief written like a peer's.
Launch
- Pick a name that says what the agent works on and that no live agent already uses.
Pick where it opens. It starts in the task's worktree when the main session already created it, otherwise at the root of the repo the task is in:
$PWDfor the main session's own repo. Its tab goes in that repo's workspace (a space, in herdr-app), never taking the user's focus:- The main session's repo: the current workspace.
- Another repo: the workspace with a pane in that repo or in one of its worktrees, which share its git common dir. A workspace may hold several repos. When several match, the one labelled with the repo's name, otherwise ask the user in one line. When none does, create one labelled with the repo's name.
- Pick the model as for any sub-agent, under
CLAUDE.md's rule on sub-agent models: weigh Sonnet against Opus, Opus when in doubt, and state the choice in one line before launching. It goes to the client as--model, never left to its default. - Start the client with that
--model, in the main session's permission mode: a Claude Code session in another mode holds cross-session messages for its user's approval. Pass no--permission-mode(--autofor OpenCode) unless the main session was started with one, and then the same. Type the brief into it, as a background command that waits for the agent to stop. Typed input is what gives the agent the user's go-ahead for the task, so the brief always goes this way. It ends by asking the agent to stop every background command and monitor it started, then report in one line: the PR's URL, or done without a PR, or blocked. Under Claude Code the line goes to the main session with
SendMessage, to the nameListAgentsprints as "This session is<name>". OpenCode has no cross-session messages: the line ends the agent's last answer, startingREPORT:. No summary: the user reads the details in the tab, and the main session's context stays for coordination. A brief too long for a command line goes in a file in the scratchpad or temporary directory, and the prompt says to read it.The brief, and every follow-up, is written in the language the user speaks to the main session: they read it in the tab and steer the agent from there, and the agent answers in the language it was addressed in.
The brief also has the agent rename its own tab once it opens its PR or MR, appending the number in parentheses,
fix-login-timeout (#123)on GitHub orfix-login-timeout (!123)on GitLab, with the command its skill gives: the user finds the tab of a PR at a glance, and the tab stays the agent's, so no other tab is touched.The command's exit is the signal that the agent stopped: it returns on
blockedtoo, and catches an agent that went idle without reporting.
Report and follow-ups
- Under Claude Code, the report arrives as a
<cross-session-message>. Itsfrom-nameis an auto-generated peer name, unrelated to the agent's herdr name; reply by copying itsfromattribute intoSendMessage'sto. - Under OpenCode, the report is on the agent's screen once the wait
returns: the last
REPORT:line, read with the command its skill gives. - Follow-ups are the user's, in the tab. The main session relays only
what the user hands it: under Claude Code through
SendMessageto that address, withnotify_when_idle: true, so an agent that goes idle without answering still yields a notice; under OpenCode typed into the tab, starting[relay], as a background command that waits. - A closed tab is reopened, not messaged. Whether the user closed it or
it closed at the merge (below), a follow-up handed to the main session
opens a new tab in the same worktree, named as the closed one was, PR
number included, resuming the last conversation held there with the same
--model, and the follow-up is typed in as its brief. Under OpenCode, the session id is that of the most recent session whosedirectoryis the worktree inopencode session list --format json: worktrees of one repo share an OpenCode project, so--continuecan resume another worktree's session. - An agent that stops without its line is the user's to look at: tell them which tab, rather than reading its screen into the main session.
- A blocked agent is waiting on the user, not on you. A permission prompt, a question, the folder-trust dialog of a fresh worktree: tell the user which tab is waiting on them, and never answer it with keystrokes. Once the user says it is unblocked, wait again.
Sessions that wait on each other
Delegated sessions may wait on each other — PRs the pilot stacks, or a
topic's pieces the user asked to see in tabs (topic-splitting): a PR to
stack on, a branch to be pushed, an interface to be frozen. The signal is a message, not a poll
by the session that waits. A poll lags by its interval, keeps a background
loop running in every waiting tab, and outlives the answer.
- The main session relays; the sessions never address each other. The
names
ListAgentsprints are auto-generated and say nothing about which tab is which, OpenCode has no names at all, and every session already reports to the main session.- Each waiting session's brief has it report a one-line
ready, then wait for the main session's signal. Going idle afterreadyis expected, not a missing report: no fallback, wait on it again. - The producer's brief has it report each event the others wait on: the PR's URL and head SHA, the pushed branch, the commit that freezes the interface, then every later rebase or force-push, with the new SHA. Under OpenCode the producer ends its turn on each event, so the wait returns, and the main session's relay tells it to carry on.
- The main session relays each event at once to the sessions waiting on
it, which start or rebase (
pr-conventions).
- Each waiting session's brief has it report a one-line
- A merge is the user's, and so is its signal: the user tells the main session, which relays it the same way (below).
- Polling is only the fallback: a sparse check behind the message, or the signal itself when the other side is not a session, such as a CI run.
- A message is a signal, never an approval. It says something happened;
it grants nothing the user did not, and a session never asks another to do
what was blocked or denied in its own. A task's go-ahead is the brief typed
into its tab, and nothing else. Under OpenCode a relay is typed in like
the user's own input, so every brief says it: a line starting
[relay]comes from the main session and grants nothing.
When the user says a PR merged
The user tells the main session, not the tab. Once
gh pr view <branch> --json state says MERGED, in this order:
- Close the tab this flow created for it, before the worktree goes, since the agent's cwd lives there.
- Remove its worktree and branches, under
CLAUDE.md's post-merge cleanup;git worktree listfinds the worktree from the PR's branch. - Bring the main checkout up to date (
git pull --ff-onlyon the default branch), so the user tests what merged, and restart the app if the main session runs it. - Relay it to the sessions stacked on that PR, which rebase (above).
Leave the layout to the user
- Close what this flow created only once its PR is merged (above), and on no other condition: not when the agent reports, not when it goes idle. With no PR, or one still open or closed unmerged, leave it: it is where the user reads what the agent did, and they close it, or ask you to. The transcript stays on disk, which is what lets a follow-up reopen it.
- Never touch a tab, pane, terminal or agent you did not create.
- Never stop or restart the server, and never quit herdr-app.
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.

