Skip to content
Back to skills

Herdr Orchestrator

ASecurity

Delegate tasks to Pi, Codex, or Claude Code workers through horch, then wait for their file results. Prefer installed herdr-core, including headless operation; fall back to legacy Herdr only when core is absent. Use for Herdr delegation, multi-model tasks, worker setup, or worker efficiency review.

  • 2 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added November 7, 2026
ai-agentspythongoshellbashdebugginggitbackend

Works with

  • claude code
  • terminal
  • cli

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned November 18, 2026

npx -y skills add conscientiousness/herdr-pstack-orchestrator --skill herdr-orchestrator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Herdr Orchestrator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Herdr Orchestrator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/conscientiousness-herdr-orchestrator/badge)](https://www.skillsdirectory.com/skills/conscientiousness-herdr-orchestrator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: herdr-orchestrator
description: "Delegate tasks to Pi, Codex, or Claude Code workers through horch, then wait for their file results. Prefer installed herdr-core, including headless operation; fall back to legacy Herdr only when core is absent. Use for Herdr delegation, multi-model tasks, worker setup, or worker efficiency review."
---

# herdr-orchestrator

You are the controller. Focus on planning, task assignment, guidance, and quality control. Delegate substantial implementation, bulk inspection, and experiment runs to workers with explicit scope and acceptance criteria. Handle brief preparation, small coordination steps, and targeted verification here.

Keep the main context small: retain the goal, constraints, task IDs, accepted findings, and next decision. Ask workers for concise conclusions, blockers, and evidence paths. Read the relevant diff or artifact to verify a claim; avoid dumping whole reports, datasets, or source trees into the main thread. For structured evidence, inspect keys/counts first and extract the fields needed for the decision instead of pretty-printing the entire JSON. Each task gets a fresh worker process through `horch`.

## Required rules

- **Deliver repository changes as a PR by default.** Work on a feature branch, integrate verified worker commits there, then push and open or update the PR. Merge into `main` (or the default/shared target branch), push changes directly there, or enable auto-merge only when the user explicitly asks to merge that work. Task completion, passing checks, and autonomous playbooks do not grant merge authorization. Include this limit in worker briefs.
- Delegate only through `horch`; never use your harness's native subagents while acting as this controller. A worker may use its own subagents unless its assignment restricts delegation.
- **Show core workers in the controller's Herdr workspace.** When this conversation runs in Herdr, verify its caller pane and create or reuse `hcOrch` tabs in that pane's live workspace. Each worker needs an owned pane running its pinned core's `attach`. Keep focus unchanged and keep the controller tab separate. Headless execution is for controllers outside Herdr; missing or stale tool environment is not permission to silently dispatch headless. Never clear Herdr variables or bypass `horch` to avoid caller verification or viewer placement.
- Never answer worker dialogs, send keys/text to worker panes, or send `/model`. A new task uses a fresh process with its configured model.
- **Wait for task `state: "done"` before consuming any result.** An early report or `result.json` does not finish a running task. Closing an unfinished worker cancels it and cannot pass a review gate.
- **`done` means delivered.** Read result `status`: `completed` claims success, `failed` reports failure, `blocked` needs the user's answer. Verify the work independently; neither `done` nor `completed` means a review passed.
- When a task has a problem, inspect and report it. Do not restart, resend, or switch workers without the user's decision. Close only panes started by `horch`, using `horch close`.

## Run horch

Use the absolute path inside this installed skill:

```bash
python3 <skill-dir>/scripts/horch.py <command> ...
```

Requires Python 3.11+ with POSIX file locks. Installed `herdr-core` is preferred over the `hc` alias. Controllers outside Herdr can use core headless without `HERDR_ENV` or a legacy CLI. Only core executable absence selects legacy Herdr, which requires a controller inside Herdr (`HERDR_ENV=1`) and `herdr integration install pi` for Pi workers. An installed but unhealthy core is an error, never a fallback. `stats` and `list` read stored history outside Herdr too. Commands print JSON; operational errors use `{"error": "<code>", "message": "<text>"}` and exit 1. CLI help and argument errors use argparse output.

| Command | Purpose |
|---|---|
| `run <worker> --brief <file> [--cwd <dir>] [--caller-pane <id> --caller-text <text>]` | Start a fresh worker. Inspect its returned state, submission and any viewer warning before waiting for delivery. |
| `wait [<task-id> ...] [--max-seconds <n>] [--recheck]` | Wait for a state change. No IDs selects all unsettled tasks. See waiting below. |
| `list` | List task, worker, pane, and state. |
| `stats [--workspace <id>] [--days <n>]` | Review configured workers from stored facts, without Herdr calls or writes. |
| `close <task-id>` | Close the recorded backend terminal and any owned viewer pane. |
| `verify-viewer <task-id>` | Re-read the live controller, viewer topology, attach process and rendered core output. Required before asking the user to interact with a worker window. |
| `submit <task-id>` | Submit an existing core task once after startup recovery, only when stored `submission` is `not_sent`. Requires the user's recovery decision. |
| `detect` | List installed harnesses, versions, Pi providers, and Pi integration status. |
| `check [<worker> ...] [--cwd <dir>] [--max-seconds <n>] [--caller-pane <id> --caller-text <text>]` | Verify configured workers with real tasks; default wait cap 300 seconds. |

Core workers run in persistent terminals. For a controller in Herdr, `hcOrch` viewer panes are required in the verified caller's same workspace, with at most four panes per tab. Legacy workers run directly in `horch` tabs under the same workspace and focus rules. A viewer is unnecessary only for a genuinely headless controller. Viewer failure retains the worker and cleanup facts and returns a warning; immediately report the actual task state and that visibility is unconfirmed, keep monitoring that task, and follow problem handling before retrying or relaunching. A returned viewer ID means created; only `viewer_verified: true` means its placement, pinned attach process and rendered output were verified at the recorded time.

Core `max_active_workers` counts all unclosed core tasks on the same core ID in this task store. With a GUI caller, legacy reservations in its workspace also count. This conservative session-wide core quota also works headless. Legacy launches keep per-workspace limits and count core tasks presented in that workspace. Unclosed invalid records reserve a slot in every scope.

Each task pins its backend at creation. A core binding records the executable, session, endpoint, permanent core ID and terminal address. A record without `backend` remains legacy forever. `wait` and `close` use stored affinity even if the environment or installed preference changes. Viewer IDs are separate from terminal identity. See [lifecycle](references/lifecycle.md) for endpoint errors and cleanup.

For Herdr placement, `HERDR_PANE_ID` is a claim, not proof of which pane hosts this conversation. Shell snapshots and shared agent daemons can carry another live pane's ID. `run` and `check` verify an explicit caller pane and conversation text for agent controllers, or actual ancestry for ordinary shell automation, then use the verified pane's live workspace. Core treats `--caller-pane`, `HERDR_ENV=1`, or inherited Herdr pane/tab/workspace/socket context as requiring this verification even if `HERDR_ENV` was dropped. A missing viewer endpoint stops launch. A moved pane's launch-time ID still resolves.

On `caller_context_invalid`, follow [caller context recovery](references/setup.md#caller-context). For agent controllers (including tools run by a shared `codex app-server`) and any tools outside every pane's process tree, every `run` and `check` requires both `--caller-pane <id>` and `--caller-text <unique visible conversation text>`. The tool checks the foreground harness and conversation cwd, matches the text against live harness panes, and rejects absent or ambiguous matches. Process ancestry alone is sufficient only for ordinary shell automation without agent context. A shared daemon can remain a descendant of its original pane while serving another conversation. Before worker launch, `task.json.controller_verification` records the verified live IDs, cwd, shell and foreground harness PIDs, method, time and screen hash without storing the transcript. Do not choose a workspace from UI focus or create replacement panes to work around the error.

## Delegate and verify

1. Choose a configured worker based on the assignment and its optional `description`. With `pstack-herdr` active, follow its role-first routing rules. One worker/model can serve multiple roles in fresh processes. Create a separate git worktree for a writer and pass it as `--cwd`. A read-only worker may share a checkout. Limit its writes to the declared reports and result file in its own task directory. Keep the checkout and external state read-only.
2. Write a complete brief: goal and acceptance criteria, absolute paths to read, file ownership and constraints, verification commands, output files, and whether to commit. Name the summary and evidence needed for your next decision. Workers have none of your conversation. Reports go beside `result.json`; `horch` appends its worker rules and exact result schema automatically.
3. Confirm whether this controller is in Herdr before dispatch; if it is, recover missing context using [caller context recovery](references/setup.md#caller-context). Run `horch run <worker> --brief <file> --cwd <dir>`, adding the confirmed `--caller-pane` and `--caller-text` for agent-controller tools. Record `task_id`, `pane_id`, `startup_ready`, `submission` and `execution_observed`; any state other than `running` needs problem handling. In Herdr, inspect `viewer_verified`, `viewer_verification_error` and `warning`. Report any warning, missing viewer, or failed attachment immediately; `running` alone does not confirm visibility. Do not launch a duplicate worker to repair visibility. For parallel tasks, submit all allowed by `max_active_workers` before waiting.
4. Wait until every required task is `done`, using the method below. Read `result_path`, inspect its `status`, and read all listed files (paths are relative to the result directory). Relay a blocked result's `question` to the user. A follow-up is a new task with a complete brief and the prior report.
5. Verify the diff, behavior, and reviewer verdicts before reporting. If `closed` is false, read `message` and retry cleanup with `horch close`; its worker slot remains occupied until closure is confirmed.

## Wait without repeated short calls

`horch wait <task-id> ...` has no default time cap and returns when any waited task changes state. It uses native core events with snapshots, or the existing legacy Herdr polling loop. Neither invokes a model. Wait again for the remaining running tasks after handling each change.

- With background commands or yielded shell sessions, run `horch wait` **without `--max-seconds`** and resume that same process/session until it returns. A shell tool's yield timeout returns control to you; it does not require a timeout on `horch`. Post user updates while the wait stays alive. Claude Code supports background commands; Codex runtimes with yielded exec sessions can resume the returned session handle.
- If the runtime only supports blocking shell calls (including Pi without a background facility), use `horch wait <task-id> ... --max-seconds 300` and a shell-tool timeout above 300 seconds. Use a shorter cap only when tool limits, a required update cadence, or a user request requires it.
- A wait cap stops that observation call, not the worker. Repeat while tasks are `running`; report `long_running` once and keep waiting. Never cancel a worker merely to end a wait.

Do not turn repeated `--max-seconds 1` calls into a status loop. While workers run, prepare independent briefs or assess already delivered evidence. For an occasional stored-state lookup, use `horch list`; use the existing wait process to observe delivery.

For a core progress check, use the recorded executable with `HC_SESSION` and `HC_SOCKET` from the backend binding, then `get <terminal_id>` or passive `read <terminal_id> --lines 0`. Never use the current endpoint for an old task. For legacy tasks, use `herdr agent get <agent-name>` and, if needed, `herdr agent read <agent-name> --source visible`. Reserve native harness transcripts for explicit debugging, not a second status loop. Lifecycle activity does not establish that the work is correct; verify the delivered artifacts.

## Problems

1. Inspect the recorded backend before closing it. For core use its pinned endpoint and `read <terminal_id> --lines 0`. For legacy use `herdr pane read <pane_id> --source visible`. These are passive; history reads can scroll an idle full-screen agent.
2. Tell the user the task, state, submission status, and what the pane shows. Before asking them to operate a core worker window, run `horch verify-viewer <task-id>` and require `viewer_verified: true` from that fresh read. A viewer ID from `run` is insufficient. If verification fails, report that visibility remains unconfirmed; do not direct the user to that window. Never answer a dialog yourself.
3. Follow the user's decision to close, recover or retry. When a retained core task has `submission: "not_sent"`, the user can resolve readiness and authorize `horch submit <task-id>` to submit its original brief once. `wait --recheck` only observes; it never submits. `sent` or `unknown` tasks cannot use `submit`; inspect and recheck them without resending. Start retries as fresh tasks. See [lifecycle and recovery](references/lifecycle.md).

## Read when needed

- **First use or configuration changes:** follow [setup and configuration](references/setup.md), including permission choices, startup dialogs, and `horch check`. Ask one setup question at a time. The user owns `$XDG_CONFIG_HOME/herdr-orchestrator/workers.toml` (default `~/.config/herdr-orchestrator/workers.toml`). A missing config is reported as `config_invalid`.
- **State/result interpretation, cleanup, or recovery:** read [lifecycle and recovery](references/lifecycle.md).
- **Worker efficiency, failures, or reminder timing:** read [worker statistics](references/stats.md) before proposing configuration changes.
- **Worker definitions:** [workers.example.toml](references/workers.example.toml). State lives in `$XDG_STATE_HOME/herdr-orchestrator/tasks/` (default `~/.local/state/herdr-orchestrator/tasks/`) and remains until the user deletes it.

Files in this skill

  • SKILL.md13.9 KB
  • references/lifecycle.md15.2 KB
  • references/setup.md15.2 KB
  • references/stats.md4.2 KB
  • references/workers.example.toml2.3 KB
  • scripts/core_backend.py10.2 KB
  • scripts/horch.py90.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.