The agent
squirrel agent runs squirrel unattended: an HTTP server with scheduled audits
and cadence-driven index/sync. It is how you keep an index fresh and backups
flowing without running commands by hand.
squirrel agentThe agent requires an [agent] block in config.
What the agent does
Section titled “What the agent does”- Cadence-driven index/sync — runs
indexandsyncon the configured cadence (index_every/sync_every). - Scheduled audits — runs
auditpasses on a schedule. - Scheduled verify — re-checks each content-addressed/packed destination’s
recorded objects and packs against their upload fingerprints, and each native
mirror’s recorded copies, on its
verify_everycadence (per-destination, or an[agent]default) — the same pass assquirrel verify, recorded as anauditrun. Offsite bitrot detection stops depending on anyone typing it. - Scheduled durability pull — refreshes a peer’s relayed durability
evidence on its
pull_durability_everycadence, independent of any sync. A receive-only node keeps its offload gate evidence fresh unattended. - Hook firing — fires per-volume hooks on change
(after each successful index run) and on their
interval. - HTTP server — exposes a health endpoint, serves peer syncs, and drives
the state the TUI and desktop app read. Only when
[agent] listenis set (see below). - Config reload — notices when the config file on disk stops matching the one it is running, applies what it can without a restart, and says on every surface which part of the edit a restart still owes (see below).
One slow destination cannot stall the rest
Section titled “One slow destination cannot stall the rest”Syncs are dispatched per destination, so a cloud target that has gone dark does not hold up local NAS→HTPC replication behind it. Two bounds keep a sick destination from occupying its own worker forever:
- every automatic transfer has a connect bound — rclone’s connect and I/O timeouts, or a one-minute connect and handshake limit on an sftp destination squirrel writes itself — so a dead endpoint fails rather than hanging;
- a stall timeout (10 minutes without progress by default) covers the case those miss — an endpoint that is live but stuck, accepting the connection and then never moving bytes.
A pair that is already syncing when its cadence comes round again is skipped and logged, not queued up behind itself.
Config edits apply themselves
Section titled “Config edits apply themselves”Edit the config file and save it. Within a minute the running agent is using it — no restart, no command, nothing to remember.
The agent hashes the config file’s contents at load and re-reads that file every
minute. When the bytes on disk stop matching the ones it is running it loads the
file, works out what changed, and adopts what it can. It compares content, not
timestamps: a rewrite that produces identical bytes — touch, an editor
saving an unmodified buffer, a configuration-management tool re-rendering the
same template — is not a change and does nothing at all.
What reloads, and what still wants a restart
Section titled “What reloads, and what still wants a restart”The line is between what the agent does and what the agent is.
Reloaded in place — policy the agent consults on its next tick:
| Config | Effect of a reload |
|---|---|
[volumes.*] | Added, removed, repathed; new sync_every / index_every / hook cadences arm on the next scheduler tick, and the peer-sync endpoints host a new volume immediately |
[destinations.*] | Added, removed, retuned; the managed rclone.conf is re-rendered as part of adopting the change |
[nodes.*] | Added, removed, re-addressed; a new pull_durability_every arms on the next tick |
[backups] | Applies to the next snapshot-on-sync |
[agent] verify_every | The fleet-wide default cadence is re-resolved per tick |
Restart required — the shape of the process itself, which cannot change under a running listener or an armed loop:
| Config | Why |
|---|---|
[agent] listen, [agent.tls] | Rebinding the HTTP surface under live peer syncs |
[agent.auth] token, [agent.auth.peers.*] | Swapping the credentials in-flight requests are being authenticated against |
[agent] scan_interval, scan_strategy | Re-arming the audit loop mid-pass |
db, [agent] db, node_name | The index handle is open and this node’s identity is already recorded in it |
When an edit touches both halves, the agent applies the first half and latches a
standing state for the second — the same latch shape a
verify alarm uses. Both
squirrel status and the
TUI then name what is left:
config on disk has changed; the agent applied what it could and agent.auth.token still need a restartThat latch stands until you restart — or until the file’s process-shaped keys go back to what the running process actually bound, which is what happens if you rotate a credential and then think better of it.
A config that will not load never reaches the agent
Section titled “A config that will not load never reaches the agent”The agent validates the whole file before it applies any of it. If the file no longer parses, or state derived from it cannot be rebuilt (rclone has gone missing, say, for a destination the edit just added), nothing is adopted: the agent keeps running the last configuration it knows works, and the latch says why.
config on disk has changed but could not be applied (parse …: …); the agent is still running the last config it loadedFix the file and the next check picks it up. A reload can never wedge the agent, which is exactly why it is safe to do automatically.
In-flight work is never disturbed
Section titled “In-flight work is never disturbed”A reload lands between scheduler ticks and between requests. A sync already pushing when the config changed finishes against the policy it started with; a peer-sync session already open keeps the volume it was opened for. Nothing is cancelled, re-planned, or re-armed underneath itself — the new configuration governs the next piece of work, not the one in progress.
It is all in the audit trail
Section titled “It is all in the audit trail”Every reload is recorded as an audit run naming
which config keys were applied and which are still pending, so “the agent
changed its own configuration at 02:14, and this is what it changed” outlives
the event. A latch raised for a pending restart is its own audit run, and the
clear is recorded against that same run — restart, revert, or reload, the trail
says which resolved it.
Orphaned runs are reaped at startup
Section titled “Orphaned runs are reaped at startup”A run interrupted by a killed agent would otherwise sit at running forever and
render as a live, elapsed-ticking banner on the dashboard. The agent reaps its
own orphans on startup, marking them
aborted — a terminal status that,
unlike the others, does not consume the cadence window, so the work is
re-attempted rather than treated as a finished pass.
Listener-less (cadence-only) machines
Section titled “Listener-less (cadence-only) machines”A machine that only originates content — a roaming laptop that pushes to a
hub and never receives peer syncs — has no reason to run an HTTP listener. Omit
[agent] listen and the agent runs its schedulers (index/sync/audit cadences)
without binding a listener; with no listener there is nothing to
authenticate, so [agent.auth] is optional too.
[agent]# no `listen`: schedulers only, no HTTP server
[volumes.photos]path = "~/Pictures"sync_to = ["nas"]sync_every = "1h"When listen is set, behaviour is unchanged: the agent runs the schedulers
and the HTTP server (and then a bearer token is required). A listener-less
agent with no cadence and no scan_interval has nothing to do and refuses to
start, rather than idling silently.
Database path precedence
Section titled “Database path precedence”When run as the agent, the database path resolves as:
- the
--dbflag, cfg.Agent.DB,cfg.DB,- the built-in default.