hyperhive — per-agent options
services.hyperhive.agent.acp.args
Arguments for command (HIVE_ACP_ARGS, as JSON).
Type: list of string
Default:
[ ]
Example:
[
"acp"
]
Declared by:
services.hyperhive.agent.acp.command
Program the harness spawns as its ACP agent (HIVE_ACP_COMMAND).
claude is on PATH only when services.hyperhive.agent.runtime is
"claude". A command that runs claude (a Claude ACP adapter, say)
needs pkgs.claude-code in environment.systemPackages and
"claude-code" in nixpkgs.config.allowUnfreePackages.
Type: string
Default:
""
Example:
"${pkgs.opencode}/bin/opencode"
Declared by:
services.hyperhive.agent.acp.env
Environment for the ACP agent only, on top of the harness’s own
(HIVE_ACP_ENV, as JSON). Rendered into the nix store: never put a
credential here. Put it in services.hyperhive.agent.backendEnvironmentFile,
which the agent inherits through the harness.
Type: attribute set of string
Default:
{ }
Declared by:
services.hyperhive.agent.acp.opencode.contextWindow
The model’s context window in tokens; the harness’s ctx % is measured against it.
Type: positive integer, meaning >0
Default:
131072
Example:
262144
Declared by:
services.hyperhive.agent.acp.opencode.model
Model id, as the provider’s API names it.
Type: null or string
Default:
null
Example:
"Qwen/Qwen3.6-35B-A3B-FP8"
Declared by:
services.hyperhive.agent.acp.opencode.outputLimit
Maximum output tokens per model response.
Type: positive integer, meaning >0
Default:
32768
Declared by:
services.hyperhive.agent.acp.opencode.provider.apiKeyEnv
Environment variable opencode reads the provider’s API key from.
Set it in services.hyperhive.agent.backendEnvironmentFile, or store
the key in the swarm secret store at
swarm/agents/<agent>/acp-provider, field api_key.
Type: string
Default:
"ACP_PROVIDER_API_KEY"
Declared by:
services.hyperhive.agent.acp.opencode.provider.baseUrl
Base URL of the OpenAI-compatible API.
Type: null or string
Default:
null
Example:
"https://inference.hetzner.com/api/v1"
Declared by:
services.hyperhive.agent.acp.opencode.provider.id
Provider id in opencode’s config; the model is addressed as <id>/<model>.
Type: string
Default:
"provider"
Example:
"hetzner"
Declared by:
services.hyperhive.agent.acp.opencode.provider.name
Display name of the provider.
Type: string
Default:
config.services.hyperhive.agent.acp.opencode.provider.id
Declared by:
services.hyperhive.agent.acp.preset
Name of an entry in services.hyperhive.agent.acp.presets whose
command, args and env become the defaults of the options of
the same name here.
Type: null or string
Default:
null
Example:
"opencode"
Declared by:
services.hyperhive.agent.acp.presets
Named ACP agent setups services.hyperhive.agent.acp.preset can
select. opencode runs opencode acp against the OpenAI-compatible
provider set in services.hyperhive.agent.acp.opencode.
Type: attribute set of (submodule)
Declared by:
services.hyperhive.agent.acp.presets.<name>.args
Arguments passed to command.
Type: list of string
Default:
[ ]
Declared by:
services.hyperhive.agent.acp.presets.<name>.command
Executable that speaks ACP over stdio.
Type: string
Declared by:
services.hyperhive.agent.acp.presets.<name>.env
Environment for this preset only, rendered into the nix store.
Type: attribute set of string
Default:
{ }
Declared by:
services.hyperhive.agent.autoCompact
Enable proactive watermark-based compaction. When true (the
default) the harness automatically runs a notes-checkpoint turn
followed by /compact once the context window crosses 75% of
the model’s limit, keeping later turns from hitting the hard
overflow path. Set to false to disable proactive compaction
entirely (HIVE_COMPACT_WATERMARK_TOKENS=0); the reactive path
(compact-on-overflow when the session is already past the limit)
still applies.
Disable for agents that run large-context models (sonnet/opus) where the heuristic fires too early and discards useful history before the session is actually close to the limit.
Type: boolean
Default:
true
Declared by:
services.hyperhive.agent.availableModels
Models this agent may run. services.hyperhive.agent.model must be one
of them, and the subagent daemon refuses a start or continue on any
other model (rendered into its HIVE_AVAILABLE_MODELS) unless the swarm
sets subagent_models for the agent. An empty list restricts nothing.
Values are the short model names that claude --model accepts:
"haiku", "sonnet", "opus" (or any future identifier).
Type: list of string
Default:
[
"haiku"
"sonnet"
"opus"
]
Example:
[
"sonnet"
"opus"
]
Declared by:
services.hyperhive.agent.backendEnvironment.environmentFiles
The EnvironmentFile= entries that carry this agent’s backend
environment, in load order: backendEnvironmentFile when set, then the
file hive-agent-backend-env.service keeps when the agent has a store and uses an
API key. Read-only: the harness and the subagent daemon take it as it is.
Type: list of string (read only)
Default:
[ ]
Declared by:
services.hyperhive.agent.backendEnvironmentFile
Path (outside the nix store) to a systemd EnvironmentFile loaded
by the harness service — the mechanism for supplying
ANTHROPIC_API_KEY/ANTHROPIC_BASE_URL (or any other backend
credential claude/the harness reads from the environment) without
baking a secret into the nix store.
The file must use systemd EnvironmentFile syntax: one KEY=value
pair per line, no export, no shell quoting needed for simple
values. Example contents:
ANTHROPIC_API_KEY=sk-or-v1-...
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1
Place the file inside the agent’s bind-mounted harness dir (e.g.
/agents/<name>/harness/openrouter.env, $HYPERHIVE_HARNESS_DIR),
not state/ — harness/ survives container rebuilds exactly like
state/ does, but is never bind-mounted into another agent’s
container (unlike state/, which a ManageRootAgent holder gets
read-write for recovery — see docs/4-implementation/agent-state/persistence.md’s “Cross-agent access to
state”), so this credential is reachable by nothing but this agent
and the host. Permissions should be 0600, owned by the agent’s
unix user. Whatever owner it was installed with, the file becomes
agent-owned at the container’s next boot, so the agent can rewrite it;
it is no boundary the agent can’t cross until the swarm secret store
replaces the file. Loaded with a leading - (optional EnvironmentFile),
so a path that doesn’t exist yet — an operator setting this option
before creating the file, or a fresh host rebuild before state is
restored — makes systemd skip it rather than refuse to start the
harness. See services.hyperhive.agent.useApiKey’s doc for the option this one is
paired with. The subagent daemon loads the same file on an ACP agent
and on an agent with useApiKey set, so its subagents authenticate
the same way the harness does.
On an agent with a store (services.hyperhive.agent.bao.addr) that uses
useApiKey or the acp runtime, hive-agent-backend-env.service also
keeps this file’s text at swarm/agents/<agent>/backend-env, field env.
A leaf nobody has written is created from this file once, with the same
bytes, and this file is never rewritten or deleted. The harness and the
subagent daemon load this file first and the store’s copy after it, so
a variable the store holds wins and this file carries the agent while
the store is down. Both read at their own start.
On an ACP agent using the opencode preset, a provider key this file
leaves unset is read from the swarm secret store at
swarm/agents/<agent>/acp-provider, field api_key, if one is stored.
After a turn that ends empty or idle, the store is read again, and a
key that changed there gets the agent respawned with it.
Type: null or string
Default:
null
Example:
"/agents/myagent/harness/openrouter.env"
Declared by:
services.hyperhive.agent.bao.addr
Where the swarm secret store listens, as this container reaches it.
Set by the generated meta flake from the host’s own BAO_ADDR, which
is the address this hive already uses, and setting it is what generates
hive-agent-bao-identity.service: at boot that unit logs in with the certificate
its hive delivered and reads this agent’s own path back, failing if
either step does not succeed. systemctl status hive-agent-bao-identity inside the
container is then the answer to “can this agent reach the store as
itself”, which nothing else in the tree reports.
null means the hive was given no store. No unit is generated then,
because an agent whose swarm never minted an identity has nothing to
log in with, and a failed unit at every boot would say that in the
loudest possible way about a deployment that never asked for it.
Type: null or string
Default:
null
Example:
"https://bao.example.com:8200"
Declared by:
services.hyperhive.agent.bao.clientCertFile
This agent’s current store certificate, kept by hive-agent-bao-identity.service.
Read-only: it is where that unit writes, not a knob. Every unit that
logs in to the store as this agent points BAO_CLIENT_CERT here.
Type: string (read only)
Default:
"/run/hive-agent-bao-identity/current/cert"
Declared by:
services.hyperhive.agent.bao.clientKeyFile
The private key for clientCertFile, 0400 to the agent user.
🩸 A PATH and never a value.
Type: string (read only)
Default:
"/run/hive-agent-bao-identity/current/key"
Declared by:
services.hyperhive.agent.bao.servicesPkiMount
Mount path of the store’s services pki engine, whose root is the one
anchor every swarm service certificate chains to. Set by the generated
meta flake from the host’s
services.hyperhive.deploy.bao.servicesPkiMountPath.
hive-agent-trust-bundle.service reads <mount>/ca/pem from it.
Type: string
Default:
"pki"
Example:
"pki"
Declared by:
services.hyperhive.agent.cargo.shortMessages
Auto-inject --message-format short on cargo compile
subcommands (build, check, clippy, test, run,
doc, bench, install, rustc, fix) when claude (or
anything else) invokes cargo inside this container.
Saves tokens + context — the verbose default output floods
the response window with per-crate progress lines that
carry no signal beyond the warning/error summary.
Implementation: contributes a cargo shell function to
/etc/hyperhive/bash-env.sh (see services.hyperhive.agent._bashEnvFragments).
Loaded via BASH_ENV for non-interactive shells (bash -c —
what the claude Bash tool runs) and sourced from
programs.bash.interactiveShellInit for interactive shells.
The function:
- handles the
+toolchainselector prefix (cargo +nightly buildworks); - passes through cleanly when the caller already specified
--message-format(any form); - leaves non-compile subcommands (
new,add,search, third-partycargo-*subcommands) untouched so they don’t error on the unknown flag.
Set to false for agents that need full cargo output (e.g.
tooling that parses --message-format json programmatically
and doesn’t pass the flag explicitly).
Type: boolean
Default:
true
Example:
false
Declared by:
services.hyperhive.agent.claudeMarketplaces
Claude Code plugin marketplaces to add at harness boot. Each
entry is passed to claude plugin marketplace add <source>
(owner/repo, full git URL, or local path). Idempotent —
re-adding an existing marketplace is treated as success.
Required before services.hyperhive.agent.claudePlugins entries that
reference a marketplace (e.g. foo@claude-plugins-official).
Rendered to /etc/hyperhive/claude-marketplaces.json.
Defaults to Anthropic’s official marketplace plus hyperhive’s
own claude-plugins nix package (see
nix/packages/claude-plugins.nix) — a local-path marketplace
built as a plain nix store path, registered under the name
hyperhive (from its marketplace.json, not the store path
itself, so plugin specs stay stable across rebuilds). No forge
repo or git remote needed to ship a hive-authored skill; agents
get both marketplaces out of the box without any per-agent.nix
wiring.
Type: list of string
Default:
[ "anthropics/claude-plugins-official" "${hyperhive.packages.claude-plugins}" ]
(the flake’s own local-path plugin marketplace)
Example:
[
"anthropics/claude-plugins-official"
"anthropics/claude-plugins-community"
]
Declared by:
services.hyperhive.agent.claudePlugins
Claude Code plugins to install at harness boot. Each entry is
passed verbatim to claude plugin install <spec> once per
container start, before the turn loop opens. claude plugin install is expected to be idempotent, so reinstalling on every
boot is cheap. Failures log a warning but do not abort boot — a
missing plugin is preferable to a non-serving agent. Rendered to
/etc/hyperhive/claude-plugins.json; the harness reads it via
plugins::install_configured.
Always includes Anthropic’s skill-creator (teaches an agent to
write, refine, and evaluate its own skills) plus hyperhive’s own
base plugin — one plugin bundling every skill that applies to
all agents regardless of role (currently just state-hygiene,
read-before-write + dated-archive discipline for durable
notes/state files; more all-agent skills land as additional
skills inside this same plugin, not new plugins — a skill that
only some agents need gets its own specialized plugin instead).
Agents get both out of the box, matching the default
marketplaces above.
A per-agent definition ADDS to that base set rather than
replacing it — unlike claudeMarketplaces, this list is merged
across every module that defines it (ordinary NixOS list-option
semantics: two plain definitions concatenate). An agent that sets
services.hyperhive.agent.claudePlugins = [ "foo@bar" ] gets the
base set plus foo@bar, with no need to repeat the base entries.
An operator who wants to replace the base set entirely, rather
than add to it, can still do that with lib.mkForce or
lib.mkOverride.
Type: list of string
Default:
[ ]
Example:
[
"formatter@my-marketplace"
"thinking-tools@anthropics"
]
Declared by:
services.hyperhive.agent.claudePluginsAutoUpdate
When true, the harness runs claude plugin marketplace update
before installing plugins at boot, pulling the latest index from
all configured marketplaces. Disabled by default — most agents
want pinned plugin versions and the network round-trip adds to
boot time. Enable for agents that should always install the latest
available version of their plugins.
Type: boolean
Default:
false
Declared by:
services.hyperhive.agent.dashboardLinks
Extra navigation links surfaced on the hive-c0re dashboard card for this agent. Declare any additional web UI pages the agent exposes — stats pages, custom UIs, etc. hive-c0re reads the JSON file this option produces at each container-view snapshot and attaches the links to the agent card without any code changes.
Type: list of (submodule)
Default:
[ ]
Example:
[
{ label = "Stats"; icon = "📊"; url = "http://localhost:9001/stats"; }
]
Declared by:
services.hyperhive.agent.dashboardLinks.*.icon
Optional icon emoji or short glyph.
Type: string
Default:
""
Declared by:
services.hyperhive.agent.dashboardLinks.*.label
Display label for the link.
Type: string
Declared by:
services.hyperhive.agent.dashboardLinks.*.url
Full URL (may include a different port, e.g. http://localhost:9001/stats)\.
Type: string
Declared by:
services.hyperhive.agent.docs.enable
Whether to enable make the hyperhive reference docs (the repo docs/ tree, shipped
read-only as the reference-docs package) available
in-container. When enabled the harness exposes the docs dir to claude
via claude --add-dir, so the markdown is readable at
$HIVE_DOCS_DIR/, and appends a single pointer sentence to the agent’s
system prompt so it knows the docs exist (see
hive-agent::prompt::render). Off by default for every agent; an agent
turns it on from its agent.nix.
.
Type: boolean
Default:
false
Example:
true
Declared by:
services.hyperhive.agent.docs.source
Store path of the reference-docs tree exposed at $HIVE_DOCS_DIR
when services.hyperhive.agent.docs.enable is set. Defaults to the flake’s
reference-docs package (the nix/packages/reference-docs.nix
build), which the meta flake’s pinned hyperhive input provides.
Type: absolute path
Default:
hyperhive.packages.reference-docs (built from the repo docs/ tree)
Declared by:
services.hyperhive.agent.effortLevel
Baseline claude effort level for this agent. Rendered into the
HIVE_DEFAULT_EFFORT environment variable; the harness resolves
effort as an existing hyperhive-effort file → this env → built-in
"medium", and passes the result to claude --effort at turn launch.
An effort the swarm sets for the agent (the swarm UI’s agents page, or
swarmctl agent inference set) wins over all of these.
Ascending scale: "low" (minimal thinking budget), "medium"
(default — balanced), "high" (platform default), "xhigh"
(recommended for autonomous coding on capable models), "max"
(maximum thinking budget, highest cost).
Type: one of “low”, “medium”, “high”, “xhigh”, “max”
Default:
"medium"
Example:
"high"
Declared by:
services.hyperhive.agent.extraMcpServers
Extra MCP servers claude sees alongside the hyperhive tool surface.
Keys are the server names (claude addresses tools as
mcp__<key>__<tool>). Rendered to /etc/hyperhive/extra-mcp.json
at activation time; the harness reads that file at boot and merges
it into --mcp-config + --allowedTools. Take effect on the
agent’s next harness restart (no operator approval needed beyond
whatever brought the new agent.nix into deployed/*).
The bash entry above is illustrative only — it’s auto-injected
below (services.hyperhive.agent.extraMcpServers.bash via lib.mkDefault) already
tracking services.hyperhive.agent.mcp.bashHttpPort, so overriding it directly
with a hardcoded port (as shown) is unusual and will drift if
bashHttpPort is changed separately; bump bashHttpPort instead.
Type: attribute set of (submodule)
Default:
{ }
Example:
{
matrix = {
command = "/run/current-system/sw/bin/mcp-matrix";
args = [ "--config" "/state/matrix.toml" ];
env.MATRIX_HOMESERVER = "https://matrix.example.org";
allowedTools = [ "send_message" "join_room" ];
};
bash = {
type = "http";
url = "http://127.0.0.1:8791/mcp";
};
}
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.allowedTools
Tool names this MCP server is auto-approved to call via
--allowedTools. Single entry "*" (the default) means
“every tool from this server” — convenient but trusting.
Tighten to a specific list when you only want a subset.
Names are bare (e.g. send_message); the harness prepends
mcp__<server-key>__ at build time.
Type: list of string
Default:
[
"*"
]
Example:
[
"send_message"
"join_room"
]
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.args
Args passed to the MCP server binary. "stdio" only.
Type: list of string
Default:
[ ]
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.availableToSubagents
Whether a claude subagent (mcp__subagent__start/continue,
served by hive-subagent-daemon) also gets this MCP server.
Default false: a subagent runs --strict-mcp-config with no
ambient MCP discovery, so this is the only path an
extraMcpServers entry reaches a subagent’s own claude
invocation at all — leaving it unset keeps a subagent exactly
as narrow as before this option existed (its native built-in
tools only, zero MCP servers).
The automatically injected bash and subagent entries below stay at
this default — a subagent never gets hive-bash (it already has
claude’s native Bash tool instead) or the ability to spawn
its own nested subagents, unless an operator opts a
different entry in explicitly. Set true on an entry (e.g.
a scraper or read-only lookup MCP) to hand it to subagents too.
Type: boolean
Default:
false
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.command
Absolute path to the MCP server binary. Use ${pkgs.foo}/bin/foo
or /run/current-system/sw/bin/foo. Required when
type = "stdio"; ignored (leave null) for "http".
Type: null or string
Default:
null
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.env
Environment variables for the MCP server child process. "stdio" only.
Type: attribute set of string
Default:
{ }
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.headersFile
Absolute path (a string, never a nix path literal, which would
copy the secret into the world-readable store) to a file holding
a JSON object of request headers, e.g.
{"Authorization": "Bearer <token>"}, for an "http" server
that needs them. Rendered as claude’s headersHelper
(cat <file>), so the file is read when claude connects, on
reconnect and after a 401/403: a rotated token needs no
harness restart. A missing or non-JSON file leaves that server
without headers (claude’s own behaviour). "http" only; not
applied to ACP agents.
Type: null or string
Default:
null
Example:
"/agents/janet/state/secrets/truth-headers.json"
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.type
Transport for this MCP server. "stdio" (the default) spawns
command as a fresh child process every turn, talking
JSON-RPC over its stdin/stdout — existing entries need zero
changes to keep this behaviour. "http" points claude at a
long-lived streamable-http url instead: no per-turn spawn,
no re-registration race, same shape as the built-in
hyperhive surface (hive-mcp-http) — use this for a server
backed by an always-on daemon. command/args/env only
apply to "stdio"; url only to "http".
Type: one of “stdio”, “http”
Default:
"stdio"
Declared by:
services.hyperhive.agent.extraMcpServers.<name>.url
Streamable-http URL (e.g. http://127.0.0.1:8791/mcp) of the
always-on daemon serving this MCP surface. Required when
type = "http"; ignored (leave null) for "stdio".
Type: null or string
Default:
null
Declared by:
services.hyperhive.agent.extraWebProxies
Transparent reverse-proxies mounted under /extra/ in the per-agent web UI.
Each attribute name becomes the sub-path and the value is the upstream.
E.g. { "stats" = "http://127.0.0.1:3737"; } mounts a proxy at
/agent/<name>/extra/stats/ that forwards to port 3737 with the prefix
stripped. All user-declared proxies live under /extra/ so they can
never conflict with native agent endpoints (/api/*, /events/*, etc.).
The upstream value is either an http(s):// URL or a Unix domain
socket, spelled unix:<path> (e.g. unix:/run/myapp/http.sock) — for
agents whose secondary web server only listens on a UDS.
Intended for agents that run secondary web servers in the same container. Static assets served by the secondary app must use relative paths to resolve correctly under the sub-path prefix.
Sets the HIVE_EXTRA_WEB_PROXIES environment variable (JSON object)
on the harness service unit.
Type: attribute set of string
Default:
{ }
Example:
{ "stats" = "http://127.0.0.1:3737"; }
Declared by:
services.hyperhive.agent.forge.tokenFile
Path this agent’s own forge token is fetched to. Read-only: it is a
fact about where hive-agent-forge-token.service writes, not a knob.
🩸 A PATH and never a value. The file is 0400 to the agent user.
The file exists only once the swarm has minted a token for this agent
and the agent has a store identity to fetch it with. Until then every
consumer falls back to $HYPERHIVE_STATE_DIR/forge-token.
Type: string (read only)
Default:
"/run/hive-agent-forge-token/token"
Declared by:
services.hyperhive.agent.forge.url
Base URL of the hyperhive-managed Forgejo. Scopes the git credential helper to this forge, and is where the avatar sync uploads the agent’s icon.
null means “no forge”, not “guess one”. There is deliberately
no loopback default: the forge may run on a different host from
the agents, and inside an agent’s network namespace localhost
reaches the agent rather than the forge, so a default would be a
value that builds fine and then talks to the wrong machine.
When this is null the credential helper and avatar-sync units are not
generated at all — an absent integration, never a misdirected
one.
On a real hive it is always set: hive-c0re renders it into every
agent’s config from the host’s HIVE_FORGE_URL (which
hive-c0re.nix sets unconditionally) and refuses to render a meta
flake without it, so null only survives where the modules are
evaluated outside a hive — exactly the case that has no forge.
Type: null or string
Default:
null
Example:
"http://forge.internal:3000"
Declared by:
services.hyperhive.agent.frontend.dist
The shipped frontend dist (built by nix/packages/frontend.nix).
Output layout: dashboard/ (used by hive-c0re on the host) and
agent/ (used here, layered with extraFiles below at
activation time). Override to ship a fully custom per-agent SPA;
the JSON contract (/api/state, /events/stream, the action
endpoints) is the source of truth for any replacement.
Type: package
Default:
hyperhive.packages.frontend (the flake’s frontend dist)
Declared by:
services.hyperhive.agent.frontend.extraFiles
Per-agent additions layered on top of the default frontend
dist. Each entry copies its source into the served static
tree under target. Useful for shipping a self-contained
agent-specific surface alongside the standard agent UI (e.g.
the bitburner agent’s game page at /bitburner/).
The default agent UI remains served at /; entries here only
add new routes and never replace the default. Overwrite
semantics are hard-fail: if target collides with an
existing file or directory in the default dist (or with a
prior entry’s target), the mergedDist build aborts with
refusing to overwrite existing path '<target>' in the default dist. To override a default file, fork the dist via
services.hyperhive.agent.frontend.dist instead — extraFiles is for
pure additions.
target must be a relative path inside the static dir. An
assertion rejects leading / and .. segments at config
eval time (string-concat-into-paths safety, even though
agent.nix goes through operator review before deploy).
Type: attribute set of (submodule)
Default:
{ }
Example:
{
bitburner = {
source = ./bitburner-dist;
# served at GET /bitburner/...
};
}
Declared by:
services.hyperhive.agent.frontend.extraFiles.<name>.source
Source file or directory to layer over the default
agent dist. A path (relative to agent.nix or
absolute) — nix copies its contents into the merged
static tree.
Type: absolute path
Declared by:
services.hyperhive.agent.frontend.extraFiles.<name>.target
Destination path within the merged static tree, used
as both the served URL prefix (/<target>/...) and
the on-disk layout in the merged derivation. Defaults
to the attribute name. Use forward slashes for
nested layouts (e.g. "games/bitburner").
Constrained shape: must start with an alphanumeric or
_, and only contain alphanumerics, _, ., /,
-. .. segments are separately rejected at config
eval time.
Type: string matching the pattern ^[A-Za-z0-9_][A-Za-z0-9_./-]*$
Default: the attribute name
Declared by:
services.hyperhive.agent.frontend.mergedDist
Computed: the merged static tree consumed by the harness via
HIVE_STATIC_DIR. Composed at evaluation time by copying
services.hyperhive.agent.frontend.dist’s agent/ subdir as the base, then
layering each extraFiles entry on top. Read-only — do not set directly.
Type: package (read only)
Declared by:
services.hyperhive.agent.github.enable
Install the GitHub integration in this agent: a gh CLI wrapper and a
git credential helper for https://github.com, both authenticated from
an operator-supplied personal access token (PAT). The operator links the
PAT in the swarm UI, and the agent fetches it from the swarm secret store
into <state>/github-token (needs services.hyperhive.agent.bao.addr),
so giving an agent GitHub is a runtime action, no per-agent config or
rebuild. The wrappers read the token file at invocation, so a fetched
PAT takes effect immediately; until one exists, gh / git push just
fail unauthenticated.
github.com only. git authenticates as x-access-token + the PAT (GitHub
ignores the username for PAT auth); gh derives its identity from the
token. Keep the PAT minimally scoped: the agent has passwordless sudo, so
a compromised agent can act within the token’s scopes — scope is the
real blast-radius limiter.
On by default. Host-driven: set services.hyperhive.swarm.github.enable = false
to turn the integration off swarm-wide (meta.rs propagates the override
into every agent).
Type: boolean
Default:
true
Declared by:
services.hyperhive.agent.gui.enable
Run Weston with the VNC backend as a systemd service, for
in-browser GUI access via the harness /screen/ws WebSocket
relay. Renders in software (pixman) — no GPU, DRM, or VT
access, so no extra container capabilities are needed.
Weston binds a fixed VNC port (services.hyperhive.agent.gui.vncPort) on the
container’s own loopback. Network isolation is unconditional
(each agent has its own netns), so a fixed port can’t collide
across containers — no per-agent hashing needed. The harness
learns the port from the HIVE_GUI_VNC_PORT env var (set by the
harness service when gui is enabled). The unit is
Type = "simple" so a misconfigured weston degrades to a restart
loop instead of blocking nixos-container update.
Weston, the wayland client and the agent harness run as the
agent’s own non-root user (services.hyperhive.agent.user.name), sharing one
session: a fixed XDG_RUNTIME_DIR=/run/gui, one wayland display,
and one D-Bus session bus at /run/gui/bus (gui-dbus.service),
so GUI clients need no private dbus-run-session.
Type: boolean
Default:
false
Declared by:
services.hyperhive.agent.icon
Path to an SVG file used as this agent’s icon — shown on the
dashboard and the per-agent web UI (header + favicon). Commit
the SVG into the agent’s config repo next to agent.nix and
reference it as a relative path (./icon.svg).
When null (the default), GET /icon on the per-agent web port
404s and consumers (dashboard, this agent’s own page header)
fall back client-side to the frontend-bundled /favicon.svg
rather than a server-resolved default.
Type: null or absolute path
Default:
null
Example:
./icon.svg
Declared by:
services.hyperhive.agent.logs.queryUrl
The swarm log store’s LogsQL query endpoint, as this container
reaches it — the machine route swarm-victorialogs.nix puts on the
gateway, not the browser one at /.
Set by the generated meta flake from the host’s own
services.hyperhive.swarm.victorialogs.domain.
null means this hive has not been given the log store’s address for
its agents, and swarm-logs is then not installed at all. Deliberately
not defaulted: a guessed address resolves cleanly to the wrong place.
Type: null or string
Default:
null
Example:
"https://logs.example.com/select/logsql/query"
Declared by:
services.hyperhive.agent.matrix.url
Matrix homeserver URL the agent’s hive-matrix-daemon connects
to. hive-c0re writes this per agent from the hive’s own
isolation-aware URL (gatewayHost’s vhost via the gateway,
chat.<swarm-domain> by default), so a
generated agent config always carries a real value; set it by
hand only when an agent should talk to an external homeserver
instead (a federation-only setup, or a remote hive’s tuwunel
reached over a vpn).
null means “no matrix”, not “guess one”. There is
deliberately no loopback default: the homeserver may run on a
different host from the agents, and inside an agent’s network
namespace localhost reaches the agent rather than the
homeserver, so a default would be a value that builds fine and
then talks to the wrong machine. An absent integration, never a
misdirected one.
null is also this agent’s matrix off switch — there is no
separate services.hyperhive.agent.matrix.enable boolean: the
hive-internal main account in
services.hyperhive.agent.matrixAccounts is declared from this
URL, so null leaves that set empty and the whole integration —
daemon unit, path watcher, injected MCP entry — is not generated
at all. Declaring an external account with its own homeserver
turns matrix back on without a hive homeserver, which is the
honest reading of that config.
Type: null or string
Default:
null
Example:
"https://matrix.darkest.space"
Declared by:
services.hyperhive.agent.matrixAccounts
Every matrix account served by the single hive-matrix-daemon
(one matrix-sdk Client + sync loop each). The attribute name keys
each account (unique by construction) and is the handle the matrix
MCP tools target via their account argument.
This set is also the enable signal for per-agent matrix — there is no separate boolean. A non-empty set means the harness:
- runs
hive-matrix-daemonas a systemd unit that holds a matrix-sdk Client + sync per account against that account’s homeserver (homeserver, elseservices.hyperhive.agent.matrix.url). The daemon leaves an account whose URL or token is missing down (an extra one is tried again every few minutes), and asystemd.pathswatcher restarts it the moment a token file appears (same path-trigger shape asforge-avatar-sync). - exposes the matrix tool surface (send_message, send_dm,
send_reaction, send_reply, mark_read, list_rooms,
list_room_members, read_room) to claude via an auto-injected
extraMcpServers.matrixentry pointed at the daemon’s own streamable-http listener (services.hyperhive.agent.mcp.matrixHttpPort) — no stdio bridge, no per-turn respawn, same shape as the built-in hyperhive surface andhive-bash-daemon. - wakes the agent on incoming room events via a short teaser
Wake signal (
[matrix] <sender> in <room>: <first 100c>…) to the hyperhive control socket; the full event stays unread server-side untilread_roomconsumes it.
An empty set is an agent with no matrix at all: none of those
three exist. That is the state an agent reaches by having no
homeserver (services.hyperhive.agent.matrix.url = null) and no
account of its own, and it replaces the removed
services.hyperhive.agent.matrix.enable = false.
The hive-internal account is the primary whenever it exists: it
is named main, and this module declares it for you from
services.hyperhive.agent.matrix.url + <state>/matrix-token +
<state>/matrix-sdk-state — so it is present exactly when that URL
is non-null, which on a real hive is always (hive-c0re renders it
per agent). It is the account a tool call acts as when it omits
account. It is an ordinary entry of this option
like any other, so it shows up in the account list — what you
add here are the further accounts (e.g. an external
public-matrix account). Its tokenFile stays pinned to
<state>/matrix-token (an assertion; the file the daemon falls back
to when the store has no main token), and the
dashboard’s link-account route refuses to create an account named
main — the entry belongs to the module, not to a provisioner.
Leave it alone (the default) for the common single-account case:
the agent then has only main. The whole set is serialized to the
daemon’s HIVE_MATRIX_ACCOUNTS environment variable, main
first.
Type: attribute set of (submodule)
Default:
{ }
Example:
{
ccc = {
tokenFile = "/agents/dmatrix/state/matrix-token-ccc";
sessionDir = "/agents/dmatrix/state/matrix-sdk-state-ccc";
homeserver = "https://matrix.example.org";
};
}
Declared by:
services.hyperhive.agent.matrixAccounts.<name>.homeserver
Homeserver URL for this account. When null (the default),
the account falls back to services.hyperhive.agent.matrix.url. Set it for
an account on a different homeserver than the agent’s
default (e.g. an external public-matrix account).
Type: null or string
Default:
null
Example:
"https://matrix.example.org"
Declared by:
services.hyperhive.agent.matrixAccounts.<name>.sessionDir
Per-account matrix-sdk sqlite store directory (crypto keys
- event cache). Must differ between accounts so their sessions do not collide.
Type: string
Example:
"/agents/dmatrix/state/matrix-sdk-state-ccc"
Declared by:
services.hyperhive.agent.matrixAccounts.<name>.tokenFile
Path to this account’s bearer-token file. The daemon reads
the token from here to restore the matrix session; how the
file gets populated is the provisioner’s concern
(for main, a file only when the store has no token: the
swarm mints main into the store; an operator-supplied
secret for an external one). The daemon
leaves an extra account whose token is absent down and tries
it again every few minutes, and
exits cleanly to wait on the path watcher when main’s is.
Type: string
Example:
"/agents/dmatrix/state/matrix-token-ccc"
Declared by:
services.hyperhive.agent.mcp.bashHttpPort
Loopback port hive-bash-daemon serves its MCP tools
(run/status/kill) on. Same shape as services.hyperhive.agent.mcp.httpPort
for the built-in surface: HTTP is the sole transport (no stdio
bridge — the daemon that owns the subprocess runner serves the MCP
tools directly in-process), Restart = "always" keeps the listener
self-healing, and loopback-only binding means no auth token is
needed (same allowed_hosts reasoning as services.hyperhive.agent.mcp.httpPort).
Safe as a single fixed default across all agents (private
per-container network namespace — see docs/4-implementation/networking/network.md).
Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
8791
Example:
8792
Declared by:
services.hyperhive.agent.mcp.httpPort
Loopback port the built-in hyperhive MCP surface is served on. HTTP
is the sole transport for the built-in surface: a
long-lived hive-mcp-http systemd unit runs
hive-agent-mcp --http 127.0.0.1:<port> and render_claude_config
points claude at the stable http://127.0.0.1:<port>/mcp URL. That
URL survives the per-turn claude re-spawn (and a host-side hive-c0re
restart — each tool call dials the control socket fresh), so there
is no per-turn MCP re-registration race (a resumed stdio child could
emit its first tool call before that turn’s async
initialize/tools-list completed, stranding the agent with No such tool — the http endpoint eliminates that). matrix stays a
stdio bridge; bash runs its own persistent http listener (see
services.hyperhive.agent.mcp.bashHttpPort).
Bound loopback-only; the rmcp streamable-http transport’s default
allowed_hosts (localhost / 127.0.0.1 / ::1) rejects Host
headers from anywhere else, so no auth token is required for a
container-local endpoint.
Failure-mode note: with no stdio fallback, if hive-mcp-http is
down claude hits a dead URL until the unit restarts (guarded by
Restart=always, RestartSec=3). Intended shape: no per-turn race
while up, a bounded self-healing gap while restarting.
Safe as a single fixed default across all agents: each container
runs in its own private network namespace (isolation is always-on —
see docs/4-implementation/networking/network.md), so 127.0.0.1:<port> is per-container-private
and cannot collide across agents. Override only if a container-local
service already occupies this port.
Must match mcp_config::DEFAULT_MCP_HTTP_PORT (the harness always
exports HYPERHIVE_MCP_HTTP_PORT, so the const is only a fallback).
Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
8790
Example:
8791
Declared by:
services.hyperhive.agent.mcp.matrixHttpPort
Loopback port hive-matrix-daemon serves its MCP tools
(send_message, list_rooms, read_room, …) on. Same shape as
services.hyperhive.agent.mcp.bashHttpPort: HTTP is the sole transport (no
stdio bridge — the daemon that owns the matrix-sdk Client
registry serves the MCP tools directly in-process),
Restart = "always" keeps the listener self-healing, and
loopback-only binding means no auth token is needed (same
allowed_hosts reasoning as services.hyperhive.agent.mcp.httpPort). Safe as a
single fixed default across all agents (private per-container
network namespace — see docs/4-implementation/networking/network.md).
Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
8792
Example:
8793
Declared by:
services.hyperhive.agent.mcp.subagentHttpPort
Loopback port hive-subagent-daemon serves its MCP tools
(start/continue/status/interrupt) on. Independent daemon (own crate,
hive-subagent-mcp) — a subagent spawns a full nested claude
process, a much heavier capability than a bash command, worth its own
deployable/restartable unit. Same shape/reasoning as
services.hyperhive.agent.mcp.bashHttpPort otherwise: sole transport, self-healing
restart, loopback-only so no auth token is needed. Shipped default-on
for every agent today, same as bash — expected to become a real
opt-in capability gate later, not yet.
Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
8793
Example:
8794
Declared by:
services.hyperhive.agent.metrics.url
The swarm metrics store’s gateway origin, as this container reaches
it. swarm-metrics appends the read API’s paths (/api/v1/query,
…) to it.
Set by the generated meta flake from the host’s own
services.hyperhive.swarm.victoriametrics.domain.
null means this hive has not been given the metrics store’s address
for its agents, and swarm-metrics is then not installed at all.
Not defaulted: a guessed address resolves cleanly to the wrong place.
Type: null or string
Default:
null
Example:
"https://metrics.example.com"
Declared by:
services.hyperhive.agent.model
Claude model for this agent. Sets the HIVE_DEFAULT_MODEL
environment variable; the harness applies it at boot and it takes
priority over a hyperhive-model file in the harness dir. A model the
swarm sets for the agent (the swarm UI’s agents page, or
swarmctl agent inference set) wins over this option.
Valid values are the short model names that claude --model accepts:
"haiku", "sonnet", "opus" (or any future identifier). The
harness takes the context window from the model’s own report after
each turn, and from a per-family default before the first.
Type: string
Default:
"haiku"
Example:
"sonnet"
Declared by:
services.hyperhive.agent.nixBuilds
Where this agent’s nix builds run.
host(default): builds go through the host’s nix-daemon socket, which every agent container gets bound in by default. The daemon runs them outside this container, so the container’s CPU and memory caps do not apply to a build.none: the container cannot reach the host’s nix-daemon, sonix build,nix run,nix shelland the like fail for anything not already in the store, with a “cannot connect to socket” error. The agent’s own system closure stays readable. The container’s own nix-daemon socket and service are off, so nothing in the container listens on that path either.
The swarm builder reads the option from the evaluated config into the
agent’s closure record, and the hive applies it when it next starts the
container, so a running agent keeps its mode until restarted. A host
that does not know the option leaves the agent on host.
Type: one of “host”, “none”
Default:
"host"
Example:
"none"
Declared by:
services.hyperhive.agent.otel.debug
Emit claude’s OTEL SDK diagnostics to stderr
(CLAUDE_CODE_OTEL_DIAG_STDERR=1). Set it in this agent’s own
config while troubleshooting its collector connection; it is noisy,
so leave it off otherwise. Only takes effect when enable is true.
Type: boolean
Default:
false
Declared by:
services.hyperhive.agent.rea.enable
Whether to enable REA (Reverse Engineer Anything) with Ghidra in the container. Installs rea,
Ghidra 12.1 and procps, sets GHIDRA_INSTALL_DIR, JAVA_HOME,
REA_GHIDRA_PROJECT_PATH (under the agent’s state dir) and
GHIDRA_HEADLESS_MAXMEM, and registers rea mcp as
extraMcpServers.rea with all its tools allowed. Ghidra’s 2G heap counts
against the agent’s normal memory cap
.
Type: boolean
Default:
false
Example:
true
Declared by:
services.hyperhive.agent.runtime
What drives this agent’s turns. "claude" runs claude --print.
"acp" runs the Agent Client Protocol agent described by
services.hyperhive.agent.acp, as one long-lived child of the
harness, and turns services.hyperhive.agent.useApiKey on by default:
the agent authenticates to its own provider, so there is no Claude
login to wait for.
On "acp", model and effortLevel are set on the session before
each prompt, but only when the session offers that value (otherwise
the agent keeps the model it is configured with). autoCompact applies
as it does on "claude". The web UI’s cancel button and /compact
both work.
Subagents (hive-subagent-daemon) run on the same runtime. On
"acp", each subagent run spawns its own copy of the ACP agent, which
also gets services.hyperhive.agent.backendEnvironmentFile.
Type: one of “claude”, “acp”
Default:
"claude"
Example:
"acp"
Declared by:
services.hyperhive.agent.useApiKey
Authenticate this agent’s claude invocations with an API key
(ANTHROPIC_API_KEY/ANTHROPIC_BASE_URL, e.g. OpenRouter) rather
than a Claude OAuth session. Sets HIVE_USE_API_KEY=1, which the
harness reads (hive_agent::login::using_api_key) to report
LoginState::Online at boot without checking ~/.claude/ — an
api-key agent has no OAuth session to wait for, so it must never
park the turn loop expecting one. Also stamped into the consolidated
harness state file so hive-c0re’s dashboard stops reading an empty
~/.claude/ as “needs login” for this agent (see
hive_c0re::container_view’s needs_login computation).
Set this AND services.hyperhive.agent.backendEnvironmentFile together — this
option changes what the harness believes about its own login state,
the other actually supplies the credentials claude reads. Neither
is useful alone.
Type: boolean
Default:
false
Declared by:
services.hyperhive.agent.user.gid
Optional fixed GID for the per-agent unix group. null (default)
lets NixOS auto-assign. Usually set alongside services.hyperhive.agent.user.uid
to the same value (the conventional Unix pattern for per-user
groups where uid == gid), but can be set independently.
Type: null or signed integer
Default:
null
Example:
1100
Declared by:
services.hyperhive.agent.user.name
Unix user the harness service runs as inside the container.
The meta-flake overrides this to the agent’s own name so the
user inside the container matches the agent label (HIVE_LABEL).
Stand-alone evaluation defaults to "agent" so module evaluation
without the meta-flake wrapper still builds.
Constraints match useradd’s NAME_REGEX: lowercase / _ start,
total length ≤ 31, no special characters. UID is auto-assigned
by NixOS unless services.hyperhive.agent.user.uid is explicitly set.
Type: string matching the pattern ^[a-z_][a-z0-9_-]{0,30}$
Default:
"agent"
Example:
"iris"
Declared by:
services.hyperhive.agent.user.passwordlessSudo
Grant agent passwordless sudo
(NOPASSWD: ALL). True by default so claude’s Bash tool
keeps working for tools that expect root inside the container
(systemctl, package managers in dev shells, etc.) — the
same surface the previous root-user shape had, just elevated
explicitly instead of implicitly.
Flip to false for agents that should be strictly
unprivileged. Anything claude shells out to that needs root
will then fail loudly with the standard sudo error rather
than silently succeeding — easier to spot the leak.
Type: boolean
Default:
true
Example:
false
Declared by:
services.hyperhive.agent.user.privateUsers
Run this agent’s container in its own user namespace. Off by default.
Approving the config PR that sets this authorises a host-level
change. The swarm builder reads the option from the evaluated config
into the agent’s closure record, and the hive then starts the container
with --private-users=pick, every hive bind mounted owneridmap, and
its root idmapped. The first such start has hive-priv, as root, chown
the agent’s state, harness, work and claude dirs once to the
host’s data owner
(services.hyperhive.deploy.hive-controller.userns.dataOwner). Nothing is
deleted. Turning it off afterwards needs the dirs chowned back by hand.
Needs user.uid and user.gid set to the same number: nspawn maps a
bind’s gids with its uid map, so a group of another number has no
mapping and writes fail. Start the agent once with the pin before
turning this on; hive-priv refuses to move a state dir whose gid
differs from its uid. An agent that holds ManageRootAgent should not
set it, since the other agents’ dirs it mounts are not remapped.
Type: boolean
Default:
false
Example:
true
Declared by:
services.hyperhive.agent.user.uid
Optional fixed UID for the per-agent unix user. null (default)
lets NixOS auto-assign from the normal-user range (≥ 1000),
which is the right default for most deployments — the UID stays
stable across container rebuilds because each container only has
one normal user and the assignment is written into the container’s
/etc/passwd at activation time.
Set an explicit value only when the host needs a predictable UID for the agent’s state files — e.g. if an operator script references files by numeric UID, or to keep ownership stable across full container destroy + recreate on a fresh host.
Values must be in [1000, 60000). Using UIDs < 1000 clashes with
system accounts and is rejected by NixOS.
Type: null or signed integer
Default:
null
Example:
1100
Declared by: