Legion CLI uses a hierarchical configuration system with project-level and global settings.
| File | Purpose | Scope |
|---|---|---|
legion.json |
Project configuration | Project |
~/.legion/legion.json |
Global configuration | User |
LEGION.md |
Project memory | Project |
~/.legion/LEGION.md |
Global memory | User |
{
"$schema": "https://legioncli.com/schema/legion.json",
"model": "anthropic/claude-sonnet-4",
"small_model": "anthropic/claude-haiku-4",
"subagent_model": "anthropic/claude-sonnet-4",
"theme": "dark",
"elc": {
"enabled": true,
"skills": true,
"commands": true,
"agents": true,
"rules": true
},
"context": {
"enabled": true,
"intensity": "normal"
},
"memory": {
"enabled": true,
"autoSave": true
},
"git": {
"autoPush": false,
"createDraftPR": false
}
}
{
"model": "provider/model-id",
"small_model": "provider/model-id",
"subagent_model": "provider/model-id"
}
| Setting | Purpose |
|---|---|
model |
Primary model for main tasks |
small_model |
Faster model for simple tasks |
subagent_model |
Model for subagent tasks |
{
"theme": "dark" | "light" | "system"
}
{
"elc": {
"enabled": true,
"skills": true,
"commands": true,
"agents": true,
"rules": true,
"disabledSkills": ["skill-name"],
"disabledCommands": ["command-name"]
}
}
{
"context": {
"enabled": true,
"intensity": "light" | "normal" | "deep",
"preserveStyle": true,
"minimalChanges": true,
"customRules": true
}
}
{
"memory": {
"enabled": true,
"autoSave": true,
"maxEntries": 100,
"persistSession": true
}
}
{
"git": {
"autoPush": false,
"createDraftPR": false,
"defaultBranch": "main",
"commitStyle": "conventional"
}
}
{
"permissions": {
"tool": {
"bash": "ask" | "allow" | "deny",
"write": "ask" | "allow" | "deny",
"edit": "ask" | "allow" | "deny"
},
"network": {
"fetch": "ask" | "allow" | "deny"
}
}
}
{
"providers": {
"anthropic": {
"apiKey": "env:ANTHROPIC_API_KEY"
},
"openai": {
"apiKey": "env:OPENAI_API_KEY"
}
}
}
{
"mcp": {
"servers": {
"my-server": {
"command": "node",
"args": ["./server.js"],
"env": {
"API_KEY": "env:MY_API_KEY"
}
}
}
}
}
Legion respects these environment variables:
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY |
Anthropic API key |
OPENAI_API_KEY |
OpenAI API key |
LEGION_CONFIG_DIR |
Custom config directory |
LEGION_PLATFORM |
Platform identifier |
legion.json~/.legion/legion.json{
"model": "anthropic/claude-sonnet-4"
}
{
"model": "anthropic/claude-sonnet-4",
"small_model": "anthropic/claude-haiku-4",
"theme": "dark",
"elc": {
"enabled": true
},
"context": {
"enabled": true,
"intensity": "normal"
},
"memory": {
"enabled": true
},
"git": {
"autoPush": false
}
}
{
"model": "anthropic/claude-sonnet-4",
"permissions": {
"tool": {
"bash": "ask"
}
},
"git": {
"commitStyle": "conventional",
"defaultBranch": "develop"
},
"mcp": {
"servers": {
"jira": {
"command": "jira-mcp",
"args": ["--project", "PROJ"]
}
}
}
}
Legion validates configuration on startup:
# Check configuration
legion config validate
# Show current config
legion config show
# Reset to defaults
legion config reset
When upgrading Legion, configuration may need migration:
# Auto-migrate configuration
legion config migrate
# Check migration status
legion config migrate --status