Docs/Reference/Environment Variables

Environment Variables

Complete reference for all CADENCE_* and related environment variables

Environment Variables Reference

This document is the single source of truth for all environment variables that configure Cadence. All configuration variables use the CADENCE_ prefix.

Configuration Variables

VariableSectionDefaultTypeRequiredDescriptionExample
CADENCE_CONFIGCorenonestringNoPath to configuration file/etc/cadence/cadence.yaml
CADENCE_LOG_LEVELLogginginfostringNoLogging verbosity: debug, info, warn, errordebug

Detection Thresholds

VariableSectionDefaultTypeRangeDescription
CADENCE_THRESHOLDS_SUSPICIOUS_ADDITIONSThresholds500integer100-10000Flag commits with more lines added than this
CADENCE_THRESHOLDS_SUSPICIOUS_DELETIONSThresholds1000integer100-10000Flag commits with more lines deleted than this
CADENCE_THRESHOLDS_MAX_ADDITIONS_PER_MINThresholds100integer10-500Flag if additions per minute exceeds this
CADENCE_THRESHOLDS_MAX_DELETIONS_PER_MINThresholds500integer50-1000Flag if deletions per minute exceeds this
CADENCE_THRESHOLDS_MIN_TIME_DELTA_SECONDSThresholds60integer0-300Flag if commits are within N seconds of previous commit
CADENCE_THRESHOLDS_MAX_FILES_PER_COMMITThresholds50integer10-200Flag commits modifying more files than this
CADENCE_THRESHOLDS_MAX_ADDITION_RATIOThresholds0.95float0.0-1.0Flag commits where additions are >N ratio (0=0%, 1=100%)
CADENCE_THRESHOLDS_MIN_DELETION_RATIOThresholds0.95float0.0-1.0Flag commits where deletions are >N ratio
CADENCE_THRESHOLDS_ENABLE_PRECISION_ANALYSISThresholdstrueboolean-Enable precision/consistency analysis

Webhook Server

VariableSectionDefaultTypeRequiredDescriptionExample
CADENCE_WEBHOOK_ENABLEDWebhookfalsebooleanNoEnable webhook servertrue
CADENCE_WEBHOOK_HOSTWebhook0.0.0.0stringNoHost address to bind to0.0.0.0
CADENCE_WEBHOOK_PORTWebhook8000integerNoPort to listen on8000
CADENCE_WEBHOOK_SECRETWebhooknonestringYes (if enabled)Secret key for webhook authenticationyour-secret-key
CADENCE_WEBHOOK_MAX_WORKERSWebhook4integerNoNumber of concurrent webhook handlers8
CADENCE_WEBHOOK_READ_TIMEOUTWebhook30integerNoRequest read timeout (seconds)30
CADENCE_WEBHOOK_WRITE_TIMEOUTWebhook30integerNoResponse write timeout (seconds)30

AI Analysis Configuration

VariableSectionDefaultTypeRequiredDescriptionExample
CADENCE_AI_ENABLEDAIfalsebooleanNoEnable AI-powered analysis featurestrue
CADENCE_AI_PROVIDERAIopenaistringYes (if enabled)AI provider: openai or anthropicopenai
CADENCE_AI_KEYAInonestringYes (if enabled)API key for selected providersk-proj-...
CADENCE_AI_MODELAI(provider default)stringNoSpecific model to usegpt-4o-mini
CADENCE_AI_BASE_URLAI(provider default)stringNoCustom API endpoint (if self-hosted)https://api.custom.com/v1
CADENCE_AI_TIMEOUTAI30integerNoRequest timeout (seconds)60
CADENCE_AI_MAX_RETRIESAI3integerNoNumber of retry attempts5

OpenAI Specific

VariableDefaultExamplePurpose
CADENCE_AI_PROVIDER=openai-openaiSet provider to OpenAI
CADENCE_AI_KEY-sk-proj-xxxOpenAI API key (starts with sk-proj-)
CADENCE_AI_MODELgpt-4o-minigpt-4o-mini or gpt-4Model selection

Example:

Bash
CADENCE_AI_PROVIDER=openai
CADENCE_AI_KEY=sk-proj-abc123...
CADENCE_AI_MODEL=gpt-4o-mini

Anthropic (Claude) Specific

VariableDefaultExamplePurpose
CADENCE_AI_PROVIDER=anthropic-anthropicSet provider to Anthropic
CADENCE_AI_KEY-sk-ant-...Anthropic API key (starts with sk-ant-)
CADENCE_AI_MODELclaude-sonnet-4-20250514claude-opus-4-1Model selection
CADENCE_AI_BASE_URLhttps://api.anthropic.com/v1-Usually not needed

Example:

Bash
CADENCE_AI_PROVIDER=anthropic
CADENCE_AI_KEY=sk-ant-abc123...
CADENCE_AI_MODEL=claude-sonnet-4-20250514

File Exclusions

VariableDefaultTypeDescriptionExample
CADENCE_EXCLUDE_FILES(defaults)stringComma-separated file patterns to exclude*.lock,node_modules/*

Example:

Bash
CADENCE_EXCLUDE_FILES="*.log,temp/**,*.tmp"

Advanced Configuration

VariableDefaultTypeDescriptionExample
CADENCE_CACHE_ENABLEDtruebooleanEnable analysis cachingtrue
CADENCE_CACHE_TTL86400integerCache time-to-live (seconds, 1 day)86400
CADENCE_PRECISION_ANALYSIStruebooleanEnable precision analysis strategytrue

Strategy Configuration

VariableSectionDefaultTypeDescription
CADENCE_STRATEGIES_DISABLEDStrategiesnonestringComma-separated strategy names to disable

Example:

Bash
CADENCE_STRATEGIES_DISABLED="emoji_usage,special_chars"

Common Environment Variable Combinations

Minimal Configuration (Local Analysis)

Bash
# No webhook, no AI, just detection
export CADENCE_LOG_LEVEL=info

Development Configuration

Bash
export CADENCE_LOG_LEVEL=debug
export CADENCE_WEBHOOK_ENABLED=true
export CADENCE_WEBHOOK_PORT=8000
export CADENCE_WEBHOOK_SECRET=dev-secret

Production Configuration (OpenAI)

Bash
export CADENCE_LOG_LEVEL=warn
export CADENCE_WEBHOOK_ENABLED=true
export CADENCE_WEBHOOK_PORT=8000
export CADENCE_WEBHOOK_SECRET=$(aws secretsmanager get-secret-value --secret-id cadence/webhook --query SecretString --output text)
export CADENCE_AI_ENABLED=true
export CADENCE_AI_PROVIDER=openai
export CADENCE_AI_KEY=$(aws secretsmanager get-secret-value --secret-id cadence/openai-key --query SecretString --output text)
export CADENCE_AI_MODEL=gpt-4o-mini

Production Configuration (Anthropic)

Bash
export CADENCE_LOG_LEVEL=warn
export CADENCE_WEBHOOK_ENABLED=true
export CADENCE_WEBHOOK_PORT=8000
export CADENCE_WEBHOOK_SECRET=$(vault kv get -field=webhook_secret secret/cadence)
export CADENCE_AI_ENABLED=true
export CADENCE_AI_PROVIDER=anthropic
export CADENCE_AI_KEY=$(vault kv get -field=api_key secret/cadence/anthropic)
export CADENCE_AI_MODEL=claude-sonnet-4-20250514

Setting Environment Variables

Docker

Bash
docker run -e CADENCE_AI_KEY=sk-... -e CADENCE_WEBHOOK_PORT=8000 trycadence/cadence:latest

Docker Compose

YAML
environment:
  CADENCE_AI_ENABLED: "true"
  CADENCE_AI_PROVIDER: "openai"
  CADENCE_AI_KEY: ${CADENCE_AI_KEY}
  CADENCE_WEBHOOK_PORT: "8000"

Kubernetes

YAML
env:
- name: CADENCE_AI_KEY
  valueFrom:
    secretKeyRef:
      name: cadence-secrets
      key: ai-key

systemd

Create /etc/cadence/cadence.env:

Bash
CADENCE_AI_ENABLED=true
CADENCE_AI_PROVIDER=openai
CADENCE_AI_KEY=sk-...
CADENCE_WEBHOOK_SECRET=secret

Then reference in service file:

INI
EnvironmentFile=/etc/cadence/cadence.env

Priority/Override Order

Environment variables override configuration file settings in this order (highest to lowest priority):

  1. Command-line flags (if supported)
  2. Environment variables (CADENCE_*)
  3. Configuration file (.cadence.yaml)
  4. Built-in defaults

Example:

Bash
# Config file says port=8000
# But this overrides it:
export CADENCE_WEBHOOK_PORT=9000
cadence webhook  # Will use port 9000

Required vs Optional

For Local Analysis (No Webhook/AI)

  • ✅ All optional (uses defaults)

For Webhook Server

  • CADENCE_WEBHOOK_ENABLED=true
  • CADENCE_WEBHOOK_SECRET (must be set)

For AI Analysis

  • CADENCE_AI_ENABLED=true
  • CADENCE_AI_PROVIDER (openai or anthropic)
  • CADENCE_AI_KEY (provider API key)
  • ⚠️ CADENCE_AI_MODEL (optional, uses provider default)

See Also