ks CLI reference
The ks command is the primary interface for building, deploying, and inspecting Keystone-managed infrastructure.
Help
Use any of these forms to view help:
ks --help
ks -h
ks help
ks help update
ks update --help
ks update -hGlobal behavior
HOSTSis a comma-separated list such asworkstation,ocean.- When
HOSTSis omitted,ksresolves the current host fromhosts.nix. - Repo discovery reads
/run/current-system/keystone-system-flake(written at activation time bykeystone.systemFlake). Override with--flake <path>.
Global flags
--flake <PATH>: Override the consumer flake path (default: read from/run/current-system/keystone-system-flake).
Commands
ks build
ks build [--lock] [--user USERS] [--all-users] [HOSTS]Build Keystone configurations for one or more hosts.
--lock: Build full NixOS system closures instead of home-manager profiles.--user USERS: Limit home-manager builds to a comma-separated user list.--all-users: Build all home-manager users on each target host.
Examples:
ks build
ks build workstation,ocean
ks build --user alice,agent-coder workstation
ks build --lock oceanks update
ks update [--debug] [--dev] [--boot] [--pull] [--lock] [--user USERS] [--all-users] [HOSTS]Pull, verify, build, and deploy Keystone hosts.
Lock mode (pull latest flake inputs, build, push) is the default behavior.
Use --dev to deploy the current local checkout without locking.
Use ks switch to apply the current local state without any pull, lock, or push steps.
--debug: Show warnings fromgitandnixcommands.--dev: Build and deploy the current unlocked checkout without pull, lock, or push.--boot: Register the new generation for next boot without switching now.--pull: Pull managed repos only, then stop. Only takes effect when combined with--dev; without--devit is ignored and the full lock-mode cycle runs.--lock: Force lock mode explicitly. This is the default; it overrides--devwhen both are passed.--user USERS: Limit home-manager activation to a comma-separated user list.--all-users: Activate all home-manager users on each target host.
Examples:
ks update
ks update --dev workstation
ks update --boot ocean
ks update --pull --devks agents
ks agents <pause|resume|status> <agent|all> [reason]Control task-loop pause state for one agent or the full agent fleet.
pause: Create the pause marker so scheduled task-loop runs exit before ingest and execution.resume: Remove the pause marker and allow scheduled task-loop runs again.status: Show whether the target agent task loop is paused.
Examples:
ks agents pause drago "waiting for human review"
ks agents pause all "human focus block"
ks agents status luce
ks agents resume allks docs
ks docs [topic|path]Browse Keystone Markdown docs in the terminal with glow and fzf.
- With no argument,
ks docsopens an interactive picker over Markdown files indocs/only. - In the picker, type to filter, press Enter to open, and press Esc to cancel.
- Topic shortcuts:
os,terminal,desktop,agents,projects. - Relative docs paths such as
terminal/projects.mdalso work.
Examples:
ks docs
ks docs desktop
ks docs terminal/projects.mdks hardware-key
ks hardware-key doctor [user|user/key] [--json]
ks hardware-key secrets [--json]Inspect hardware-key wiring for the current host and current user.
doctorvalidates registered SSH hardware keys, host root-key wiring, current-userageYubikeyidentities, local YubiKey visibility, FIDO2 device visibility, and disk-unlock status when available.- With no selector,
doctorprefers the current user’s registered keys and falls back to all registered keys when no current-user keys exist. secretsis an explicit TODO stub for future agenix recipient and rekey orchestration. It currently reports the detected secrets layout and the planned implementation path.
Examples:
ks hardware-key doctor
ks hardware-key doctor ncrmro
ks hardware-key doctor ncrmro/yubi-black --json
ks hardware-key secrets --jsonks photos
ks photos search [options]
ks photos people [options]
ks photos download <asset-id> [options]
ks photos preview <asset-id>Search and preview the remote Immich-backed photo library.
Keystone Photosis the canonical name for this feature.- The public CLI entrypoint is
ks photos. immich-searchis legacy spec wording and should not be used for new docs.
Examples:
ks photos search --text "acme"
ks photos search --album "Screenshots - alice" --tag "receipt" --city "Austin"
ks photos search --text "nick romero" --kind business-card
ks photos search --person "Nick Romero" --type photo
ks photos search --filename "IMG_" --camera-make "Apple" --camera-model "iPhone 15 Pro"
ks photos people --json
ks photos search --text "ks build" --type screenshot --from 2026-01-01 --to 2026-03-31ks screenshots
ks screenshots sync [options]Sync local PNG screenshots into the configured Immich server.
ks screenshotsmanages the local screenshot pipeline.ks photosremains the remote search and preview surface.
Examples:
ks screenshots sync
ks screenshots sync --directory ~/Pictures --album-name "Screenshots - alice"
ks screenshots sync --url https://photos.example.com --api-key-file /run/agenix/alice-immich-api-keyks switch
ks switch [--boot] [HOSTS]Build and deploy the current local state without pull, lock, or push steps.
--boot: Register the new generation for next boot without switching now.
Examples:
ks switch
ks switch workstation,ocean
ks switch --boot oceanks sync-agent-assets
ks sync-agent-assetsRefresh generated Keystone agent assets for the current user from the current profile manifest.
- Rewrites generated instruction files, curated command files, and managed Codex skills from the live keystone checkout in development mode.
- This is the supported no-sudo refresh path for development-mode agent assets.
Example:
ks sync-agent-assetsks sync-host-keys
ks sync-host-keysFetch SSH host public keys from live hosts and write them into hosts.nix.
- Hosts without
sshTargetare skipped. - If
sshTargetis unreachable andfallbackIPexists,ksretries overfallbackIP.
Example:
ks sync-host-keysks grafana dashboards
ks grafana dashboards <apply|export> [uid]Manage checked-in Keystone Grafana dashboards through the Grafana API.
apply: Push every checked-in dashboard JSON file to Grafana, and delete stale keystone-managed dashboards that are no longer in the repo.export <uid>: Pull one dashboard by UID into its checked-in JSON file.GRAFANA_URL: Override the Grafana base URL.GRAFANA_API_KEY: Override the Grafana API key.- In development mode,
ks update --dev,ks update, andks switchautomatically sync keystone dashboards after deployment.
Examples:
ks grafana dashboards apply
ks grafana dashboards export keystone-host-overviewks agent
ks agent [--local [MODEL]] [args...]Launch an AI coding agent with Keystone conventions and host context.
ks agent launches claude by default. Its static base prompt comes from the
generated ~/.keystone/AGENTS.md, then ks appends live host and fleet context.
The generated command surface inside the session is curated to /ks, optional
/ks.dev in development mode, and /deepwork.
--local [MODEL]: Use the local Ollama-backed model, or the configured default model.- Remaining args are passed through to the underlying
claudeinvocation.
Examples:
ks agent
ks agent --local
ks agent --local qwen2.5-coder:14b --continueks doctor
ks doctor [--local [MODEL]] [args...]Print the scripted fleet doctor report, then optionally launch the default agent.
--local [MODEL]: If you choose to launch the agent, use the local Ollama-backed model, or the configured default model.- Remaining args are passed through to the agent if you choose to launch it.
Examples:
ks doctor
ks doctor --local
ks doctor --local mistral --continue