Skip to content

Secrets Management

Paperclip encrypts secrets at rest using a local master key. Agent environment variables that contain sensitive values (API keys, tokens) are stored as encrypted secret references.

Secrets are encrypted with a local master key stored at:

~/.paperclip/instances/default/secrets/master.key

This key is auto-created during onboarding. The key never leaves your machine.

Onboarding writes default secrets config:

Terminal window
pnpm paperclipai onboard

Update secrets settings:

Terminal window
pnpm paperclipai configure --section secrets

Validate secrets config:

Terminal window
pnpm paperclipai doctor
VariableDescription
PAPERCLIP_SECRETS_MASTER_KEY32-byte key as base64, hex, or raw string
PAPERCLIP_SECRETS_MASTER_KEY_FILECustom key file path
PAPERCLIP_SECRETS_STRICT_MODESet to true to enforce secret refs

When strict mode is enabled, sensitive env keys (matching *_API_KEY, *_TOKEN, *_SECRET) must use secret references instead of inline plain values.

Terminal window
PAPERCLIP_SECRETS_STRICT_MODE=true

Recommended for any deployment beyond local trusted.

If you have existing agents with inline API keys in their config, migrate them to encrypted secret refs:

Terminal window
pnpm secrets:migrate-inline-env # dry run
pnpm secrets:migrate-inline-env --apply # apply migration

Agent environment variables use secret references:

{
"env": {
"ANTHROPIC_API_KEY": {
"type": "secret_ref",
"secretId": "8f884973-c29b-44e4-8ea3-6413437f8081",
"version": "latest"
}
}
}

The server resolves and decrypts these at runtime, injecting the real value into the agent process environment.