Skip to main content
Cortex CLI keeps its settings in a TOML file. There is one for you, an optional one per repository, and a set of overrides you can pass on the command line. Between them they decide which model a session starts on, how much the agent may do without asking, how the terminal app looks, and how long a command may run before it is killed. This page covers where the files live, the order in which they are merged, the keys you can set in each section, and how named profiles let you keep several setups side by side. Permission and sandbox rules have their own page, and so do the environment variables that sit above the files in precedence.

Where the config file lives

The Cortex home directory is resolved in this order: CORTEX_CONFIG_DIR, then CORTEX_HOME, then ~/.cortex. CORTEX_CONFIG overrides the config file path outright, wherever the home directory ends up. Inside a project, Cortex looks for .cortex/config.toml, then .cortex/config.json, then .cortex/config.jsonc, then cortex.toml, cortex.json and cortex.jsonc. The first one it finds is the project config. Commit the project file when the settings belong to the repository rather than to you.

Precedence

Five layers, weakest first. A later layer overrides a key set by an earlier one.
  1. Built-in defaults
  2. Your own config, ~/.cortex/config.toml
  3. The profile selected with -p / --profile, or by profile = "<name>"
  4. The project config, .cortex/config.toml
  5. The command line: -c / --config KEY=VALUE, repeatable, then the dedicated flags
Environment variables sit between config files and command-line flags in precedence: a flag beats a variable, a variable beats a config file. See Environment variables for the full list.
A project .cortex/config.toml beats your own ~/.cortex/config.toml. Cloning a repository can therefore change your model, your sandbox mode and your approval policy without you touching anything. Run cortex config in a new clone to see the values that are actually in effect.

Inspect and edit

From inside the terminal app, /config opens the same file and /reload-config re-reads configuration from disk.

Keys

Model

Permissions and sandboxing

[sandbox_workspace_write] refines workspace-write with writable_roots, network_access, exclude_tmpdir_env_var and exclude_slash_tmp. The [permission] table sets per-capability and per-command policy. Both are documented on Permission policy.

Behaviour

History

Terminal app

The theme ids stay lowercase in config even though the picker shows friendlier names. See Themes.

Execution

Each of these has a flag: --max-agent-threads, --max-tool-threads, --command-timeout, --http-timeout, --no-streaming.

Plugins

Plugins are configured in the same file:

Profiles

A profile is a named block that overrides top-level keys. Anything you can set at the top level you can set in a profile.
Select it for one invocation with -p review, or set profile = "review" at the top level to make it your default. A profile sits below the project config, so a repository can still override it.
Nothing in the CLI documentation states whether Cortex prompts you before honouring a repository’s .cortex/config.toml. Treat an unfamiliar repository’s config as something to read before you run a session in it.