Skip to content

Configuration

Clew Code is configured through settings files, environment variables, and hooks.

Settings files

Settings live in .clew/ at the project root:

FilePurpose
.clew/settings.jsonShared project settings (checked into version control)
.clew/settings.local.jsonPrivate/local overrides (gitignored, never committed)

Settings are merged at startup: settings.json is the base, settings.local.json overrides.

Example settings.json

json
{
  "permissionMode": "acceptEdits",
  "model": "deepseek-v4-pro",
  "provider": "deepseek",
  "hooks": {
    "PostToolUse": "echo 'tool used: $TOOL_NAME'"
  },
  "permissions": {
    "allow": ["Bash", "Read", "Edit", "Write", "Glob", "Grep"],
    "deny": []
  },
  "theme": "dark",
  "maxTokens": 8192,
  "temperature": 0.7
}

Local overrides

json
{
  "permissionMode": "ask",
  "model": "gpt-5.5",
  "provider": "openai"
}

Environment variables

Provider API keys

Each provider uses a specific environment variable. See Providers for the full list.

bash
# Common ones
export OPENAI_API_KEY=sk-...
export DEEPSEEK_API_KEY=...
export GROQ_API_KEY=...

Clew Code settings

VariableDescription
CLEW_DISABLE_GATEWAYSet to true to disable gateway auth and use direct provider connections
CLEW_DATA_DIROverride the data directory (default: ~/.clew/)
ENABLE_COMPUTER_USEEnable computer use features (Windows only)

Hooks

Hooks are shell commands that run in response to events. They are configured in settings.json or settings.local.json.

HookWhen it runs
PreToolUseBefore each tool call. $TOOL_NAME and $TOOL_INPUT are set.
PostToolUseAfter each tool call. $TOOL_NAME, $TOOL_INPUT, $TOOL_RESULT are set.
PrePromptBefore the AI prompt is constructed.
PostPromptAfter the AI prompt is constructed.
PreBashBefore a Bash command executes.
UserPromptSubmitWhen the user submits a message.

Example hook

json
{
  "hooks": {
    "PreToolUse": "echo \"[$(date)] Tool: $TOOL_NAME\" >> /tmp/clew-audit.log"
  }
}

Permission modes

ModeBehavior
defaultAsk for sensitive operations (write, bash)
askAsk before every operation
acceptEditsAuto-accept file edits, ask for bash
planFull access, no prompts (plan mode)
guardianAI reviews and may deny tool calls
bypassPermissionsFull access, no prompts
dontAskAuto-accept everything
autoAuto-accept in automated contexts

Switch with /profile <mode> or set in settings.json.

Theme

sh
> /theme dark
> /theme light
> /theme custom

Custom themes can be configured in settings.json with ANSI color codes.

Per-project configuration

Settings are per-project — each repository has its own .clew/settings.json. Global defaults live in ~/.clew/config.json.

Released under the GPL-3.0 License.