Skip to content

Configuration Reference

GoClaw reads configuration from a JSON5 file. Secrets are kept separate from config.json and are only read from environment variables or the .env.local file.


Overview

  • Format: JSON5 (supports // comments, trailing commas, unquoted keys)
  • Default location: ~/.goclaw/data/config.json (Desktop) or ./config.json (Standard)
  • Environment variable override: GOCLAW_CONFIG specifies an explicit path
  • Security principle: Secrets (API keys, tokens, DSN) are NEVER stored in config.json

Basic example:

json5
{
  // Gateway server settings
  gateway: {
    host: "0.0.0.0",
    port: 8080,
    token: "", // Leave empty, use GOCLAW_GATEWAY_TOKEN environment variable
  },
  agents: {
    defaults: {
      provider: "anthropic",
      model: "claude-sonnet-4-5",
      max_tokens: 8192,
    }
  }
}

Section: gateway

Controls the gateway server.

FieldTypeDefaultDescription
hoststring"0.0.0.0"Listen address
portint8080Listen port (Desktop: 18790)
tokenstring""Bearer token for WS/HTTP authentication (secret — use env)
owner_ids[]string[]Sender IDs treated as "owner"
allowed_origins[]string[]WebSocket CORS whitelist (empty = allow all)
max_message_charsint32000Maximum characters per user message
rate_limit_rpmint20Request limit per minute per user (0 = disabled)
injection_actionstring"warn"Action on prompt injection detection: log, warn, block, off
inbound_debounce_msint1000Coalesce rapid messages from the same sender (ms, -1 = disabled)
block_reply*boolfalseSend intermediate text while tools are running
tool_status*booltrueShow tool name in streaming preview
task_recovery_interval_secint300Interval for checking team task recovery (seconds)

gateway.quota

Per-user/group request quota configuration.

FieldTypeDescription
enabledboolEnable/disable the quota system
defaultQuotaWindowDefault limits per user
providersmap[string]QuotaWindowOverride per provider (key = provider name)
channelsmap[string]QuotaWindowOverride per channel (key = channel name)
groupsmap[string]QuotaWindowOverride per group (key = userID)

QuotaWindow:

json5
{
  hour: 20,   // max requests/hour (0 = unlimited)
  day: 100,   // max requests/day
  week: 500   // max requests/week
}

Merge priority order: Groups > Channels > Providers > Default.


Section: channels

channels.telegram

FieldTypeDefaultDescription
enabledboolfalseEnable Telegram channel
tokenstring""Bot token (secret — use env)
allow_from[]string[]Sender ID whitelist
dm_policystring"pairing""pairing", "allowlist", "open", "disabled"
group_policystring"open""open", "allowlist", "disabled"
require_mention*booltrueRequire @bot mention in groups
mention_modestring"strict""strict" or "yield"
history_limitint50Max pending group messages for context (0 = disabled)
dm_stream*boolfalseEnable streaming for DMs
group_stream*boolfalseEnable streaming for groups
reaction_levelstring"off""off", "minimal", "full"
media_max_bytesint6420MBMaximum media download size
proxystring""HTTP/SOCKS5 proxy URL
api_serverstring""Custom Telegram Bot API server URL

channels.discord

FieldTypeDefaultDescription
enabledboolfalseEnable Discord channel
tokenstring""Bot token (secret — use env)
allow_from[]string[]User ID whitelist
dm_policystring"open""open", "allowlist", "disabled"
group_policystring"open""open", "allowlist", "disabled"
require_mention*booltrueRequire @bot mention
history_limitint50Max pending messages for context
media_max_bytesint6425MBMaximum media download size

channels.slack

FieldTypeDefaultDescription
enabledboolfalseEnable Slack channel
bot_tokenstring""xoxb-... Bot User OAuth Token (secret)
app_tokenstring""xapp-... App-Level Token Socket Mode (secret)
dm_policystring"pairing""pairing", "allowlist", "open", "disabled"
group_policystring"open""open", "pairing", "allowlist", "disabled"
dm_stream*boolfalseStreaming for DMs
group_stream*boolfalseStreaming for groups
reaction_levelstring"off""off", "minimal", "full"
debounce_delayint300Ms delay before processing rapid messages
thread_ttl*int24Hours before thread participation expires

Other Channels

  • channels.whatsappenabled, bridge_url, allow_from, dm_policy, group_policy
  • channels.zaloenabled, token, allow_from, dm_policy, webhook_url, webhook_secret
  • channels.zalo_personalenabled, allow_from, dm_policy, group_policy, credentials_path
  • channels.feishuenabled, app_id, app_secret, domain ("lark"/"feishu"), connection_mode ("websocket"/"webhook")

channels.pending_compaction

FieldDefaultDescription
threshold200Trigger compaction when entries exceed this
keep_recent40Number of recent messages to keep after compaction
max_tokens4096Max output tokens for LLM summarization
provider""LLM provider (empty = use agent's provider)

Section: providers

API keys are always read from env vars — NEVER stored in config.json.

ProviderFieldsDescription
anthropicapi_key, api_baseAnthropic Claude
openaiapi_key, api_baseOpenAI GPT
openrouterapi_key, api_baseOpenRouter
geminiapi_key, api_baseGoogle Gemini
deepseekapi_key, api_baseDeepSeek
groqapi_key, api_baseGroq
mistralapi_key, api_baseMistral AI
xaiapi_key, api_basexAI Grok
minimaxapi_key, api_baseMiniMax
ollamahostLocal Ollama (no API key needed)
claude_clicli_path, model, perm_modeClaude CLI (uses subscription)
acpbinary, args, model, work_dir, idle_ttl, perm_modeACP protocol agents
dashscopeapi_key, api_baseAlibaba DashScope (Qwen)
novitaapi_key, api_baseNovita AI

Section: tools

FieldTypeDescription
profilestring"minimal", "coding", "messaging", "full"
allow[]stringAllow list (tool names or "group:xxx")
deny[]stringDeny list
alsoAllow[]stringAdd without removing existing
rate_limit_per_hourintMax tool executions/hour/session (0 = disabled)
scrub_credentials*boolAutomatically redact API keys/tokens in tool output (default true)

tools.execApproval

FieldDefaultDescription
security"full""deny", "allowlist", "full"
ask"off""off", "on-miss", "always"
allowlist[]Glob patterns for allowed commands

tools.web_fetch

FieldDefaultDescription
policy"allow_all""allow_all" or "allowlist"
allowed_domains[]e.g., ["github.com", "*.example.com"]
blocked_domains[]Always checked regardless of policy

tools.browser

FieldDefaultDescription
enabledfalseEnable browser automation tool
headlessfalseRun Chrome headless
remote_url""CDP endpoint for remote Chrome
action_timeout_ms30000Timeout per action (ms)
idle_timeout_ms600000Auto-close page when idle (ms, 0 = disabled)
max_pages5Max open pages per tenant

tools.mcp_servers

json5
{
  tools: {
    mcp_servers: {
      "my-server": {
        transport: "stdio",        // "stdio", "sse", "streamable-http"
        command: "npx",
        args: ["-y", "@my/mcp-server"],
        env: {"API_KEY": "xxx"},
        tool_prefix: "my_",
        timeout_sec: 60,
        enabled: true
      }
    }
  }
}

Section: sessions

FieldTypeDefaultDescription
scopestring"per-sender""per-sender" or "global"
dm_scopestring"per-channel-peer"DM session scope
main_keystring"main"Key suffix for main session

dm_scope values:

ValueDescription
"main"All DMs share a single session
"per-peer"Each peer has a separate session (shared across channels)
"per-channel-peer"Each (channel, peer) pair has a separate session (default)
"per-account-channel-peer"Adds bot account to key separation

Section: tts

FieldTypeDefaultDescription
providerstring"""openai", "elevenlabs", "edge", "minimax"
autostring"off""off", "always", "inbound", "tagged"
modestring"final""final" or "all"
max_lengthint1500Maximum text length before truncation
timeout_msint30000API call timeout (ms)

TTS Providers:

ProviderConfiguration Fields
tts.openaiapi_key, api_base, model (default "gpt-4o-mini-tts"), voice (default "alloy")
tts.elevenlabsapi_key, base_url, voice_id, model_id
tts.edgeenabled, voice (default "en-US-MichelleNeural"), rate
tts.minimaxapi_key, group_id, api_base, model, voice_id

Section: agents.defaults

FieldDefaultDescription
workspace"~/agents"Root workspace directory
restrict_to_workspacefalseRestrict file access to workspace
provider""Default provider name
model""Default model
max_tokens8192Max output tokens
temperature0.7LLM temperature
max_tool_iterations30Maximum tool iterations per run
context_window200000Context window size
max_tool_calls25Maximum total tool calls per run (0 = unlimited)
agent_type"open""open" or "predefined"

Environment Variables

VariableDescription
GOCLAW_CONFIGExplicit path to config.json file
GOCLAW_GATEWAY_TOKENGateway authentication bearer token
GOCLAW_POSTGRES_DSNPostgreSQL connection string
GOCLAW_REDIS_DSNRedis connection string (optional)
GOCLAW_STORAGE_BACKEND"postgres" or "sqlite"
GOCLAW_SQLITE_PATHSQLite DB path
GOCLAW_PORTOverride gateway port (Desktop)
GOCLAW_TSNET_AUTH_KEYTailscale auth key

The .env.local file is automatically loaded if it exists alongside config.json. Environment variables take priority over config.json.

.env.local example:

bash
GOCLAW_GATEWAY_TOKEN=my-secret-token
GOCLAW_POSTGRES_DSN=postgres://user:pass@localhost:5432/goclaw
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...

See Also