Cortex Code CLI Settings

Cortex Code CLI settings control tool permissions, connections, and session behavior. You can configure settings using managed policy (if provided by your organization), configuration files, environment variables, and command-line arguments.

Configuration files

The following configuration files are used by Cortex Code CLI:

FilePurpose
<admin-managed path>/managed-settings.jsonOrganization-managed policy file (optional). For OS-specific locations, see .
~/.snowflake/cortex/settings.jsonMain Cortex Code CLI settings file.
~/.snowflake/cortex/permissions.jsonPermission preferences.
~/.snowflake/cortex/mcp.jsonMCP server configuration (see ).
~/.snowflake/config.tomlSnowflake connections (see Cortex Code CLI). Shared with Snowflake CLI.

The full layout of the main configuration directory is:

~/.snowflake/cortex/        # Main Cortex Code CLI config directory
 settings.json          # Main settings
 mcp.json               # MCP server configs
 permissions.json       # Saved permissions
 hooks.json             # Global hooks
 history                # Command history
 conversations/         # Session files
 cache/                 # Temporary cache
    table_cache.json   # SQL result metadata
    sql_result_cache/  # Parquet files
 logs/                  # Log files
 memory/                # Persistent memory
 agents/                # Custom agents
 skills/                # Global skills
 commands/              # Custom commands
 hooks/                 # Hook scripts
 remote_cache/          # Cloned repos

Settings precedence

Settings are applied in the following order of precedence (highest to lowest):

  1. Managed settings restrictions (settings.* fields in managed-settings.json). Can’t be overridden by any user-level configuration. See .
  2. Profile overrides (settingsOverrides from the active profile, if any).
  3. Project settings (.cortex/settings.json or .claude/settings.json in the working directory).
  4. Managed settings defaults (defaults.* fields in managed-settings.json). Users can override these in their own settings.json.
  5. Global user settings (~/.snowflake/cortex/settings.json).
  6. Default values embedded in the Cortex Code CLI.

Permissions follow a separate evaluation order. See Permission evaluation.

settings.json

~/.snowflake/cortex/settings.json

Main settings file for Cortex Code CLI.

Example content:

{
   "compactMode": true,
   "autoUpdate": true,
   "theme": "dark"
}

The following settings are available:

  • compactMode: Enables compact output formatting.
  • autoUpdate: Enables automatic updates.
  • theme: Sets the CLI theme (light or dark).

permissions.json

~/.snowflake/cortex/permissions.json

Controls tool access permissions.

Example content:

{
  "onlyAllow": ["read_file", "execute_sql"],
  "defaultMode": "ask",
  "dangerouslyAllowAll": false
}

The following settings are available:

  • onlyAllow: List of allowed tool patterns.
  • defaultMode: Default permission mode (ask, allow, deny).
  • dangerouslyAllowAll: Allows all tools without prompts (unsafe).

Managed settings (organization policy)

Administrators can deploy a system-level JSON policy file to enforce Cortex Code CLI behavior across an organization, restricting tools, accounts, and minimum versions. For details, see Managed settings (organization policy).

Environment variables

Cortex Code CLI recognizes the following configuration environment variables:

VariableDescription
SNOWFLAKE_HOMEOverrides the default ~/.snowflake directory.
CORTEX_AGENT_MODELOverrides model selection.
CORTEX_ENABLE_MEMORYEnables the memory tool (set to true or 1).
COCO_DANGEROUS_MODE_REQUIRE_SQL_WRITE_PERMISSIONRequires confirmation for SQL write operations in bypass mode.

Note

For additional permission-related environment variables, see Security.

Command-line overrides

Cortex Code CLI settings can be overridden via command-line arguments, which include the following:

ExampleDescription
cortex -c productionSpecifies the connection.
cortex --workdir /pathSets the working directory.
cortex --continueContinues the last session.
cortex --resume <session_id>Resumes a specific session.
cortex --planEnables planning mode.
cortex --dangerously-allow-all-tool-callsDisables permission prompts (unsafe).

Session storage

Conversations and settings are stored in:

LocationDescription
~/.snowflake/cortex/conversations/Session files.
~/.snowflake/cortex/permissions.jsonPermission preferences.
~/.snowflake/cortex/mcp.jsonMCP configuration.