agentleFS
leroyguillaumeleroyguillaume/claude/herdr-tui-delegation/SKILL.md

herdr-tui-delegation

Skill7 starsChanged 5 days agoMITView on GitHub

Herdr TUI commands (`herdr pane`, `herdr workspace`, `herdr tab`, `herdr agent`) to find the target repo's workspace, then launch, brief, wait on and read a visible `claude` or `opencode` in a tab of its own. TRIGGER when: `herdr-delegation` detected `herdr` (`HERDR_ENV=1`, no `HC_TERMINAL_ID`) and a visible session is being launched, briefed, waited on, read or unblocked. SKIP when: `HC_TERMINAL_ID` is set (`herdr-core-delegation`); `DELEGATED_AGENT` is set; outside herdr. Load `herdr-delegation` alongside.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is 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.

  • 1

    Very specific

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

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

    When no workspace holds the repo, create one instead, which comes with its tab, then label that tab (.result.tab.tab_id) with the agent's …

    line 60

≈ “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.

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

Delegating through Herdr TUI

Herdr TUI is a terminal multiplexer whose server keeps workspaces, tabs and panes alive, driven by herdr tab … and herdr agent …. The policy is herdr-delegation; this skill holds the commands.

The installed binary is the authority on its syntax: herdr --skill for the full guide, herdr tab <command> --help and herdr agent <command> --help for one command.

Loop guard

A tab this flow opens carries DELEGATED_AGENT=1, which the detection in herdr-delegation reads: the session in it delegates through its sub-agent tool, never through another tab.

Launch

  1. Pick a name that herdr agent list does not already show.
  2. Find the workspace of a repo other than the main session's, dir being the directory the agent starts in. The first command lists the workspaces with a pane in that repo or its worktrees, the second those labelled with the repo's name:

    common() { git -C "$1" rev-parse --path-format=absolute --git-common-dir 2>/dev/null; }
    key=$(common "$dir"); repo=$(basename "$(dirname "$key")")
    herdr pane list | jq -r '.result.panes[] | [.workspace_id, .cwd] | @tsv' |
      while IFS=$'\t' read -r ws cwd; do [ "$(common "$cwd")" = "$key" ] && echo "$ws"; done | sort -u
    herdr workspace list | jq -r --arg l "$repo" '.result.workspaces[] | select(.label == $l) | .workspace_id'

    Without --path-format=absolute, git prints .git relative to each pane, which matches every pane at the root of any repo.

  3. Open a tab in that workspace, or in $HERDR_WORKSPACE_ID for the main session's repo, labelled with the agent's name, with the marker set and the user's focus kept where it is:

    herdr tab create --workspace <workspace-id> --cwd "$dir" \
      --label fix-login-timeout --env DELEGATED_AGENT=1 --no-focus

    When no workspace holds the repo, create one instead, which comes with its tab, then label that tab (.result.tab.tab_id) with the agent's name:

    herdr workspace create --cwd "$dir" --label "$repo" \
      --env DELEGATED_AGENT=1 --no-focus
    herdr tab rename <tab-id> fix-login-timeout
  4. Start the client in the tab's pane (.result.root_pane.pane_id, from either command), --kind claude or --kind opencode as herdr-delegation picks. Flags after -- go to the client:

    herdr agent start fix-login-timeout --kind claude --pane <pane-id> -- --model <model>
  5. Type the brief into it, as a background command:

    herdr agent prompt fix-login-timeout "<brief>" --wait

    --wait matches the first state observed after submission, so it cannot match the idle state the agent has not left yet.

    The brief gives the agent the command that renames its tab once its PR or MR is open. Herdr injects HERDR_TAB_ID into every pane it manages, so the agent names its own tab without being told its id:

    herdr tab rename "$HERDR_TAB_ID" "fix-login-timeout (#123)"
  6. Under OpenCode, read the report once it returns:

    herdr agent read fix-login-timeout --source recent-unwrapped --lines 200 |
      grep -o 'REPORT: .*' | tail -n 1

While it runs

  • Read its screen with herdr agent read <name> --source recent-unwrapped.
  • Relay into it, under OpenCode, as a background command: herdr agent prompt <name> "[relay] <text>" --wait.
  • Blocked: agent start returns agent_not_ready, or a wait returns blocked. Never answer it with herdr pane send-keys or send-text. Once the user says it is unblocked, wait again with herdr agent wait <name>.
  • Close the tab this flow created with herdr tab close <tab-id> when herdr-delegation says to. Never close a pane on its own, never touch a tab, pane or agent it did not create, and never herdr server stop.
  • Reopen it for a follow-up with a new tab in the same worktree, as in the launch, --label carrying the PR number when it has one, and -- --model <model> --continue to herdr agent start, or --session <id> in place of --continue under OpenCode.

Download now (ZIP)

Does it work?

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

No reviews yet

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

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

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

Your trail

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

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

Now do this for your own.

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