Skip to content

Configuration Reference

SAM uses environment variables for platform configuration. User-specific settings (Hetzner tokens, agent keys) are stored encrypted in the database, not as environment variables.

These are Cloudflare Worker secrets, set during deployment. Pulumi auto-generates security keys on first deploy.

SecretDescription
ENCRYPTION_KEYAES-256-GCM key for credential encryption (auto-generated)
JWT_PRIVATE_KEYRSA-2048 private key for signing tokens (auto-generated)
JWT_PUBLIC_KEYRSA-2048 public key for token verification (auto-generated)
CF_API_TOKENCloudflare API token for DNS and infrastructure
CF_ZONE_IDCloudflare zone ID for DNS record management
CF_ACCOUNT_IDCloudflare account ID
GITHUB_CLIENT_IDGitHub App client ID for OAuth
GITHUB_CLIENT_SECRETGitHub App client secret for OAuth
GITHUB_APP_IDGitHub App ID for installation tokens
GITHUB_APP_PRIVATE_KEYGitHub App private key (PEM or base64)
GITHUB_APP_SLUGGitHub App URL slug

Set as [vars] in wrangler.toml or as environment variables:

VariableDefaultDescription
BASE_DOMAINRoot domain for the deployment (e.g., example.com)
VERSIONDeployment version string

Set in GitHub Settings → Environments → production:

VariableDescriptionExample
BASE_DOMAINDeployment domainexample.com
RESOURCE_PREFIXCloudflare resource name prefixsam
PULUMI_STATE_BUCKETR2 bucket for Pulumi statesam-pulumi-state
VariableDefaultDescription
REQUIRE_APPROVAL(unset)Require admin approval for new users. First user becomes superadmin.
VariableDefaultDescription
MAX_SESSIONS_PER_PROJECT1000Max chat sessions per project
MAX_MESSAGES_PER_SESSION10000Max messages per chat session
MESSAGE_SIZE_THRESHOLD102400Max message size in bytes
ACTIVITY_RETENTION_DAYS90Days to retain activity events
SESSION_IDLE_TIMEOUT_MINUTES60Idle session timeout
DO_SUMMARY_SYNC_DEBOUNCE_MS5000Debounce for DO-to-D1 summary sync
VariableDefaultDescription
MAX_PROJECT_RUNTIME_ENV_VARS_PER_PROJECT150Max env vars per project
MAX_PROJECT_RUNTIME_FILES_PER_PROJECT50Max files per project
MAX_PROJECT_RUNTIME_ENV_VALUE_BYTES8192Max bytes per env var value
MAX_PROJECT_RUNTIME_FILE_CONTENT_BYTES131072Max bytes per file content
MAX_PROJECT_RUNTIME_FILE_PATH_LENGTH256Max file path length
VariableDefaultDescription
TASK_TITLE_MODEL@cf/meta/llama-3.1-8b-instructWorkers AI model
TASK_TITLE_MAX_LENGTH100Max characters in generated title
TASK_TITLE_TIMEOUT_MS5000Timeout before falling back to truncation
TASK_TITLE_GENERATION_ENABLEDtrueSet false to disable AI generation
TASK_TITLE_SHORT_MESSAGE_THRESHOLD100Messages at or below this length bypass AI
TASK_TITLE_MAX_RETRIES2Max retry attempts on failure
TASK_TITLE_RETRY_DELAY_MS1000Base delay between retries
TASK_TITLE_RETRY_MAX_DELAY_MS4000Max delay cap for backoff
VariableDefaultDescription
NODE_WARM_TIMEOUT_MS1800000 (30 min)Time a node stays warm after task completion
DEFAULT_TASK_AGENT_TYPEclaude-codeAgent used for autonomous task execution

Applied via cloud-init on each node:

SettingDefaultDescription
SystemMaxUse500MMax disk space for journal
SystemKeepFree1GMinimum free disk to maintain
MaxRetentionSec7dayMax log retention period
StoragepersistentPersist logs across reboots
CompressyesCompress stored entries