Skip to content

Configuration

All persistent state lives under one directory:

SourcePath
Default~/.keyledger/
Override$KEYLEDGER_HOME environment variable

The directory contains:

File / FolderPurpose
keyledger.dbSQLite database — provider config, encrypted credentials, snapshots
snapshots/JSON snapshot files written by dump and watch
debug.logError log written when provider errors occur

Settings are edited via the TUI (g key) or read-only from the database. There is no hand-editable config file — all values are stored in SQLite.

SettingDefaultDescription
snapshot_dir~/.keyledger/snapshotsDirectory where JSON snapshot files are written
timeout30 (seconds)Per-provider API request timeout
parallel4Maximum concurrent provider queries
max_key_age_days90Keys older than this get a warning risk score
max_idle_days30Keys unused for longer than this get a warning risk score
critical_age_days365Keys older than this get a critical risk score
RiskCondition
okAge ≤ 90 days, used recently
warningAge > 90 days, OR idle > 30 days, OR active and never used (after 7-day grace period)
criticalAge > 365 days, OR active and never used beyond 365 days

Each provider stores two kinds of data:

  • Credentials — stored encrypted in the SQLite database
  • Config fields — provider-specific settings (e.g. project lists, boolean toggles) stored as JSON in the database

Both are managed through the Providers screen in the TUI (p key).

Credentials are stored in the enc_credentials table inside keyledger.db, encrypted with AES-256-GCM using a key derived from a password you set on first use (scrypt, N=131072). The store must be unlocked with your password at the start of each session before KeyLedger can read credentials.

The following environment variables auto-populate credentials:

VariableProviderField
OPENAI_API_KEY or OPENAI_ADMIN_KEYOpenAIadmin_key
ANTHROPIC_API_KEY or ANTHROPIC_ADMIN_KEYAnthropicadmin_key
GOOGLE_APPLICATION_CREDENTIALS or GCP_SERVICE_ACCOUNT_JSONGoogleservice_account_json
AWS_ACCESS_KEY_IDAWSaccess_key_id
AWS_SECRET_ACCESS_KEYAWSsecret_access_key
AWS_SSO_PROFILEAWSsso_creds

When an environment variable is detected, it appears as an auto-discovery candidate in the TUI credential picker. You can select it to store it permanently in the encrypted store, or ignore it.