Configuration
Unfault can be configured at the user level and per-workspace.
User Configuration
Section titled “User Configuration”The configuration file location depends on your operating system:
| Platform | Location |
|---|---|
| Linux | ~/.config/unfault/config.json or $XDG_CONFIG_HOME/unfault/config.json |
| macOS | ~/.config/unfault/config.json or $XDG_CONFIG_HOME/unfault/config.json |
| Windows | %USERPROFILE%\.config\unfault\config.json |
Example configuration:
{ "api_key": "uf_live_...", "base_url": "https://api.unfault.dev", "llm": { "provider": "openai", "model": "gpt-4", "api_key": "sk-..." }}Authentication
Section titled “Authentication”After running unfault login, your API key is stored automatically.
For CI/CD environments, set the API key via environment variable:
export UNFAULT_API_KEY="sk_live_..."LLM Configuration
Section titled “LLM Configuration”For the unfault ask command, configure an LLM provider:
unfault config llm openai --model gpt-5.1unfault config llm anthropic --model claude-4-5-sonnet-latestunfault config llm ollama --model llama3.2Workspace Configuration
Section titled “Workspace Configuration”Unfault reads configuration from your project’s manifest file, avoiding the need for a dedicated config file. The configuration location depends on your language:
[tool.unfault]# Override auto-detected profileprofile = "python_fastapi_backend"
# Limit analysis to specific dimensionsdimensions = ["stability", "correctness", "performance"]
[tool.unfault.rules]# Rules to exclude (supports glob patterns)exclude = [ "python.missing_structured_logging", # We use custom logging "python.http.*", # All HTTP rules]
# Additional rules to includeinclude = ["python.security.*"]
# Severity overrides[tool.unfault.rules.severity]"python.bare_except" = "low"[package.metadata.unfault]profile = "rust_axum_service"dimensions = ["stability", "correctness"]
[package.metadata.unfault.rules]exclude = ["rust.println_in_lib"]
[package.metadata.unfault.rules.severity]"rust.unsafe_unwrap" = "critical"{ "name": "my-app", "unfault": { "profile": "typescript_express_backend", "dimensions": ["stability", "security"], "rules": { "exclude": ["typescript.console_in_production"], "include": ["typescript.security.*"], "severity": { "typescript.empty_catch": "critical" } } }}# For Go projects, multi-language repos, or any project# where you prefer a dedicated config file
# Override auto-detected profile (optional)profile = "go_gin_service"
# Limit analysis to specific dimensions (optional)# Available: stability, correctness, performance, scalability, security, maintainabilitydimensions = ["stability", "performance"]
[rules]# Rules to exclude - supports exact IDs and glob patternsexclude = [ "go.missing_structured_logging", "go.http.*", # All HTTP-related rules]
# Additional rules to include beyond profile defaultsinclude = ["go.security.*"]
# Severity overrides: low, medium, high, critical[rules.severity]"go.unchecked_error" = "critical""go.defer_in_loop" = "low"Configuration Priority
Section titled “Configuration Priority”When multiple configuration sources exist:
- Manifest files are checked first —
pyproject.toml,Cargo.toml, thenpackage.json .unfault.tomlis the fallback — Used when no manifest contains unfault configuration- No merging — Only one source is used per project (the first one found with unfault config)
Rule Patterns
Section titled “Rule Patterns”Patterns for exclude and include use glob syntax:
| Pattern | Matches | Does Not Match |
|---|---|---|
python.http.missing_timeout | Exact match only | Any other rule |
python.http.* | python.http.missing_timeout, python.http.missing_retry | python.http.client.timeout |
*.missing_timeout | python.missing_timeout, go.missing_timeout | python.http.missing_timeout |
python.** | All rules starting with python. | Rules from other languages |
Disabling Rules
Section titled “Disabling Rules”To disable a rule project-wide, add it to the exclude list in your config.
You can also disable rules inline in your code:
// unfault:disable http_client_missing_timeoutclient := http.Client{}# unfault:disable-next-line n_plus_one_queryfor user in users: orders = get_orders(user.id)Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
UNFAULT_API_KEY | API key for authentication |
UNFAULT_BASE_URL | Override API endpoint (enterprise) |
OPENAI_API_KEY | OpenAI API key for ask command |
ANTHROPIC_API_KEY | Anthropic API key for ask command |
Configuration Precedence
Section titled “Configuration Precedence”Settings are applied in this order (later overrides earlier):
- Default values
- User config (see User Configuration for platform-specific paths)
- Workspace config (
pyproject.toml,Cargo.toml,package.json, or.unfault.toml) - Environment variables
- Command-line flags