Skip to content

Configuration Reference

ra uses a layered config system: defaults → file → env → CLI. Each layer overrides the previous.

defaults → config file → env vars → CLI flags

Commit a ra.config.yml for a team or project baseline. Use environment variables for secrets and per-environment settings. Use CLI flags for one-off overrides.

Config file

Place in your project root. Supports JSON, YAML, or TOML.

  • ra.config.json
  • ra.config.yaml / ra.config.yml
  • ra.config.toml

Full example:

yaml
# ra.config.yml
provider: anthropic
model: claude-sonnet-4-6
systemPrompt: You are a helpful coding assistant.
maxIterations: 50
thinking: medium
toolTimeout: 30000

skills:
  - code-review
skillDirs:
  - ./skills

compaction:
  enabled: true
  threshold: 0.8
  model: claude-haiku-4-5-20251001

context:
  enabled: true
  patterns:
    - "CLAUDE.md"
    - "AGENTS.md"

dataDir: .ra              # root for all runtime data

storage:
  maxSessions: 100
  ttlDays: 30

maxConcurrency: 4

middleware:
  beforeModelCall:
    - "./middleware/budget.ts"
  afterToolExecution:
    - "./middleware/audit.ts"

memory:
  enabled: true
  maxMemories: 1000
  ttlDays: 90
  injectLimit: 5

mcp:
  client:
    - name: filesystem
      transport: stdio
      command: npx
      args: ["-y", "@anthropic/mcp-filesystem"]

All fields

Core

FieldEnv varCLI flagDefaultDescription
providerRA_PROVIDER--provideranthropicLLM provider
modelRA_MODEL--modelprovider defaultModel name
systemPromptRA_SYSTEM_PROMPT--system-promptSystem prompt text
maxIterationsRA_MAX_ITERATIONS--max-iterations50Max agent loop iterations
thinkingRA_THINKING--thinkingExtended thinking: low, medium, high
toolTimeout30000Per-tool and middleware timeout (ms)
builtinToolsRA_BUILTIN_TOOLS--no-builtin-toolstrueEnable/disable built-in tools

Permissions

Regex-based rules controlling what tools can do. See the Permissions guide for full details and examples.

FieldEnv varCLI flagDefaultDescription
permissions.no_rules_rulesfalseDisable all permission checks
permissions.default_actionallowAction when no rule matches: allow or deny
permissions.rules[]Array of per-tool regex rules
yaml
permissions:
  rules:
    - tool: execute_bash
      command:
        allow: ["^git ", "^bun "]
        deny: ["--force", "--hard"]
    - tool: write_file
      path:
        allow: ["^src/", "^tests/"]

Skills

FieldEnv varCLI flagDefaultDescription
skills--skill[]Skills to activate (always-on)
skillDirs["./skills"]Directories to scan for skills

Compaction

FieldEnv varCLI flagDefaultDescription
compaction.enabledtrueEnable automatic context compaction
compaction.threshold0.8Trigger at this fraction of context window
compaction.modelprovider defaultModel for summarization

Context

FieldEnv varCLI flagDefaultDescription
context.enabledtrueEnable context file discovery
context.patterns[]Glob patterns for context files
context.resolversbuilt-inPattern resolvers for @file and url:

Subagent

The Agent tool forks parallel copies of the agent. Forks inherit the parent's model, system prompt, tools, thinking level, and maxIterations.

FieldEnv varCLI flagDefaultDescription
maxConcurrency4Max parallel subagent tasks per invocation

Data directory

FieldEnv varCLI flagDefaultDescription
dataDirRA_DATA_DIR--data-dir.raRoot directory for all runtime data (sessions, memory, etc.)

All runtime data is organized under dataDir: sessions in {dataDir}/sessions/, memory in {dataDir}/memory.db.

Storage

FieldEnv varCLI flagDefaultDescription
storage.maxSessionsRA_STORAGE_MAX_SESSIONS--storage-max-sessions100Max sessions before auto-pruning
storage.ttlDaysRA_STORAGE_TTL_DAYS--storage-ttl-days30Auto-expire sessions older than this

Memory

FieldEnv varCLI flagDefaultDescription
memory.enabledRA_MEMORY_ENABLED--memoryfalseEnable persistent memory
memory.maxMemoriesRA_MEMORY_MAX_MEMORIES1000Max stored memories (oldest trimmed)
memory.ttlDaysRA_MEMORY_TTL_DAYS90Auto-prune memories older than this
memory.injectLimitRA_MEMORY_INJECT_LIMIT5Memories to inject as context per loop (0 to disable)

Observability

FieldEnv varDefaultDescription
logsEnabledRA_LOGS_ENABLEDtrueEnable session logs
logLevelRA_LOG_LEVELinfoMinimum log level: debug, info, warn, error
tracesEnabledRA_TRACES_ENABLEDtrueEnable session traces

MCP

FieldEnv varCLI flagDefaultDescription
mcp.lazySchemasRA_MCP_LAZY_SCHEMAStrueLazy schema loading — register MCP tools with server-prefixed names and minimal schemas. First call to each tool returns the full schema; model retries with correct params.

See MCP for details.

HTTP

FieldEnv varCLI flagDefaultDescription
--httpStart HTTP server
http.port--http-port3000Server port
http.token--http-tokenBearer token for authentication

Interface

FieldEnv varCLI flagDefaultDescription
--interfaceautocli, repl, http
--mcp-stdioStart as MCP server (stdio)
--mcpStart as MCP server (HTTP)
--resumeResume a previous session
--fileAttach files to the prompt
--execRun a script file
--configPath to config file

Environment variables

bash
# Provider
export RA_PROVIDER=anthropic
export RA_MODEL=claude-sonnet-4-6
export RA_SYSTEM_PROMPT="You are a helpful assistant"
export RA_MAX_ITERATIONS=50

# API keys (env-only — kept out of shell history)
export RA_ANTHROPIC_API_KEY=sk-...
export RA_OPENAI_API_KEY=sk-...
export RA_GOOGLE_API_KEY=...
export RA_OLLAMA_HOST=http://localhost:11434
export RA_BEDROCK_REGION=us-east-1

# Azure OpenAI (RA_AZURE_API_KEY optional — omit to use DefaultAzureCredential)
export RA_AZURE_ENDPOINT=https://myresource.openai.azure.com/
export RA_AZURE_DEPLOYMENT=my-gpt4o
export RA_AZURE_API_KEY=...
export RA_AZURE_API_VERSION=2024-12-01-preview

CLI flags

CLI flags override everything. Use them for one-off runs.

bash
ra --provider openai \
   --model gpt-4.1 \
   --system-prompt "Be concise" \
   --max-iterations 10 \
   --thinking high \
   --skill code-review \
   --file context.md \
   "Review this code"

Provider credentials

Credentials are env-only — never exposed as CLI flags to keep them out of shell history.

ProviderEnv var(s)Docs
AnthropicRA_ANTHROPIC_API_KEY, RA_ANTHROPIC_BASE_URLSetup
OpenAIRA_OPENAI_API_KEY, RA_OPENAI_BASE_URLSetup
GoogleRA_GOOGLE_API_KEYSetup
AzureRA_AZURE_ENDPOINT, RA_AZURE_DEPLOYMENT, RA_AZURE_API_KEY, RA_AZURE_API_VERSIONSetup
BedrockRA_BEDROCK_API_KEY, RA_BEDROCK_REGIONSetup
OllamaRA_OLLAMA_HOSTSetup

See also

  • Context Control — compaction, thinking, and pattern resolution details
  • Sessions — session storage and resume
  • Middleware — middleware configuration
  • MCP — MCP client and server configuration

Released under the MIT License.