Configuration
Environment variables, data directory, and configuration options for loop-task.
This reference covers every configuration surface of loop-task: environment variables, the data directory layout, interval and color syntax, the HTTP API defaults, log rotation settings, and IPC transport details.
Environment variables
Two environment variables control the runtime behaviour of loop-task.
| Variable | Default | Description |
|---|---|---|
LOOP_CLI_HOME | ~/.loop-cli | Data directory for all state (loops, tasks, projects, logs, daemon files) |
LOOP_CLI_HTTP_PORT | 8845 | Port for the HTTP API server |
LOOP_CLI_MCP_ENABLED | true | Enable/disable the MCP server |
LOOP_CLI_MCP_TRANSPORT | sse | MCP transport: sse or stdio |
LOOP_CLI_MCP_PORT | 8846 | Port for MCP SSE transport |
LOOP_CLI_HOME overrides the default data-directory location. When unset, all
state is stored under ~/.loop-cli. LOOP_CLI_HTTP_PORT changes the port the
HTTP API listens on. The MCP server variables control the Model Context Protocol
server, see MCP Server for details.
The HTTP API bind host is not controlled by an environment variable — it defaults
to 0.0.0.0 (all interfaces) and is configurable at runtime via
loop-task http-host. See CLI Reference
for details.
Data directory structure
The data directory ($LOOP_CLI_HOME or ~/.loop-cli) contains the following
files and directories.
| Path | Format | Description |
|---|---|---|
loops.json | JSON array | All loop configurations and state (LoopMeta) |
tasks.json | JSON array | All task definitions (TaskDefinition) |
projects.json | JSON array | All projects (Project) |
logs/{id}.log | Plain text | Per-loop log files, append-only, auto-rotated |
daemon.pid | Text | Daemon process ID |
daemon.sig | Text | Code signature (SHA-1 of dist/) |
daemon.log | Plain text | Daemon diagnostic log |
- loops.json, tasks.json, and projects.json are the authoritative data stores. They are read at startup and written on every mutation.
- logs/ contains one log file per loop instance, named by the loop ID. Files are appended to and rotated automatically (see Log rotation).
- daemon.pid holds the PID of the running daemon process. It is written on daemon start and removed on clean shutdown.
- daemon.sig stores the SHA-1 hash of the
dist/directory at daemon launch time. The daemon compares this signature periodically to detect code changes and trigger a restart. - daemon.log captures daemon-level diagnostics (startup, shutdown, keep-alive checks). It is distinct from per-loop log files.
Interval syntax
The interval field on loops and tasks accepts the following formats.
| Interval | Meaning |
|---|---|
10s | 10 seconds |
5m | 5 minutes |
1h | 1 hour |
1d | 1 day |
1w | 1 week |
manual or 0 | No automatic scheduling (trigger on demand only) |
Intervals are specified as a positive integer followed by a single-letter unit
(s, m, h, d, w). A value of manual or the literal string 0
disables automatic scheduling; the loop or task will only run when triggered
explicitly.
Project colors
Projects may be assigned a colour for display in list and TUI views. Six named colours are built in, and any hex colour is also accepted.
| Name | Hex | Colour |
|---|---|---|
| amber | #fbbf24 | Brand amber |
| blue | #38bdf8 | Loop blue |
| purple | #a78bfa | Task purple |
| green | #34d399 | Project green |
| red | #f87171 | Danger red |
| orange | #fb923c | Idle orange |
In addition to the six named values, any hex colour string (e.g. #ff6b6b,
#aaccff) is accepted. Colour values are validated on input; invalid strings
produce a configuration error.
HTTP API
The HTTP API server binds to 0.0.0.0 (all interfaces) by default, making it
reachable remotely. The bind host is configurable at runtime via
loop-task http-host — restrict to localhost with loop-task http-host local.
The API is unauthenticated. When bound to anything other than 127.0.0.1, secure
access at the network layer (SSH, Tailscale, firewall).
| Setting | Value |
|---|---|
| Host | 0.0.0.0 by default (configurable via loop-task http-host) |
| Port | 8845 (override with LOOP_CLI_HTTP_PORT) |
| Swagger UI | http://<host>:8845/api/docs |
| OpenAPI spec | http://<host>:8845/api/openapi.json |
All API endpoints are served under the /api/ prefix. The Swagger UI provides
an interactive documentation browser. The raw OpenAPI 3.0 specification is
available at /api/openapi.json for use with code-generation tools and API
clients.
Log rotation
Per-loop log files are rotated automatically when they exceed the maximum file size.
| Setting | Value |
|---|---|
| Max file size | 1 MB |
| Max generations | 3 (current + 2 rotated) |
| Naming scheme | {id}.log, {id}.1.log, {id}.2.log |
| Format | Plain text with run headers and exit codes |
When a log file reaches the 1 MB threshold it is rotated: {id}.1.log is
renamed to {id}.2.log, {id}.log is renamed to {id}.1.log, and a fresh
{id}.log is created. Older generations beyond the max are discarded.
Each run is written as a header line followed by the captured output and a final exit-code line:
=== RUN 2026-07-09T10:00:00Z loop-name (task-id) ===
<captured stdout / stderr>
--- EXIT 0 ---IPC
Inter-process communication between the CLI client and the daemon uses socket transport with a JSON-lines protocol.
| Setting | POSIX (macOS / Linux) | Windows |
|---|---|---|
| Transport | Unix domain socket | Named pipe |
| Address | $LOOP_CLI_HOME/loop-task.sock | \\.\pipe\loop-task |
| Protocol | JSON-lines (newline-delimited JSON) | JSON-lines |
| Client timeout | 10 seconds | 10 seconds |
- Each message is a single line of JSON terminated by
\n. - The client opens a connection, sends a request, and waits for a response with a 10-second timeout. If the daemon does not respond within that window the client treats the request as failed.
- On POSIX systems the socket file is created inside the data directory and cleaned up on daemon shutdown. On Windows the named pipe is managed by the operating system and does not persist on disk.