Configuration
AI Labs reads all of its tunables from environment variables. Server basics (host, port, auth mode, JWT secret) also live in ~/.cptr/config.toml; everything an admin can change is in the Admin settings and stored in the database.
Data directory
| Variable | Default | Purpose |
|---|---|---|
CPTR_DATA_DIR | ~/.cptr | Where the database (app.db), config.toml, logs/, memory/, and uploads live. Set to /data in Docker. |
Logging
| Variable | Default | Purpose |
|---|---|---|
CPTR_LOG_LEVEL | INFO | Application log level. |
CPTR_LOG_FORMAT | text | text or json. |
CPTR_LOG_UPSTREAM_REQUESTS | false | Capture full upstream model requests. |
CPTR_UPSTREAM_REQUEST_LOG_PATH | <data>/logs/upstream-requests.jsonl | Where they go. |
CPTR_UPSTREAM_REQUEST_LOG_ROTATION | 50 MB | Rotation size. |
Audit log
| Variable | Default | Purpose |
|---|---|---|
CPTR_AUDIT_LOG_LEVEL | NONE | Set to a level to enable the audit trail. |
CPTR_AUDIT_LOG_PATH | <data>/logs/audit.jsonl | Output file. |
CPTR_AUDIT_LOG_ROTATION | 10 MB | Rotation size. |
CPTR_AUDIT_MAX_BODY_SIZE | 2048 | Max request-body bytes recorded. |
CPTR_AUDIT_EXCLUDED_PATHS | /api/chats,/v1/chat | Comma-separated path prefixes to skip. |
Chat & agent
| Variable | Default | Purpose |
|---|---|---|
CHAT_MAX_ITERATIONS | 2048 | Max tool-loop iterations per turn. |
CHAT_TOOL_MAX_CHARS | 50000 | Truncation cap for tool output. |
CHAT_TOOL_COMMAND_MAX_CHARS | 8000 | Truncation cap for command output. |
CHAT_COMPACT_TOKEN_THRESHOLD | 80000 | Default context-compaction threshold (overridable per model). |
CHAT_AGENT_SEED_TRANSCRIPT_MAX_CHARS | 12000 | How much recent context seeds a coding-agent session. |
CPTR_CLAUDE_CODE_MAX_BUFFER_SIZE | 128 MiB | stdout JSON buffer for the Claude Code backend. |
ENABLE_CHAT_RECONCILE_ON_STARTUP | true | Reconcile interrupted chats on boot. |
CPTR_EXECUTE_TIMEOUT | unset (return immediately) | Default wait (seconds) for run_command / check_task when no explicit wait is given. |
Streaming timeouts
| Variable | Default |
|---|---|
CPTR_STREAM_CONNECT_TIMEOUT | 30 |
CPTR_STREAM_READ_TIMEOUT | 300 |
CPTR_STREAM_WRITE_TIMEOUT | 600 |
Workspace
| Variable | Default | Purpose |
|---|---|---|
CPTR_AUTO_GITIGNORE_DOT_CPTR | true | Auto-add .cptr/ to a workspace's .gitignore. |
Schedulers
| Variable | Default | Purpose |
|---|---|---|
AUTOMATION_POLL_INTERVAL | 10 | Seconds between automation scheduler checks. |
TIMER_POLL_INTERVAL | 1 | Seconds between timer-worker checks. |
Networking
| Variable | Default | Purpose |
|---|---|---|
CPTR_CORS_ALLOWED_ORIGINS | * | Socket.IO CORS origins. Comma-separated list to restrict. |
CPTR_PORT | set by CLI | Port advertised to the frontend. |
Backups
| Variable | Default | Purpose |
|---|---|---|
CPTR_BACKUP | 0 | Set to 1 to stream the database to a replica via Litestream (litestream.yml), with automatic restore on a fresh volume. |
Startup token
| Variable | Purpose |
|---|---|
CPTR_STARTUP_TOKEN | One-time first-run setup token. Set by cptr run, consumed by the app — you normally don't set this yourself. |