All plugins

delegation-gate

Ask a person before delegate_task spawns subagents. Every call that would start subagents goes to the same once / session / always / deny approval gate Hermes uses for dangerous shell commands, and the prompt shows what you'd be paying for: the subagent's goal, or the task count and the first five goals for a batch. Controlling subagents that are already running (list, steer, stop) is never gated, so stopping a runaway subagent never waits on approval. Optional block mode (DELEGATION_GATE_MODE=block) refuses delegation outright for unattended profiles; an unrecognized value also blocks. Fails closed: with no person present (cron, scripts) a gated call is blocked, not allowed. Smart approvals don't auto-approve it; YOLO mode bypasses it like every approval prompt. Disclosure: one pre_tool_call hook and no tools; no network or model calls, no shell commands, and it stores nothing. It reads DELEGATION_GATE_MODE through Hermes's agent.secret_scope.get_secret() (never a .env file), and logs the mode it chose once per profile; a call Hermes can't attribute to a profile is blocked.

kenpritchard1Toolsv1.3.3Updated 8 days ago

About

Ask a person before delegate_task spawns subagents. Every call that would start subagents goes to the same once / session / always / deny approval gate Hermes uses for dangerous shell commands, and the prompt shows what you'd be paying for: the subagent's goal, or the task count and the first five goals for a batch. Controlling subagents that are already running (list, steer, stop) is never gated, so stopping a runaway subagent never waits on approval. Optional block mode (DELEGATION_GATE_MODE=block) refuses delegation outright for unattended profiles; an unrecognized value also blocks. Fails closed: with no person present (cron, scripts) a gated call is blocked, not allowed. Smart approvals don't auto-approve it; YOLO mode bypasses it like every approval prompt. Disclosure: one pre_tool_call hook and no tools; no network or model calls, no shell commands, and it stores nothing. It reads DELEGATION_GATE_MODE through Hermes's agent.secret_scope.get_secret() (never a .env file), and logs the mode it chose once per profile; a call Hermes can't attribute to a profile is blocked.

delegation-gate

A tiny Hermes Agent plugin that requires human approval before delegate_task spawns subagents — so your agent can't silently fan out expensive parallel work.

⚠️ Runtime requirement (read this first)

The default approve mode uses the pre_tool_call → action: "approve" directive, which Hermes only honors on builds newer than commit 36308f066 (feat(plugins): pass approve rule keys to approval gate, ~2026-07-07).

On older builds (e.g. v0.18.0), approve mode loads without error but silently does not gate anything. Verify your runtime before relying on it:

python3 -c "import hermes_cli.plugins as p; print(hasattr(p, 'resolve_pre_tool_block'))"
# must print: True

(Run with the Python interpreter of your Hermes install.)

The manifest declares requires_hermes: ">=0.18.2", so current Hermes refuses to load it on a build that is too old instead of loading it as a no-op. Tested on Hermes v0.23.0.

If it prints False, you can't use approve mode — but block mode (DELEGATION_GATE_MODE=block) still works: the block directive predates the approve action, so on older runtimes the plugin can refuse delegation outright even though it can't prompt.

Why

Subagent delegation is powerful but easy for the model to overuse. In the incident that motivated this plugin, an agent spawned a batch of subagents on a job that didn't need them; re-running the same job with delegation disabled produced almost as good a result for less than half the tokens.

Disabling the delegation toolset entirely throws away the upside. This plugin keeps delegation available but puts a human decision in front of every use — the agent proposes, you approve.

Hermes configuration allows for assigning less expensive models to subagents or limiting their number, but nothing allowed for the default configuration to be enabled with a guard that would allow for human approval before execution so this plugin was developed.

What it does

When the model calls delegate_task, the call is intercepted before execution and escalated to the same [o]nce / [s]ession / [a]lways / [d]eny human-approval gate Hermes uses for dangerous shell commands. The model cannot skip or bypass it.

The approval prompt shows what you'd be paying for:

  • single task: the subagent's goal
  • batch fan-out: the task count and a preview of each goal (first 5, then +N more) — important, since one delegate_task call can spawn several children

Controlling running subagents is never gated. delegate_task also has live-control actions (action: list / steer / stop, Hermes v0.21+) for children that are already running. Those can't spawn anything, so they pass straight through in both modes. Stopping a runaway subagent never needs your approval.

Approval semantics:

  • once — this call only; next call prompts again
  • session — the rest of the session is approved ("yes, this job is worth parallelizing")
  • always — opens delegation permanently for the profile. The plugin deliberately uses one stable rule key (delegate_task:spawn-subagents) so always means what it says; avoid it unless you've decided you no longer want the gate.
  • deny — the call is blocked; the model sees the denial as the tool result

Fail-closed: in non-interactive contexts (cron jobs, scripts) with no human present, gated calls are blocked, not silently allowed. Set approvals.cron_mode: approve if you truly want unattended delegation — better to keep the delegation toolset off on cron profiles entirely.

approvals.mode: smart does not auto-approve it. Smart mode's guardian model only judges flagged shell commands; a plugin-requested approval always goes to a human.

YOLO mode bypasses this gate. Like every approval prompt in Hermes, running with --yolo (or the session /yolo toggle) skips the gate entirely and delegation proceeds unprompted. That's by design — yolo means "I trust the agent with everything" — but if uncontrolled delegation spend is the very thing you're guarding against, don't run gated profiles in yolo mode.

Install

hermes plugins install kenpritchard/hermes-delegation-gate --enable

When enabling, Hermes asks "Allow this plugin to replace built-in tools (e.g. shell_exec, write_file)?" — it asks this for every plugin. Answer No: delegation-gate registers a hook, not a tool replacement, and works fully without the grant. To skip the prompt (e.g. in scripts):

hermes plugins enable delegation-gate --no-allow-tool-override

Installing for a specific profile

Plugins are per-profile: each profile has its own plugins/ directory and its own plugins.enabled allow-list in config.yaml, so you can gate one profile and leave others untouched.

hermes plugins install has no profile flag of its own — use the global -p flag, which repoints the Hermes home (and therefore the plugins directory) at that profile:

hermes -p myprofile plugins install kenpritchard/hermes-delegation-gate --enable
hermes -p myprofile plugins list      # verify: delegation-gate enabled

Or manually: copy plugin.yaml and __init__.py into the profile's plugins directory —

<hermes home>/profiles/<name>/plugins/delegation-gate/   # named profile
~/.hermes/plugins/delegation-gate/                       # default profile

— then hermes -p <name> plugins enable delegation-gate --no-allow-tool-override. (Git install is preferred: it lets hermes plugins update delegation-gate pull future versions, which a hand-copied directory can't.)

Note the delegation toolset is a separate per-profile switch from the plugin: the plugin gates delegate_task only where the tool is enabled at all (hermes tools enable delegation -p <name>). A sensible fleet setup is: toolset off on unattended/cron profiles, toolset on + this gate everywhere else.

Verify it gates

Start an interactive session and give the agent a prompt that forces a delegation:

Use delegate_task to list the contents of this directory and return the count. Do not do it yourself.

You should get the once/session/always/deny prompt with a goal preview before any subagent starts (or, in block mode, an immediate refusal). If delegation runs without a prompt, re-check the runtime requirement at the top of this README.

Block mode (DELEGATION_GATE_MODE)

By default the gate asks (approve mode). Set DELEGATION_GATE_MODE=block to refuse delegation outright: the model gets a policy message as the tool result ("delegation is disabled by policy... complete the task yourself") and adapts, with no prompt and no waiting.

Block mode differs from approve mode in two ways that matter:

  • It holds under yolo mode. --yolo / /yolo bypasses approval prompts (including this plugin's approve mode), but a block directive never reaches the approval machinery — there is nothing to bypass.
  • It works on older runtimes. Hermes builds that predate the approve action (see the runtime requirement above) still honor block, so block mode functions even where approve mode silently doesn't.

Recommended: the profile's .env, then restart

Put the setting in the profile's .env and restart whatever runs that profile's agent (its gateway; with a Docker or Desktop backend, the dashboard too):

# macOS / Linux
echo 'DELEGATION_GATE_MODE=block' >> <hermes home>/profiles/batch-profile/.env
# Windows (PowerShell)
Add-Content <hermes home>\profiles\batch-profile\.env 'DELEGATION_GATE_MODE=block'

This works everywhere, including a gateway that serves several profiles. To go back to prompting, remove the line and restart again. A restart is required both ways, because the mode is fixed once it has been read (see below).

Why not a shell variable?

DELEGATION_GATE_MODE=block hermes -p <profile> usually has no effect. The variable reaches only the process you start, but the agent normally runs in the gateway serving that profile, and the gateway was started without it. That includes one-shot runs such as hermes chat -q, which attach to a running gateway too. You get the normal approval prompt, and no new mode= line appears in the log. Use the profile's .env.

The mode is read on the first delegation attempt for each profile, and then fixed for the life of the process (mirroring how Hermes freezes yolo mode): it's a policy set by whoever launched the process, not something a session can flip. The plugin reads it through Hermes's profile-aware agent.secret_scope.get_secret(), so on a gateway that serves several profiles (Desktop sessions, gateway.multiplex_profiles) each profile gets the value from its own .env, even though that .env never reaches the process environment. The plugin never opens .env itself. If Hermes can't tell which profile a call belongs to, that call is blocked (fail closed) and the mode is read again on the next one. On Hermes before v0.21.6, which has no profile scopes, it reads the process environment. One gateway serving several profiles keeps a separate mode for each. Changing it takes a gateway restart (and, on a Docker/Desktop backend, a dashboard restart too). The chosen mode and where it came from are logged once per profile: [delegation-gate] mode=block (set; profile /path/to/profile; ...). Unset or approve = prompt; any unrecognized value logs a warning and falls back to block, so a typo on an unattended profile fails safe rather than open.

Suggested fleet pattern: approve mode (default) on interactive profiles, block in the .env of cron/unattended/yolo profiles.

To check which mode a profile is really using, look for the [delegation-gate] mode= line in that profile's logs/agent.log after its first delegation attempt.

Companion cost controls

The gate decides whether delegation runs; these config.yaml settings limit the blast radius when you approve:

delegation:
  max_concurrent_children: 2   # default 3
  max_iterations: 20           # tool-call cap per subagent (default 50)
  max_spawn_depth: 1           # no grandchildren
  child_timeout_seconds: 600   # wall-clock cap (default unlimited)
  reasoning_effort: low        # don't inherit an expensive parent level
  # model: <a cheap model>     # route subagents to a cheaper model

Prompt-level guidance helps too — a line in SOUL.md/AGENTS.md that delegation is expensive and should only be proposed for genuine parallelism or context isolation reduces how often you're even prompted.

How it works

agent/tool_executor.py → hermes_cli/plugins.py:resolve_pre_tool_block() → tools/approval.py:request_tool_approval(). The hook returns:

{"action": "approve", "message": "<what's being requested>", "rule_key": "delegate_task:spawn-subagents"}

Approval outcomes reuse Hermes' existing session/permanent allowlist machinery; a gate error fails closed to a block.

Development

python -m pytest tests/        # no Hermes install needed
hermes plugins validate .

Changelog

  • 1.3.3 (2026-11-22): docs only. The profile .env plus a restart is now the only documented way to set block mode. The shell-prefix and PowerShell/cmd examples are removed: the variable never reaches the gateway that runs the agent, so DELEGATION_GATE_MODE=block hermes -p <profile> (and hermes chat -q) still prompted when tested on v0.23.0. No code change.
  • 1.3.2 (2026-11-22): read the mode through Hermes's get_secret() instead of opening the profile's .env file (plugin catalog rule 11). Same behavior on multiplexed gateways; a call Hermes can't attribute to a profile is blocked rather than guessed. Removed debug logging of goal text. Tests use a stand-in for Hermes's profile scope, plus a check that a .env file the plugin could read has no effect.
  • 1.3.1 (2026-11-11): fix block mode set in the profile's .env, which was ignored on Hermes v0.23 so the gate kept prompting. Two causes: the mode was read at import, before Hermes loads .env; and a gateway serving the profile (Desktop sessions, multiplexed profiles) never loads that profile's .env into the environment at all. The mode is now read on the first gated call, from the environment and the profile's .env file (block in either wins), and kept per profile. Tests for the load order, the .env file, and multi-profile gateways.
  • 1.3.0 (2026-11-08): list / steer / stop control actions pass through ungated; manifest uses provides_hooks (fixes hermes plugins validate on current Hermes) and declares requires_hermes: ">=0.18.2"; unit tests.
  • 1.2.0 (2026-07-12): block mode (DELEGATION_GATE_MODE=block).
  • 1.1.0 (2026-07-11): first public release.

License

MIT

README from the reviewed commit bec2154; it updates when the author re-pins.

More by kenpritchard

2 plugins by kenpritchard in the catalog.

kenpritchardshow-your-workAn evidence board for a change's acceptance criteria: which requirements your agent actually tested, what the imported results say, whether they still match the code, and whether you signed off. Point it at the requirements you already have (a ticket, bug report or spec in Markdown) and it shows four separate statuses per requirement, never merged into one green check: coverage (is a test linked?), outcome (latest imported JUnit run), freshness (tracked files changed since?) and human review. For review, click a requirement and then a linked test to see that test's source and its own diff against the base branch (new, changed or unchanged), plus the change under review. The agent links tests and imports reports from wherever they ran (terminal, Docker, CI); it has no tool to accept or reject. Sign-off comes from the Desktop page, /syw or hermes syw. Five tools (syw_board, syw_link, syw_import, syw_run_detail, syw_test_evidence), a /syw command, a hermes syw CLI, a Desktop page and a workflow skill. Disclosure — runs no tests and makes no network or model calls; reads syw.toml, the criteria file, tracked files (to hash them) and JUnit XML inside the project folder (paths outside it and symlinks refused), runs read-only git (rev-parse, merge-base, diff, show, ls-files) in the project folder when you open a test's evidence or the change panel, stores links, results, hashes and reviews in SQLite under the profile's plugin-data, and writes show-your-work-review.md into the project only when you export.Communitytools

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section