Flux-CLI

Configuration Reference

This page provides a complete reference for all configuration options in Flux-CLI.

Complete Configuration Schema

# API Configuration
api_key = "sk-or-v1-your-key"           # API key (can also use env var)
base_url = "https://openrouter.ai/api/v1"  # API base URL

# Model Configuration
[model]
name = "mistralai/devstral-2512:free"    # Model identifier
temperature = 1.0                         # 0.0 - 2.0
context_window = 256000                    # Max context tokens

# Session Configuration
max_turns = 100                          # Max agent loop iterations

# Approval Policy
[approval]
policy = "on-request"                     # on-request | on-failure | auto | auto-edit | never | yolo

# Shell Environment
[shell_environment]
ignore_default_excludes = false           # Don't filter default patterns
exclude_patterns = ["*KEY*", "*TOKEN*", "*SECRET*"]  # Filtered env vars
set_vars = { MY_VAR = "value" }          # Custom env vars

# Hooks
hooks_enabled = true                      # Enable/disable all hooks

[[hooks]]
name = "my-hook"                          # Hook identifier
trigger = "before_agent"                  # Trigger point
command = "echo 'Agent started'"          # Shell command to execute
script = "path/to/script.sh"              # Or script file path
timeout_sec = 30                          # Execution timeout
enabled = true                            # Enable/disable this hook

# Tool Restrictions
allowed_tools = ["read_file", "grep"]     # If set, only these tools are available

# Developer Instructions
developer_instructions = "Follow PEP 8"   # From AGENT.md or config
user_instructions = "Use TypeScript"      # Custom user instructions

# MCP Servers
[mcp_servers.filesystem]
command = "npx"                           # stdio transport
args = ["-y", "@modelcontextprotocol/server-filesystem"]
env = { KEY = "value" }                   # Server environment
cwd = "/path/to/server"                   # Server working directory
enabled = true
startup_timeout_sec = 10                  # Connection timeout
tool_timeout_sec = 120                    # Tool execution timeout

[mcp_servers.remote]
url = "https://example.com/mcp"           # SSE transport
enabled = true
startup_timeout_sec = 10

# Working Directory
# cwd = "/path/to/project"                # Override via CLI --cwd flag

Approval Policy Reference

PolicyBehaviorUse Case
on-requestAsk for confirmation on mutating operationsDefault — Safe for most users
on-failureAuto-approve, but ask if something failsCI/CD pipelines
autoAuto-approve all operationsTrusted environments
auto-editAuto-approve safe commands, confirm editsDevelopment
neverNever auto-approve anythingHigh-security environments
yoloApprove everythingTesting/demo only

Hook Trigger Reference

TriggerWhenEnvironment Variables
before_agentBefore agent starts processingAI_AGENT_TRIGGER, AI_AGENT_CWD, AI_AGENT_USER_MESSAGE
after_agentAfter agent finishes+ AI_AGENT_RESPONSE
before_toolBefore a tool executes+ AI_AGENT_TOOL_NAME, AI_AGENT_TOOL_PARAMS
after_toolAfter a tool completes+ AI_AGENT_TOOL_RESULT
on_errorWhen an error occursAI_AGENT_ERROR

MCP Server Configuration Reference

FieldRequiredTypeDefaultDescription
enabledNobooltrueEnable/disable this server
startup_timeout_secNofloat10Connection timeout in seconds
tool_timeout_secNofloat120Tool execution timeout
commandConditionalstringCommand for stdio transport
argsNostring[][]Arguments for stdio transport
envNoobject{}Environment variables
cwdNostringWorking directory
urlConditionalstringURL for SSE transport

Config File Locations

Config TypeLinuxmacOSWindows
System~/.config/flux-cli/config.toml~/Library/Application Support/flux-cli/config.toml%APPDATA%\flux-cli\config.toml
Project.flux-cli/config.toml.flux-cli/config.toml.flux-cli/config.toml

Validation Rules

On this page