Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tiann/hapi/llms.txt
Use this file to discover all available pages before exploring further.
Overview
HAPI CLI can be configured using environment variables. These variables control connection settings, storage locations, feature flags, and runtime behavior.Required Variables
CLI_API_TOKEN
Shared secret for authenticating with the HAPI hub. Required for CLI-hub communication.Authentication token matching the hub’s token.Priority:
- Environment variable (highest)
~/.hapi/settings.jsonfile- Interactive prompt (first run)
- Check hub startup logs (generated on first run)
- Read
~/.hapi/settings.jsonon the hub server - Ask your hub administrator
- Use
hapi auth loginto save it locally
Connection Settings
HAPI_API_URL
Base URL of the HAPI hub server.Hub server URL for API and Socket.IO connections.
Storage and Paths
HAPI_HOME
Custom directory for HAPI data, settings, and logs.Configuration and data directory. Supports
~ expansion.Feature Flags
HAPI_EXPERIMENTAL
Enable experimental features (currently unused, reserved for future features).Enable experimental features.Accepted values:
true, 1, yes (case-insensitive)Agent Configuration
HAPI_CLAUDE_PATH
Custom path to the Claude CLI executable.Absolute path to a specific
claude binary.HAPI_HTTP_MCP_URL
Default MCP (Model Context Protocol) target URL forhapi mcp.
HTTP URL for MCP stdio bridge target.
Runner Configuration
HAPI_RUNNER_HEARTBEAT_INTERVAL
Interval (in milliseconds) between runner heartbeats.Heartbeat interval in milliseconds (60000 = 60 seconds).
- Default:
60000(1 minute) - good balance - Frequent:
30000(30 seconds) - faster failure detection - Infrequent:
120000(2 minutes) - lower overhead
HAPI_RUNNER_HTTP_TIMEOUT
HTTP timeout (in milliseconds) for runner control requests.Timeout for HTTP requests to runner control API (10000 = 10 seconds).
Worktree Variables
These variables are set automatically by the runner when spawning sessions in worktrees. Do not set them manually.
HAPI_WORKTREE_BASE_PATH
Absolute path to the base repository.Example:
/home/user/projects/myprojectHAPI_WORKTREE_BRANCH
Git branch name for the worktree.Example:
feature/new-uiHAPI_WORKTREE_NAME
Worktree name (typically same as branch).Example:
feature-new-uiHAPI_WORKTREE_PATH
Absolute path to the worktree directory.Example:
/home/user/projects/myproject/.worktrees/feature-new-uiHAPI_WORKTREE_CREATED_AT
Unix timestamp (milliseconds) when worktree was created.Example:
1709712000000Hub Server Variables
These variables configure the hub server when runninghapi hub:
WEBAPP_HOST
Host interface for hub to bind to.
127.0.0.1- Localhost only (default, most secure)0.0.0.0- All interfaces (network access)192.168.1.100- Specific interface
WEBAPP_PORT
HTTP port for hub server.
Debug Variables
DEBUG
Enable verbose debug logging.Enable debug mode for detailed logging and error traces.
Complete Configuration Example
A typical production setup:Environment File
For development, create an.env file:
Per-Command Variables
Set variables for a single command:Verification
Check current configuration:Security Best Practices
1. Use .env files with .gitignore
2. Create example files
3. Use secrets managers in CI/CD
GitHub Actions:4. Rotate tokens regularly
Troubleshooting
Variable Not Taking Effect
Check if set:Token Issues
Token not recognized:Custom Home Not Working
Check path expansion:Reference Table
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
CLI_API_TOKEN | string | - | Yes | Authentication token for hub |
HAPI_API_URL | string | http://localhost:3006 | No | Hub server URL |
HAPI_HOME | string | ~/.hapi | No | Data directory |
HAPI_EXPERIMENTAL | boolean | false | No | Enable experimental features |
HAPI_CLAUDE_PATH | string | claude | No | Custom Claude CLI path |
HAPI_HTTP_MCP_URL | string | - | No | MCP bridge target URL |
HAPI_RUNNER_HEARTBEAT_INTERVAL | number | 60000 | No | Heartbeat interval (ms) |
HAPI_RUNNER_HTTP_TIMEOUT | number | 10000 | No | HTTP timeout (ms) |
WEBAPP_HOST | string | 127.0.0.1 | No | Hub host interface |
WEBAPP_PORT | string | 3006 | No | Hub HTTP port |
DEBUG | string | - | No | Enable debug logging |
Next Steps
- Settings File - Understand the settings.json structure
- Authentication - Configure CLI_API_TOKEN
- Hub Command - Start the hub server