CLI configuration

Where the cruxy CLI reads settings from, the order they merge in, the environment variables it honors, and the defaults for each setting.

The CLI reads its settings from JSON config files and a few environment variables, merges them over built-in defaults, and validates the result before it does anything else. Your API key is never one of these settings: it comes from CRUXY_API_KEY or the credential that cruxy login saves; see Sign in from the CLI.

Config files

FileScopeHow it is found
~/.cruxy/config.jsonGlobal: every project for your user.Always read when it exists.
cruxy.config.json or .cruxy/config.jsonProject.The first one found, checking the current directory and then each parent up to the filesystem root. cruxy.config.json is checked first in each directory.
The file named by --config <path>Explicit.Replaces project discovery for that run. The path is resolved as given, and a missing file fails with CRUXY_E_CONFIG_NOT_FOUND.

Each file holds one JSON object. Unknown keys and out-of-range values fail with CRUXY_E_CONFIG_INVALID, which names each bad field and the file to start with, and malformed JSON fails with CRUXY_E_CONFIG_PARSE. Both exit 3.

cruxy config path prints the global config path, the project file it found (if any), and the file named by --config when there is one:

cruxy config path

Precedence

Later layers win:

  1. Built-in defaults.
  2. The global file, ~/.cruxy/config.json.
  3. The project file, or the file named by --config.
  4. Environment variables that map to a setting.

Objects merge key by key; an array or a single value replaces the earlier one. To see each resolved value and the layer it came from, run:

cruxy config list --origin

Change a setting

cruxy config set writes one value by its dot path. It validates the file before writing, and turns true, false, and numbers into JSON booleans and numbers.

# Global: ~/.cruxy/config.json
cruxy config set model.model saga
 
# Project: the discovered project file, or ./cruxy.config.json if there is none
cruxy config set --project test.command "pnpm test"

cruxy config get <key> reads one resolved value, and cruxy config init writes every default to ~/.cruxy/config.json if that file does not exist yet. You can also edit the files by hand.

Environment variables

These override config or supply values the CLI reads only from the environment.

VariableEffect
CRUXY_API_KEYThe API key. Wins over the saved credential. Never read from a config file.
CRUXY_MODELOverrides model.model.
CRUXY_PROVIDEROverrides model.provider. The only accepted value is cruxy.
CRUXY_LOG_LEVELOverrides logLevel. debug also makes errors show the underlying error.
DEBUGAny value other than empty, 0, or false makes errors show the underlying error.
GITHUB_TOKEN, GH_TOKENThe GitHub token cruxy pr uses. Without either, it tries gh auth token.
TAVILY_API_KEYThe web search key, when web.enabled is on. web.apiKeyEnv names a different variable.
HTTPS_PROXY, HTTP_PROXY, NO_PROXYHonored when the CLI downloads the embedding model for semantic search.

These change how the terminal output looks, not what the agent does. TERM=dumb and screen-reader mode also turn off the full-screen session, so cruxy falls back to plain output:

VariableEffect
NO_COLORNo ANSI color at all.
FORCE_COLORKeep color when output is piped or redirected.
CRUXY_ASCIIASCII glyphs such as [ok] and -> instead of Unicode marks.
CRUXY_SCREEN_READER, ACCESSIBLEScreen-reader mode: status marks are spoken as words, decorative marks are dropped, and animation is off.
NO_MOTION, CRUXY_REDUCED_MOTION, CRUXY_NO_SPINNERNo animation: spinners draw their end state once.
CRUXY_NO_ALT_SCREENKeep the full-screen session in the normal terminal buffer.
CRUXY_NO_MOUSELeave the mouse to the terminal, so text selection works without Shift.
COLUMNS, LINESOverride the terminal size. Each takes a positive integer.
TERM=dumbNo color, no cursor control, and ASCII glyphs.

Except for COLUMNS, LINES, and TERM, any non-empty value turns a variable on, including 0 and false; unset it or set it to the empty string to turn it off. COLUMNS and LINES ignore a value that is not a positive integer.

Model and routing

model.model is the tier every turn asks for: canto (Deep), saga (Balanced), epos (Fast), or auto, the default, which lets the gateway pick the tier for each request. To compare the tiers, see Choosing a tier.

cruxy config set model.model canto

/model changes it for the current session only. routing sends kinds of work to different tiers. Its keys are the task classes main-turn, subagent, plan, commit-msg, and summarize:

{
  "routing": {
    "default": "saga",
    "map": {
      "commit-msg": "epos",
      "summarize": "epos"
    }
  }
}

A class not in map takes routing.default. With no default, it takes the tier model.model names, or goes out as auto when model.model is auto. A class mapped to a tier the gateway does not offer fails with CRUXY_E_ROUTING_TIER_UNAVAILABLE, never a silent substitute.

Former tier names

model.model, routing.default, and routing.map still accept the former names kavi, vaani, and mira, and load them as canto, saga, and epos; see Deprecated aliases. The same goes for CRUXY_MODEL and for a name typed after /model, which switches to the new tier and names it. If your team shares a project cruxy.config.json, keep the former names in routing.default and routing.map until everyone runs 1.18.0 or later: 1.17 and earlier refuse to start on a config that sets them to canto, saga, or epos.

Gateway URL

cruxy.gatewayUrl is where every request goes, and defaults to https://api.cruxy.ai. A config that sets it to exactly https://api.cruxy.in (with or without a trailing slash), the legacy name of the same service, is resolved to https://api.cruxy.ai with a one-line warning; the file itself is not edited.

The CLI sends a credential only over https://. Plain http:// is allowed only to localhost, 127.0.0.1, and [::1], for a gateway on your own machine. Any other URL fails before a request is made, with CRUXY_E_CONFIG_INVALID (exit 3) titled "cruxy.gatewayUrl is not https, so no credential was sent". This applies to every command that calls the gateway, including cruxy login, cruxy logout, cruxy limits, and cruxy pr. The config file still loads, so you can fix the value:

cruxy config set cruxy.gatewayUrl https://api.cruxy.ai

cruxy config path lists the files in effect, if you are not sure which one sets it.

Approval is not a setting

approval.mode accepts only prompt. No config key or flag turns approvals off: cruxy config set approval.mode auto fails with CRUXY_E_CONFIG_INVALID. Running without prompts is a session mode that you switch on in the session it affects, and a session resumed with --resume comes back in the last mode you switched to during it; see Projects, permissions, and context.

Settings you are most likely to change

SettingDefaultDescription
model.modelautoThe tier: canto, saga, epos, or auto.
model.maxTokens8192The max_tokens sent on each chat request.
model.temperature0The temperature sent on each chat request, from 0 to 2.
cruxy.gatewayUrlhttps://api.cruxy.aiThe gateway every request goes to. https:// only, except to localhost.
cruxy.memory.recalltrueLet the gateway recall your memory into each turn.
cruxy.memory.capturefalseLet the gateway capture memory from each turn.
cruxy.rulestrueLet the gateway add your organization's standing rules to each turn.
cruxy.streamIdleTimeoutMs90000How long a stream may go without a byte before it counts as dead. A stream that dies before its first token is retried; one that dies after it is not. 0 turns it off.
cruxy.maxRetries4Retries of a request that failed before its stream opened: a 429, a 5xx, or a connection that never opened.
cruxy.streamRetries2Retries of a stream that dropped before its first token.
agent.maxIterations25Agent loop turns per message in an interactive session.
agent.maxIterationsOneShot40Agent loop turns for a one-shot cruxy run "<task>".
agent.maxTokensPerTurn0A cap on input plus output tokens for one turn. 0 is off.
agent.planModefalseStart every session in plan mode.
tools.fileEdittruefalse removes write_file, edit_file, and apply_patch. Reads stay.
tools.shelltruefalse removes run_command and run_tests.
shell.timeoutMs120000Kill a command and its process tree after this many milliseconds.
shell.maxOutputBytes102400Command output captured; the rest is truncated.
shell.executableunsetThe shell to run commands through, overriding detection.
context.maxTokens100000The approximate context budget, in tokens.
context.compactThreshold0.75Summarize older history once it passes this fraction of context.maxTokens.
git.protectedBranches[]Branches the CLI never commits or pushes to directly, added to main and master.
git.defaultBaseunsetThe base branch for generated pull requests.
test.commandunsetThe test command, instead of the test script in package.json.
checkpoint.enabledtrueSnapshot the working tree before a run's first approved file change, shell command, test run, or pull request, which cruxy rollback restores.
checkpoint.retention10Checkpoints to keep.
sessions.enabledtrueRecord sessions so they can be resumed.
sessions.retention50Sessions to keep. The minimum is 10.
sessions.maxAgeDays30Prune sessions untouched for this many days.
memory.enabledtrueThe CLI's local memory: recall at session start and the remember tool.
memory.maxRecallTokens1000Token budget for recalled local memory.
index.enabledtruesearch_codebase and cruxy index.
sandbox.enabledfalseRun shell and test commands in a container, as --sandbox does.
sandbox.networknoneContainer network: none, host-loopback, or full.
hooks.enabledfalseRun configured hooks.
mcp.enabledfalseConnect configured MCP servers.
web.enabledfalseGive the agent web_search and web_fetch.
usage.enabledtrueRecord token usage locally for cruxy usage.
usage.pricesunsetNo longer used: cost is the gateway's own figure. Still accepted, and cruxy usage notes that you can remove it. The same goes for usage.currency.
logLevelinfodebug, info, warn, error, or silent.

Every default

cruxy config init writes this file in 1.19.0. cruxy config list prints every key with its resolved value.

{
  "model": { "provider": "cruxy", "model": "auto", "maxTokens": 8192, "temperature": 0 },
  "cruxy": {
    "gatewayUrl": "https://api.cruxy.ai",
    "streamIdleTimeoutMs": 90000,
    "maxRetries": 4,
    "minRetryDelayMs": 1000,
    "maxRetryDelayMs": 20000,
    "streamRetries": 2,
    "memory": { "recall": true, "capture": false },
    "rules": true
  },
  "agent": { "maxIterations": 25, "maxIterationsOneShot": 40, "maxTokensPerTurn": 0, "planMode": false },
  "tools": { "fileEdit": true, "shell": true },
  "git": { "autoCommit": false, "protectedBranches": [] },
  "shell": { "timeoutMs": 120000, "maxOutputBytes": 102400 },
  "context": { "maxTokens": 100000, "compactThreshold": 0.75, "reserveTokens": 4500, "keepRecentMessages": 6 },
  "approval": { "mode": "prompt" },
  "index": {
    "enabled": true,
    "embedder": "fastembed",
    "store": "auto",
    "maxFileBytes": 1048576,
    "chunk": { "windowLines": 60, "overlapLines": 15 },
    "search": { "defaultK": 8, "tokenBudget": 1500, "maxSnippetLines": 40 }
  },
  "lsp": {
    "enabled": false,
    "servers": {},
    "startupTimeout": 15000,
    "requestTimeout": 10000,
    "maxServers": 4,
    "idleTimeout": 300000,
    "maxResults": 100
  },
  "checkpoint": { "enabled": true, "retention": 10 },
  "sessions": { "enabled": true, "retention": 50, "maxAgeDays": 30 },
  "subagent": { "maxDepth": 1, "maxConcurrency": 3, "defaultBudget": { "maxIterations": 10, "maxTokens": 32000 } },
  "jobs": { "enabled": false, "maxJobs": 5, "logBufferLines": 1000, "logFileLines": 20000 },
  "test": { "maxIterations": 4, "captureBytes": 65536 },
  "sandbox": {
    "enabled": false,
    "image": "node:20-bookworm-slim",
    "network": "none",
    "memory": "512m",
    "pids": 512,
    "cpus": 1,
    "mounts": []
  },
  "hooks": { "enabled": false, "trustPrompt": true },
  "routing": { "map": {} },
  "memory": { "enabled": true, "maxRecallTokens": 1000 },
  "usage": { "enabled": true, "retention": 50 },
  "mcp": {
    "enabled": false,
    "servers": {},
    "startupTimeout": 15000,
    "requestTimeout": 30000,
    "maxToolsPerServer": 32,
    "maxDescriptionChars": 1024,
    "maxSchemaBytes": 8192
  },
  "web": {
    "enabled": false,
    "provider": "tavily",
    "apiKeyEnv": "TAVILY_API_KEY",
    "maxResults": 5,
    "snippetMaxChars": 500,
    "fetchMaxBytes": 524288,
    "timeoutMs": 15000,
    "maxRedirects": 3,
    "allowPrivateHosts": false
  },
  "logLevel": "info"
}

Keys with no default appear only once you set them, such as git.defaultBase, shell.executable, shell.dialect, test.command, routing.default, subagent.defaultBudget.timeoutMs, sandbox.timeout, and usage.prices. Until then, cruxy config get on one of them fails with CRUXY_E_CONFIG_KEY_UNKNOWN, exit 2.

Was this page helpful?