Skip to content

Configuration

Claw Insights uses a three-layer configuration system:

  1. Environment variables (highest priority)
  2. Config file (~/.claw-insights/config.json)
  3. NODE_ENV defaults (lowest priority)

Environment Variables

All variables use the CLAW_INSIGHTS_ prefix. For backward compatibility, OPENCLAW_ prefix is also accepted (lower priority).

Core

VariableDefaultDescription
CLAW_INSIGHTS_SERVER_PORT41041GraphQL API + web server port
CLAW_INSIGHTS_WEB_PORT41042Vite dev server port (development only)
CLAW_INSIGHTS_API_TOKEN(auto-generated)Auth token (minimum 32 characters). Empty = auto-generate on startup
CLAW_INSIGHTS_NO_AUTHfalseDisable authentication entirely (true or 1)
CLAW_INSIGHTS_SERVER_ONLYfalseRun API server without serving web UI
CLAW_INSIGHTS_OPENfalseOpen dashboard in browser after start (true or 1)
CLAW_INSIGHTS_GATEWAYOpenClaw gateway URL (set via --gateway flag, e.g., http://127.0.0.1:3578)
LOG_LEVELinfoLog level override — no CLAW_INSIGHTS_ prefix (pino levels: fatal, error, warn, info, debug, trace)

Data Sources

VariableDefaultDescription
CLAW_INSIGHTS_DB~/.claw-insights/metrics.dbSQLite database path (alias: CLAW_INSIGHTS_DB_PATH)
CLAW_INSIGHTS_SESSIONS_PATH~/.openclaw/agents/main/sessions/sessions.jsonOpenClaw sessions file
CLAW_INSIGHTS_LOG_DIR/tmp/openclaw/OpenClaw log directory
CLAW_INSIGHTS_DIR~/.openclawOpenClaw base directory (used as prefix for other paths)
CLAW_INSIGHTS_CLI(auto-detected)Path to openclaw CLI binary. Auto-detection checks which openclaw, common install locations, then falls back to bare openclaw
CLAW_INSIGHTS_CRON_PATH~/.openclaw/cron/jobs.jsonOpenClaw cron jobs file
CLAW_INSIGHTS_TRANSCRIPTS_DIR~/.openclaw/agents/main/sessionsTranscript JSONL files directory
CLAW_INSIGHTS_DEVICE_JSON~/.openclaw/identity/device.jsonDevice identity JSON file (used for lifetime stats createdAt)

Note: CLAW_INSIGHTS_TRANSCRIPTS_DIR and CLAW_INSIGHTS_DEVICE_JSON default paths are derived from CLAW_INSIGHTS_DIR when set. For example, setting CLAW_INSIGHTS_DIR=/custom/path makes transcripts default to /custom/path/agents/main/sessions.

Data Retention

VariableDefaultDescription
CLAW_INSIGHTS_RAW_RETENTION_DAYS7Days to keep raw metric data
CLAW_INSIGHTS_HOURLY_RETENTIONpermanentHourly aggregate retention (permanent or days)

Config File

Create ~/.claw-insights/config.json:

json
{
  "serverPort": 41041,
  "apiToken": "your-secure-token-at-least-32-characters"
}

Security: If the file contains apiToken, restrict permissions:

bash
chmod 600 ~/.claw-insights/config.json

Public Keys

These keys are commonly configured:

KeyTypeDefaultDescription
serverPortnumber41041GraphQL API + web server port
webPortnumber41042Vite dev server port
apiTokenstringAuth token (min 32 chars)
noAuthbooleanfalse (prod)Disable authentication
dbPathstring~/.claw-insights/metrics.dbSQLite database path
logLevelstringLog level: debug, info, warn, error
rawRetentionDaysnumber7Days to keep raw metric data
serverOnlybooleanfalseRun API server without web UI
hourlyRetentionstringpermanentHourly aggregate retention
transcriptsDirstring~/.openclaw/agents/main/sessionsTranscript JSONL directory
deviceJsonPathstring~/.openclaw/identity/device.jsonDevice identity JSON path
sessionHierarchyModestringsingleSession hierarchy display: single (flat) or dual (parent + sub-agent)

Advanced Keys

Advanced Configuration

These keys are for fine-tuning and rarely need modification.

Token Rotation:

KeyTypeDefaultDescription
tokenRotationEnabledbooleantrueEnable automatic token rotation
tokenRotationIntervalMsnumber86400000 (24h)Rotation interval
tokenGraceMsnumber43200000 (12h)Grace period for old tokens
tokenRotationCheckIntervalMsnumber300000 (5min)How often to check rotation
tokenMaxPreviousnumber2Max previous tokens kept valid

Log Budget:

KeyTypeDefaultDescription
logBudgetMbnumber1024Total log budget in MB
logRetentionDaysnumber14Log retention in days
errorFloorMbnumber300Minimum error log space
errorReserveMbnumber50Reserved error log space
appSoftMbnumber500App log soft limit
debugSoftMbnumber200Debug log soft limit

Queue & I/O:

KeyTypeDefault
criticalQueueMaxnumber10000
bestEffortQueueMaxnumber50000
criticalFsyncMsnumber100
criticalSyncBatchnumber1000
logFileModenumber0o644

Back-Pressure Thresholds:

KeyTypeDefaultDescription
pressureQueuePctnumber70Queue pressure threshold (%)
pressureIoLagMsnumber200I/O lag pressure threshold
pressureBudgetPctnumber85Budget pressure threshold (%)
pressureFreeSpaceMbnumber512Free space pressure threshold
emergencyQueuePctnumber90Queue emergency threshold (%)
emergencyIoLagMsnumber1000I/O lag emergency threshold
emergencyBudgetPctnumber95Budget emergency threshold (%)
emergencyFreeSpaceMbnumber128Free space emergency threshold

Unknown keys are logged as warnings and ignored.

NODE_ENV Defaults

Settings change based on NODE_ENV:

Settingdevelopmenttestproduction
Authenticationdisableddisabledenabled
Server port41041411141041
Web port41042321141042
Databasemetrics.dbtest-metrics.dbmetrics.db
Raw retention7 days1 day7 days

Authentication Details

Token flow

  1. Server starts → generates token (or reads from env/config)
  2. Prints token URL: 🔑 http://127.0.0.1:41041/?token=xxx
  3. Browser opens URL → server sets claw_session cookie containing a hash of the token (7 days, httpOnly)
  4. Subsequent requests authenticated via cookie (automatic in browsers) or Authorization: Bearer <token> header

Programmatic access

bash
# Bearer token (recommended for scripts)
curl -H "Authorization: Bearer YOUR_TOKEN" http://127.0.0.1:41041/graphql \
  -H "Content-Type: application/json" \
  -d '{"query":"{ system { ... on OpenClawSystem { gateway { running version uptime } } } }"}'

Note: Cookie-based auth (claw_session) is handled automatically by browsers after visiting the token URL. The cookie contains a hash of the token, not the raw token itself.

Multi-source Support

Planned

Multi-source support is architected but not yet exposed as a user-facing feature. The internal data source registry already supports multiple sources with independent status tracking. This section will be updated when multi-gateway configuration is available.

Released under the MIT License.