Skip to content

CLI Configuration

Cosine CLI can be configured through multiple sources: command-line flags, configuration files, and environment variables. This guide covers all configuration options and how to use them effectively.

Configuration is resolved in this order (highest to lowest priority):

  1. Command-line flags - Override everything else
  2. Repository config - Project-specific settings in cosine.toml
  3. User config - Personal settings in ~/.cosine.toml
  4. Environment variables - System-level overrides
  5. Default values - Built-in defaults

The main configuration file for your user account. Store personal preferences, API tokens, and global settings here.

[auth]
user_id = "usr_123456789"
token = "your_api_token_here"
[api]
base_url = "https://api.cosine.wtf"
[inference]
base_url = "https://api.cosine.wtf"
model = "lumen"
max_context_tokens = 128000
max_turns = 100
[config]
system_prompt_id = "lumen"
latex_formatting = false
reasoning_level = "medium"
[browser]
cdp_url = "http://localhost:9222"
[telemetry]
enabled = true

Repository Configuration (cosine.toml or .cosine.toml)

Section titled “Repository Configuration (cosine.toml or .cosine.toml)”

Project-specific configuration that lives in your repository. This is ideal for team settings and project-specific behavior.

is_topmost_config = true
[agent]
model = "codex"
extra_context = "AGENTS.md"
[hooks]
on_save = "go test ./..."

Create multiple configuration profiles for different contexts:

In your repo:

Terminal window
# cosine.work.toml for work projects
cos --profile work start
# cosine.personal.toml for personal projects
cos --profile personal start

In your home directory:

~/.cosine.work.toml
cos --profile work start
# ~/.cosine.personal.toml
cos --profile personal start

Profile resolution order:

  1. Check for cosine.<profile>.toml in the repo
  2. Check for ~/.cosine.<profile>.toml in home

Your Cosine account credentials.

FieldTypeDescription
user_idstringYour Cosine user ID
tokenstringYour API authentication token

Setting credentials:

Terminal window
# Via login command (recommended)
cos login
# Or manually via flag
cos start --api-key your_token_here

Base configuration for Cosine’s API.

FieldTypeDefaultDescription
base_urlstringhttps://api.cosine.wtfBase URL for API requests

Configure the AI model and inference behavior.

FieldTypeDefaultDescription
base_urlstringhttps://api.cosine.wtfOpenAI-compatible inference endpoint
modelstringcodexDefault model for sessions
max_context_tokensint0 (unlimited)Maximum context window size
max_turnsint0 (unlimited)Maximum conversation turns

Available models:

  • codex - Default model for general tasks
  • lumen - Alternative model optimized for specific tasks
  • judge - Model for evaluation tasks
  • orchestrator - Model for orchestration tasks

Miscellaneous configuration options.

FieldTypeDefaultDescription
system_prompt_idstringlumenDefault system prompt ID
latex_formattingboolfalseEnable LaTeX formatting in responses
reasoning_levelstring"medium"Default reasoning effort level
shellstring""Preferred shell for terminal sessions
checkpointingbooltrueEnable automatic checkpointing each turn

Reasoning levels:

  • low - Faster responses, less thorough
  • medium - Balanced speed and depth
  • high - Slower but more thorough
  • xhigh - Maximum depth (Codex models only)

Shell configuration:

By default, the CLI uses your system’s `$SHELL` environment variable (falling back to `/bin/bash` on Unix or `cmd.exe` on Windows). You can override this to use a different shell:

[config]
shell = "/opt/homebrew/bin/fish"

Common shell paths:

  • Bash: `/bin/bash`
  • Zsh: `/bin/zsh` or `/usr/local/bin/zsh`
  • Fish: `/opt/homebrew/bin/fish` or `/usr/bin/fish`
  • Dash: `/bin/dash`

The configured shell must exist on your system or the CLI will fall back to the default shell detection.

Checkpointing:

By default, Cosine CLI creates a checkpoint at the end of each agent turn, committing only the files the agent edited. Each checkpoint is a lightweight git commit that you can revert or reapply from the timeline. To disable this globally:

[config]
checkpointing = false

You can also disable it per session with the `—checkpointing=false` flag:

Terminal window
cos start --checkpointing=false

Chrome DevTools Protocol (CDP) configuration for browser automation.

FieldTypeDescription
cdp_urlstringURL to Chrome’s debugging port (e.g., http://localhost:9222)

Model Context Protocol server configurations. See MCP Configuration for detailed documentation.

[mcp.servers.myserver]
transport = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/path"]

Settings for the AI agent in this specific repository.

FieldTypeDescription
modelstringOverride the default model for this repo
extra_contextstringPath to a markdown file to append to system prompts

Automated actions triggered by CLI events.

FieldTypeDescription
on_savestringShell command to run after file writes

on_save details:

  • Runs via sh -c with working directory set to the config’s directory
  • Supports {file} or {{file}} placeholder for the saved file path
  • Exposes environment variables:
    • COSINE_ON_SAVE_FILE - Path to the saved file
    • COSINE_ON_SAVE_CONFIG - Path to the config file

Example with placeholder:

[hooks]
on_save = "go test ./... -run TestRelatedTo{file}"

Control usage data collection.

FieldTypeDefaultDescription
enabledbooltrueEnable/disable telemetry

Override the default user config file location:

Terminal window
export COSINE_CONFIG_FILE=/path/to/custom/config.toml
cos start

Some MCP servers require their own API keys as environment variables:

Terminal window
export OPENAI_API_KEY=sk-...
cos start

All available global flags:

FlagShortDescriptionDefault
--inference-iInference base URLFrom config
--system-prompt-sSystem prompt IDlumen
--prompt-pOne-shot prompt-
--cwd-Working directory.
--api-key-kAPI tokenFrom config
--auto-accept-plans-Auto-accept plansfalse
--auto-accept-Auto-accept allfalse
--checkpointing-Enable checkpointingtrue
--debug-Debug modefalse
--forceUpdate-Force update flowfalse
--lsp-diagnostics-on-file-read-Include LSP diagnosticsfalse
--profile-Config profile-
--workspace-Workspace modeos
--worktree-name-Worktree name-
--endpoint-API endpoint URLFrom config
--cdp-url-Chrome CDP URLFrom config
--model-Model overrideFrom config
--reasoning-Reasoning levelFrom config

A comprehensive example showing all configuration options:

~/.cosine.toml:

[auth]
user_id = "usr_123456789"
token = "tok_abcdef123456"
[api]
base_url = "https://api.cosine.wtf"
[inference]
base_url = "https://api.cosine.wtf"
model = "lumen"
max_context_tokens = 128000
max_turns = 50
[config]
system_prompt_id = "lumen"
latex_formatting = false
reasoning_level = "high"
[browser]
cdp_url = "http://localhost:9222"
[telemetry]
enabled = true

cosine.toml (in repo):

is_topmost_config = true
[agent]
model = "codex"
extra_context = "AGENTS.md"
[hooks]
on_save = "npm run lint -- --fix {file}"

Don’t commit API tokens to version control. Put them in ~/.cosine.toml, not cosine.toml.

Create different profiles for work vs. personal projects:

Terminal window
# Work profile with work settings
cos --profile work start
# Personal profile with personal preferences
cos --profile personal start

Use flags for temporary overrides without changing config files:

Terminal window
# Use a different model just for this session
cos start --model codex
# Debug mode for troubleshooting
cos start --debug

In monorepos, mark the root config as topmost:

# In root cosine.toml
is_topmost_config = true
# CLI won't look above this directory for config

Test your configuration:

Terminal window
# Start with debug mode to see loaded config
cos start --debug
# Check if MCP servers load correctly
cos start # Look for MCP status in the TUI