Command-Line Help for swarmctl

This document contains the help content for the swarmctl command-line program.

Command Overview:

swarmctl

swarm-level operator CLI

Usage: swarmctl [OPTIONS] <COMMAND>

Subcommands:
Options:

swarmctl agent

Manage agents across the swarm

Usage: swarmctl agent <COMMAND>

Subcommands:

swarmctl agent create

Queue creation of a new agent on a hive in this swarm.

Asks the swarm-controller to insert its agent-creation job graph — SSO identity, forge user, config repo, and the deploy message that puts the agent on --hive — and prints the queued job's node id.

This returns as soon as it queues the work. It doesn't wait, and a finished graph would not mean the agent is up either: the last node publishes a deploy, after which the hive converges on its own clock. Watch the swarm UI's job view, or the hive itself, for the rest.

No approval gate guards this: the caller is root on the controller's host, or logged in through the swarm domain's SSO gate.

Usage: swarmctl agent create [OPTIONS] --hive <HIVE> <NAME>

Arguments:
Options:

swarmctl agent mint-forge-token

Check one agent's forge token, and mint it if it's missing or stale.

swarm-controller does this for every agent with a store identity at start and every five minutes; this is for when waiting isn't an option. It leaves a current token alone.

Queues and returns, the same way agent create does — watch the swarm UI's job view for the outcome.

Usage: swarmctl agent mint-forge-token [OPTIONS] <NAME>

Arguments:
Options:

swarmctl agent set-state

Declare the state a hive converges an agent to: up, offline, paused or destroyed.

Writes the swarm's declaration for the agent, the one the swarm UI's state menu writes, and returns once the controller has published it; the hive converges on its own clock. The swarm must already know the agent on --hive: this never creates one.

destroyed can't be undone, so it needs --yes.

No approval gate guards this: the caller is root on the controller's host, or logged in through the swarm domain's SSO gate.

Usage: swarmctl agent set-state [OPTIONS] --hive <HIVE> <AGENT> <STATE>

Arguments:
Options:

swarmctl agent watch

Follow an agent's terminal rows live: the newest retained rows, then each new one, one line per row, until Ctrl-C or the stream ends.

The swarm-level counterpart of hivectl agent watch, read from the swarm-controller rather than from the agent's own web UI, so it works from any machine with --swarm and doesn't need the agent running to show what it last did. Fails when the swarm has never heard from the agent.

Usage: swarmctl agent watch [OPTIONS] <AGENT>

Arguments:
Options:

swarmctl agent inference

Show the model, effort, subagent models, subagent cap and the two context limits the swarm sets for an agent, or change the model, effort and subagent models.

get prints the subagent cap (max_subagents), the soft context limit (soft_context_percent) and the fresh-session threshold (fresh_session_percent); set has no flag for them and keeps stored ones. Only swarm-ui sets them.

A field the swarm sets wins over the agent's own value (its agent.nix or a hyperhive-model/hyperhive-effort file) from its next turn on; the agent reads its settings every ten seconds. A field the swarm doesn't set, or clears, leaves the agent on its own value.

Usage: swarmctl agent inference <COMMAND>

Subcommands:

swarmctl agent inference get

Show what the swarm sets for an agent, naming the fields it doesn't set, and the model and effort the agent runs on, each with where it comes from

Usage: swarmctl agent inference get [OPTIONS] <AGENT>

Arguments:
Options:

swarmctl agent inference set

Set fields for an agent. Only the flags given change; the others keep what's stored

Usage: swarmctl agent inference set [OPTIONS] <AGENT>

Arguments:
Options:

swarmctl agent inference clear

Clear every field for an agent, so it goes back to its own values

Usage: swarmctl agent inference clear [OPTIONS] <AGENT>

Arguments:
Options:

swarmctl agent permissions

Show or change the permissions the swarm grants an agent.

The agent applies its tool permissions at its next turn; the hive running it restarts it, after its current turn, when manage_root_agent changes. Unset leaves the agent on the default: messaging, meta, inbox, execution, whatever its name.

Usage: swarmctl agent permissions <COMMAND>

Subcommands:

swarmctl agent permissions get

Show the permissions the swarm grants an agent, or that it sets none

Usage: swarmctl agent permissions get [OPTIONS] <AGENT>

Arguments:
Options:

swarmctl agent permissions set

Replace the permissions the swarm grants an agent; the internet flag stays unless given

Usage: swarmctl agent permissions set [OPTIONS] --permissions <PERMISSIONS> <AGENT>

Arguments:
Options:

swarmctl agent permissions clear

Clear the agent's permissions, so the default applies again

Usage: swarmctl agent permissions clear [OPTIONS] <AGENT>

Arguments:
Options:

swarmctl agent agents-md

Show an agent's AGENTS.md, or edit it with a diff.

get shows the copy the agent last published, so it works while the agent isn't running. apply hands the diff to the agent, which applies it to the file with git apply; it needs the agent running.

Usage: swarmctl agent agents-md <COMMAND>

Subcommands:

swarmctl agent agents-md get

Print an agent's AGENTS.md on stdout, and its revision on stderr

Usage: swarmctl agent agents-md get [OPTIONS] <AGENT>

Arguments:
Options:

swarmctl agent agents-md apply

Apply a unified diff to an agent's AGENTS.md.

The diff names a/AGENTS.md and b/AGENTS.md, as diff -u a/AGENTS.md b/AGENTS.md writes it. The agent refuses it when the file is no longer at --base, or when it doesn't apply, and leaves the file as it was.

Usage: swarmctl agent agents-md apply [OPTIONS] --base <REVISION> <AGENT> <DIFF_FILE>

Arguments:
Options:

swarmctl schedule

Manage scheduled prompts.

The swarm keeps each prompt, and every agent it names fires it in its own container. Fire times are the schedule's start time plus whole intervals: changing the body never moves them, and an agent that was down fires the latest missed one once.

Usage: swarmctl schedule <COMMAND>

Subcommands:

swarmctl schedule add

Add a scheduled prompt and print it with its new id.

Without --every it fires once. Without --at its first fire is now.

Usage: swarmctl schedule add [OPTIONS] --name <TEXT> --agent <AGENT> --body <TEXT>

Options:

swarmctl schedule list

List scheduled prompts, one row each, with their agents and next fire time

Usage: swarmctl schedule list [OPTIONS]

Options:

swarmctl schedule edit

Change a scheduled prompt.

Only the flags given change, and the id stays. --at and --every move the fire times; --name, --body and the agent flags don't.

Usage: swarmctl schedule edit [OPTIONS] <ID>

Arguments:
Options:

swarmctl schedule pause

Stop a scheduled prompt firing. Times that pass while it's paused aren't fired when it resumes

Usage: swarmctl schedule pause [OPTIONS] <ID>

Arguments:
Options:

swarmctl schedule resume

Let a paused scheduled prompt fire again, from its next time on

Usage: swarmctl schedule resume [OPTIONS] <ID>

Arguments:
Options:

swarmctl schedule rm

Remove a scheduled prompt from every agent it names

Usage: swarmctl schedule rm [OPTIONS] <ID>

Arguments:
Options:

swarmctl user

Manage subjects in the swarm's SSO provider

Usage: swarmctl user <COMMAND>

Subcommands:

swarmctl user add

Add a user, generating a password for them

Usage: swarmctl user add [OPTIONS] <USERNAME>

Arguments:
Options:

swarmctl user reset-password

Set a new password for an existing user, generating it the same way user add does.

authelia's file store has no self-service reset (no SMTP notifier), so this is the only way a human account gets a new password once an operator forgets the old one. Refuses if the user doesn't exist — there's no separate "create" path here.

Usage: swarmctl user reset-password <USERNAME>

Arguments:

swarmctl user update

Change an existing user's attributes.

Every flag is optional and they compose, so one call can set multiple things at once. Deliberately doesn't touch the password: regenerating a credential is a different intent from editing an attribute, and folded together an attribute edit can invalidate a login by accident.

Usage: swarmctl user update [OPTIONS] <USERNAME>

Arguments:
Options:

swarmctl user list

List every user in authelia's users database.

Read-only: it never writes the file. Shows every subject in it, including agent identities swarm-authelia-bridge created — one line per user: username, display name, email (if set), groups (if any).

Usage: swarmctl user list

swarmctl forge

Manage human accounts on the swarm's forge

Usage: swarmctl forge <COMMAND>

Subcommands:

swarmctl forge make-admin

Make an existing forge user a site admin.

The forge creates a human's account on their first SSO login, and this fails until that login has happened. Running it on a site admin changes nothing. Refused for an agent.

Usage: swarmctl forge make-admin [OPTIONS] <NAME>

Arguments:
Options:

swarmctl setup

Walk through the first-run setup, interactively.

Run it as root, in a terminal. It checks docs/1-getting-started/setup.md first, so a rerun continues at the first open step, then takes the open steps one at a time. It prompts for what a step needs, shows a running action as one live line, and prints anything to record in colour under a ⚠️ warning, such as the secret store's keys and root token. It prints those once and stores none of them. A step that needs a service this host doesn't run names the deploy option to enable and the host to run swarmctl setup on. A step without a verb yet prints its command and waits until you confirm you ran it.

For scripts, use setup status and the individual verbs.

Usage: swarmctl setup [OPTIONS] setup <COMMAND>

Subcommands:
Options:

swarmctl setup status

Print the first-run setup as a progress report: a count and a bar, then each step as done, not done or unknown, and what to do next.

Read-only, and needs no token. The secret store's steps come from bao status and systemd, so they show only on the host running swarm-bao; the SSO account comes from authelia's users file, on its host; ruth and the other agents come from the swarm-controller. When a check can't run, its steps print unknown with the reason, and the rest still print. Steps 7 and 8, the browser login and the forge site admin, always print unknown (not observable).

Exits 0 when every step it can see has finished, and 1 otherwise, including when a check failed to run. Step 10, another agent, is optional and never changes the exit code. The steps are those of docs/1-getting-started/setup.md.

Usage: swarmctl setup status [OPTIONS]

Options:

swarmctl bao

Initialise the swarm's secret store and bootstrap its granter.

Runs the bao CLI against the store over HTTPS, so the store need not run on this host. The root token never reaches a file, an argument list or an environment variable of this process.

Usage: swarmctl bao <COMMAND>

Subcommands:

swarmctl bao init

Initialise the store, printing its keys and the root token once.

Prints the unseal or recovery keys and the root token to stdout, once, and stores none of them: record them off this host before doing anything else. Refuses an initialised store.

Usage: swarmctl bao init [OPTIONS]

Options:

swarmctl bao grant-bootstrap

Bootstrap the granter: the one-time step that lets swarm-bao-granter-role write every swarm-* policy and role.

Reads the root token from a hidden prompt, or from stdin when stdin isn't a terminal; never from an argument or an environment variable. Writes the bao-bootstrap policy, places a 24h grant token for the granter unit and restarts it, so run it as root on the host running that unit. When the granter exists already it runs the same steps again, which is how a change to the granter's policy reaches an existing store, then resets and restarts the failed swarm-bao-*-policy units.

Usage: swarmctl bao grant-bootstrap [OPTIONS]

Options:

swarmctl login

Log in to the swarm named by --swarm as your own SSO account.

With no --swarm or SWARMCTL_SWARM, logs in to SWARMCTL_LOGIN_DEFAULT_SWARM: on a swarm-controller host, the swarm that host belongs to.

Opens the swarm's SSO login in your browser (and prints the URL) and receives the answer on a loopback port, so run it where that browser runs. swarmctl keeps the login, mode 0600, under $XDG_STATE_HOME/swarmctl/ and refreshes it as it's used. To log out, delete that file.

On a host with no browser, forward the callback port from the machine that has one: ssh -L 8765:127.0.0.1:8765 <host>, then run swarmctl login --callback-port 8765 on the host and open the printed URL in that machine's browser.

Usage: swarmctl login [OPTIONS]

Options:

swarmctl completions

Generate a shell completion script for swarmctl and print it to stdout.

Supports bash, zsh, fish, elvish and powershell. The nix package already installs bash/zsh/fish system-wide; this is for ad-hoc or other-shell use.

Dispatched before PathArgs::resolve() for the same reason as markdown-docs: emitting a completion script needs none of the SWARMCTL_AUTHELIA_* deployment env vars, and requiring them would make the package's own build-time invocation fail.

Usage: swarmctl completions <SHELL>

Arguments: