Agent sessions

How HQ starts, watches and drives coding agent sessions.

Checked on 2026-11-19 against build v0.9.1-main.648. See this page on GitHub.

Agent HQ runs and monitors two kinds of agent in its built-in host (hq host, see AGENT_HOST.md): coding agents (Claude Code, Codex, Cursor, Pi, OpenCode, Copilot CLI, Kimi, Qwen, Antigravity), which edit code, and general-purpose agents (Hermes, OpenClaw), full assistants with their own tools and memory that never take code work (see General-purpose agents). The host owns the terminals, recognises which agent sits in a pane, and reports its state: idle, working, blocked (waiting on a dialog or approval), or done. It replaced the earlier tmux-based runner, which could only guess state from screen text.

A host is a machine running hq host. native (also written local) is the machine HQ runs on. Any other host is a machine you paired (see JOIN_A_MACHINE.md) and is reached over ssh, which is how HQ on a VPS can run and watch agents on a laptop whenever the laptop is on and reachable over Tailscale.

Choosing the model

harness_session_spawn, harness_session_handoff and hq sessions spawn --model <id> take an optional model, passed to the agent’s CLI with its --model flag (Claude Code, Codex, Cursor, Pi, OpenCode, Copilot CLI, Kimi, Qwen and Antigravity all take one). The id is the CLI’s own, for example sonnet or haiku for Claude Code. It is stored with the session, so a resume or a host restart starts the agent on the same model, and the result reports it as model (null means the agent’s own default). An agent with no model flag HQ knows (Hermes, OpenClaw) refuses a model instead of starting on its default, and so does an id that could read as a flag.

What HQ can do

Tool Effect
harness_session_spawn Start an agent on a host. Returns a session_id.
harness_session_send Submit a prompt, or press keys (down, enter, esc, ctrl+c) for a dialog HQ cannot read. Drive, an agent session, a claude.ai connection, an hq_ask reply and a turn that read untrusted content answer a dialog HQ can read with harness_session_answer, never with keys, and at one it cannot read may only press esc or ctrl+c. An automated caller may not press esc or ctrl+c to stop a turn the owner started (the daemon remembers who gave each session its latest prompt; after a restart nothing is refused).
harness_session_pending The dialog a blocked session waits at, as data: its number (seq), kind, question, command or path, folder and options.
harness_session_answer Answer that dialog by option (seq and option), or decline it, optionally with a message sent as the next prompt.
harness_session_wait Block until the session goes idle, done or blocked. session_ids (up to 10) waits for several against one deadline and returns one report per session, each with its own turn result; one that cannot be reached reports its error and does not fail the rest.
harness_session_events What happened to sessions, a task or a team, as compact events after a cursor, waiting up to 45 s for the next one. See “Following sessions by events”.
harness_session_logs / _status / _list Read output and live state. logs with since returns only what is new.
harness_session_stop / _resume Close the workspace, or continue a stopped session.
host_list Which hosts exist and whether each answers right now.
host_agents / host_read Read-only view of every agent on a host, including ones you started by hand.
host_send Prompt (text) or press keys in an existing pane by pane id or agent name, including one you started by hand. host is required.

The harness_session_* tools only change sessions HQ launched. An agent you started yourself is visible and readable, and host_send is the one way to steer it: it checks the target first, sends nothing to an unreachable host or a stale pane id, and refuses text while the agent is blocked at a dialog (it returns the screen so the dialog can be answered with keys). hq sessions list|spawn|status|logs|send|stop|resume mirrors the tools, and hq sessions spawn <harness> --host laptop --cwd <path on laptop> starts one on a remote host. The folder is optional: with none, or with one the machine does not have, the session starts in a folder inside that machine’s own Documents/HQ, which the host creates (a missing folder keeps its name there; no folder gives the agent a folder of its own). The result says so in cwd_note. A folder that exists is used exactly as before, and a home or root directory is still refused.

There is no terminal UI to attach to: read a session with harness_session_logs or the web app, and list every agent on a machine with hq host status.

Behavior worth knowing

  • Dialogs are not answered for you. If an agent stops at a startup dialog, spawn returns the screen and types nothing. Claude Code’s workspace-trust prompt defaults to “No, exit”, so pressing Enter would quit it. Read the screen, then send keys. Only Antigravity, whose default is verified to be “trust”, is accepted automatically.
  • Dialogs are data. For Claude Code, Codex and Copilot, harness_session_status, _list and _wait say when a blocked session waits at a dialog HQ can read (pending_seq, its number, and pending_kind); harness_session_pending returns the dialog itself. The dialog’s text is the agent’s output, so reading it counts as reading untrusted content, the same as harness_session_logs. harness_session_answer names that number, so it never answers a dialog that replaced the one that was read: it is refused, and the caller reads again. HQ moves the agent’s cursor and presses Enter only once the screen shows it on the chosen option. registered: false (not_registered) means the dialog was still open afterwards.
  • “Don’t ask again” is the owner’s call. An option marked remember lets the agent do the same thing later without asking (Copilot’s path dialog even highlights “remember this path”). Drive, a session’s own token, a claude.ai connection, an hq_ask reply and a turn that read untrusted content may pick only one-time answers or decline. Reading the dialog with harness_session_pending counts as reading untrusted content, so a model that has read it never widens an agent’s permissions: the owner does that from the web Sessions panel, which shows one button per option. An option that opens a text field is never picked: decline with a message instead.
  • A yes that loses something is the owner’s call too. A command dialog whose command deletes, stops, drops or overwrites (hq_core::losing::dialog_verb), or one cut too short to judge, is refused to the same automatic answerers; they may still decline it. harness_session_pending and the inbox show such a dialog with loses: true and its verb. A session’s command policy still applies its own rules, which the owner chose.
  • Following output without rereading it. harness_session_logs with since: "" starts a cursor; each reply’s next is the since for the next call, and the reply holds only the lines that scrolled off the screen since then, plus the screen now. An agent that redraws a full-screen view in place (Copilot) scrolls nothing off, so for it only the screen changes.
  • A blocked agent alerts once. The supervisor (every minute) raises an action-needed item when a session blocks, and again only if it blocks in a new state.
  • A session a chat drives asks HQ first. When the chat has Drive on, the block wakes the chat and nothing goes to the owner’s inbox: HQ answers the prompt, or asks the owner for approval in its own name. If the prompt is still there after agent_host.driver_grace_minutes (default 5, 0 tells the owner at once), or the chat let go of the session, the owner gets the item after all. A chat that only watches tells the owner at once.
  • An answered prompt leaves the inbox. When a session is no longer blocked, or ends, its waiting “needs an answer” items are retired, however the prompt was cleared.
  • A finished agent alerts once. When the host reports done (the agent finished a turn and is waiting), the supervisor posts the last screen to the relay, so the operator hears about completion without the session having to exit. idle (nothing new happened) does not alert.
  • An unreachable host is not an exit. If the laptop sleeps or leaves the tailnet, its sessions stay running and are left alone. They resume being watched when it answers. harness_session_stop fails for such a session rather than pretending to stop it.
  • A host that stops answering is reported. Once a host with running sessions has been silent for agent_host.unreachable_alert_minutes (default 5, 0 turns it off), the supervisor raises one action-needed item naming the host and its sessions, which reaches the phone and web push like any other. When the host answers again the item leaves the inbox and a notice says it is back, with how long it was gone. A short silence says nothing. The outage is kept in the database (host_outages), so a daemon restart neither repeats the alert nor forgets it, and hq doctor lists hosts that are silent right now.
  • Where to run a long team. A machine that sleeps stops every agent on it. Run long unattended teams on a host that is always on (a desktop or a server), and backend work on the server’s own host where its toolchain allows. On a laptop, agent_host.keep_awake: while_sessions in that machine’s config keeps it awake while an agent runs (see AGENT_HOST.md); a laptop with its lid closed on battery still sleeps.
  • Prompts are confirmed, not just sent. agent prompt writes the text and Enter together, but a TUI that is not listening yet can swallow the Enter and leave the text in its input box. harness_session_send and the initial prompt wait for the agent to start working. If it never does and the pane printed nothing after the echo of the typed text, HQ presses Enter once more and says so in the result. If the pane did print something (an agent HQ has no state rules for, such as Copilot CLI, never reports working), HQ leaves it alone and reports the prompt as stalled, because Copilot sends the last prompt again on an empty Enter. Read the output before resending anything by hand.
  • Copilot gets its first prompt at start. Copilot CLI draws its screen, then reloads its MCP servers and clears whatever was typed meanwhile, so a fresh github-copilot session is started with copilot --interactive=<prompt> instead of having the prompt typed. A resume still types its prompt.
  • Exit summaries use the last screen the supervisor captured while the agent was alive.

A team run from outside

A remote client (a claude.ai connection, a web chat, the owner’s own key) that starts a lead, a builder and a reviewer used to get three unrelated sessions. team: <root session id> on harness_session_spawn and harness_session_handoff starts the new session under that root instead, with everything a delegated worker gets:

  • the team’s roster (team_roster);
  • messages between members (agent_message_send);
  • stop-with-root;
  • the limits in agent_host.teams: depth, children per session, running sessions per team and starts per hour.

Two rules apply to team:

  • The root must be running and must be the team’s root; naming a worker is refused with the root’s id.
  • A claude.ai connection may name only a team it started. An agent inside a session adds workers with agent_delegate, and the handoff key cannot reach a team.

A reviewer joining a team with a task_id and no observe observes the team’s running coding sessions, so their finished turns and commits reach it. Its command policy may not be wider than the root’s.

Moving on to the next step. File each plan step as a sub-task, and move a running session on with harness_session_link to the next one:

  • Its goal moves with it: the new task’s title and description, with its acceptance criteria as the definition of done. Drive reads that, not the launch brief.
  • The reply’s next_message is the one line the session needs: “Continue with : . Its acceptance is on the task." `continue: true` sends it. </li> <li>The task’s description is never pasted into the session.</li> </ul> <p><strong>Decisions a task waits on.</strong> <code>task_decisions</code>, and “Waiting for you” on the task’s page in the web app, list every dialog the task’s sessions and their teams wait on the owner for. Each comes with its question, command or path, and options, for example a command a policy left to you or a question an agent asked. Allow once and Decline there answer through the same route as the phone’s notification buttons, so a dialog that moved on is refused and the answer is recorded with who gave it. The phone’s Helpers screen does the same: <code>GET /api/harness-sessions</code> carries each running session’s open dialog as <code>decision</code> (<code>item_id</code>, <code>seq</code>, <code>options</code>, <code>question</code>), and every screen that answers uses that alert when there is one. Only a helper with no alert, such as one on an older server, is answered by reading its terminal and sending keys.</p> <h2 id="following-sessions-by-events">Following sessions by events</h2> <p>A remote client that drives a team used to read every agent’s screen to learn whether anything changed: about 1.5k tokens a read, a hundred and fifty reads a run. The supervisor now writes what happens to an event log, and <code>harness_session_events</code> reads it as one stream.</p> <ul> <li><strong>Kinds:</strong> <ul> <li><code>blocked</code>: with the dialog when HQ can read it (its number, kind, question, command and options, the text capped at 300 characters).</li> <li><code>question</code>: the agent asks the owner something.</li> <li><code>unblocked</code>: with how long it waited.</li> <li><code>finished</code> and <code>exited</code>.</li> <li><code>commit</code>: sha, subject and branch (see “Agents that share a repository”).</li> <li><code>policy_decision</code> and <code>escalation</code>: what a command policy decided, and what it left to the owner and why.</li> <li><code>host_unreachable</code> and <code>host_back</code>: on each session of a host that stopped answering.</li> <li><code>policy</code>, <code>goal</code> and <code>drive</code>: written when a session starts or changes.</li> </ul> </li> <li><strong>Scope:</strong> <code>session_ids</code>, a <code>task_id</code> (the sessions working on it and their teams), or a <code>team</code> (a root session id). None reads every session the caller may see.</li> <li><strong>Cursor:</strong> each reply has <code>next</code>. Pass it as <code>after</code> and the reply holds only what came since, oldest first, at most <code>limit</code> (50 by default) with <code>more</code> when there is more. Without <code>after</code> the reply holds the newest events and a cursor.</li> <li><strong>Waiting:</strong> <code>wait_secs</code> (at most 45, under an MCP client’s 60 second limit) holds the call until the first new event, so a client loops on one call instead of polling screens. Every waiting call shares one feed that checks for a new event about once a second, so many watchers cost no more than one, and nothing polls while nobody waits.</li> <li><strong>Who sees what:</strong> the owner sees every session, a claude.ai connection the teams it started, and an agent with its own session token its own team. Naming a session outside that is refused.</li> <li><strong>Untrusted:</strong> dialog text is the agent’s own output, so reading events counts as reading untrusted content, the same as <code>harness_session_logs</code>.</li> </ul> <p><strong>The numbers.</strong> <code>harness_session_stats</code> (or <code>hq sessions stats [<root session id>] [--task <id>]</code>) reads the same log into counts and times: dialogs and who answered them, how long they waited (median, 90th percentile, longest, total), the command policy’s allows, denies and escalations, host outages, and finished turns, commits and exits. It quotes no dialog text.</p> <p><strong>From a cloud client, read-only (opt-in).</strong> A client somewhere else (a cloud session, a CI job) can follow a team without any key that could change it. Set <code>AGENTHQ_SPARK_API_KEY</code> on the server (unset, <code>/mcp</code> refuses it), give the client that key and HQ’s <code>/mcp</code> URL, and have it loop on one call:</p> <pre tabindex="0"><code class="language-json">{"tool": "harness_session_events", "args": {"team": "<root session id>", "after": 0, "wait_secs": 40}} </code></pre> <p>sent through <code>hq_call</code> with <code>Authorization: Bearer <spark key></code>. Each reply’s <code>next</code> is the next call’s <code>after</code>. The Spark scope reads sessions, logs and events and nothing else: it cannot answer, send, start or stop a session. Answering stays with the owner’s phone, the web app, or a full key.</p> <h3 id="reacting-without-polling-per-client">Reacting without polling, per client</h3> <p>Each kind of agent hears about other sessions in the way it can take it:</p> <div class="table-scroll" role="region" aria-label="Table" tabindex="0"><table> <thead> <tr> <th>Client</th> <th>How it hears</th> <th>Limits</th> </tr> </thead> <tbody> <tr> <td>An agent HQ runs (Claude Code, Copilot, agy, pi, Codex and the rest)</td> <td><code>harness_session_subscribe</code> (or <code>observe</code> at spawn): a message typed in at its next idle</td> <td>Needs a task; at most 10 sessions; chains stop after three rounds</td> </tr> <tr> <td>Claude Code in a terminal, outside HQ</td> <td><code>hq sessions channel</code> as a channel: an idle session wakes on each event</td> <td>Claude Code’s channels are a research preview, terminal only</td> </tr> <tr> <td>Claude Code’s Monitor tool, Codex, scripts, any background shell</td> <td><code>hq sessions watch</code>: one JSON line per event</td> <td>A Monitor watch lasts at most 30 minutes: use <code>--until</code> and start it again</td> </tr> <tr> <td>Claude Desktop and other MCP chats</td> <td>Loop on <code>harness_session_events</code> with <code>wait_secs</code></td> <td>One model turn per wait; no way to push into the chat</td> </tr> </tbody> </table></div> <p><code>hq sessions watch</code> follows this machine’s HQ, or a paired one with <code>--remote <name></code> (the <code>remote_mcp</code> name, such as the hub a bridge pairing added). It starts from now (or <code>--after <event id></code>), prints only <code>--kinds</code> when given, and exits after the first event in <code>--until</code>:</p> <pre tabindex="0"><code>hq sessions watch --remote server --session hs-pi-1a2b3c --until finished --until blocked hq sessions watch --task FR-053 --kinds blocked --kinds exited </code></pre> <p><code>hq sessions channel</code> takes the same flags and is a stdio MCP server that declares <code>claude/channel</code>. Each event reaches Claude as <code><channel source="hq-sessions" session_id="..." kind="..."></code> with only the session id, the kind and the event id, never text an agent wrote; Claude reads the rest with <code>harness_session_events</code> or <code>harness_session_logs</code>. While channels are in preview, Claude Code loads a server it did not ship only with the development flag, and only from an MCP config file (a project <code>.mcp.json</code> or user settings), not from <code>--mcp-config</code>:</p> <pre tabindex="0"><code class="language-json">{"mcpServers": {"hq-sessions": {"type": "stdio", "command": "hq", "args": ["sessions", "channel", "--remote", "server", "--task", "FR-053"]}}} </code></pre> <pre tabindex="0"><code>claude --dangerously-load-development-channels server:hq-sessions </code></pre> <h2 id="command-policies">Command policies</h2> <p>A coding agent that asks before every command waits on whoever is there to answer, and one that asks nothing can push, wipe a tree or print its environment. A <strong>command policy</strong> sits between: commands it allows go ahead, commands it denies are refused, and only the rest reach the owner. Policy is code. A model never approves a command.</p> <pre tabindex="0"><code class="language-yaml">agent_host: command_policies: builder: # replaces the built-in builder allow: ["git status", "git add", "git commit", "cargo test", "pnpm codegen"] deny: ["git push", "git stash", "git reset --hard", "rm -r", "env", "pnpm deploy"] otherwise: escalate # escalate | allow | deny scripts: escalate # escalate | allow careful: extends: builder allow_remove: ["cargo test"] deny: ["cargo publish"] </code></pre> <ul> <li><strong>Which one.</strong> <code>harness_session_spawn</code>, <code>harness_session_handoff</code>, <code>agent_delegate</code> and <code>hq sessions spawn --policy</code> take <code>policy</code>. Without one, a coding session gets <code>builder</code> and a review gets <code>reviewer</code>; monitors, researchers and general-purpose agents get none, and <code>policy: none</code> asks for none (every dialog goes to the owner, as before). The built-ins are generic: <code>builder</code> allows reading the tree, local git and common build and test commands, and denies <code>git push</code>, <code>git stash</code>, <code>git reset --hard</code>, <code>git clean</code>, <code>git checkout --</code>, <code>git restore</code>, <code>rm -r</code>, <code>env</code> and <code>printenv</code>; <code>reviewer</code> extends it and may also <code>git checkout --detach</code> and <code>git push</code>, never with <code>--force</code>, <code>-f</code>, <code>--force-with-lease</code>, <code>--mirror</code> or <code>--delete</code>. An entry of the same name in your config replaces a built-in. A session started by another session may run only under a policy no wider than its starter’s. The policy is resolved and stored with the session at launch (a <code>policy</code> event), so editing the config later changes new sessions, not running ones; a resume keeps it.</li> <li><strong>Matching.</strong> A command line is split at <code>&&</code>, <code>||</code>, <code>;</code>, <code>|</code> and <code>&</code>, and is allowed only when every command in it is; a deny anywhere wins. A pattern names a command’s leading words (<code>git push</code>) and flags that may appear anywhere after them (<code>git push --force</code> also catches <code>git push origin main --force</code>; <code>rm -r</code> also catches <code>rm -rf</code>). Git’s own options before the subcommand (<code>git -C dir push</code>) do not hide it, and wrappers (<code>env X=1</code>, <code>nohup</code>, <code>timeout</code>, <code>sudo</code>) are looked through; <code>sudo</code> always goes to the owner. Command substitution, <code>eval</code>, a heredoc and inline interpreter code (<code>sh -c</code>, <code>python3 -c</code>, <code>node -e</code>) go to the owner unless the policy sets <code>scripts: allow</code>. Edits and paths inside the session’s folder or worktree are allowed; anything outside goes to the owner. Relative paths in path dialogs resolve against the directory the shell command cd’d into when that directory is inside the session’s folder, else against the session folder.</li> <li><strong>At launch.</strong> Copilot starts with every tool allowed (<code>--allow-all-tools</code>) and the policy’s denies as <code>--deny-tool=shell(...)</code>. Its rules name a command and subcommand but no flags, so a deny with a flag becomes the whole command (<code>git reset --hard</code> denies <code>git reset</code>), unless the policy allows that command (the reviewer’s <code>git push</code>), when it is left to the dialogs. Claude Code keeps its permission bypass and gets a <code>PreToolUse</code> hook on its shell tool that refuses what the policy denies (see <a href="/docs/agent-host/">AGENT_HOST.md</a>). For both, <code>otherwise</code> and escalations apply only to the dialogs they still show: they do not ask before other commands.</li> <li><strong>In the supervisor.</strong> When a session with a policy blocks at a command, edit or path dialog HQ can read, the policy decides. Allowed: HQ picks the one-time yes (never a “remember” option). Denied: HQ declines and tells the agent which rule. Anything else becomes the usual “waiting for you” alert, with a line saying why the policy left it to you. An answer that does not take raises the alert after all. Questions and trust dialogs always go to the owner. Each decision is a <code>policy_decision</code> event (command, decision, rule, outcome), and the task gets one summary line when the session finishes a turn or exits: how many commands the policy allowed, declined (by rule) and left to you since the last one.</li> <li><strong>Drive</strong> does not answer a command dialog of a session with a policy: the policy decided it, and what it left open is the owner’s. A remote client may still answer an escalation.</li> </ul> <h3 id="what-actually-stops-each-deny">What actually stops each deny</h3> <p>A deny guards against a slip. What stops the action for certain is the agent not having what it needs to do it:</p> <div class="table-scroll" role="region" aria-label="Table" tabindex="0"><table> <thead> <tr> <th>Deny</th> <th>What stops it for certain</th> </tr> </thead> <tbody> <tr> <td><code>git push</code></td> <td>The builder holds no git credential: the sandbox hides the credential stores (<code>agent_host.sandbox.hide_credentials</code>, on by default) and HQ passes no token. Give push rights only to a reviewer’s profile, through a harness profile’s <code>env</code>.</td> </tr> <tr> <td>A deploy, a migration on a shared database</td> <td>The deploy key lives only in the owner’s or the reviewer’s environment (a harness profile’s <code>env</code>), never the builder’s.</td> </tr> <tr> <td><code>git stash</code>, <code>git reset --hard</code>, <code>git clean</code>, <code>git checkout --</code>, <code>git restore</code></td> <td>A worktree per writer (see below): another agent’s changes are not in the tree these act on.</td> </tr> <tr> <td><code>rm -r</code></td> <td>A worktree, and commits: what was committed comes back from git.</td> </tr> <tr> <td><code>env</code>, <code>printenv</code></td> <td>The sandbox’s allowlisted environment: HQ’s own tokens and other agents’ environments are not in it.</td> </tr> </tbody> </table></div> <h2 id="agents-that-share-a-repository">Agents that share a repository</h2> <p>Two agents editing one working tree overwrite each other, and one running <code>git stash</code> or <code>git checkout</code> takes the other’s changes with it. HQ keeps writers apart:</p> <ul> <li><strong>A worktree of its own.</strong> <code>harness_session_spawn</code>, <code>harness_session_handoff</code>, <code>hq sessions spawn --branch <name></code> and the web’s New agent dialog (“Its own branch”) take <code>worktree</code>: <ul> <li> <p><code>{"branch": "<name>"}</code> for a writer. The host makes a git worktree of the folder’s repository at <code><HQ folder>/worktrees/<repository>/<session></code>, on that branch (made from the folder’s current commit if it does not exist), and the agent starts there. A branch checked out in another worktree is refused, so a branch has one writer.</p> </li> <li> <p><code>{"branch": "<name>", "from": "<ref>"}</code> makes a new branch at that ref instead of the folder’s current commit (<code>hq sessions spawn --branch <name> --from <ref></code>). <code>from</code> is ignored when the branch exists, and it is refused with <code>detached</code>, which is already at its commit. Use it to start a worker at its lead’s branch.</p> </li> <li> <p><code>{"detached": "<commit or ref>"}</code> for a reviewer, which gets that commit checked out detached.</p> </li> <li> <p>The worktree counts as approved because it comes from a folder that already is. The reply has <code>worktree</code> (<code>path</code>, <code>repo</code>, <code>branch</code> or <code>detached</code>, <code>head</code>, and <code>from</code>, <code>copied</code> and <code>not_copied</code> when they apply).</p> </li> <li> <p><strong>Files git ignores.</strong> A new worktree has none of the repository’s untracked, ignored files (<code>.env</code>, <code>node_modules</code>). A <code>.worktreeinclude</code> file at the repository root names the ones to bring along, in gitignore syntax:</p> <pre tabindex="0"><code>.env .env.local node_modules/ target/ </code></pre> <p>Only paths the file names and git ignores are copied, up to 500 paths, from the folder the session was started in. They are copy-on-write clones on APFS, btrfs and XFS, and plain copies elsewhere. The worktree’s own <code>.worktreeinclude</code> (the one at the commit it starts from) is read first, then the folder’s, which may be untracked. A path the worktree already has is left alone. Copying happens when the worktree is created, not on a retry or a resume that finds it again. What was copied is in <code>worktree.copied</code>; paths that could not be are in <code>worktree.not_copied</code>, and a failure never fails the launch.</p> </li> <li> <p><strong>A port per session.</strong> Every session’s environment has <code>HQ_PORT</code>, a number from 20000 to 29999 worked out from the session id, so two agents’ dev servers do not collide. A restart gets the same one.</p> </li> <li> <p><strong>Where it stands.</strong> <code>harness_session_status</code> reports <code>worktree_status</code> (<code>changed</code> files, <code>ahead</code> and <code>behind</code> the commit the session started at, <code>branch</code>, <code>head</code>) for a session with a worktree still in place. If the host cannot say, the reply has <code>worktree_status_error</code> instead. <code>harness_session_list</code> does the same for running sessions when passed <code>worktree_status: true</code>, with one host call per session; without it the list makes none.</p> </li> <li> <p><code>agent_delegate</code> takes <code>worktree: true</code> for a branch named for the worker’s sub-task (<code>hq/<task id></code>), or the same object.</p> </li> </ul> </li> <li><strong>Or paths it owns.</strong> Without a worktree, a coding session (<code>purpose: code</code>) in a folder another running coding session writes in is refused unless both name <code>owns</code> paths (relative to the folder) that do not overlap. No <code>owns</code> means the whole folder. Not counted: a reviewer, monitor or researcher, the new session’s own parent (it delegated the work and waits on it), and a session the host no longer has.</li> <li><strong>A reviewer sees commits, not a moving tree.</strong> When a writer finishes a turn, the supervisor reads the commit its folder is at. A new one is named in the finished alert, in the message to whoever delegated it and to the sessions observing it (“committed <sha> "subject" on branch <b>”), and recorded as a <code>commit</code> event. A reviewer then checks out that sha detached in its own worktree, so it reviews exactly what was committed.</li> <li><strong>Cleanup.</strong> At <code>harness_session_stop</code>, or when the agent exits, a worktree with nothing uncommitted is removed; one with changes is kept and the reply or the exit message says where. The branch keeps every commit either way. <code>harness_session_resume</code> makes the worktree again on its branch, or finds it where it was kept.</li> </ul> <h2 id="sessions-that-work-on-a-task">Sessions that work on a task</h2> <p><code>harness_session_spawn</code> takes an optional <code>task_id</code> (an id or a display id such as <code>FR-053</code>). The task is then the durable record of the work, stored in the session’s <code>mission_id</code>, and <code>harness_session_list</code> with <code>task_id</code> shows every session launched for it. The task must exist and not be complete, and that is checked before anything is launched. <code>harness_session_link</code> attaches a session that was started without <code>task_id</code>; linking a running session counts as a launch in the table below, and linking one that already ended only records the link. Each event leaves a comment on the task, and the web Tasks view picks it up at once. Comments never quote the agent’s screen: pane text is untrusted input, and task comments are read back as trusted, so they point at <code>harness_session_logs</code> instead. Status moves only from the states listed here, and the supervisor never sets <code>complete</code>: the agent saying it is done is not verification. With <code>tasks.verification</code> off, the owner decides. With it enforced, HQ’s verifier completes a task only from evidence the session could not write (a merged pull request with green required checks, a note’s content hash, a probed URL) and sends it back to the agent with the findings when that evidence is missing or says otherwise (<code>docs/TASK_VERIFICATION.md</code>).</p> <div class="table-scroll" role="region" aria-label="Table" tabindex="0"><table> <thead> <tr> <th>Event</th> <th>Task status</th> <th>Notification</th> </tr> </thead> <tbody> <tr> <td>Launched or resumed</td> <td><code>to_do</code>, <code>blocked</code> or <code>ready_for_review</code> becomes <code>in_progress</code></td> <td>none; the reply to the launch says it</td> </tr> <tr> <td>New instruction sent</td> <td>same as launch; commented only when the status moved</td> <td>none</td> </tr> <tr> <td>Working or idle, every sweep</td> <td>unchanged, no comment</td> <td>none</td> </tr> <tr> <td>Blocked on a dialog</td> <td>unchanged, comment</td> <td>action-needed item, sent by the next value-bus run (every 5 minutes)</td> </tr> <tr> <td>Finished a turn (<code>done</code>)</td> <td><code>in_progress</code> becomes <code>ready_for_review</code></td> <td>relay message, batched with other updates</td> </tr> <tr> <td>Exited while no other session of the task is running</td> <td><code>in_progress</code> becomes <code>blocked</code></td> <td>relay message sent as an interrupt</td> </tr> <tr> <td>Exited while another session of the task still runs</td> <td>unchanged</td> <td>relay message, batched</td> </tr> <tr> <td>Stopped by hand</td> <td>unchanged</td> <td>none</td> </tr> </tbody> </table></div> <p>Each event is recorded right after the registry claim that makes it happen once (<code>claim_state_alert</code>, or the running-to-exited update), and before the exit summary, so the recorded event survives a daemon restart or a sweep cut off at its timeout. It is recorded only once.</p> <p>Offline behavior:</p> <ul> <li><strong>Laptop asleep or off the tailnet.</strong> No event is produced and the task does not move. A session on that host still counts as running, so another session’s exit does not block the task. When the host answers again, whatever happened meanwhile is reported on the next sweep. A <code>done</code> that was followed by an exit while the host was away shows up as the exit.</li> <li><strong>Daemon down.</strong> Nothing is watched. On start the supervisor sweeps within a minute and reports anything that changed, once.</li> <li><strong>No chat to push to.</strong> Interrupts and value-bus items wait in the relay’s pending queue until a chat is known. Batched updates are dropped, but the task comments still hold them.</li> </ul> <p>A session whose <code>mission_id</code> matches no task is treated as having none. Rows written by the retired mission engine are like that.</p> <h2 id="handing-work-over-from-outside-harness_session_handoff">Handing work over from outside (<code>harness_session_handoff</code>)</h2> <p>A client that is not a web chat (an MCP client such as another agent) can start tracked work in one call. <code>harness_session_handoff</code> takes <code>title</code>, <code>description</code>, <code>acceptance</code> (alias <code>done_criteria</code>), <code>harness</code>, <code>cwd</code>, optional <code>host</code> (default local), <code>external_id</code>, <code>task_id</code>, <code>prompt</code>, <code>space_id</code>, <code>initiative</code> and <code>drive</code>. It then:</p> <ol> <li>Files an HQ task (acceptance criteria are appended to its description), or reuses the one <code>external_id</code> already names in that space, or works on <code>task_id</code>. The two are alternatives.</li> <li>Starts one session linked to the task, with the task as its goal and <code>acceptance</code> as its definition of done. With no <code>prompt</code>, the agent is told the task title, description and acceptance.</li> <li>Creates a web chat thread that owns the session (<code>owner_thread</code>), so ready-for-review, blocked and exited notices post there and Drive follows the usual gate and <code>agent_host.drive_new_watches</code> (pass <code>drive: false</code> to opt out).</li> </ol> <p>The result carries the task id and display id, session id, thread id and <code>links.chat</code> (<code>/chat?thread=<id></code>) and <code>links.task</code> (<code>/tasks?task=<id></code>), and <code>handoff</code> says what happened: <code>started</code>, <code>blocked_at_dialog</code> (the agent stopped at a dialog, so the prompt was not typed and nothing is running yet; answer with <code>harness_session_send</code> keys) or <code>existing_session</code>.</p> <p>It is idempotent. The same <code>external_id</code> returns the same task (<code>task.deduplicated: true</code>), and a task that already has a session its host still reports as running gets no second one. A session marked running that its host no longer lists is stale and does not block a new one. A host that cannot be reached when the task already has a running session is reported as unknown, and no second session starts. If the launch fails (host unreachable, binary missing, agent never started) the call errors, the unused thread is archived, no session row is written, and the task stays so a retry reuses it. If the agent stops at a startup dialog instead, the session stays registered and the task is set to <code>blocked</code> with a comment saying so (the comment does not quote the pane, which is untrusted); the next instruction sent to the session moves it back to <code>in_progress</code>. The check and the launch share one process-wide lock; two separate <code>hq</code> processes sharing a database could still both start a session.</p> <h3 id="launch-bounds-preflight-and-disconnects">Launch bounds, preflight and disconnects</h3> <p>A harness that cannot start used to leave the call waiting past an MCP client’s roughly 60 second transport limit, with an orphan pane behind it. Now:</p> <ul> <li><strong>Preflight (local hosts, conservative).</strong> Before anything is launched, HQ looks for the harness binary (<code>claude</code>, <code>agy</code>, <code>cursor-agent</code>, … or the first word of a profile’s <code>command</code>). It only does so when that word is a plain program name or an absolute path with no spaces, and the command has no <code>=</code>, <code>$</code>, <code>~</code>, quote, <code>&</code>, <code>;</code>, <code>|</code>, <code><</code>, <code>></code>, backtick or parenthesis. An env prefix (<code>CLAUDE_CONFIG_DIR=x claude</code>), <code>cd x && claude</code>, a quoted path or a <code>$VAR</code> is left to the shell and never blocks a launch. Search roots: the profile’s <code>PATH</code> entries (literal <code>$PATH</code> and <code>~</code> entries skipped), then HQ’s own <code>PATH</code> (never replaced), then <code>~/.local/bin</code>, <code>~/.bun/bin</code>, <code>~/.cargo/bin</code>, <code>~/.npm-global/bin</code>, <code>~/.volta/bin</code>, <code>~/.local/share/mise/shims</code>, <code>~/.asdf/shims</code>, <code>~/.local/share/pnpm</code>, <code>~/.claude/local</code>, <code>~/.nvm/versions/node/*/bin</code>, <code>/usr/local/bin</code> and <code>/opt/homebrew/bin</code>. A miss fails at once with <code>harness 'claude-code' is not installed on host 'local' (binary 'claude' not found on PATH; searched ...)</code>, listing the roots. Remote hosts are not preflighted: the gate does not expose their filesystem.</li> <li><strong>Bounded start.</strong> The wait for the agent to leave <code>launch_pending</code> is <code>agent_host.launch_bound_secs</code> (default 25, clamped to 5..=50 so it stays under the transport limit). If the last poll still shows <code>launch_pending</code> with an <code>unknown</code> status, or no agent, HQ reads the pane’s last lines, closes the host workspace and fails with the host, the harness, what the host reported and those lines. An agent whose last poll shows <code>launch_pending: false</code> is never closed. No row is written, so no session claims to be running. Any other failure between the workspace being created and the row being recorded (the agent lookup, the database write) also closes the workspace; if the close fails the error says so and names the workspace.</li> <li><strong>One launch per agent.</strong> A second launch of the same agent name on the same host (a resume retried while the first is still waiting) is refused with “already in progress”.</li> <li><strong>Disconnects.</strong> <code>harness_session_handoff</code> and every launch (spawn, resume) run on their own task, so a client that drops the connection cannot skip the cleanup or leave a thread, a workspace or the process-wide lock behind. The bound above is what makes a real error likely to arrive before the client gives up. The one launch step that can still outlast the limit is accepting a vouched trust dialog (Antigravity), which waits up to 120 seconds.</li> </ul> <p><code>task_create</code> takes the same <code>external_id</code>: unique per space, 200 characters at most, a repeat returns the existing task with <code>deduplicated: true</code>. The REST <code>POST /api/tasks</code> accepts it too.</p> <h4 id="spawn-limits-outside-a-team">Spawn limits outside a team</h4> <p>A <code>harness_session_spawn</code> that names no team used to skip every limit. It now checks <code>agent_host.spawn_limits</code> before anything starts, and holds a lock until the start finishes, so two simultaneous starts cannot both pass the cap. Sessions inside a team keep the <code>agent_host.teams</code> limits.</p> <ul> <li><code>max_live_sessions</code> (default 12, clamped to 1..=500): running sessions that have no parent and whose agent is active (working, blocked, or not yet seen by a sweep). Sessions sitting idle or done do not count, so a host that keeps many idle sessions open is not locked out.</li> <li><code>max_spawns_per_hour</code> (default 60, clamped to 1..=6000): sessions with no parent started in the last 60 minutes, running or ended.</li> <li><code>max_live_per_harness</code> (default empty, each value clamped to 1..=500): a live cap per harness (lane), counted like <code>max_live_sessions</code>, for example <code>{copilot-lean: 3, agy: 20}</code>. A start on a full lane is refused with an error that says the lane is full, so a driving agent can route the work to another lane. A harness that is not listed has no cap of its own. The cap applies to the harness the caller named, before any quota fallback to another lane.</li> <li><code>count_harness_in_global</code> (default false): global budgets leave harness spend out of their sum. Set this to true to make a used-up hard global budget stop starts too. An <code>origin:harness</code> budget is always checked.</li> </ul> <p>A start is also refused when a hard (<code>action: block</code>) budget that covers harness spend is used up. The error names the budget and the time it resets. Soft budgets (<code>notify</code>, <code>downgrade</code>) never stop a start. Each refusal files one inbox item (an FYI) per limit and period: per hour for the two caps, per budget period for a budget, so a loop retrying a refused start does not flood the inbox.</p> <h3 id="refusing-working-directories">Refusing working directories</h3> <p>Every <code>cwd</code> must be an absolute path with no <code>..</code> component and none of <code>~</code>, <code>$</code>, a backtick or NUL, so the string that was checked is the string the host receives.</p> <p>A <code>cwd</code> shaped like a home directory is refused whichever host the session runs on, because the agent stops at its folder-trust dialog there and nobody is watching: <code>/</code>, <code>/Users/<name></code>, <code>/home/<name></code>, <code>/root</code>, <code>/var/root</code>, <code>/opt/hq</code>, the bare <code>/Users</code> and <code>/home</code>, and HQ’s own <code>$HOME</code>. Trailing and doubled slashes and letter case do not get past it. There is no per-host home setting yet, so a home that is not shaped like one of these (say <code>/data/me</code>) is only caught through <code>agent_host.spawn_cwd_deny</code>.</p> <p><code>agent_host.spawn_cwd_deny</code> is a list of path fragments. A <code>cwd</code> that contains any entry (case-insensitive, trailing and doubled slashes ignored on both sides) is refused by <code>harness_session_spawn</code>, <code>harness_session_handoff</code>, <code>harness_session_resume</code> and <code>hq sessions spawn</code>, with an error naming the entry. It is empty by default. The match is on the path as written, so a symlink into a denied directory is not caught, and a remote host’s paths are matched as text.</p> <pre tabindex="0"><code class="language-yaml">agent_host: spawn_cwd_deny: - /clients/acme - /private handoff_cwd_allow: # empty means the handoff key is unrestricted - /srv/projects </code></pre> <h3 id="scoping-an-mcp-client">Scoping an MCP client</h3> <p>Give an external client <code>AGENTHQ_HANDOFF_API_KEY</code> instead of the full key. It reaches the read tools (except <code>harness_session_logs</code>) plus <code>task_create</code>, <code>task_update</code>, <code>task_comment_add</code>, <code>harness_session_spawn</code> and <code>harness_session_handoff</code> (see <code>docs/security/WEB_AUTH.md</code>). It cannot stop, resume, relink, re-goal, send to or read the output of sessions, delete tasks or write the vault. Send and logs are withheld because the registry does not record which key started a session. It can also ask HQ’s own chat agent a read-only question with <code>hq_ask</code> (see <code>docs/MCP_ASK.md</code>), which is not a harness session. That reply’s session has the session-log, the host and file-reading tools removed, so the key cannot read through HQ what it cannot call.</p> <p><strong>This key is code-execution equivalent.</strong> A spawned <code>claude-code</code> session runs with permissions skipped, on any host and <code>cwd</code> the deny list allows. Set <code>agent_host.handoff_cwd_allow</code> to the directories the client may use: a call that arrived on the handoff key must then have a <code>cwd</code> in or under one of them (the gateway marks those calls, a client cannot set the marker). Left empty, treat the key as shell access to those hosts as described under “Security model”.</p> <h3 id="folders-the-owner-approves">Folders the owner approves</h3> <p>A claude.ai connector, or the handoff key while <code>handoff_cwd_allow</code> lists anything, that asks for a <code>cwd</code> outside its folders does not get a dead end. HQ files an approval request for that folder on that host (your chat, the web inbox and a push notification), and the spawn or handoff call waits for your answer:</p> <ul> <li>Approve within the wait and the session starts in that same call. The folder, with everything under it, is then allowed on that host until you revoke it.</li> <li>Dismiss and the call fails at once saying you declined. The caller is not asked again until the request expires (24 hours).</li> <li>No answer within the wait and the call fails with an error that starts <code>BLOCKED: no session was started</code>, telling the caller to say it is waiting on you and to call again with the same arguments. Each call waits again, so a caller that keeps calling starts the session as soon as you approve. Nothing about the error reads as a started session.</li> </ul> <p>The wait is 55 seconds less <code>launch_bound_secs</code>, at most 30 seconds, so the launch that follows an approval still finishes inside an MCP client’s one-minute limit. One caller may have at most 5 requests waiting. Home and root folders and anything <code>spawn_cwd_deny</code> matches are refused before any request is made.</p> <p>Approving is an owner action (the chat button, the web inbox or <code>hq queue approve</code>, all signed with the install key); no MCP key reaches it. The live grants are listed at <code>GET /api/session-folders</code> and revoked with <code>DELETE /api/session-folders/<id></code>, both behind the web credential.</p> <p>Keys sent to a session (<code>keys</code> on <code>harness_session_send</code>, <code>host_send</code> and the REST endpoint) must be logical names matching <code>^[A-Za-z0-9][A-Za-z0-9+_-]*$</code>, at most 32 characters, so a key can never be read as a host flag.</p> <h2 id="watching-and-driving-from-a-web-chat">Watching and driving from a web chat</h2> <p>A session launched or linked from a web chat is watched by that chat (<code>owner_thread</code>), and <code>harness_session_watch(session_id)</code> makes a chat watch any session. The chat header shows “Watching N”, with each session’s task, live agent status and a Drive switch (<code>/api/threads/{id}/sessions</code>, <code>/api/harness-sessions/{id}/drive</code>, <code>.../unwatch</code>). On a phone the same panel shows under the chat header with 44px controls, and the button counts the sessions waiting on an answer.</p> <p>A session no chat watched starts with Drive on (<code>agent_host.drive_new_watches</code>, default true) when it passes the goal gate below; without a usable goal it starts observation-only. Spawn, link and watch take <code>drive=false</code> to start with updates only, and on a session the chat already drives it stops driving. Every other case starts or stays off, so a tool can never turn Drive back on once the user switched it off:</p> <ul> <li>A chat watching a session again keeps its switch where the user left it.</li> <li>A session taken over from another chat starts with Drive off.</li> <li>A turn the owner typed that has read untrusted content (pane text, the web, mail, vault notes) still starts its new watches with Drive on when the gate passes. This is an accepted prompt-injection risk, by the owner’s decision: HQ is meant to drive a session to its goal and ask the owner only for key decisions. <code>agent_host.drive_after_untrusted_reads: false</code> restores the old rule, where governance marks those calls (<code>untrusted_turn</code>) and such a turn starts its watches with Drive off and can only give Drive up. The goal, the 48-turns-a-day cap, the nudge and loop limits and the driver’s ask-in-chat rules do not change, and Drive never marks a task complete. Changing a session’s goal from such a turn stays refused.</li> <li>Every Drive-on HQ chooses (a watch that starts driving, or <code>harness_session_mode</code>) records a <code>drive_on</code> event with actor <code>hq</code> and posts one fixed-text notice in the chat, so the owner can see it and switch it off in the Watching panel.</li> <li>A turn the session driver started never starts a new watch driving.</li> <li>A turn in a chat that <code>hq_ask</code> opened never starts a new watch driving, and neither does a handoff made from one.</li> <li><code>drive=true</code> on spawn, link and watch is refused. The one way for HQ to turn Drive on is <code>harness_session_mode</code> (below), which the gate and an untrusted turn both override.</li> </ul> <p>Sessions already watched when this default shipped keep their stored switch; nothing is backfilled.</p> <p>A watched session sends nothing to Telegram, Discord or the value bus. The supervisor turns each finished turn, block and exit into a durable wake on the row (<code>pm_wake</code>), and the web server’s session driver (<code>crates/hq-web/src/session_driver.rs</code>) answers it in the chat:</p> <ul> <li><strong>Watching only.</strong> A short update names the session, what happened and where its task stands. It never quotes the screen.</li> <li><strong>Driving.</strong> HQ runs a turn in the chat as the session’s project manager: it reads the session, then sends the next instruction, approves a permission prompt, resumes an exited session, or leaves a working one alone, all toward the linked task’s goal. It asks you in the chat instead of acting when the step is outside the task, destructive, touches credentials, deploys to production unless the task says so, or spends money. It never marks the task complete. A driven session also gets a check-in every <code>agent_host.driver_checkin_minutes</code> (default 30) while it runs and its host answers, to catch an agent that is stuck. After 48 driver turns in a day a session drops back to updates. A chat that is archived or deleted lets go of its sessions, whose events return to the relay. The limits in “Limits on driving” below stop a session that keeps being nudged. These turns are ordinary chat replies tagged with the session, so their tool calls show exactly what HQ sent. Stop ends one like any reply.</li> </ul> <p>A wake is claimed before it is acted on, and a chat with a reply already running is retried on the next pass (every minute, or at once when the supervisor writes a wake in the same process). If the web server is not running, wakes wait on the row. Driving approves prompts after reading pane text, which can carry instructions planted by content the agent read; turn it on only for sessions whose work you would approve yourself.</p> <h3 id="slots-passes-and-the-fleet-roll-up">Slots, passes and the fleet roll-up</h3> <p>A pass of the driver runs every minute, whenever the supervisor writes a wake in the same process, and whenever any chat turn ends. A wake that arrived while its chat was mid-reply is therefore answered when that reply ends, not up to a minute later. The turn map still decides who starts a turn, so a pass cannot start a second one in a busy chat.</p> <p>Each pass also tidies the slots counted by <code>agent_host.max_driven_sessions</code>: a driven session that has reported idle or done with nothing happening for <code>agent_host.driver_idle_release_minutes</code> has Drive switched off (the chat gets one notice and the reason shows in the panel), and then the oldest observe-only session with a goal that passes the drive gate takes any free slot. Only a session the cap itself held back (a default-on watch that started observing, <code>drive_off_reason</code> starting “HQ already drives”) is promoted: one you switched off by hand, one an MCP client, an <code>hq_ask</code> or a connector started, and one released for idleness stay as they are. A session another chat drives is never touched. A slot also frees when a driven session exits, or when a guard or the task ending switches its Drive off.</p> <p><code>harness_fleet_status</code> (read-only) answers “what needs me” in one small reply when many sessions run: counts by registry status and by live agent status, the blocked sessions (at most 10, longest wait first, with the dialog kind and number for <code>harness_session_pending</code>, the task and the team root), the driven sessions against the cap (at most 20 named), and <code>list_hides</code>, the number of rows <code>harness_session_list</code> leaves out past its 50. <code>harness_session_wait</code> still takes at most 10 sessions at once; use the roll-up to pick which.</p> <h3 id="limits-on-driving">Limits on driving</h3> <p>What wakes a driven turn: a finished turn, a block or an exit that the supervisor turns into a wake (<code>pm_wake</code>), and a check-in every <code>agent_host.driver_checkin_minutes</code> while the session runs. What used to stop it: the model deciding the goal was met, and 48 driver turns a day. A model that judges an unreachable definition of done (a physical-device test, say) as unmet kept sending another wrap-up instruction, each answered by a finished turn that woke it again. These limits do not depend on the model deciding to stop. Each one switches Drive off, posts one notice in the chat (fixed text, never pane text), records a <code>drive_off</code> event with actor <code>guard</code> in <code>harness_session_events</code>, comments on the linked task, and keeps the reason on the row (<code>drive_off_reason</code>, in the sessions payload and shown under the Drive switch):</p> <div class="table-scroll" role="region" aria-label="Table" tabindex="0"><table> <thead> <tr> <th>Limit</th> <th>Default</th> <th>Setting</th> </tr> </thead> <tbody> <tr> <td>Instructions (text prompts and resume prompts) the driver sends one session, counted since the user last switched Drive on. Claimed in one conditional write before the send, so parallel calls cannot overshoot, and handed back if the send fails. <code>harness_session_send</code> and <code>harness_session_resume</code> in a driver turn refuse past it, and <code>host_send</code> is removed from driver turns so it cannot go around it</td> <td>8 (1 to 100)</td> <td><code>agent_host.driver_nudge_budget</code></td> </tr> <tr> <td>Key presses (permission dialogs, menus) the driver sends one session, on the same terms but a separate, larger allowance so a task with many dialogs is not cut off</td> <td>40 (1 to 500)</td> <td><code>agent_host.driver_key_allowance</code></td> </tr> <tr> <td>Finished turns in a row that show no new tool activity on the screen the supervisor stored (<code>Bash(...)</code>, <code>Update(...)</code>, <code>Ran ...</code> lines). A tool line the last turn did not show, or one shown more times, counts as work, so re-running a test is not a stall. A finished turn that follows something other than a driver instruction (you typing in the chat) is not judged. A harness that prints none is never judged stalled; the budget covers it</td> <td>3 (2 to 20)</td> <td><code>agent_host.driver_no_progress_limit</code></td> </tr> <tr> <td>The linked task is complete, or is not in progress at a check-in while the agent is not working (a working agent means someone is typing in the pane). A finished turn itself moves the task to ready for review, so that is not a stop</td> <td>none</td> <td>none</td> </tr> <tr> <td>The session exited or was stopped (Drive goes off in the registry write, and the exit is reported as an update)</td> <td>none</td> <td>none</td> </tr> <tr> <td>Running sessions HQ drives at once. A default-on watch past it starts observing and says so, and <code>harness_session_mode</code> from HQ cannot go past it (the user can); a session the user already switched on is never switched off by it. Eight by default: each driven session costs a full agent turn on the chat model per wake (at most 48 a day, and the instruction budget above ends a session’s Drive after 8 instructions), so eight sessions cap near 64 steering turns between your top-ups</td> <td>8 (1 to 500)</td> <td><code>agent_host.max_driven_sessions</code></td> </tr> <tr> <td>Minutes a driven session may report idle or done, with no event, wake or driver turn, before it gives up its slot (the session keeps running; switch Drive back on to continue). 0 turns it off</td> <td>180 (0 to 10080)</td> <td><code>agent_host.driver_idle_release_minutes</code></td> </tr> <tr> <td>Running sessions started by an MCP client with no chat (<code>harness_session_spawn</code>, <code>harness_session_handoff</code>), recorded in <code>harness_sessions.origin</code></td> <td>3 (1 to 500)</td> <td><code>agent_host.max_mcp_started_sessions</code></td> </tr> <tr> <td>Running sessions started from a chat an <code>hq_ask</code> created, including by handoff</td> <td>2 (0 to 100)</td> <td><code>agent_host.max_ask_spawned_sessions</code></td> </tr> <tr> <td>Full-mode <code>hq_ask</code> questions waiting at once</td> <td>2 (1 to 10)</td> <td><code>agent_host.max_full_asks</code></td> </tr> </tbody> </table></div> <p>Known harmless prompts are not left to the model. Claude Code’s optional feedback survey (<code>How is Claude doing this session? (optional)</code> with <code>0: Dismiss</code>) used to stall a driven loop until a person pressed <code>0</code>. The supervisor (<code>harness_session::dismiss</code>, called from <code>session_supervisor.rs</code> on its minute sweep) now dismisses it by text match, not judgement:</p> <ul> <li>Both exact lines (the title and <code>1: Bad 2: Fine 3: Good 0: Dismiss</code>) must sit within the last 12 non-empty lines of the screen, so the same words in older scrollback are ignored. The screen is read again just before the key goes out, so a survey that already closed gets no stray <code>0</code>.</li> <li>The key is the constant <code>0</code> (a bare <code>0</code> works with <code>agent send-keys</code> on a real claude-code session). A tail that shows a dialog needing a human is never touched: <code>do you trust</code>, <code>do you want to</code>, <code>would you like</code>, <code>permission to</code>, <code>requires permission</code>, <code>enter to select</code>, <code>esc to cancel</code>, <code>(y/n)</code>, <code>allow this</code>, <code>no, exit</code> and <code>yes, proceed</code> all veto. The word “permission” alone does not, because Claude’s bypass-mode footer (<code>bypass permissions on</code>) always sits in the tail. A prompt without a recognised dismiss option is never answered, and trust dialogs still default to “No, exit” and are reported.</li> <li>Nothing is typed while the host reports the agent <code>working</code> (the text would be the agent’s own output), and nothing is typed when the input line below the survey holds any text. The input line is recognised by its glyph: Claude Code’s <code>❯</code> (U+276F), <code>></code>, or either inside a <code>│ … │</code> box. A ghost suggestion looks like a draft and cannot be told apart from screen text, so it counts as one and the survey is left for a person.</li> <li>After a dismissal the supervisor remembers a hash of the screen tail (<code>harness_sessions.last_dismiss_tail</code>). If the next sighting has the same tail, the key did nothing: HQ types nothing more, records a <code>dismiss_cap</code> event (“prompt did not close”) and posts the same single notice as the cap. Together with the draft check, a survey lookalike can cost at most one stray <code>0</code>. Switching Drive on clears the hash.</li> <li>Host calls are bounded: at most one screen re-read and one key send per session per sweep, each with a 3 second timeout. The screen is read again just before the key goes out, so a survey that already closed gets no stray <code>0</code>. A send the host refused is handed back; a timeout or lost connection keeps the claim spent (the key may have landed, and a second <code>0</code> could reach the input box).</li> <li>A finished turn is never silenced by a dismissal: its alert and driver wake fire as usual, even if the host changes the session’s state after the keypress. Only the blocked alert the survey itself caused is skipped.</li> <li>Only sessions with Drive on and a watching chat. An observe-only session is never typed into.</li> <li>Dismissals have their own counter (<code>harness_sessions.dismissals</code>, refilled when the user switches Drive on) and cap of 5. They spend neither the instruction budget nor the key allowance. The sixth sighting sends nothing, records a <code>dismiss_cap</code> event and posts one notice.</li> <li>Each dismissal is a <code>prompt_dismissed</code> event with actor <code>guard</code>; the linked task gets one comment per session, not one per dismissal.</li> </ul> <p>A second finished turn with no instruction sent since the driver last answered one is posted as a plain update, not driven. Anything other than the driver sending the session something (the user typing in the chat, the Sessions page) re-arms that. Notices never create a wake.</p> <p>Only the user switching Drive on (the panel switch or <code>POST .../drive</code>) refills the budgets and clears the stall streak. A driver turn or an <code>hq_ask</code> reply cannot turn Drive on with <code>harness_session_mode</code>, and an HQ-initiated switch does not refill anything: if HQ switches Drive back on after a budget stop, the next wake switches it off again.</p> <p>Driver turns (the session driver, not sub-agent follow-ups) may not start, hand off, attach or link sessions, and cannot type into a pane except through the metered tools. Attach and link are also refused in <code>hq_ask</code> replies. Sessions started over the handoff key never start driven. After a guard stops Drive, the session keeps running untouched and later events arrive as ordinary updates.</p> <p><code>agent_host.drive_new_watches</code> stays <code>true</code>: a handoff or spawn whose goal and definition of done pass the gate starts driven, bounded by the limits above. Set it to <code>false</code> for every new watch to start observing.</p> <h3 id="sessions-hq-spawned-start-sessions-only-as-their-team">Sessions HQ spawned start sessions only as their team</h3> <p>Every pane HQ launches has <code>HQ_SESSION_ID=<session id></code> in its environment. An MCP client in that pane can pass it on, and the gateway then marks the call as coming from an HQ-spawned session (the marker only adds restrictions, so the caller cannot gain anything by setting or omitting it). A marked call to <code>harness_session_spawn</code>, or one that names its session in <code>from_session</code>, becomes a delegation from that session: the new session is its worker, on a sub-task, in its folder and host, under the team limits in <code>agent_host.teams</code> (see “Delegating” in <code>docs/AGENT_MESSAGING.md</code>). A marked <code>harness_session_handoff</code> is refused, and <code>hq_ask</code> is refused in <code>mode: full</code> (<code>read_only</code> still works).</p> <ul> <li><strong>HTTP <code>/mcp</code></strong>: the client config sends header <code>x-hq-session-id</code> filled from the variable. In the Claude Code MCP entry for <code>agent-hq</code> (verified against Claude Code 2.1.x on 2026-10-04: it expands the variable in HTTP headers, and a blank value arrives as an empty header): <code>"headers": {"x-hq-session-id": "${HQ_SESSION_ID:-}"}</code>. A blank value means no marker. A live session started by HQ with this entry was refused <code>hq_ask</code> in full mode. Add the header to every Claude profile’s <code>agent-hq</code> entry (<code>~/.claude.json</code>, and <code>.claude.json</code> in each <code>CLAUDE_CONFIG_DIR</code>); HQ does not edit client config.</li> <li><strong>stdio <code>hq mcp</code></strong>: reads <code>HQ_SESSION_ID</code> from its own environment when the client passes it on.</li> </ul> <p>A marked call also cannot use <code>harness_session_resume</code> or <code>config_manage</code>, and can type (<code>harness_session_send</code>, <code>host_send</code>) only into its own session.</p> <p><strong>This depends on that client config, which HQ does not write, so containment fails open without it</strong> (see <code>TECHDEBT.md</code>). HQ does not pass a per-pane <code>--mcp-config</code>. Without the marker these caps still hold, whatever the client says about itself: a watch past <code>agent_host.max_driven_sessions</code> does not drive; a session started from a chat that <code>hq_ask</code> created never starts driven, and is capped at <code>agent_host.max_ask_spawned_sessions</code>; sessions an MCP client starts with no chat are capped at <code>agent_host.max_mcp_started_sessions</code>; full-mode asks wait at most <code>agent_host.max_full_asks</code> at a time; an <code>hq_ask</code> reply loses <code>config_manage</code>.</p> <h3 id="the-workbench-page">The Workbench page</h3> <p>The Workbench page (<code>/sessions</code> in the web app, named Sessions before) lists every registry row with its task, host, goal, live agent status and whether its host answers (an unreachable host shows “host unreachable”, never “exited”). Picking one shows the pane text (refreshed every 3s), a prompt box, the keys that answer a dialog, an Adopt button, and the command that lists the agents on that machine (<code>hq host status</code>, or <code>ssh <host> hq host status</code> for a remote host; the page notes that this assumes the host name is an ssh alias on your machine). <code>ctrl+c</code> sits apart from the other keys and needs a second tap. A task’s drawer lists its sessions and links here. All of it sits behind the same web auth as the rest of <code>/api</code>, and <code>send</code> and <code>adopt</code> under <code>/api/harness-sessions/</code> must also carry <code>X-HQ-Client</code> (the web app sends it; scripts must add it, or get a 403). <code>drive</code>, <code>goal</code> and <code>unwatch</code> predate the header and stay open to cached PWAs that do not send it yet. Errors the endpoints do not recognise are logged and answered generically, never with ssh or the host stderr.</p> <ul> <li><code>POST /api/harness-sessions</code> starts an agent: <code>{harness, host?, folder?, new_folder?, prompt?, label?, purpose?, branch?, task_id?}</code>. <code>task_id</code> (an id or display id) makes that task the record of the work, as <code>harness_session_spawn</code> does; a missing, archived or complete task is refused before any folder is made. The folder is resolved on the computer that runs the agent and must be inside its HQ folder (<code>~/Documents/HQ</code>; <code>GET /api/workbench/hosts</code> reports it, <code>GET</code> and <code>POST /api/workbench/hosts/{host}/dirs</code> browse and create folders there). The agent always starts in an approval mode. <code>POST .../{id}/stop</code>, <code>/resume</code>, <code>/rename</code> and <code>/archive</code> manage a session; an archived session leaves the default list (<code>include_archived=true</code> brings it back) and only a session that is not running can be archived. All of these need <code>X-HQ-Client</code>.</li> <li><code>GET /api/harness-sessions?task_id=&status=&host=&include_archived=</code> is <code>harness_session_list</code> plus the task and goal. <code>GET /api/harness-sessions/{id}</code> is one row, live.</li> <li><code>GET /api/harness-sessions/{id}/screen/stream?lines=N</code> is the same screen as server-sent events: a <code>screen</code> event on connect and again only when it changes, an <code>end</code> event (<code>stopped</code>, <code>time</code> or <code>unavailable</code>) when the session is not running any more or after 15 minutes, and a keepalive comment every 15 seconds. At most 8 views are open at once (503 beyond that); the page falls back to polling. <code>screen?styled=true</code> adds color as ANSI escape sequences when the host can give them (<code>styled</code> in the reply says whether it did; a stored snapshot is always plain).</li> <li><code>GET /api/harness-sessions/{id}/screen?lines=N</code> (default 80, at most 500) reads the pane while the agent runs and returns the last stored snapshot after it ends (<code>source</code>). A live read is one host call (one ssh round trip on a remote host). Concurrent reads of one session share a single in-flight call, and a live result is reused for about a second; a failed read or a stored-snapshot answer is never reused, and a send, stop or resume drops what is held. A session the registry no longer lists as running is answered from its snapshot without calling the host. A live answer also carries <code>host_source</code> (<code>recent-unwrapped</code> or <code>visible</code>; null for a snapshot). While an agent is working, the host refuses a <code>recent</code> read of more than about 25 lines with <code>agent_not_idle</code>; <code>ScriptedHost::read</code> then retries that one error once as <code>--source visible</code> with the same line count, so the page and the supervisor stay live instead of falling back to a stale snapshot. Other errors (<code>agent_not_found</code>, an unreachable host) are not retried, writes never take this path, and idle agents keep the deep <code>recent-unwrapped</code> read. The supervisor was left on the same read rather than moved to <code>--source detection</code>: <code>detection</code> is the host’s own classifier input with no documented wrapping or depth contract, and the stored snapshots and progress hashing assume unwrapped text. The page waits for each response before polling again and backs off (up to 30s) while requests fail.</li> <li><code>POST /api/harness-sessions/{id}/send</code> takes exactly one of <code>text</code> or <code>keys</code>, with the same rules as <code>harness_session_send</code>: text is refused with a 409 while the agent waits at a dialog, and a session that is not running or whose host is down is refused too. Each send is a <code>sent</code> row in <code>harness_session_events</code> (key names, or the length of the text, never the text itself).</li> <li><code>POST /api/harness-sessions/{id}/adopt</code> with an optional <code>thread_id</code> makes that chat watch a session nobody watches, or creates a chat named “Session: <label>” when omitted. It starts observation-only. Repeating it, or naming the chat that already watches it, changes nothing; a session another chat watches is a 409 until that chat unwatches it.</li> </ul> <h3 id="goal-and-definition-of-done-the-drive-gate">Goal and definition of done (the drive gate)</h3> <p>HQ steers a session only while it can state what the session is for and how anyone could tell it is finished. Both live on the session row (<code>goal</code>, <code>done_criteria</code>, migration 063), for tracked-task and ad hoc sessions alike. Set them with <code>goal</code> and <code>done_criteria</code> on <code>harness_session_spawn</code>, with <code>harness_session_goal</code>, or from the web panel (<code>POST /api/harness-sessions/{id}/goal</code>). A session spawned or linked with a <code>task_id</code> and no goal takes the task’s title and description as its goal; the definition of done always has to be stated.</p> <p>The gate (<code>hq_db::harness_drive_gate</code>) is deterministic, no model involved. Each field must be non-empty, not a placeholder (<code>TBD</code>, <code>when done</code>, <code>it works</code>, …), and have minimum substance (goal: 4 words and 20 characters; definition of done: 3 words and 15 characters), and the definition of done must not just repeat the goal. When the gate fails, HQ stays observation-only and the refusal names what is missing, in the tool result, the REST 409 and the Watching panel. Editing the goal so it no longer passes switches a driven session to observing on the spot, and the driver re-checks before every turn. The driver prompt carries the goal and definition of done. A session that exits or goes idle has not thereby met its goal: the task moves to review at most, and a person completes it.</p> <p>Every goal change, drive change, refusal and attach is a row in <code>harness_session_events</code> with the goal and criteria in force at the time (<code>registry::list_events</code>).</p> <h3 id="attaching-and-switching-mode-mid-chat">Attaching and switching mode mid-chat</h3> <ul> <li><code>host_agents</code> lists what the host runs, including agents started by hand. <code>harness_session_attach(agent, host)</code> starts tracking one and makes the chat watch it, observation-only. An agent already tracked is reused, and another chat can take it over (Drive off). An unreachable host or a missing agent is an error and records nothing. Family guests cannot attach.</li> <li><code>harness_session_mode(session_id, mode)</code> switches HQ between <code>drive</code> and <code>observe</code> for a session the chat watches. <code>observe</code> always works and takes effect at once: the driver reads the row before every turn, so at most the step already in flight finishes. <code>drive</code> needs a live agent (an ended session or an unreachable host is refused, since HQ cannot confirm what it would steer), a passing gate, and, only when <code>agent_host.drive_after_untrusted_reads</code> is false, a turn that has not read untrusted content (by default an owner turn that did read some may turn Drive on, an accepted risk). The Drive switch in the panel is the same mode change.</li> <li>Switching mode never touches the agent: it is not paused or stopped. <code>harness_session_stop</code> is the only tool that ends it, and it is never called as a side effect of a mode change. After a resume the row keeps its goal, so Drive can be turned on again.</li> </ul> <h2 id="asking-for-sandbox-access-sandbox_request">Asking for sandbox access (<code>sandbox_request</code>)</h2> <p>A helper under the strict sandbox that needs something outside its wall calls <code>sandbox_request</code> instead of working around the denial. It names one resource: <code>fs_write</code> or <code>fs_read</code> with an absolute path, <code>loopback</code> with a port, or <code>egress</code> with <code>host[:port]</code>. The session is the one the MCP gateway attested; the helper’s <code>reason</code> is shown to the owner as its own words and never decides anything.</p> <p><code>hq_core::grants::classify</code> decides from the typed request and the access profile the task opted into:</p> <ul> <li><strong>Approve</strong> when the path is inside the session’s worktree or a profile directory, the port or host is listed in the profile. The grant is stored in <code>sandbox_grants</code> and the session restarts (resumed, same conversation) when its turn ends, because a sandbox cannot be widened on a live process. Every launch of the session reads its active grants back (<code>LaunchRequest.grants</code>).</li> <li><strong>Ask</strong> for anything else: an inbox item (<code>source: sandbox-grants</code>) the owner approves or dismisses. The helper calls again with the same arguments to find the answer. A declined request is not asked twice; three declined or refused requests stop further ones.</li> <li><strong>Refuse</strong>, without asking anyone, for credentials, HQ’s own files, other agents’ state, the home directory and its parents, <code>..</code>, relative paths and port 0.</li> </ul> <p>The owner opts a task or session in with <code>hq grants profile [--task] <id> <profile></code> (nothing a helper can write does it: a task tag or a note does not). Profiles are <code>agent_host.grants.profiles</code> and nothing is enabled until the owner writes one:</p> <pre tabindex="0"><code class="language-yaml">agent_host: grants: profiles: mobile-dev: writable: ["~/.gradle", "~/.pub-cache"] readable: ["~/Library/Android/sdk"] loopback_ports: [5037] egress: ["pub.dev", "dl.google.com"] </code></pre> <p>A helper that needs a host but does not know its exact name calls <code>sandbox_denials</code>, which lists what its session’s egress proxy refused recently (host, port, reason). File and local-port denials are not collected: the helper’s own tool errors name the path or port. A refusal by the command policy (for example <code>env</code>) is not a sandbox grant: the helper reports it, and brokered commands are a later stage.</p> <p>Standing access, so the owner never edits config or binds profiles: the inbox card for a request answers <code>approve</code> (this session), <code>allow_task</code> (every session on the task), <code>allow_repo</code> (every session in the repository, the folder a worktree was made from) or <code>allow_starter</code> with <code>starter</code> set to <code>mobile-dev</code>, <code>node-build</code> or <code>rust-build</code> (the toolchain caches and registries HQ ships, for the repository). They go through <code>POST /api/notifications/{id}/action</code> with <code>{action, starter?}</code>. Each leaves rules in <code>sandbox_grants</code> (<code>task:<id></code> or <code>repo:<root></code> scope; resources with <code>~</code> mean the session computer’s home), and a later request one of them covers is approved without asking, after the same checks (credentials and HQ’s files are never opened, whatever a rule says). <code>GET /api/sandbox-grants</code> adds <code>suggested_starter</code> to a waiting request. <code>GET /api/sandbox-grants/rules</code> lists the rules (revoke with the grant revoke route), <code>/starters</code> lists the shipped sets, <code>/summary?days=7</code> counts what HQ approved by policy, approved for the owner, asked, declined and refused (counts only, on this device).</p> <p>Owner routes (web credential only, never an MCP key or a helper token): <code>GET /api/sandbox-grants[?session=<id>]</code>, <code>POST /api/sandbox-grants/{id}/revoke</code>, <code>GET /api/sandbox-grants/profiles</code> (each configured profile with <code>~</code> resolved and credential paths dropped), and <code>POST /api/sandbox-grants/profile</code> with <code>{scope: session|task, id, name}</code> (<code>name</code> a configured profile or <code>none</code>). A request waiting for you is the inbox item (<code>source: sandbox-grants</code>) answered through <code>/api/notifications/{id}/action</code>.</p> <p>Paths, symlinks and the home directory are resolved on the computer the session runs on, not where HQ runs: the broker asks that computer’s host (<code>host.realpath</code>). A host that predates this answers nothing, and the helper is told to update the host instead of being decided blind. <code>~</code> in a profile means the session computer’s home.</p> <p><code>hq grants list</code> shows every request and how it was decided; <code>hq grants revoke <id|session></code> revokes. A running session keeps the access until it is stopped. Plan and what is still to come (owner prompts in the web and Android apps, denial diagnostics, brokered commands and devices): <code>docs/plans/delegated-sandbox-grants.md</code>.</p> <h2 id="publishing-a-helpers-work-harness_session_publish">Publishing a helper’s work (<code>harness_session_publish</code>)</h2> <p>A sandboxed helper that committed work in its own worktree used to stop at “policy denies pushing” and ping the owner. It now asks HQ: <code>harness_session_publish</code> takes a <code>title</code> and a <code>body</code>, nothing else. The session is the one the MCP gateway attested for the call (its own token), never a name in the arguments, so a helper can publish only its own branch. HQ’s host checks the change, pushes the branch to <code>origin</code> and opens the pull request with its own GitHub login (<code>gh</code>). The helper never gets a credential and its sandbox does not change.</p> <p>What the host refuses, each with the exact reason in the reply so the helper can fix it and call again:</p> <ul> <li>a worktree HQ did not make, a branch other than the one checked out, a detached head;</li> <li>the default branch (what <code>origin/HEAD</code> names, or <code>main</code>/<code>master</code>), <code>develop</code> and <code>release/*</code>;</li> <li>uncommitted changes, or no commits ahead of the base;</li> <li>any changed path under <code>.github/</code> or another CI or hook directory, any <code>.git*</code> file, a submodule pointer, a file over <code>max_bytes</code>, more than <code>max_files</code> files;</li> <li>anything shaped like a credential in a file, the title or the body (the same scanner <code>github_write</code> uses, <code>hq_core::publish_check</code>);</li> <li>a repository whose own configuration redirects a push (<code>pushurl</code>, <code>insteadOf</code>) or names a program a push would run;</li> <li>a <code>gh</code> that is missing (<code>gh_missing</code>) or not logged in (<code>gh_not_logged_in</code>): there is no fallback to anything else.</li> </ul> <p>Policy, in <code>agent_host.publish</code>:</p> <pre tabindex="0"><code class="language-yaml">agent_host: publish: enabled: true # off refuses every request repos: ["<owner>/<repo>"] # opened for without asking; empty by default max_files: 100 max_bytes: 1048576 # per file max_per_session_per_day: 10 </code></pre> <p>A repository not in <code>repos</code> files one inbox request, “Allow HQ to open PRs for <code><repo></code> for helpers?”, and returns <code>pending_owner_approval</code> to the helper, which tells the user and calls again. A request already waiting is never filed twice, a decline is a hard no, and an approval lasts 30 days and covers every helper for that repository. On success HQ adds a comment with the pull request address to the session’s task and records a <code>publish</code> event; the day limit counts those events. Security notes: <code>docs/security/PUBLISH.md</code>.</p> <p>After the pull request is open, <code>harness_session_request_merge</code> asks the owner to merge it when every check is green; it is off by default (<code>agent_host.publish.merge.enabled</code>) and never merges without the owner’s yes. See “Merging a green pull request” in <code>docs/security/PUBLISH.md</code>.</p> <h2 id="general-purpose-agents">General-purpose agents</h2> <p>Setting one up, everyday use and removal are in <a href="/docs/personal-agents/">PERSONAL_AGENTS.md</a>. This section is the reference.</p> <p>Hermes (<code>hermes chat</code>) and OpenClaw (<code>openclaw tui --local</code>) are a second category of harness, <code>general_purpose</code>, next to the coding agents. They run in the same host, the same process sandbox and the same session registry, and the same <code>harness_session_*</code> tools, web page and <code>hq sessions</code> commands start, read, steer and stop them. What differs is what HQ hands them, and that is mechanical rather than a matter of prompt wording:</p> <ul> <li><strong>Never code.</strong> Every session records a <code>purpose</code>: <code>code</code>, <code>monitor</code>, <code>research</code>, <code>review</code> or <code>general</code>. A coding agent defaults to <code>code</code> and takes any purpose. A general-purpose agent defaults to <code>general</code> and refuses <code>code</code> before anything is started, naming the coding harnesses instead. Profiles built on a general-purpose base (<code>base: hermes</code>) inherit the refusal. HQ’s own chat prompt is told the same rule.</li> <li><strong>Monitoring, research, review.</strong> <code>purpose: monitor</code> and <code>purpose: review</code> sessions are about someone else’s work. Linked to a task, they leave comments on it (<code>Session ... (hermes, a monitor) finished a turn.</code>) but never hold its work lease or move its status, so a reviewer finishing a turn does not put a coding task into review. <code>research</code> and <code>general</code> sessions do their task’s own work and move it like a coding session does. Several research sessions can run at once; each is an ordinary session with its own task.</li> <li><strong>Observing other sessions.</strong> Any session started with <code>task_id</code> can be given <code>observe: [session ids]</code> (at most 10), whatever its harness or purpose. When an observed session finishes a turn, blocks at a dialog or exits, the supervisor leaves the observer a message on the observer’s task thread, with the observed agent’s last reply or screen tail, and types it in when the observer is next idle, the same route a delegated child uses to report to its parent. The text is the observed agent’s screen and is presented as such, never as an instruction. Spawn reports <code>observing</code> and says so in <code>observing_note</code>. The ids are checked before anything launches: a claude.ai connection may name only sessions it started and their teams, and the handoff key none, the same line <code>harness_session_subscribe</code> holds.</li> <li><strong>Subscribing while running.</strong> <code>harness_session_subscribe(session_ids, kinds?)</code> does the same for a session that is already running, so a Copilot coder can hear when the agy session it waits on finishes without polling. A session subscribes only itself, needs a task, and may watch its own team or sessions on its task; the owner can wire any pair with <code>observer</code>. <code>kinds</code> narrows it to some of <code>finished</code>, <code>blocked</code> and <code>exited</code>. <code>harness_session_unsubscribe</code> stops it. Sessions that keep waking each other (A’s turn wakes B, B’s wakes A) stop after three rounds: the observers are not told, the session logs <code>relay_capped</code>, and the owner’s inbox says so. Any other input to the session starts a fresh count.</li> </ul> <pre tabindex="0"><code>harness_session_spawn(harness: "hermes", purpose: "monitor", task_id: "FR-053", observe: ["hs-claude-code-1a2b3c"], prompt: "Watch the refactor session and tell me when it stalls or asks for a decision.") hq sessions spawn hermes --purpose review --task FR-053 --observe hs-codex-4d5e6f --prompt "Review the diff when it lands." </code></pre> <p>Security, which is the point of running these agents through the host at all:</p> <ul> <li>They are confined like every other agent: the process sandbox and no read of the host’s token or your credential directories. Under <code>profile: strict</code> that also means a private copy of the temporary directories and an egress allowlist, and their own state in <code>~/.hermes</code> or <code>~/.openclaw</code> is writable for them and hidden from other agents. They reach whichever model provider you configured for them; under <code>strict</code> add that provider’s host to <code>agent_host.sandbox.allow_domains</code>, as HQ ships no default for it.</li> <li>They get no HQ session token and no MCP configuration. HQ never wires itself into a general-purpose agent’s own tool loop; what reaches the agent is what HQ types into it, and what comes back is read from its screen, which <code>harness_session_logs</code> treats as untrusted.</li> <li>They count against the same origin and driven-session caps, their folders pass the same deny and allow lists, and a family guest’s harness allowlist does not include them.</li> <li>The host has no state rule file for them yet, so their state shows as <code>unknown</code> rather than <code>idle</code> or <code>working</code>: <code>harness_session_wait</code> cannot wait on them, the finished-turn alert does not fire for them, and a message for them is typed once the launch is over rather than at the next idle. A rule file for each, built into the host like the Claude Code and Codex ones (see <a href="/docs/agent-host/">AGENT_HOST.md</a>, “Agent state”), fixes all three and is the next step. A stack run (below) needs none of this: its process ending is its signal. Resume is a fresh start that the agent’s own session store may continue.</li> </ul> <p>The launch commands are the ones each project documents; an install that starts differently gets a profile (<code>base: hermes</code>, <code>command: ...</code>, <code>args: [...]</code>), and a profile may reuse the built-in name.</p> <h3 id="running-an-agent-over-acp">Running an agent over ACP</h3> <p>A profile with <code>transport: acp</code> starts the base CLI’s Agent Client Protocol server instead of its terminal interface, so the host reads state, dialogs, finished turns and the transcript from the protocol (rule <code>acp</code>) and types nothing into it. <code>harness_session_wait</code>, the finished-turn alert and dialog answering then work for agents that have no state rule file. Opt in per profile; the terminal stays the default.</p> <pre tabindex="0"><code class="language-yaml">agent_host: harness_profiles: opencode-acp: base: opencode transport: acp env: OPENCODE_DISABLE_AUTOUPDATE: "1" </code></pre> <p><code>model: <id></code> on any profile sets the model its sessions start on when the caller names none: the CLI’s model flag in a terminal, a switch in the session over ACP (through <code>session/set_model</code> or the agent’s model config option). A caller’s own <code>model</code> wins, and an id the agent does not offer fails the start with the list it offers. An alias finds the profile of its canonical name, so one <code>antigravity</code> profile serves <code>agy</code> too.</p> <p><code>fallback: [lane, ...]</code> on a profile lists the lanes to try, in order (at most four), when a start fails because the lane is unavailable: a login that ran out, a quota or rate limit, the agent cap. The reply of the spawn that fell back has <code>fell_back: {from, to, reason}</code>. Any other failure (a bad folder, a refused policy) stops there, since another lane would fail the same way. A turn that fails for the same reason midway is not retried by HQ, because it may already have changed files: the <code>turn</code> object carries <code>failure</code> (<code>auth</code>, <code>billing</code> or <code>other</code>) and, for the first two, the reply of <code>harness_session_wait</code> adds <code>next_lane</code>, the first fallback, so the caller can start the work again there.</p> <p>A lane that is nearly out is skipped before it starts. HQ reads the stored lane quota reading of the lane on the host (never the network, never the host: <code>docs/LANE_QUOTAS.md</code>), and when its worst window is at or above <code>quota.block_percent</code>, the start goes to the next lane of the list, checked the same way. The reply has <code>fell_back</code> with a reason such as <code>quota: week at 97% until 2026-11-18T09:00:00Z</code>. When every lane of the list is at the line, or the lane has no fallback, the start still goes ahead on the lane asked for and the reply carries <code>quota_warning: {lane, window, used_percent, resets_at, stale}</code>: the vendor is the one to refuse, and HQ does not strand an owner who chose the lane. At or above <code>quota.warn_percent</code> the start is normal and carries the same <code>quota_warning</code>. An unknown or missing reading, or one older than twice <code>quota.interval_minutes</code>, never blocks (an old one may warn, with <code>stale: true</code>), and <code>quota.enabled: false</code> or <code>quota.lanes.<lane>: false</code> turns the check off. The driver prompt tells a driver to call the read-only <code>lane_quotas</code> tool before choosing a lane; no balance is put in the prompt.</p> <p>Built-in ACP commands: <code>opencode acp</code>, <code>agy acp</code>, <code>cursor-agent acp</code>, <code>kimi acp</code>, <code>hermes acp</code>, <code>copilot --acp --stdio</code>. A base without one (or a different command) sets <code>acp_args</code>. Not supported over ACP: a wrapper <code>command</code>, one-shot runs and command-policy hooks. An ACP agent comes back after a host restart (its stored session is loaded again). <code>hq_mcp: true</code> on the profile gives the agent HQ’s MCP connection (tasks, vault, handing work on) in its session, with a token of its own, if the agent says it can use an HTTP MCP server; without it the agent gets none. A message sent while a turn runs waits for it to end; <code>esc</code> stops the turn. Hermes over ACP is not confined by the process sandbox (its gateway daemon runs the tools), so keep it on the terminal where a sandbox is required. A finished turn adds the files the agent’s edit tools reported, and its token use, to the task comment (the agent’s own account; check <code>git diff</code>). <code>harness_session_wait</code> and <code>harness_session_status</code> carry a <code>turn</code> object for an ACP agent: how the turn ended, the files edited, the tokens, and <code>result</code>, what the agent said last (up to 4000 characters, untrusted text), so an agent driving it gets the answer without reading its output. See <a href="https://github.com/CalvinMagezi/hq/blob/main/docs/plans/acp-lane.md">plans/acp-lane.md</a>.</p> <p>OpenClaw runs with <code>--local</code>: its default talks to the OpenClaw gateway on a loopback port, and the sandbox refuses loopback connections. OpenClaw refuses <code>--local</code> while a gateway runs for the same state directory (<code>A Gateway is running for this state directory ... Run without --local to use it, or stop the Gateway first</code>), so on an HQ host do not run OpenClaw’s gateway daemon (skip <code>--install-daemon</code> when you set it up). If that machine needs the gateway for something else, give HQ a harness profile for OpenClaw instead.</p> <h3 id="the-agentic-stack-specialists-that-pull-their-tasks">The Agentic Stack: specialists that pull their tasks</h3> <p>An interactive pane is the slow way to use these agents. The faster one is to name them in your stack and assign them tasks. The words are Kola Academy’s: a <em>stack</em> of <em>specialists</em>, each with a lane, directed toward outcomes a person reviews (<code>docs/plans/agentic-stack.md</code>).</p> <pre tabindex="0"><code class="language-yaml">stack: specialists: - name: hermes # tasks assigned to "hermes" are its queue harness: hermes # a general-purpose harness or a profile on one purposes: [research, general] # its lane; first is the default; code is refused cwd: /home/me/Documents/HQ/stack-hermes # optional: a folder of its own by default run_minutes: 30 # a run past this is stopped and the task blocked runs_per_day: 24 # the budget, counted from the session registry </code></pre> <ul> <li><strong>Trigger.</strong> Assign a task to the specialist’s name (web board, <code>task_update</code>, chat). Every minute the daemon’s <code>stack-dispatch</code> asks the queue for that name’s next task, the same pick <code>task_next</code> makes (open, dependencies done, nobody holding it, start date reached, most urgent first), less anything code-shaped: a task tagged <code>code</code> or linked to a commit or pull request is never offered to a general-purpose specialist.</li> <li><strong>Run.</strong> One run per specialist at a time. HQ builds a brief from the task (display id, title, description as the definition of done, initiative, the resume point from its last checkpoint, and what to print at the end) and starts the harness’s one-shot command in the sandbox: <code>hermes chat --oneshot -q "<brief>"</code>, <code>openclaw agent --local --message "<brief>"</code>. A profile’s <code>one_shot_args</code> (with <code>{brief}</code>) replaces that for an install that differs. The session has origin <code>stack</code> and label <code>stack/<name></code>, and shows in the Workbench, <code>hq sessions</code> and <code>harness_session_logs</code> like any other. A tag on the task that names a purpose in the lane (<code>review</code>, <code>monitor</code>, <code>research</code>) picks the run’s purpose.</li> <li><strong>Output.</strong> The process ending is the completion signal. The supervisor keeps the final screen as the session’s snapshot, closes the pane, and records the run on the task by its exit code: zero moves the task from in progress to ready for review and releases its lease; anything else is a crash and blocks the task with a reason that names the run and, when it is short, quotes the last paragraph on its screen, where a CLI prints the error it stopped on (on a host that reports no code, output on screen counts as a finished run and a blank screen as a crash). A run is never resumed: fix the cause, then assign the task again or <code>hq stack run</code>. You read the output (<code>harness_session_logs</code>) and complete the task, or not; with task verification on, HQ checks the evidence and completes what passes. A monitor’s or reviewer’s run comments and never moves the task, as its interactive turns do.</li> <li><strong>Limits.</strong> <code>runs_per_day</code> is counted over a rolling 24 hours. A run past <code>run_minutes</code> is stopped and its task blocked with the reason. A launch that fails leaves one comment on the task and is not retried for 30 minutes. Token cost is not a limit HQ can enforce for these agents yet: it reads usage from the coding agents’ own transcripts only.</li> <li><strong>Fire now.</strong> <code>hq stack run <specialist> <task></code> starts a run for one task without waiting for a sweep, whoever the task is assigned to; the lane, the budget and one-run-at-a-time still hold. <code>hq stack list</code> shows each specialist with its lane, its queue, what is running and the day’s count.</li> </ul> <p>What a specialist never gets: an HQ token, MCP wiring, a coding task, or the right to complete a task. What it keeps: the sandbox, its own state directory, and under <code>profile: strict</code> the egress allowlist, so add its model provider’s host to <code>agent_host.sandbox.allow_domains</code>. The one-shot arguments are the ones each project documents and have not been run against a live install here.</p> <h2 id="custom-harness-profiles">Custom harness profiles</h2> <p>A profile in <code>config.yaml</code> names a launcher that is not one of the built-in harnesses (a wrapper script that selects an account, sets a config directory, or adds flags) and borrows everything else from a built-in harness:</p> <pre tabindex="0"><code class="language-yaml">agent_host: harness_profiles: my-claude: # the name callers pass as `harness` base: claude-code # resume, trust and token behavior come from this harness command: my-claude-wrapper # run through a shell; must end up running claude args: ["--dangerously-skip-permissions"] # optional; replaces the base args on a fresh spawn env: # optional; set for the agent, so for the CLI too CLAUDE_CONFIG_DIR: /home/you/.claude-work </code></pre> <p><code>harness_session_spawn</code>, <code>hq sessions spawn</code> and session-mode dispatch all accept the profile name, and <code>harness_session_resume</code> finds it again from the stored session. A profile without <code>command</code> launches the base CLI with the profile’s <code>args</code> and <code>env</code>; a resume uses the base harness’s resume arguments. A profile may reuse a built-in name to change how that harness starts. If no agent appears within the launch bound the spawn fails with the screen; the usual cause is a command that is not on the <code>PATH</code> of the host service.</p> <p>A separate Claude Code account needs no wrapper: point <code>CLAUDE_CONFIG_DIR</code> at that account’s config directory and the host starts <code>claude</code> in it (inside the sandbox that directory is the agent’s own, and the default <code>~/.claude</code> and other profiles are hidden from it). Write the path out in full, since <code>env</code> values are passed through as written and <code>~</code> is not expanded:</p> <pre tabindex="0"><code class="language-yaml"> claude-work: base: claude-code env: { CLAUDE_CONFIG_DIR: /Users/you/.claude-work } </code></pre> <p>The spawn result’s <code>harness</code> field names the profile the session was started with. An unknown name fails before anything is started, listing the known harnesses and profiles. Profiles run shell commands on the host, so they belong to whoever can edit <code>config.yaml</code>.</p> <h2 id="setup">Setup</h2> <p>On the machine HQ runs on, <code>hq host serve</code> (or <code>hq host install</code>, which runs it as a login service) provides the <code>native</code> host. To use another machine, pair it: <a href="/docs/join-a-machine/">JOIN_A_MACHINE.md</a>. Settings live under <code>agent_host:</code> in <code>config.yaml</code> (all defaults shown, sandbox and idle settings are in <a href="/docs/agent-host/">AGENT_HOST.md</a>):</p> <pre tabindex="0"><code class="language-yaml">agent_host: default_host: native # where new sessions start: native, or a paired host's name launch_bound_secs: 25 # how long a launch waits for the agent (5-50) command_timeout_secs: 30 driver_nudge_budget: 8 # instructions the driver may send one session (1-100) driver_no_progress_limit: 3 # finished turns without new tool activity before Drive stops (2-20) max_driven_sessions: 3 # running sessions HQ drives at once (1-500) max_ask_spawned_sessions: 2 # running sessions hq_ask chats may start (0-20) max_mcp_started_sessions: 3 # running sessions MCP clients with no chat may start (1-50) driver_key_allowance: 40 # key presses the driver may send one session (1-500) max_full_asks: 2 # full-mode hq_ask questions waiting at once (1-10) </code></pre> <p>To revoke a paired machine’s access, delete its line from that machine’s <code>authorized_keys</code> (the one <code>hq host authorize</code> added) and remove the host from <code>agent_host.hosts</code>.</p> <h3 id="connection-reuse-agent_hostssh_multiplex">Connection reuse (<code>agent_host.ssh_multiplex</code>)</h3> <p>Every call to a remote host is one ssh command, and a fresh Tailscale ssh handshake costs seconds, so HQ keeps one connection per host open between calls (<code>ControlMaster=auto</code>, <code>ControlPersist=120</code>, sockets in <code>~/.hq/run/ssh</code>, mode 0700, one per host). It also sets <code>ServerAliveInterval=15</code> and <code>ServerAliveCountMax=2</code>, so a master whose laptop went to sleep exits within about 30s instead of holding later calls until their deadline. The key, <code>IdentitiesOnly</code>, <code>BatchMode</code>, the forced command and the gate are unchanged: sshd still runs your <code>authorized_keys</code> command for every session on the shared connection.</p> <pre tabindex="0"><code class="language-yaml">agent_host: ssh_multiplex: true # default; false opens a fresh connection per call </code></pre> <p>The control socket is a bearer credential for the gated key: anything that can open it can make gated host calls as that key without the key file, so it sits inside the same boundary as the key. The directory is 0700 and holds nothing else; keep <code>identity_file</code> mode 0600 and owned by the HQ user.</p> <p>If the socket directory cannot be made private or its path would be too long for a unix problem before a session opens, a read-only call (<code>status</code>, <code>agent get</code>, <code>agent list</code>, <code>agent read</code>) is retried once on a fresh connection. A write (send, prompt, launch) is never retried, since the gate may already have run it. A master that hangs rather than failing is bounded by the normal command timeout. Run HQ with <code>RUST_LOG=hq_tools::agent_host=debug</code> to log the elapsed milliseconds of every host call.</p> <h2 id="security-model">Security model</h2> <p>The gate limits what the key can ask for, but the host starts arbitrary commands by design (<code>agent.spawn</code>, and any agent it starts can run code). Treat the key as shell access to the machine as you, scoped to the host’s own API and to one source address. Consequences:</p> <ul> <li>Keep the private key readable only by the HQ user and out of backups you do not control.</li> <li>Anyone who can call HQ’s <code>harness_session_*</code> tools can start an agent on a paired machine, and anyone who can call <code>host_send</code> can type into any agent pane there, including ones you started by hand. Do not expose those tools to callers you would not give a shell.</li> <li>Agents run in a process sandbox (see <a href="/docs/agent-host/">AGENT_HOST.md</a>): they cannot read the host’s own files or your credentials directories, and reach only the sites you allow.</li> <li>The host’s control socket is a local unix socket, so access control is its file permissions plus the ssh key above; agents get a separate socket that accepts only their own token.</li> </ul> <h2 id="troubleshooting">Troubleshooting</h2> <div class="table-scroll" role="region" aria-label="Table" tabindex="0"><table> <thead> <tr> <th>Symptom</th> <th>Likely cause</th> </tr> </thead> <tbody> <tr> <td><code>host_check</code> or <code>host_list</code> shows <code>unreachable</code> with <code>Permission denied</code></td> <td>The pinned key is missing from <code>authorized_keys</code> (run the <code>hq host authorize</code> command again), the <code>from=</code> address is wrong, or <code>identity_file</code> is unreadable by the HQ user.</td> </tr> <tr> <td><code>unreachable</code> with <code>Host key verification failed</code></td> <td>Trust the machine’s host key from the HQ’s user: <code>ssh-keyscan -H <address> >> ~/.ssh/known_hosts</code>.</td> </tr> <tr> <td><code>unreachable</code> with <code>timed out</code></td> <td>Machine asleep, off the tailnet, its host service stopped, or sshd disabled.</td> </tr> <tr> <td><code>unreachable</code> with <code>No such file or directory</code></td> <td>The host is not running on that machine: <code>hq host install</code>.</td> </tr> <tr> <td><code>gate_denied</code></td> <td>The call used a method the gate does not allow.</td> </tr> <tr> <td><code>agent_not_ready</code> at spawn</td> <td>Agent is at a dialog. Read the screen from the spawn result and answer with <code>keys</code>.</td> </tr> <tr> <td>Spawn fails with <code>cannot sandbox the agent</code></td> <td>No sandbox program works on that machine (install <code>bubblewrap</code> on Linux, allow user namespaces on Ubuntu 24.04), or the project directory contains your home.</td> </tr> <tr> <td>An agent’s MCP server or plugin is missing</td> <td>Under <code>profile: strict</code> the sandbox refused its host; see the egress log and add it to <code>agent_host.sandbox.allow_domains</code>. The default <code>open</code> profile has no allowlist, so look at the plugin’s own log.</td> </tr> <tr> <td><code>git</code> over ssh, <code>gh</code>, <code>aws</code> or <code>kubectl</code> fails inside an agent</td> <td>The credential stores are hidden from agents by default. Set <code>agent_host.sandbox.hide_credentials: false</code>, or reveal one directory to one kind of agent with <code>agent_readable</code>. See <a href="/docs/agent-host/">AGENT_HOST.md</a>.</td> </tr> <tr> <td>Spawned Claude replies <code>Login expired</code></td> <td>The user account on that host is not logged in to that CLI.</td> </tr> <tr> <td>A stack specialist starts nothing</td> <td><code>hq stack list</code> shows its <code>problem</code> (a coding harness, an unknown purpose, a profile without <code>one_shot_args</code>), its queue is empty (<code>task_next</code> for that name, less code-shaped work), a run is up, or its <code>runs_per_day</code> budget is spent. A task whose run could not start is left a comment and tried again after 30 minutes.</td> </tr> <tr> <td>A stack run ended and its task is blocked</td> <td>The process exited non-zero (a crash or a refused login). Its last screen is in <code>harness_session_logs</code>; fix the cause, then assign the task to the specialist again or <code>hq stack run <name> <task></code>.</td> </tr> </tbody> </table></div> <h2 id="a-quiet-inbox-inboxfleet">A quiet inbox: <code>inbox.fleet</code></h2> <p>Helpers do not fill the Inbox. A prompt from a session that has a command policy, a chat, a parent session or a task waits <code>inbox.fleet.grace_minutes</code> (default 15) for them to answer it, and only then becomes one item. A finished or stopped helper is counted in one rolling “N helpers finished today” item that is never pushed. Sign-ins, connector and chat approvals, escalations and prompts that lose work are owner-only: they come at once and are the only ones the phone badge counts. A daily task (<code>inbox-tidy</code>, off with <code>daemon.inbox_tidy: false</code>) moves requests from ended or silent sessions out of Needs you into Done as “No longer waiting”; <code>hq inbox tidy</code> shows what it would move, and <code>hq inbox restore --since 1d</code> brings items back.</p> <pre tabindex="0"><code class="language-yaml">inbox: fleet: enabled: true # false: an item for every prompt and every finish, as before grace_minutes: 15 # wait for the fleet to answer before telling the owner ttl_hours: 24 # a helper request older than this leaves Needs you signin_ttl_hours: 24 # a new-device sign-in request older than this leaves Needs you digest: true # one rolling item per day instead of a row per finished helper helper_policy: nothing # nothing | loses_work | everything </code></pre> <p>Every key also reads from the environment, for example <code>HQ_INBOX__FLEET__GRACE_MINUTES=30</code>. The rules and the reasons behind them: <code>docs/plans/quiet-fleet.md</code>.</p> </article> <nav class="doc-toc glass" aria-label="On this page"> <p class="eyebrow">On this page</p> <ul class="foot-links"> <li><a href="#what-hq-can-do">What HQ can do</a></li><li><a href="#behavior-worth-knowing">Behavior worth knowing</a></li><li><a href="#a-team-run-from-outside">A team run from outside</a></li><li><a href="#following-sessions-by-events">Following sessions by events</a></li><li><a href="#command-policies">Command policies</a></li><li><a href="#agents-that-share-a-repository">Agents that share a repository</a></li><li><a href="#sessions-that-work-on-a-task">Sessions that work on a task</a></li><li><a href="#handing-work-over-from-outside-harness_session_handoff">Handing work over from outside (harness_session_handoff)</a></li><li><a href="#watching-and-driving-from-a-web-chat">Watching and driving from a web chat</a></li><li><a href="#asking-for-sandbox-access-sandbox_request">Asking for sandbox access (sandbox_request)</a></li><li><a href="#publishing-a-helpers-work-harness_session_publish">Publishing a helper’s work (harness_session_publish)</a></li><li><a href="#general-purpose-agents">General-purpose agents</a></li><li><a href="#custom-harness-profiles">Custom harness profiles</a></li><li><a href="#setup">Setup</a></li><li><a href="#security-model">Security model</a></li><li><a href="#troubleshooting">Troubleshooting</a></li><li><a href="#a-quiet-inbox-inboxfleet">A quiet inbox: inbox.fleet</a></li> </ul> </nav> </div> </div> </section> </main> <footer class="site-footer"> <span class="orb orb-b o-tl" aria-hidden="true"></span> <span class="orb orb-g o-br slow" aria-hidden="true"></span> <div class="container"> <div class="pairs" aria-hidden="true"> <svg class="pair pair-1" viewBox="0 0 64 40" aria-hidden="true" focusable="false"> <circle class="c-blue" cx="20" cy="20" r="20"></circle> <circle class="c-green" cx="44" cy="20" r="20"></circle> </svg><svg class="pair pair-2" viewBox="0 0 64 40" aria-hidden="true" focusable="false"> <circle class="c-blue" cx="20" cy="20" r="20"></circle> <circle class="c-green" cx="44" cy="20" r="20"></circle> </svg><svg class="pair pair-3" viewBox="0 0 64 40" aria-hidden="true" focusable="false"> <circle class="c-blue" cx="20" cy="20" r="20"></circle> <circle class="c-green" cx="44" cy="20" r="20"></circle> </svg><svg class="pair pair-4" viewBox="0 0 64 40" aria-hidden="true" focusable="false"> <circle class="c-blue" cx="20" cy="20" r="20"></circle> <circle class="c-green" cx="44" cy="20" r="20"></circle> </svg> </div> <div class="foot-cta glass"> <p class="foot-title">Pick your device. Add more later.</p> <div class="toc"> <a href="/get/">Android phone</a><a href="/get/">Mac</a><a href="/get/">Windows</a><a href="/get/">Linux</a><a href="/get/">Server</a> </div> <a class="btn btn-primary" href="/get/">Get Agent HQ</a> </div> <p class="body foot-statement">An AI assistant that lives on your phone and works with your computers. Open source under the MIT license.</p> <div class="foot-grid"> <nav class="foot-nav glass" aria-label="Learn"> <p class="eyebrow">Learn</p> <ul class="foot-links"> <li><a href="/architecture/">Architecture</a></li><li><a href="/compare/">Compare</a></li><li><a href="/get/">Get HQ</a></li><li><a href="/install/">Install</a></li><li><a href="/start/">Start</a></li><li><a href="/guides/">Guides</a></li><li><a href="/docs/">Docs</a></li><li><a href="/help/">Help</a></li><li><a href="/new/">What is new</a></li> <li><a href="https://github.com/CalvinMagezi/hq/blob/main/docs/FIRST_RUN.md">First run</a></li> <li><a href="https://github.com/CalvinMagezi/hq/blob/main/CHANGELOG.md">Changelog</a></li> </ul> </nav> <nav class="foot-nav glass" aria-label="Trust"> <p class="eyebrow">Trust</p> <ul class="foot-links"> <li><a href="/security/">Security</a></li> <li><a href="https://github.com/CalvinMagezi/hq/blob/main/SECURITY.md">Security policy</a></li> <li><a href="https://github.com/CalvinMagezi/hq/blob/main/LICENSE">MIT license</a></li> <li><a href="https://github.com/CalvinMagezi/hq/releases">Releases</a></li> </ul> </nav> <nav class="foot-nav glass" aria-label="Stuck"> <p class="eyebrow">Stuck</p> <ul class="foot-links"> <li class="foot-hint">Run <code>hq doctor</code> first</li> <li><a href="/help/">Fix it in your own words</a></li> <li><a href="https://github.com/CalvinMagezi/hq/issues">Ask on GitHub</a></li> <li><a href="https://github.com/CalvinMagezi/hq/security/advisories/new">Report a security problem</a></li> <li><a href="https://github.com/CalvinMagezi/hq">Source code</a></li> </ul> </nav> </div> <div class="foot-note foot-status"> <p class="small"> Build v0.9.1-main.648, checked 2026-11-21. MIT. No cookies, no analytics, nothing loaded from other origins. Not affiliated with the projects named on the comparison page. </p> <a class="small" href="#main">Back to top</a> </div> </div> </footer> <p id="copy-status" class="visually-hidden" role="status" aria-live="polite"></p> <script src="/js/enhance.js" defer></script></body> </html>