Configuration
このコンテンツはまだ日本語訳がありません。
Configuration
Section titled “Configuration”CoderClaw reads an optional ~/.coderclaw/coderclaw.json.
If the file is missing, CoderClaw uses safe defaults. Common reasons to add a config:
- Connect channels and control who can message the bot
- Set models, tools, sandboxing, or automation (cron, hooks)
- Tune sessions, media, networking, or UI
See the full reference for every available field.
Minimal config
Section titled “Minimal config”{ agents: { defaults: { workspace: "~/.coderclaw/workspace" } }, channels: { whatsapp: { allowFrom: ["+15555550123"] } },}Editing config
Section titled “Editing config”Strict validation
Section titled “Strict validation”When validation fails:
- The Gateway does not boot
- Only diagnostic commands work (
coderclaw doctor,coderclaw logs,coderclaw health,coderclaw status) - Run
coderclaw doctorto see exact issues - Run
coderclaw doctor --fix(or--yes) to apply repairs
Common tasks
Section titled “Common tasks”- [WhatsApp](/channels/whatsapp) — `channels.whatsapp`- [Telegram](/channels/telegram) — `channels.telegram`- [Discord](/channels/discord) — `channels.discord`- [Slack](/channels/slack) — `channels.slack`- [Signal](/channels/signal) — `channels.signal`- [iMessage](/channels/imessage) — `channels.imessage`- [Google Chat](/channels/googlechat) — `channels.googlechat`- [Mattermost](/channels/mattermost) — `channels.mattermost`- [MS Teams](/channels/msteams) — `channels.msteams`
All channels share the same DM policy pattern:
```json5{ channels: { telegram: { enabled: true, botToken: "123:abc", dmPolicy: "pairing", // pairing | allowlist | open | disabled allowFrom: ["tg:123"], // only for allowlist/open }, },}``````json5{ agents: { defaults: { model: { primary: "anthropic/claude-sonnet-4-5", fallbacks: ["openai/gpt-5.2"], }, models: { "anthropic/claude-sonnet-4-5": { alias: "Sonnet" }, "openai/gpt-5.2": { alias: "GPT" }, }, }, },}```
- `agents.defaults.models` defines the model catalog and acts as the allowlist for `/model`.- Model refs use `provider/model` format (e.g. `anthropic/claude-opus-4-6`).- `agents.defaults.imageMaxDimensionPx` controls transcript/tool image downscaling (default `1200`); lower values usually reduce vision-token usage on screenshot-heavy runs.- See [Models CLI](/concepts/models) for switching models in chat and [Model Failover](/concepts/model-failover) for auth rotation and fallback behavior.- For custom/self-hosted providers, see [Custom providers](/gateway/configuration-reference#custom-providers-and-base-urls) in the reference.- `"pairing"` (default): unknown senders get a one-time pairing code to approve- `"allowlist"`: only senders in `allowFrom` (or the paired allow store)- `"open"`: allow all inbound DMs (requires `allowFrom: ["*"]`)- `"disabled"`: ignore all DMs
For groups, use `groupPolicy` + `groupAllowFrom` or channel-specific allowlists.
See the [full reference](/gateway/configuration-reference#dm-and-group-access) for per-channel details.```json5{ agents: { list: [ { id: "main", groupChat: { mentionPatterns: ["@coderclaw", "coderclaw"], }, }, ], }, channels: { whatsapp: { groups: { "*": { requireMention: true } }, }, },}```
- **Metadata mentions**: native @-mentions (WhatsApp tap-to-mention, Telegram @bot, etc.)- **Text patterns**: regex patterns in `mentionPatterns`- See [full reference](/gateway/configuration-reference#group-chat-mention-gating) for per-channel overrides and self-chat mode.```json5{ session: { dmScope: "per-channel-peer", // recommended for multi-user reset: { mode: "daily", atHour: 4, idleMinutes: 120, }, },}```
- `dmScope`: `main` (shared) | `per-peer` | `per-channel-peer` | `per-account-channel-peer`- See [Session Management](/concepts/session) for scoping, identity links, and send policy.- See [full reference](/gateway/configuration-reference#session) for all fields.```json5{ agents: { defaults: { sandbox: { mode: "non-main", // off | non-main | all scope: "agent", // session | agent | shared }, }, },}```
Build the image first: `scripts/sandbox-setup.sh`
See [Sandboxing](/gateway/sandboxing) for the full guide and [full reference](/gateway/configuration-reference#sandbox) for all options.- `every`: duration string (`30m`, `2h`). Set `0m` to disable.- `target`: `last` | `whatsapp` | `telegram` | `discord` | `none`- See [Heartbeat](/gateway/heartbeat) for the full guide.See [Cron jobs](/automation/cron-jobs) for the feature overview and CLI examples.```json5{ hooks: { enabled: true, token: "shared-secret", path: "/hooks", defaultSessionKey: "hook:ingress", allowRequestSessionKey: false, allowedSessionKeyPrefixes: ["hook:"], mappings: [ { match: { path: "gmail" }, action: "agent", agentId: "main", deliver: true, }, ], },}```
See [full reference](/gateway/configuration-reference#hooks) for all mapping options and Gmail integration.```json5{ agents: { list: [ { id: "home", default: true, workspace: "~/.coderclaw/workspace-home" }, { id: "work", workspace: "~/.coderclaw/workspace-work" }, ], }, bindings: [ { agentId: "home", match: { channel: "whatsapp", accountId: "personal" } }, { agentId: "work", match: { channel: "whatsapp", accountId: "biz" } }, ],}```
See [Multi-Agent](/concepts/multi-agent) and [full reference](/gateway/configuration-reference#multi-agent-routing) for binding rules and per-agent access profiles.```json5{ gateway: { port: 18789 }, agents: { $include: "./agents.json5" }, broadcast: { $include: ["./clients/a.json5", "./clients/b.json5"], },}```
- **Single file**: replaces the containing object- **Array of files**: deep-merged in order (later wins)- **Sibling keys**: merged after includes (override included values)- **Nested includes**: supported up to 10 levels deep- **Relative paths**: resolved relative to the including file- **Error handling**: clear errors for missing files, parse errors, and circular includesConfig hot reload
Section titled “Config hot reload”The Gateway watches ~/.coderclaw/coderclaw.json and applies changes automatically — no manual restart needed for most settings.
Reload modes
Section titled “Reload modes”| Mode | Behavior |
|---|---|
hybrid (default) | Hot-applies safe changes instantly. Automatically restarts for critical ones. |
hot | Hot-applies safe changes only. Logs a warning when a restart is needed — you handle it. |
restart | Restarts the Gateway on any config change, safe or not. |
off | Disables file watching. Changes take effect on the next manual restart. |
{ gateway: { reload: { mode: "hybrid", debounceMs: 300 }, },}What hot-applies vs what needs a restart
Section titled “What hot-applies vs what needs a restart”Most fields hot-apply without downtime. In hybrid mode, restart-required changes are handled automatically.
| Category | Fields | Restart needed? |
|---|---|---|
| Channels | channels.*, web (WhatsApp) — all built-in and extension channels | No |
| Agent & models | agent, agents, models, routing | No |
| Automation | hooks, cron, agent.heartbeat | No |
| Sessions & messages | session, messages | No |
| Tools & media | tools, browser, skills, audio, talk | No |
| UI & misc | ui, logging, identity, bindings | No |
| Gateway server | gateway.* (port, bind, auth, tailscale, TLS, HTTP) | Yes |
| Infrastructure | discovery, canvasHost, plugins | Yes |
Config RPC (programmatic updates)
Section titled “Config RPC (programmatic updates)”<Warning>`config.apply` replaces the **entire config**. Use `config.patch` for partial updates, or `coderclaw config set` for single keys.</Warning>
Params:
- `raw` (string) — JSON5 payload for the entire config- `baseHash` (optional) — config hash from `config.get` (required when config exists)- `sessionKey` (optional) — session key for the post-restart wake-up ping- `note` (optional) — note for the restart sentinel- `restartDelayMs` (optional) — delay before restart (default 2000)
```bashcoderclaw gateway call config.get --params '{}' # capture payload.hashcoderclaw gateway call config.apply --params '{ "raw": "{ agents: { defaults: { workspace: \"~/.coderclaw/workspace\" } } }", "baseHash": "<hash>", "sessionKey": "agent:main:whatsapp:dm:+15555550123"}'```- Objects merge recursively- `null` deletes a key- Arrays replace
Params:
- `raw` (string) — JSON5 with just the keys to change- `baseHash` (required) — config hash from `config.get`- `sessionKey`, `note`, `restartDelayMs` — same as `config.apply`
```bashcoderclaw gateway call config.patch --params '{ "raw": "{ channels: { telegram: { groups: { \"*\": { requireMention: false } } } } }", "baseHash": "<hash>"}'```Environment variables
Section titled “Environment variables”CoderClaw reads env vars from the parent process plus:
.envfrom the current working directory (if present)~/.coderclaw/.env(global fallback)
Neither file overrides existing env vars. You can also set inline env vars in config:
{ env: { OPENROUTER_API_KEY: "sk-or-...", vars: { GROQ_API_KEY: "gsk-..." }, },}{ env: { shellEnv: { enabled: true, timeoutMs: 15000 }, },}Env var equivalent: CODERCLAW_LOAD_SHELL_ENV=1
{ gateway: { auth: { token: "${CODERCLAW_GATEWAY_TOKEN}" } }, models: { providers: { custom: { apiKey: "${CUSTOM_API_KEY}" } } },}Rules:
- Only uppercase names matched:
[A-Z_][A-Z0-9_]* - Missing/empty vars throw an error at load time
- Escape with
$${VAR}for literal output - Works inside
$includefiles - Inline substitution:
"${BASE}/v1"→"https://api.example.com/v1"
See Environment for full precedence and sources.
Full reference
Section titled “Full reference”For the complete field-by-field reference, see Configuration Reference.
Related: Configuration Examples · Configuration Reference · Doctor