Toolbox

Herdr desktop app

Run the agents the Herdr desktop app (herdr.app) starts inside toolbox, with the bundled CLIs, the isolated ~/.toolbox credentials and the container boundary. herdr.app talks to herdr-core (hc), not to the Herdr TUI the image bundles; the container that hosts herdr-core is the Herdr Core Shell, a detached shell, one per host and profile. Why it works this way: ADR 0024.

Start

Install herdr-core on the host first (herdr.app ships it, or see herdr.dev/core), so hc is on your PATH. Then:

toolbox herdr ~/src

The directory is the workspace the app's spaces can reach. To skip it on every start, set it once:

# ~/.toolbox.yaml
herdr_workspace: ~/src

A dir argument overrides herdr_workspace when it starts a Herdr Core Shell. With neither, the command joins a running Herdr Core Shell on its own workspace (run it again); with none running, it fails and names both. Either way the directory must exist and must not be your home itself (~, ~/, or its absolute path): the Shell would otherwise mount the whole home.

The command starts the Herdr Core Shell (toolbox-herdr) and adds it to the host's herdr-core as the machine toolbox:

hc machine add --name toolbox --install --via 'docker exec -i toolbox-herdr sh -c'

herdr-core installs its own hc in the container, at the host's version, checked against the release's SHA-256. Open herdr.app: the toolbox machine shows as connected, and a space on it runs its terminals and agents in the container. Claude Code, Codex and pi report their status to the app without any hook.

Running toolbox herdr again is safe. On a running Shell whose machine herdr-core already knows on the Shell's own --via line, it checks that herdr-core's binary is still in the container ($HOME/.local/bin/herdr-core) and otherwise changes nothing. When it creates the container (the first start after a stop, an image update, a recreate), or finds a running one without that binary, and the machine is already known, it runs hc machine update toolbox, which installs hc in the container again. A machine called toolbox that herdr-core reaches some other way (your own ssh machine, say) is not this Shell's: the command leaves it alone and fails, naming its current target; rename that machine (hc machine rename toolbox <name>) or run toolbox herdr --reregister to replace it. A Shell the command just created is removed in that case. When herdr-core cannot register the machine on a Shell the command just created, the Shell is removed and herdr-core's reason is the error.

To repair a machine entry, force a fresh registration: toolbox herdr --reregister removes the machine (hc machine rm) and adds it again with --install.

Without hc on the host

Without hc on your PATH, toolbox herdr still starts the Shell and prints the exact hc machine add command for it, with the machine name and --via line of the Shell it planned. Run it once herdr-core is installed, or run toolbox herdr again.

The Herdr TUI (herdr in a toolbox shell) is unaffected: the two runtimes coexist and do not see each other's terminals.

Open a terminal in it

toolbox herdr shell

It attaches a terminal to the running Herdr Core Shell, on its workspace; exit leaves herdr-core running. With no Herdr Core Shell running it fails and tells you to start one with toolbox herdr. A session reload from that terminal re-enters toolbox herdr shell.

Run it again

A second toolbox herdr on a running Herdr Core Shell says the Shell is already running and on which workspace. The Shell keeps that workspace: a dir argument or herdr_workspace that differs from it is not applied, and the report says so; toolbox herdr stop first to mount another.

Image updates

The Shell has no terminal of its own, so nothing tells you about a new runtime image while it runs. toolbox herdr is where you find out: when the running Shell is behind, it offers to replace it (a Detached Shell Refresh, ADR 0026). Behind means the local image store holds a newer image than the one the Shell was created from (a pull another session made, or a local toolbox build), or the registry holds a newer one than the store. The registry is checked through the same probe cache the update banner uses, and asked only when that cache is cold.

Before the question it lists what a replacement would end: agents, language servers, anything else running in the Shell's terminals. Empty terminals, herdr-core's own processes and the proximo watcher are not listed. When the process table cannot be read it says so, and the countdown answers no. Answer y or n; an unanswered countdown answers yes when nothing is listed and no otherwise, so walking away never ends an agent. ctrl+c abandons the command.

On y, the newer image is pulled first: a pull that fails leaves the running Shell as it was. Then the Shell is replaced on its own workspace, still detached, with its state, and the machine is updated so herdr.app reaches it again. On n nothing changes.

There is no offer without a tty (a script, a login item), and none from toolbox herdr shell, which does not register the machine. pull: never and TOOLBOX_NO_UPDATE_CHECK skip the registry check only: a store newer than the Shell is still offered. pull: always pulls at every toolbox herdr on a running Shell, before the comparison, as it does at every shell start.

Stop

toolbox herdr stop

removes the Herdr Core Shell. With none running it exits 0 without a word. herdr-core's state (terminal records, saved screens) stays in ~/.toolbox/herdr-core (under ~/.toolbox/profiles/<name>/ with a profile, or your mounts_root), so the next start restores the spaces, with shells in place of the programs that were running (Recreate). The machine stays registered on the host; the next toolbox herdr creates a new container and updates the machine, which installs hc in it again.

Profiles

--profile work runs a separate Herdr Core Shell, toolbox-herdr-work, with that profile's credentials, its own state in ~/.toolbox/profiles/work/herdr-core, registered as the machine toolbox-work. A profile whose name, once sanitized, looks like a workspace hash (eight hex characters) is refused: toolbox-herdr-<8hex> is the container of a directory named herdr.

Agents on the host

An agent in a herdr.app space on the toolbox machine and an agent in a space on the host can talk to each other: one types a message into the other's prompt and reads its screen. It runs on herdr-core and the toolbox bridge, locally — nothing leaves your machine. Claude Code's own SendMessage cannot do this: its session registry, sockets and process IDs stay on their side of the container boundary (and, on macOS, of Docker Desktop's VM).

It works between agents in herdr.app spaces (Claude Code, Codex, pi — any agent herdr-core recognises), not with a session open in Terminal.app or iTerm, and not from an ordinary toolbox shell.

Before you start

  1. herdr-core on the host, with hc on your PATH — the same requirement as Start.

  2. The bridge installed:

    toolbox bridge install
    

    After a toolbox update, the next toolbox herdr or toolbox shell restarts a daemon that runs the same binary, so it knows the relay. A bridge installed from another binary (a local checkout, say) is left alone: rerun toolbox bridge install from the toolbox you use (refresh after an update).

  3. A Herdr Core Shell started by this toolbox version:

    toolbox herdr ~/projects
    

    If a Shell was already running from an older version, toolbox herdr says it predates hc-host. Recreate it once:

    toolbox herdr stop
    toolbox herdr ~/projects
    
  4. In herdr.app, one space on the toolbox machine and one on the host, each running an agent.

From the host to the toolbox

In a terminal (or an agent) on the host, the Shell's terminals are toolbox/<terminal>:

hc ls                                   # every terminal: toolbox/t2, toolbox/t4, …
hc read toolbox/t2 --lines 40           # its screen and the 40 lines above it
hc send toolbox/t2 "run the test suite and tell me what fails"

hc send waits for a person's unfinished draft in that terminal before it types. Under a profile the machine is toolbox-<profile>.

From the toolbox to the host

In a terminal of a space on the toolbox machine, hc-host reaches the host's terminals, addressed without a machine prefix:

hc-host ls                              # the host's terminals: address, agent, status
hc-host read t2 --lines 40
hc-host send t2 "review the diff in ~/src/app"

The host agent receives [from toolbox/t3] review the diff in ~/src/app: the prefix is where to answer, so it replies with hc send toolbox/t3 "…" and the answer is typed into your terminal. There is no waiting command: the answer arrives as a message.

hc-host send types only into an agent waiting for input (idle or done in hc-host ls). A shell, a working agent or one showing a question or approval dialog is refused, and nothing is typed. Retry once it is free.

Ask your agents to do it

The agents need only the address and the command. For example, to the agent on the host:

Ask the agent in toolbox/t2 to run the tests: hc send toolbox/t2 "…". Its reply will arrive in this terminal.

And to the agent in the toolbox:

Ask the host agent in t2 (see hc-host ls) to review your diff with hc-host send t2 "…". It replies in this terminal.

Turn it off

The relay is on wherever the bridge is installed, and any toolbox container can use it. To turn it off for every container, set in ~/.toolbox.yaml on the host:

host_terminal_relay: false

It applies to the next request, with no restart. toolbox config ui sets it too, in the Global scope. Only ~/.toolbox.yaml counts: in a project's .toolbox.yaml the key changes nothing, and toolbox config doctor says so. Remove the key, or set it to true, to turn the relay back on. The host-to-toolbox direction is herdr-core's own and is not affected.

When something refuses or does not answer, see hc-host refuses or cannot reach the host. How the bridge gates it: Host terminals.

Trust boundary

herdr-core is not a sandbox: whoever reaches its socket controls its terminals. Here that is anyone allowed to docker exec into the Shell, the same Docker daemon boundary that already covers every toolbox container. Nothing is published on the network: there is no sshd and no port. The reverse direction, container to host, is narrower on purpose: the host is never registered as a machine in the Shell's herdr-core, which would hand the container a shell on the host; hc-host reaches only waiting agents (ADR 0025).

Recreate

An image update or a Session Reload recreates the container. Running programs end; the spaces come back from the saved state with fresh shells. The hc herdr-core installed lives in the container's writable layer and is gone too. When toolbox herdr itself created the new container (an image update taken at its offer), it updates the machine, which installs hc again. A Session Reload (or a refresh taken by toolbox herdr shell) recreates the Shell outside toolbox herdr: until the next toolbox herdr, which sees the binary missing and updates the machine, herdr.app cannot reach it. Run toolbox herdr once after such a recreate.

A toolbox herdr stop ends the running programs the same way: the next toolbox herdr creates a new container. In either case herdr-core treats them as lost. A kept terminal, which is how herdr.app opens terminals, comes back with a shell under its last saved screen, and herdr-core never reruns the program, just as after a reboot of a host running herdr-core natively. An agent that was running comes back as that shell: resume its conversation by hand, picking it from the list (claude --resume, codex resume), since several terminals can share one directory and claude --continue or codex resume --last takes that directory's latest conversation. The Herdr TUI's own restore of an agent's conversation does not reach herdr-core's terminals.

Remove the machine

toolbox herdr stop
hc machine rm toolbox
rm -rf ~/.toolbox/herdr-core

hc machine rm makes the host's herdr-core forget the machine (toolbox-<profile> under a profile). Removing the directory drops the saved spaces; skip it to keep them for a later start.

Where the state lives

herdr-core's state is plain files in ~/.toolbox/herdr-core, bound into the Shell at ~/.local/state/herdr-core. Its sockets cannot live there, since Docker Desktop's host file sharing cannot hold a socket: the Shell sets XDG_RUNTIME_DIR to a private tmpfs, where herdr-core puts them, and they go with the container.

Earlier toolbox versions kept the state on a Docker volume, toolbox-herdr-data (toolbox-herdr-data-<profile> per profile). The first time toolbox creates the Shell after the upgrade (a toolbox herdr after toolbox herdr stop, or an image update taken at its offer), it copies the volume into the directory and removes it. A Shell already running keeps the volume until then. When the directory already holds state, or the copy fails, the volume stays and toolbox herdr names it: remove it with docker volume rm once you no longer need it.