Skip to Content
RabbitLock Docs

CLI

Every rabbitlock command, flag and default.

rabbitlock <command> [options]

Global option: --policy PATH uses a specific policy file. Without it, RabbitLock uses rabbitlock.agent.yaml from the current directory or the nearest parent.

init

rabbitlock init [--agents-md]
  • Creates ~/.rabbitlock/identity (mode 0600) if it doesn't exist. An existing identity is never overwritten, and a passphrase-protected one isn't unlocked.
  • Creates the local CA in ~/.rabbitlock/ca/ if needed. Its private key is stored encrypted under your identity. If your identity has a passphrase, the CA is created on your first rabbitlock run instead, so init never prompts.
  • Writes an example rabbitlock.agent.yaml with a new project id, unless one already exists.
  • Prints the CA certificate path.
  • --agents-md: adds (or updates) a RabbitLock section in AGENTS.md telling coding agents how to use placeholders and what to ask you for. If CLAUDE.md exists, adds an @AGENTS.md line so Claude Code reads it too.

set NAME

echo -n "value" | rabbitlock set NAME
rabbitlock set NAME            # hidden interactive prompt

Encrypts NAME into the secrets file for every recipient (your key is always included). NAME must match ^[A-Z][A-Z0-9_]*$.

  • From stdin: one trailing newline is stripped.
  • Empty values are refused.
  • Not in the policy: if NAME isn't listed yet, RabbitLock warns that agents won't receive it.

set NAME --generate

rabbitlock set NAME --generate (--reveal | --to-command 'CMD' | --no-handoff) \
  [--length N] [--charset alnum|hex|base64url|symbols] [--force]

Creates a random value, hands it off, then encrypts it like set. Use it for credentials the agent sets up but should never see. See the guide.

FlagMeaning
--revealPrint the value once. Refused unless standard output is an interactive terminal.
--to-command 'CMD'Pipe the value, followed by a newline, to CMD's standard input (run with $SHELL -c). Nothing is stored if CMD exits non-zero.
--no-handoffDon't show it to anyone; only agents can use it, through RabbitLock.
--length N16 to 256 characters (default 32)
--charsetalnum (default), hex, base64url, or symbols (printable ASCII without space, quotes, backslash or backtick; always includes a symbol)
--forceReplace an existing value. Without it, generating over a stored secret is refused.

Exactly one of --reveal, --to-command or --no-handoff is required. Generation writes a generated receipt.

rm NAME

Removes NAME from the secrets file and re-encrypts. It's an error if NAME isn't stored.

import FILE

rabbitlock import .env [--only NAME,NAME] [--force] [--delete]

Encrypts every valid entry of a .env file into the secrets file. It never prints values.

  • Supported syntax: KEY=value, export KEY=value, double-quoted (with \n escapes, may span lines) and single-quoted values, # comments.
  • Skipped: names that don't match ^[A-Z][A-Z0-9_]*$, empty values, unparseable lines (reported by line number), and secrets already stored with a different value unless --force.
  • Not in the policy: prints a stub for each imported name that has no allowed hosts yet.
  • --delete: removes the file after a clean import. It's kept if anything was skipped for a conflict or a parse error. Without --delete, RabbitLock reminds you that the file still holds plaintext values the agent can read.

status

rabbitlock status [--json]

Shows the setup state and the next steps, never values.

  • Outside a session: identity, policy, which secrets are stored, missing values, stored secrets with no policy, .env files that still contain a brokered value, sandbox availability.
  • Inside a session (run by the agent): session.active, the session id, the sandbox in use, and which environment variables hold placeholders. The identity is unreadable there by design, so stored is null.

--json is meant for agents and scripts; the fields are version, session, identity, policy, stored, missingValues, notInPolicy, plaintextCopies, sandbox and nextSteps.

key

rabbitlock key               # print your public key
rabbitlock key protect       # encrypt your identity with a passphrase, or change it
rabbitlock key unprotect     # remove the passphrase
  • key prints your public key. It's safe to share: a teammate adds it with rabbitlock team add. It never needs the passphrase.
  • key protect encrypts ~/.rabbitlock/identity with a passphrase (scrypt, then AES-256-GCM). The new passphrase is typed twice, or read as one line from stdin for automation. It must be at least 12 characters. If the identity already has one, it asks for the current passphrase first.
  • key unprotect asks for the passphrase and writes the plain identity back (still mode 0600).

With a passphrase, commands that need your private key (run, set, import, rm, team enable|add|remove) ask for it on your terminal, with three attempts. status, ls, key and team ls don't need it. Without a terminal, for example in an agent's shell, those commands fail with a clear message instead of waiting. For automation, set RABBITLOCK_PASSPHRASE.

There's no recovery: if you forget the passphrase, secrets encrypted only to you are lost. Keep it in your password manager.

team

rabbitlock team enable [--name NAME]
rabbitlock team add KEY [--name NAME]
rabbitlock team remove NAME|KEY
rabbitlock team ls
  • enable: switches the project from individual to team mode. It moves the encrypted secrets from ~/.rabbitlock/projects/<project>/ into secrets.sops.json next to the policy, sets secrets_file, and lists you as a named recipient (default name: your git user.name). It refuses if team mode is already on or secrets.sops.json already exists.
  • add: adds a recipient and re-encrypts. A malformed key changes nothing.
  • remove: removes a recipient by name or key (or a unique key prefix) and re-encrypts, then lists the secrets to rotate. You can't remove yourself.
  • ls: who can decrypt; (you) marks your key. In individual mode it says so.

The other team commands need team mode.

ls

Lists every name in the secrets file or the policy, with its status. Never prints values, and reads names without decrypting (SOPS keeps names in clear), so it needs no passphrase.

GITHUB_TOKEN                 api.github.com,github.com approval=never
STRIPE_API_KEY               MISSING VALUE
OLD_TOKEN                    not brokered (no policy)

run

rabbitlock run [--sandbox auto|on|off] [--quiet] -- <command> [args...]

Runs <command> with brokered credentials. See How it works.

FlagDefaultMeaning
--sandboxautoauto sandboxes when possible and otherwise warns; on refuses to start without a sandbox; off disables it. See Agent sandbox.
--quietoffSuppress the startup line

The command fails before launching if the policy names a secret that isn't stored. It exits with the agent's exit code, and forwards SIGINT and SIGTERM to the agent.

receipts

rabbitlock receipts [--tail N]     # default 20

Prints recent receipts: time, decision, secrets, request and status. See Receipt format.

ca

rabbitlock ca                      # print the local CA certificate path
rabbitlock ca trust [--yes]        # macOS: trust it in the login keychain
rabbitlock ca untrust [--yes]      # macOS: remove that trust

Printing the path and trust/untrust only need the certificate, not the key or your passphrase. The CA's private key is stored encrypted under a key derived from your identity, and is unlocked only by rabbitlock run. A plain-text key left by a version before 0.4.1 is encrypted the next time you run rabbitlock run.

trust and untrust print the exact security command and ask for confirmation. --yes skips RabbitLock's confirmation, but macOS still asks for your password. Not running in a terminal and no --yes? It refuses. On Linux, trust prints instructions instead. See Trust the CA on macOS.

help

rabbitlock help, --help or -h.

On this page