synology
Use when the user asks whether client Synology NAS backups succeeded, which machines have not backed up, or how client NAS storage is doing: mirrors Synology Active Backup for Business jobs and storag
Files436
View on GitHub- .claude-plugin/1 files
- cli/417 files
- press/3 files
- AGENTS.md9.1 KB
- CHANGELOG.md8.2 KB
- credkit-sites.json51 KB
- governance.md15 KB
- guide.md35 KB
- handfixes.json144 KB
- install.ps115 KB
- install.sh20 KB
- manifest.json6.0 KB
- mcp-install.md10 KB
- page.json12 KB
- pain-point.md3.8 KB
- README.md24 KB
- server.json3.9 KB
- SKILL.md46 KB
SKILL.mdskills/synology/SKILL.md
GitHubSynology - Claude Code Skill
Prerequisites: Install the CLI
This skill drives the synology-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:
- macOS / Linux:
bash <(curl -fsSL https://raw.githubusercontent.com/Servosity/msp-skills/main/skills/synology/install.sh) - Windows (PowerShell):
iwr -useb https://raw.githubusercontent.com/Servosity/msp-skills/main/skills/synology/install.ps1 | iex - Verify:
synology-cli --version - Ensure
~/.local/bin(macOS / Linux) or%LOCALAPPDATA%\Programs\msp-skills(Windows) is on$PATH.
The installer downloads the synology-cli and synology-mcp binaries into ~/.local/bin
(macOS / Linux) or %LOCALAPPDATA%\Programs\msp-skills (Windows). It does not
register the skill with your agent and writes no MCP client config - see
mcp-install.md for that wire-up.
If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.
Talks to each Synology NAS directly with its own DSM login and mirrors Active Backup for Business job history plus volume, disk and SMART health into SQLite. After fleet add and fleet sync, fleet status, abb failures and abb stale answer the MSP morning check across every client NAS, with exit code 6 an RMM can alert on.
When to Use This CLI
Use this CLI when an agent needs to know whether Synology Active Backup for Business jobs succeeded, which protected machines are behind, or whether NAS volumes and disks are healthy, on one NAS or across many client NAS units. It is built for MSP morning checks, weekly reviews and RMM alerting. Fleet reports read the local mirror, so run fleet sync first; it has not been verified against a live NAS by its authors.
Anti-triggers
Do not use this CLI for:
- Restoring files or bare-metal images: use the Active Backup for Business portal or recovery media
- Deleting backup tasks or versions: the CLI deliberately does not expose them; use DSM
- Browsing or copying files on the NAS: use File Station or SMB
- Microsoft 365 or Google Workspace backups (Active Backup for Microsoft 365 / Google Workspace): different packages, not covered
Unique Capabilities
Fleet-wide backup assurance
fleet status- One row per client NAS with backup outcomes, stale devices, worst storage state and sync age; exits 6 when any NAS is warning, critical or unknown (--no-fail exits 0).Reach for this first when asked whether every client's backups and storage are OK; a NAS that stopped reporting shows UNKNOWN, never OK.
synology-cli fleet status --agentabb failures- Every Active Backup task across the fleet whose latest run in a window failed, partially succeeded, was canceled, or never ran.Use for the morning backup check instead of opening the ABB portal on each NAS.
synology-cli abb failures --since 24h --agentabb stale- Protected PCs, servers and VMs whose last successful backup is older than a threshold, or that never succeeded.Catches machines that silently stopped getting good backups, which no single ABB screen flags.
synology-cli abb stale --older-than 36h --agentfleet sync- Mirror ABB job status and storage health from every NAS registered with fleet add into one local database, each NAS with its own login.Run this before the fleet rollups; one unreachable NAS is recorded and does not abort the run.
synology-cli fleet sync --agentabb unprotected- Devices and tasks that dropped out of Active Backup protection across the fleet: a machine removed from its task, a task deleted, or a task whose schedule is off while it still holds devices; exits 6 when any exist or a NAS mirror is not synced or ABB stopped answering (--no-fail exits 0).abb stale only sees devices still in a task, so a PC someone quietly removed from backup disappears from every other report; this is where it shows up.
synology-cli abb unprotected --since 30d --agentabb change-rate- Devices whose newest good backup moved far more data than their own median (a mass file change) or nothing at all for several runs in a row, across the fleet; exits 6 when any device is flagged or a NAS mirror is not synced or ABB stopped answering (--no-fail exits 0).A backup that succeeds while moving forty times its usual data, or zero bytes, reads as a plain success everywhere else.
synology-cli abb change-rate --since 30d --agent
Storage health
fleet health- Degraded or crashed volumes and pools, disks with bad SMART status, hot disks and nearly full volumes across every NAS, with days-to-full when history exists.Use for the weekly storage review across clients; exit code is non-zero when anything needs attention.
synology-cli fleet health --full-pct 85 --disk-temp 55 --agentfleet capacity- Every volume on every NAS with used percent, growth per day and days until full from retained storage snapshots, soonest first; exits 6 when a volume fills inside the horizon (default 30 days), a volume's capacity is unknown, or a NAS's storage cannot be read (--no-fail exits 0).fleet health only projects volumes already over the full threshold; a volume at 60 percent that fills in twelve days shows up here first.
synology-cli fleet capacity --horizon 30d --csv
Drill-down
abb triage- Why one ABB task failed: its newest non-success run, its detail lines and the ABB log from that window, errors first. Live call to one NAS; DSM returns log types and parameters, not message text.Use after abb failures names a task, before re-running it.
synology-cli abb triage "Office PCs" --nas acme --agentabb device- Find a machine by host name across every NAS and see which task protects it, its last success and its recent runs.Answers the ticket question 'is this machine backed up, and when was the last good one?'
synology-cli abb device BOB-LAPTOP --agentabb trend- Per task or device: run count, success rate, median and p90 duration, and an overrun flag when the latest run is far slower than usual.Spots tasks that keep partially succeeding or keep getting slower before they break.
synology-cli abb trend --since 30d --agent
Command Reference
abb - Active Backup for Business tasks, job results, logs and storage
synology-cli abb backup- Start a backup now for one or more taskssynology-cli abb cancel- Cancel the running backup of one or more taskssynology-cli abb hypervisors- List the VMware and Hyper-V hypervisors registered in Active Backup for Businesssynology-cli abb logs- Read the Active Backup for Business activity log for the package, tasks and devicessynology-cli abb result-detail- Show the detail log lines (errors, warnings, skipped paths) of one job resultsynology-cli abb results- List job results across tasks (backups plus version deletions and restores; filter {"job_action":1} for backups only)synology-cli abb settings- Show Active Backup for Business package settings and certificate informationsynology-cli abb storage- List Active Backup for Business storage destinations with dedup size, device counts and volumesynology-cli abb tasks- List Active Backup for Business tasks with their last job result, protected devices, progress and next run timesynology-cli abb transfers- List protected devices with every transfer (bytes, status, start, end) inside a time window
folder - Shared folders
synology-cli folder- List shared folders, including the ActiveBackupforBusiness destination share
group - Local DSM groups
synology-cli group list- List local DSM groups on the NAS, for example to find the administrators groupsynology-cli group members- List the accounts in one group, for example administrators
hyperbackup - Hyper Backup tasks (the NAS's own backup to another NAS, USB or cloud)
synology-cli hyperbackup task-status- Show one Hyper Backup task's last result, last success, next run and health state without contacting the destinationsynology-cli hyperbackup tasks- List Hyper Backup tasks (the NAS's own backups to another NAS, USB or cloud) with their destination type
log - DSM system log
synology-cli log- Read the DSM system log with level, date range and keyword filters
package - Installed DSM packages
synology-cli package- List installed packages with version and running state; confirms Active Backup for Business is installed
session - DSM API discovery and session control
synology-cli session apis- List every API namespace this NAS exposes with its version range and CGI pathsynology-cli session logout- Invalidate the current DSM session id so it can no longer be used on this NAS
storage - Volumes, storage pools, disks and SMART data
synology-cli storage disks- List physical disks with model, serial number, temperature and SMART health statussynology-cli storage overview- Show Storage Manager's disks, storage pools and volumes with their status in one callsynology-cli storage pools- List storage pools with RAID type, status and member diskssynology-cli storage smart- Show the SMART attribute table for one disksynology-cli storage smart-schedule- List the scheduled SMART tests (quick or extended) configured for the NAS's diskssynology-cli storage volumes- List volumes with status, size, used space and file system
system - DSM system identity, health and load
synology-cli system dsm- Show DSM product identity (model, version string, serial) as the web UI reports itsynology-cli system get- Show model, serial number, DSM version, uptime and system temperaturesynology-cli system health-check- Show the aggregate system health verdict the DSM dashboard showssynology-cli system network- Show the NAS hostname, DNS servers, default gateway and network interface settingssynology-cli system ups- Show the state of the uninterruptible power supply (UPS) attached to the NAS, if anysynology-cli system utilization- Show current CPU, memory, disk and network utilization
user - Local DSM user accounts
synology-cli user- List local user accounts, for example to audit who can log in to a client NAS
fleet - register client NAS units (reports and sync are listed below)
synology-cli fleet add <name> --url https://<nas>:5001 [--client NAME] [--env-prefix PREFIX] [--tls-fingerprint SHA256 | --insecure] [--check]- Register a NAS (fleet add <name> --url ... --pin-certalone only displays the presented certificate fingerprint to check in DSM, and saves nothing); its login comes from<prefix>_ACCOUNT/<prefix>_PASSWORDsynology-cli fleet list- Registered NAS units, which credential env vars are set, TLS mode and last syncsynology-cli fleet remove <name>- Unregister a NAS and purge its mirror rows
auth - the SYNOLOGY_BASE_URL NAS (fleet NAS log in during fleet sync with <prefix>_ACCOUNT/<prefix>_PASSWORD)
synology-cli auth login- Log in to theSYNOLOGY_BASE_URLNAS and cache the session (addSYNOLOGY_OTP_CODEonce for two-factor)synology-cli auth status- Show which login and session are in usesynology-cli auth logout [--nas NAME | --all]- Forget cached sessions and the stored login on this computer (the NAS is not contacted)
abb - fleet reports (read the local mirror; run fleet sync first)
synology-cli abb failures- Every Active Backup task across the fleet whose latest run in a window failed, partially succeeded, was canceled, or never ran.synology-cli abb stale- Protected PCs, servers and VMs whose last successful backup is older than a threshold, or that never succeeded.synology-cli abb triage- Why one ABB task failed: its newest non-success run, its detail lines and the ABB log from that window, errors first. Live call to one NAS; DSM returns log types and parameters, not message text.synology-cli abb device- Find a machine by host name across every NAS and see which task protects it, its last success and its recent runs.synology-cli abb trend- Per task or device: run count, success rate, median and p90 duration, and an overrun flag when the latest run is far slower than usual.synology-cli abb unprotected- Devices and tasks that dropped out of Active Backup protection across the fleet: a machine removed from its task, a task deleted, or a task whose schedule is off while it still holds devices; exits 6 when any exist (--no-fail exits 0).synology-cli abb change-rate- Devices whose newest good backup moved far more data than their own median (a mass file change) or nothing at all for several runs in a row, across the fleet; exits 6 when any device is flagged.
fleet reports and sync (read or refresh the local mirror)
synology-cli fleet status- One row per client NAS with backup outcomes, stale devices, worst storage state and sync age; exits 6 when any NAS is warning, critical or unknown (--no-fail exits 0).synology-cli fleet sync- Mirror ABB job status and storage health from every NAS registered with fleet add into one local database, each NAS with its own login.synology-cli fleet health- Degraded or crashed volumes and pools, disks with bad SMART status, hot disks and nearly full volumes across every NAS, with days-to-full when history exists.synology-cli fleet capacity- Every volume on every NAS with used percent, growth per day and days until full from retained storage snapshots, soonest first; exits 6 when a volume will fill inside the horizon (default 30 days).
Finding the right command
When you know what you want to do but not which command does it, ask the CLI directly:
synology-cli which "machines with no recent backup"
which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match - fall back to --help or use a narrower query. --json (and other machine formats) keep that exit-2 contract and write {"matches":[]} on stdout so agents can inspect the envelope without treating a miss as success.
Recipes
Morning backup check across clients
synology-cli abb failures --since 24h --agent
After fleet sync, list every failed, partial or missed ABB run in the last day across client NAS units.
Machines with no good backup in 3 days
synology-cli abb stale --older-than 72h --agent
Device-level staleness computed from job history, including devices that never succeeded.
Narrow a verbose task list
synology-cli abb tasks --agent --select task_id,task_name,last_result.status,devices.host_name
ABB task rows carry dozens of fields; select only the outcome and the protected hosts.
Why did a task fail
synology-cli abb triage "Office PCs" --nas acme --agent
Newest failed run, its detail lines and the ABB log from that window, errors first.
Fleet storage review
synology-cli fleet health --full-pct 85 --agent
Degraded volumes, bad SMART disks, hot disks and nearly full volumes on every client NAS.
Limitations
- Fleet reports (
fleet status,fleet health,fleet capacity,abb failures,abb stale,abb unprotected,abb device,abb trend,abb change-rate) read the local mirror: runfleet syncfirst. A NAS whose mirror is missing, failed or older than--max-sync-ageappears asnas_not_synced/unknown, never as OK. - With no NAS registered and no
SYNOLOGY_BASE_URL, those reports exit 10 (config error) instead of printing an empty result. abb failuresuses a 24h window (fleet status: 26h); a weekly task shows asno_run_in_windowunless you widen--since(for example--since 8d).abbandhyperbackupcommands need the Active Backup for Business / Hyper Backup package on the NAS (otherwise DSM error 102).- DSM's Active Backup API is undocumented; the call shapes come from public open-source clients and were not verified against a live NAS by this CLI's authors.
abb_missingmeans Active Backup for Business ran on a NAS before and no longer answers (DSM error 102); it counts as a finding.abb_not_installed(a NAS that never ran ABB) does not.abb trendsetshistory_fromon rows whose window starts before the mirrored history; backfill withfleet sync --nas <name> --full --since 30d.- After an upgrade that changes the mirror format, every NAS reads as
nas_not_synceduntil its nextfleet sync(the mirror records which version wrote it). If DSM contradicts itself about a run (task list vs result listing), that NAS's sync fails rather than guessing. fleet healthwarnstemperature not reportedfor a disk that reports no temperature (some SSDs and virtual DSM);--disk-temp 0skips the temperature check.- A plain
http://NAS address gets no credential,http://localhostand loopback included: the DSM password and session are never sent over it (use the NAS'shttps://address, port 5001, and pin DSM's self-signed certificate withSYNOLOGY_TLS_FINGERPRINT). fleet syncruns one process per NAS, each with only that NAS's credentials, so a password can reach only its own NAS. A process sends credentials only to the NAS it was started for:--nas <name>, orSYNOLOGY_BASE_URL.- Credentials never reach output: a line on stdout or stderr, an MCP result, an export, a
--deliverfile, a receipt or a stored row that carries a credential the CLI holds (in any encoding: escaped, base64, hex, nested) is withheld whole, with a notice in its place, and a NAS answer that carries one is withheld as one unit. There is no length floor, so a very short password matches ordinary text and withholds most output, or the CLI refuses to start. A one-time code stays held while it is set, so an answer containing that number is withheld: after the first login, unsetSYNOLOGY_OTP_CODEor<prefix>_OTP_CODE. fleet capacityneeds storage snapshots at least a day apart (one perfleet sync) before it can show growth or days to full; until then those fields are null.abb change-ratecompares DSM's per-device transfer sizes with each device's own median of at least 5 earlier good runs; how closely those sizes track changed data has not been checked against a live NAS.
Auth Setup
DSM has no API keys. The CLI logs in with SYNO.API.Auth using SYNOLOGY_ACCOUNT and SYNOLOGY_PASSWORD (sent as a form POST, never stored) against SYNOLOGY_BASE_URL (for example https://192.168.1.50:5001), sends the session id and SynoToken on every call, and logs in again when DSM reports an expired session. Run 'synology-cli auth login' once to test the login and cache the session. For a two-factor account run it with a fresh SYNOLOGY_OTP_CODE: the CLI caches the trusted-device token DSM returns, so the code is not needed again (SYNOLOGY_DEVICE_ID overrides the cached token). Then unset the code: every credential the CLI holds (password, one-time code, device token, session id, bearer token) is withheld from all output in any encoding, so while a 6-digit code is set any output that carries those six digits is withheld. Fleet entries read <prefix>_ACCOUNT, <prefix>_PASSWORD and optional <prefix>_OTP_CODE / <prefix>_DEVICE_ID, and cache the trusted-device token per NAS the same way. DSM's self-signed certificate: pin it with SYNOLOGY_TLS_FINGERPRINT=<sha256> or 'fleet add --tls-fingerprint <sha256>', the value checked in DSM (Control Panel > Security > Certificate); 'fleet add --pin-cert' only displays the fingerprint the NAS presents and saves nothing; SYNOLOGY_SKIP_TLS_VERIFY=1 trusts any certificate on a network you control.
Run synology-cli doctor to verify setup.
Agent Mode
Add --agent to any command. Expands to: --json --compact --no-input --no-color.
Global format flags share one contract on promoted, novel, sync, and --deliver paths:
--json- one JSON document on stdout (sync progress events go to stderr)--compact- keep identity/status/timestamp fields; does not change the document vs stream shape--csv/--plain- tabular rows (collection envelopes unwrap to the row array).--csvprefixes'on a cell or header key that starts with=,+,-,@, tab, CR, or LF (fullwidth=+-@too) so a spreadsheet does not run it as a formula; a plain signed number such as-5or+2.5e3is unchanged.--quiet- one identity value per row, no envelopePipeable - JSON on stdout, errors on stderr
Filterable -
--selectkeeps a subset of fields. Dotted paths descend into nested structures; arrays traverse element-wise. Critical for keeping context small on verbose APIs:synology-cli abb tasks --agent --select task_name,last_result.statusPreviewable -
--dry-runshows the request without sendingOffline-friendly - sync/search commands can use the local SQLite store when available
Non-interactive - never prompts, every input is a flag
No confirmation prompts -
abb backup,abb cancelandsession logoutact on the NAS immediately with no confirmation prompt on the CLI; preview with--dry-runfirst. Over MCP the same three tools (abb_backup,abb_cancel,session_logout) return a preview and send nothing until called with"confirm": true.fleet addandfleet removechange only the local registry and are not MCP tools.
Response envelope
Commands that read from the local store or the API wrap output in a provenance envelope:
{
"meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
"results": <data>
}
Parse .results for data and .meta.source to know whether it's live or local. The fleet and abb report commands (fleet status, fleet health, fleet capacity, fleet list, abb failures, abb stale, abb unprotected, abb device, abb trend, abb change-rate) wrap their rows in this envelope under --agent; with plain --json they print the bare row array. Live reads may be answered from a 5-minute response cache and are still labelled live; add --no-cache when you need the NAS's state right now. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal AND no machine-format flag (--json, --csv, --compact, --quiet, --plain, --select) is set - piped/agent consumers and explicit-format runs get pure JSON on stdout.
Paths and state
Agents should treat the CLI's path resolver as part of the runtime contract:
Use
--home <dir>for one invocation, or setSYNOLOGY_HOME=<dir>to relocate all four path kinds under one root.Use per-kind env vars only when a specific kind must diverge:
SYNOLOGY_CONFIG_DIR,SYNOLOGY_DATA_DIR,SYNOLOGY_STATE_DIR,SYNOLOGY_CACHE_DIR.Resolution order is per-kind env var,
--home,SYNOLOGY_HOME, XDG (XDG_CONFIG_HOME,XDG_DATA_HOME,XDG_STATE_HOME,XDG_CACHE_HOME), then platform defaults.configholdsconfig.toml, profiles and thefleet.jsonNAS registry.dataholdscredentials.toml,data.db, thefleet.dbmirror andsession-<scheme>-<host>_<port>-<hash>.jsonper NAS (DSM session id, SynoToken and two-factor trusted-device token, mode 0600).statecontains the learn journal andteach.log.cachecontains regenerable HTTP/cache files.Stored secrets live in
credentials.tomlunder the data dir. Existing legacyconfig.tomlsecrets are read for compatibility and leaveconfig.tomlon the first auth write.Run
synology-cli doctor --fail-on warnto surface path and credential-location warnings.agent-contextexposes a schema v4pathsblock for agents that need the resolved dirs.For MCP, pass relocation through the MCP host config. The MCP binary does not inherit CLI flags:
{ "mcpServers": { "synology": { "command": "synology-mcp", "env": { "SYNOLOGY_HOME": "/srv/synology" } } } }
Fleet precedence: an inherited per-kind env var overrides an explicit --home for that kind. Use SYNOLOGY_HOME or per-kind vars as durable fleet levers, and use --home only for a single invocation. Relocation is not reversible by unsetting env vars; move files manually before clearing SYNOLOGY_HOME, or doctor will not find credentials left under the former root.
Local data is unencrypted and relies on OS account permissions plus disk encryption. The fleet mirror (fleet.db: client NAS names, host names and error lines) and the per-NAS DSM session files are outside local-data purge. SYNOLOGY_NO_LOCAL_DATA=1 stops fleet sync writing the mirror (it refuses to run), and the per-NAS session files are still kept. fleet remove <name> purges one NAS's mirror rows, deleting fleet.db removes the whole mirror, and auth logout --all forgets every cached session. Reads in the default --data-source auto mode are written to the SQLite store; GET responses are cached for five minutes under the cache dir. local-data purge previews what it would erase (store files, response cache, learn journal) and deletes only with --yes; it is not exposed over MCP. SYNOLOGY_NO_LOCAL_DATA=1 disables the response cache and store writes, turns auto reads into live reads, and blocks sync, workflow archive and fleet sync; --data-source local still reads an existing store, and SYNOLOGY_DATA_SOURCE sets the --data-source default.
Automatic learning
This CLI ships a self-capturing learning loop. The CLI does its own bookkeeping: every invocation is journaled locally, a failed flag followed by a corrected retry auto-derives a flag_alias candidate, and a teach on a query family without a playbook auto-synthesizes a playbook_candidate from the session's journal. Your job is judgment only: recall first, act on surfaced candidates, teach the final answer, playbook amend when you observe a correction. You never record failures by hand.
Step 1: recall before any discovery
Before list/search/drill commands on a new user question, pass the question as an argv or MCP tool argument to recall --agent. Do not interpolate user-controlled text into a shell command line.
Quoted recall "<question>" breaks on an apostrophe, which is ordinary English. A quoted heredoc breaks when a body line equals the delimiter, and that delimiter is published in these docs. Write the question with a non-shell file-writing tool, then read it back as data:
# Write the question verbatim with your file-writing tool (no shell involved).
# Command substitution on a file only ever yields data - the shell never
# parses the file's bytes as syntax.
QUERY=$(cat /path/to/question.txt)
synology-cli recall "$QUERY" --agent
Prefer MCP: pass the question as the tool's query argument. "$QUERY" after a file read is argv-safe; putting the question itself in the command text is not.
The response envelope:
{
"query": "...",
"normalized": "<normalized form>",
"query_entities": ["..."],
"found": true | false,
"match_score": 0.0,
"results": [
{ "resource_id": "...", "resource_type": "...", "venue": "...",
"confidence": 2, "entity_match": "exact|partial|unknown",
"source": "taught|preseed|pattern", "warnings": ["..."] }
],
"mismatches": [ /* only when --debug-mismatches */ ],
"warnings": [ /* top-level */ ],
"candidates": [
{ "id": 12, "class": "flag_alias | playbook_candidate",
"summary": "...", "sightings": 3, "last_seen": "...",
"rationale": "...",
"next_action": ["<trial command>", "synology-cli learnings confirm 12"] }
],
"playbook": {
"query_family": "...",
"playbook": {
"steps": [ { "cmd": "<command with {slot} substitution>", "purpose": "..." } ],
"entity_slots": ["$ENTITY"],
"expected_tool_calls": 3
},
"slots_resolved": { "$ENTITY": { "token": "<live token>", "canonical": "<canonical>" } },
"notes": "<workarounds + gotchas for this query family>"
},
"notes": "<duplicate surface for non-playbook callers>"
}
Empty-store short-circuit: if the store has no learnings, playbooks, or candidates yet (recall finds nothing and learnings list and learnings candidates are both empty), skip recall for the rest of this session instead of taxing every query; resume recall-first once something has been taught.
Step 2: decision tree
Read candidates, playbook, notes, results[0], and warnings in that order:
if Candidates present (warnings include "candidates_present"):
-> candidates are try-then-confirm, never facts. Follow each candidate's
two-step next_action verbatim: run the trial command first, then run
`learnings confirm <id>` only after the trial verified the behavior.
Reject a wrong candidate with `learnings reject <id>`.
-> NEVER re-teach something recall surfaced as a candidate; confirm or
reject that candidate instead of teaching a duplicate.
-> candidates ride alongside playbooks and resource hits, not instead of
them; continue with the branches below after acting on them.
if Playbook present:
-> READ Playbook.notes verbatim FIRST (workarounds + gotchas the CLI surface doesn't expose)
-> replay Playbook.steps in order, substituting Playbook.slots_resolved entries
for the entity slot tokens. If a step's slot is unresolved, fall back to
discovery for that step only.
-> the Playbook's expected_tool_calls is a budget; if you find yourself running
materially more, record the divergence via `synology-cli playbook amend`
at end-of-session.
elif Notes present (no Playbook):
-> read Notes verbatim before any discovery step; they carry known gotchas
for this query family even when no structured choreography exists yet.
elif Found AND Results[0].EntityMatch == "exact" AND Results[0].Confidence >= 2:
-> skip discovery; fetch live data for Results[*].ResourceID in parallel
elif Found AND Results[0].EntityMatch == "partial":
-> candidate hint, NOT a hit; read the resource title to validate before trusting
elif (any row in Mismatches[] when --debug-mismatches was passed):
-> treat as cold start; the stored learning is for a different entity
(different canonical resolved from query_entities)
else: // Found == false, no playbook, no notes
-> cold start; run discovery normally; teach the answer afterward (Step 4).
If the family has no playbook yet, that teach auto-synthesizes a
playbook candidate from this session's journal - you do not need to
record one by hand.
Playbook and Notes are orthogonal to the per-resource path. A recall response can carry both a Playbook AND a Results[] hit - use both: the Playbook tells you which choreography to run; the resource hits short-circuit specific steps. Default to skipping mismatches; pass --debug-mismatches only when investigating cold-start surprises.
Candidate judgment details: learnings confirm <id> prints the candidate's full payload before materializing it - check that the printed payload matches the behavior you verified. learnings reject <id> tombstones the derivation signature so the same candidate does not resurface. The envelope carries only the few candidates worth acting on now; synology-cli learnings candidates lists the full open set.
Graceful degradation: if learnings confirm is an unknown command, you are driving an older binary - ignore the candidates guidance and follow the rest of the protocol.
Step 3: always read warnings
low_confidence: row exists atconfidence<2. Treat as a hint, not a skip-discovery hit.resource_not_in_store: the local store doesn't have the resource the learning points at. The match validator couldn't classify entities - direct-fetch and re-evaluate.cross_alias_match(per-result): the row was taught under a different alias and matched the live query's canonical viaentity_lookups(e.g., a "Acme" teach satisfying an "Acme Corp" recall). Trust the resource_id.similar_shape_different_entity:<canonical>(top-level): a structurally matching row exists but its canonical entity differs from the live query's. Treated as cold start; the warning carries the conflicting canonical as a hint, but the row is NOT promoted into Results.ambiguous_alias(top-level): a single query entity resolved to multiple canonicals (e.g., "acme" → the Acme Corp NAS and the Acme Logistics NAS). Surface the ambiguity from context before committing to a resource.candidates_present(top-level): the envelope carries acandidatessection. Handle it via the candidates branch in Step 2 before anything else.lookup_refresh_available(top-level): an entity in the query has no lookup row yet, but synced data could provide one. Runsynology-cli syncto refresh entity lookups.- Top-level
no_learnings_for_query_family: the table had no rows above the Jaccard floor. Pure cold start.
Step 4: teach & after finalizing your response - always
Teaching is unconditional. After resolving a query the store could not answer, background-teach the final resource mapping - no call-count threshold, no judging whether it was "worth" learning. The teach is the anchor of the loop: it triggers playbook synthesis for a family without a playbook, and same-referent phrasings fold into one family so near-duplicate teaches do not fragment the store. Fire it after assembling your user-facing response but BEFORE emitting it, with a shell & so the call returns immediately. Pass the query the same way as recall - argv/MCP, or file-then-$QUERY. Do not splice the question into the command text:
QUERY=$(cat /path/to/question.txt)
synology-cli teach --query "$QUERY" --resource-type abb_task --resource 5 --resource 8
# (append shell `&` to background it)
Silent on success. Errors only land in teach.log under the resolved state dir. Teach the most specific resource - if the user asked a broad question and you walked through parent records to find the specific answer, teach the leaf id, not the parent. The CLI uses seeded entity_lookups for cross-alias resolution at recall time, so a teach under one alias (e.g., "fs1") satisfies future queries under another alias (e.g., "FS01", "file server") automatically.
PII rule: teach the structural question with identifiers stripped - never include names, emails, phone numbers, account ids, or other personal identifiers in taught queries or notes. The CLI scans teach queries for obvious email/phone shapes and warns, but does not block; strip before teaching rather than relying on the warning.
Step 5: playbooks - optional flags, automatic synthesis
You do not need to decide whether a session "deserves" a playbook: a teach on a family without one auto-synthesizes a playbook_candidate from the session's journal, and the next session judges it via confirm/reject. Attach explicit playbook flags only when you already hold choreography worth recording verbatim - workarounds the CLI didn't surface (silently-dropped flags, undocumented params, pagination tricks, payload gotchas). Prefer the integrated one-call form - record the resource learning and the playbook in the same teach invocation:
# Common case: record both the resource learning AND the playbook in one call.
QUERY=$(cat /path/to/question.txt)
synology-cli teach \
--query "$QUERY" \
--resource 5 \
--playbook-file ~/playbooks/failed-task.json \
--playbook-notes-file ~/playbooks/failed-task-notes.md
# (append shell `&` to background it)
# Alternate: playbook-only (no resource to record alongside).
QUERY=$(cat /path/to/question.txt)
synology-cli teach-playbook \
--query "$QUERY" \
--playbook-file ~/playbooks/failed-task.json \
--notes-file ~/playbooks/failed-task-notes.md
Playbook files are JSON with steps, entity_slots, expected_tool_calls. Notes files are markdown carrying the gotchas verbatim. File-free callers (MCP-only agents, where the file flags are not offered) pass the same content inline: --playbook-json and --playbook-notes on the integrated teach form, --playbook-json and --notes on teach-playbook. On the integrated teach form, the playbook flags are optional - omit them entirely for a resource-only teach. On the standalone teach-playbook form, at least one of the playbook and notes flags must be set; both empty is rejected. Playbooks are keyed on the structural query family (entities stripped) so a recipe taught from one entity-shaped query applies to every other query of the same shape, with slots_resolved binding the live query's canonical at recall time.
When you DO find a playbook on a future recall, treat it as ground truth: replay the steps with slots_resolved substitutions, skip the discovery that the choreography already documents, and read notes before any step.
Step 6: playbook amend & when your debug response identifies a correction
If your debug-protocol response identifies a concrete correction the notes or playbook should know - a workaround, an undocumented endpoint shape, a stale field name, observed schema drift, an empty-payload fallback - fire playbook amend BEFORE emitting your user-facing response. Same fire-and-forget posture as teach. Pass the query and note as argv/MCP arguments, or write each with a non-shell file tool and read them back (QUERY=$(cat ...), NOTE=$(cat ...)). Do not interpolate either string into the command text:
QUERY=$(cat /path/to/question.txt)
NOTE=$(cat /path/to/note.txt)
synology-cli playbook amend \
--query "$QUERY" \
--add-note "$NOTE"
# (append shell `&` to background it)
What counts as worth amending: a behavior you OBSERVED this session that future-you would benefit from knowing. Examples worth amending:
- A workaround for a CLI surface that silently drops or misorders a flag.
- An undocumented endpoint shape (response wrapped in
{meta, results}, payload nested two levels deeper than the docs claim). - Observed schema drift (a field renamed, a field that moved between DSM releases, a category label that the API now returns lower-cased).
What does NOT belong in notes:
- The year-specific or entity-specific answer to the user's question. That's the response, not a learning.
- Per-NAS / per-task / per-row data the playbook already retrieves at runtime.
- Statements that paraphrase what the existing notes already say.
The amend command appends to the family's existing notes with a timestamped marker ([amend YYYY-MM-DDTHH:MMZ]: <text>). Multiple amends accumulate; the audit trail is visible. If no playbook exists yet for the family, amend creates a notes-only one (so cold-start corrections still land).
PII discipline for amend notes
playbook amend notes are designed to potentially flow upstream as shared knowledge in future versions of the Printing Press. Keep them clean of user-identifying content so the upstream-contribution path stays open without retroactive scrubbing:
- Do NOT embed paths to user filesystems, personal API keys or tokens, user email addresses, user GitHub handles, or specific query histories tied to a single user.
- Acceptable: endpoint shapes, undocumented field names, API gotchas, observed schema drift, workarounds for CLI surfaces, generalizable pagination or retry tactics.
If a correction is only meaningful with user-specific context, it belongs in a personal note, not in the playbook amend.
Measuring the loop
synology-cli learnings stats reports recall hit rate, teach-to-reuse, playbook resolution rate, and candidate confirm/reject counts from the local learn_events table. Rates are null until they have a denominator; everything stays on this machine. Use it to check whether the loop is earning its keep for this CLI.
Disabling learning
--no-learnon a single command short-circuits bothrecalland theteachwrite path. Use for deterministic agent flows or tests that must not be affected by accumulated learnings.SYNOLOGY_NO_LEARN=truein the environment globally disables the pipeline.
Agent Feedback
When you (or the agent) notice something off about this CLI, record it:
synology-cli feedback "the --since flag is inclusive but docs say exclusive"
synology-cli feedback list --json --limit 10
Entries are stored locally as feedback.jsonl under the resolved data dir. They are never POSTed unless SYNOLOGY_FEEDBACK_ENDPOINT is set AND either --send is passed or SYNOLOGY_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.
Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.
Output Delivery
Every command except completion accepts --deliver <sink> (redirect a completion script to a file instead; the --help and --version flags print to stdout only, while the help and version commands deliver). A command that fails still delivers what it printed, so fleet status, fleet health and the abb reports deliver their rows when they exit 6 with findings; under --dry-run the sink is previewed on stderr and not written. profile save validates a --deliver sink and records it for later --profile runs rather than delivering its own confirmation. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:
| Sink | Effect |
|---|---|
stdout |
Default; write to stdout only |
file:<path> |
Atomically write output to <path> as a private 0600 file (exclusive randomly named temp in the destination directory, then rename; a planted symlink is not followed). Binary-response commands write decoded payload bytes (not the base64 JSON envelope) and print a small JSON receipt on stdout; --json/--csv do not refuse when this sink is set. |
webhook:<url> |
POST the output body to the URL (application/json). Redirects are not followed; a 3xx response fails the delivery and the body is not sent to the Location. |
Unknown schemes are refused with a structured error naming the supported set. Webhook failures, including redirects, return non-zero and log the URL and HTTP status on stderr.
Named Profiles
A profile is a saved set of flag values, reused across invocations. Use it when a scheduled or recurring agent reuses the same saved flags while providing different input each run.
synology-cli profile save briefing --json
synology-cli --profile briefing folder
synology-cli profile list --json
synology-cli profile show briefing
synology-cli profile delete briefing --yes
Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Usage error (wrong arguments) |
| 3 | Resource not found |
| 4 | Authentication required |
| 5 | API error (upstream issue; fleet sync: a NAS failed to sync) |
| 6 | Findings: a fleet/abb report ran and something needs attention (--no-fail exits 0) |
| 7 | Rate limited (wait and retry) |
| 10 | Config error (fleet/abb reports and fleet sync: no NAS configured) |
Argument Parsing
Parse $ARGUMENTS:
- Empty,
help, or--help→ showsynology-cli --helpoutput - Starts with
install→ ends withmcp→ MCP installation; otherwise → see Prerequisites above - Anything else → Direct Use (execute as CLI command with
--agent)
MCP Server Installation
- Install the MCP binary (run the install script from the Prerequisites section, or see mcp-install.md for per-agent wire-up).
- Register with Claude Code:
claude mcp add synology-mcp --env SYNOLOGY_BASE_URL=https://<nas>:5001 --env SYNOLOGY_ACCOUNT=<account> --env SYNOLOGY_PASSWORD=<password> -- synology-mcp - Verify:
claude mcp list
For a remote host, synology-mcp --transport http requires SYNOLOGY_MCP_HTTP_TOKEN set to at least 32 characters (callers send Authorization: Bearer <token>; openssl rand -hex 32 prints 64 hex characters and meets that minimum), serves http://127.0.0.1:7777/mcp by default, and needs --tls-cert/--tls-key for any non-loopback --addr. Requests with no Origin header are accepted. Loopback origins are accepted; any other Origin is refused unless listed in SYNOLOGY_MCP_HTTP_ALLOWED_ORIGINS (comma-separated scheme://host[:port] values). SYNOLOGY_MCP_READ_ONLY=1 drops every tool that is not read-only: the NAS writes (abb_backup, abb_cancel, session_logout) and the local writers (sync, fleet_sync, export, teach, learnings and playbook writes).
Direct Use
- Check if installed:
which synology-cliIf not found, offer to install (see Prerequisites at the top of this skill). - Match the user query to the best command from the Unique Capabilities and Command Reference above.
- Execute with the
--agentflag:synology-cli abb failures --since 24h --agent - If ambiguous, drill into subcommand help, for example
synology-cli abb --helporsynology-cli fleet add --help.