CLI
Configuration
Configure AFA via .afa.yaml -- models, gates, analysis, safety, and billing.
Configuration
AFA is configured via a .afa.yaml file in your project root. All settings have sensible defaults -- you only need a config file to customize behavior.
Minimal config
version: "1.0"
model:
provider: anthropicThat's it. Everything else uses defaults.
Full reference
Model
model:
provider: anthropic # anthropic | openai | google | local
model: claude-sonnet-4-6 # Provider-specific model ID
fallback: openai/gpt-5.4 # Single fallback model
fallback_chain: # Full cross-provider fallback chain
- openai/gpt-5.4
- gemini/gemini-3-flash-previewGates
Gate parameters are grouped into three governance tracks. Violations cause a ConfigError at load time.
Frozen (cannot be changed)
| Parameter | Value | Description |
|---|---|---|
complexity_floor | 0.5 | Hard floor -- non-overridable |
Stable (tunable within narrow bands)
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
delta_risk_threshold | 2.0 | 1.5 | 3.0 | Minimum risk improvement ratio |
delta_profit_threshold | 2.0 | 1.5 | 3.0 | Minimum profit improvement ratio |
bayesian_confidence | 0.95 | 0.90 | 0.99 | Posterior probability threshold |
novelty_threshold | 0.8 | 0.6 | 0.9 | Minimum novelty score |
quality_minimum | 0.7 | 0.6 | 0.9 | Minimum aggregate quality |
utility_threshold | 1.5 | -1.0 | 5.0 | Minimum LCB(U) |
kpi_r2_threshold | 0.6 | 0.5 | 0.8 | Minimum R-squared for KPI model |
phi_s | 100.0 | 50.0 | 200.0 | Static complexity cost ($/month/kLOC) |
phi_d | 2000.0 | 1000.0 | 5000.0 | Dynamic complexity cost ($/month/service) |
z_alpha | 1.645 | 1.28 | 1.96 | Confidence level z-score |
Canary (wider experimental bands)
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
entropy_floor | 0.25 | 0.20 | 0.50 | Minimum Shannon entropy of diff |
gamma | 0.3 | 0.1 | 0.5 | Low-confidence value discount |
novelty_k | 5.0 | 4.0 | 6.0 | Logistic slope |
novelty_n0 | 3.5 | 2.0 | 4.0 | Logistic center |
dead_code_threshold | 0.8 | 0.6 | 0.95 | Anti-gaming: reachable code score |
edit_locality_threshold | 0.3 | 0.1 | 0.5 | Anti-gaming: edit locality score |
gen_code_threshold | 0.5 | 0.3 | 0.8 | Anti-gaming: natural code score |
Example:
gates:
utility_threshold: 2.0
entropy_floor: 0.30
novelty_k: 5.5Analysis
analysis:
languages:
- python
- typescript
- go
- java
- rust
exclude:
- "tests/**"
- "vendor/**"
- "node_modules/**"
max_function_size: 500 # Max lines per function
protected_paths: # Additional paths AFA will never modify
- "migrations/"
- "generated/"
finding_policy: # Finding action policy
ast_definite_action: auto_block
hybrid_corroborated_action: auto_block
llm_only_critical_action: human_review
llm_only_high_action: human_review
llm_only_medium_action: advisory
style_action: advisoryProtected paths merge with AFA's hardcoded defaults (gates/, tests/, config.py, etc.). You can add paths but never remove the built-in ones.
Enhancement
enhancement:
max_candidates: 3 # Candidates per function (1-10)
auto_commit: false # Auto-commit passing enhancements
branch_prefix: "afa/" # Git branch prefix
pr_labels: # Labels for auto-created PRs
- afa-enhancement
- automated
max_retries: 3 # Redesign attempts per function (1-10)Safety
safety:
kill_switch_check_interval: 1 # Check kill switch every N functions
gate_subprocess_timeout: 30 # Seconds for out-of-band gate eval (0 = in-process)
test_isolation: true # Verify test integrity in worktreesCost budgets
cost:
hourly_budget: 5.0 # USD
daily_budget: 50.0 # USD
monthly_budget: 500.0 # USDServer
server:
host: "127.0.0.1" # Bind address (0.0.0.0 for containers)
port: 8080
api_token: "" # Bearer token (empty = open access)
audit_path: ".afa/audit.db"Billing
billing:
stripe_secret_key_env: STRIPE_SECRET_KEY
stripe_webhook_secret_env: STRIPE_WEBHOOK_SECRET
metering_db_path: ".afa/metering.db"
unkey_root_key_env: UNKEY_ROOT_KEY
unkey_api_id: ""
unkey_key_prefix: "uk_afa"Integrations (optional)
integrations:
aegis:
enabled: false
endpoint: "https://aegis.example.com"
api_key_env: AEGIS_API_KEY
timeout_seconds: 30
fallback_to_builtin: true
pcw:
enabled: false
providers:
- anthropic
- openai
agreement_threshold: 0.66
fallback_to_scoring: trueCLI config command
Set individual values without editing the file:
afa config gates.entropy_floor 0.30
afa config model.provider gemini
afa config enhancement.max_retries 5