This guide covers all aspects of configuring Horizon for development, production, and installed deployments.
- Quick Start
- Configuration Files
- Configuration Options
- Lookup Priority
- Environment Variables
- Examples
- Development vs Production
Horizon uses a configuration file (horizon.json) to customize workspace settings and agent behavior.
- Development: Config is auto-created from
config/horizon.example.jsonon first run - Edit config: Modify
config/horizon.jsonto customize your settings - Your changes are local: The config file is gitignored and won't be committed
| File | Location | Purpose |
|---|---|---|
config.schema.json |
config/ |
JSON Schema for validation |
horizon.example.json |
config/ |
Template/example configuration |
horizon.json |
config/ |
Your local configuration (gitignored) |
Controls shell command execution environment.
| Option | Type | Default | Description |
|---|---|---|---|
defaultPath |
string | null |
null |
Default working directory for shell commands. If null, uses WORKSPACE_PATH env var or current directory |
allowOverride |
boolean |
true |
Allow runtime override of workspace path via API |
restrictedPaths |
string[] |
[] |
Paths that are restricted from shell access |
allowedExtensions |
string[] |
[] |
File extensions allowed for operations (empty = all allowed) |
Controls agent behavior and retry logic.
| Option | Type | Default | Description |
|---|---|---|---|
maxRetries |
integer |
3 |
Maximum retry attempts for failed operations (0-10) |
timeout |
integer |
30000 |
Default timeout for operations in milliseconds (1000-300000) |
Horizon uses XDG-style configuration lookup with the following priority order:
HORIZON_CONFIGenvironment variable - Explicit path to config file- Monorepo config -
config/horizon.json(for development) - Current directory -
./horizon.json - Parent directories - Walking up from cwd, looks for
.horizon/config.jsonorhorizon.json - User home directory:
~/.horizon/config.json~/.config/horizon/config.json(XDG style)
- System-wide:
- Unix:
/etc/horizon/config.json - Windows:
%APPDATA%/horizon/config.json
- Unix:
- Auto-create - Copies
horizon.example.jsonto appropriate location - Default fallback - Built-in default values
These environment variables can override file-based configuration:
| Variable | Description |
|---|---|
HORIZON_CONFIG |
Explicit path to configuration file |
WORKSPACE_PATH |
Override workspace path (takes precedence over config file defaultPath) |
{
"workspace": {
"defaultPath": "/home/user/my-project",
"allowOverride": false,
"restrictedPaths": ["/etc", "/root", "~/.ssh", "~/.gnupg"]
}
}{
"workspace": {
"allowedExtensions": [".js", ".ts", ".tsx", ".json", ".md", ".txt", ".yaml", ".yml"]
}
}{
"agent": {
"maxRetries": 5,
"timeout": 60000
}
}{
"workspace": {
"defaultPath": null
},
"agent": {
"maxRetries": 3,
"timeout": 30000
}
}When running bun dev or turbo dev:
- Config is loaded from
config/horizon.jsonin the monorepo root - If missing, it's auto-created from
config/horizon.example.json - Changes take effect on server restart
When Horizon is installed as a package:
- Config follows XDG Base Directory specification
- User-level config:
~/.horizon/config.jsonor~/.config/horizon/config.json - System-wide config:
/etc/horizon/config.json(Unix) or%APPDATA%/horizon/config.json(Windows)
When running in Docker:
- Mount config at
/app/config/horizon.json - Or set
HORIZON_CONFIG=/path/to/config.json - Or use environment variables for overrides
# docker-compose.yaml example
services:
agent:
volumes:
- ./config/horizon.json:/app/config/horizon.json:ro
environment:
- WORKSPACE_PATH=/workspaceConfiguration is validated using JSON Schema. Invalid configurations will:
- Log an error with specific validation issues
- Fall back to default values
To validate your configuration manually:
# Using ajv-cli (install: npm install -g ajv-cli)
ajv validate -s config/config.schema.json -d config/horizon.json- Check file path and permissions
- Validate JSON syntax:
cat config/horizon.json | jq . - Check logs for
[Config]messages - Verify with
HORIZON_CONFIGenv var
- Check
WORKSPACE_PATHenvironment variable - Check
workspace.defaultPathin config - Verify path exists and is accessible
- Restart the agent server
- Clear any cached configuration (internal)
- Verify you're editing the correct file (check logs for loaded path)