CLI Reference
Complete reference for all loop-task CLI commands and flags.
Complete reference for all loop-task CLI commands, flags, interval syntax, exit codes, and practical examples.
Commands
loop-task (default)
Open the interactive TUI board. When invoked without a subcommand, loop-task launches the terminal user interface for managing loops, projects, and monitoring execution.
loop-taskloop-task start
Start the background daemon and restore persisted loops from the previous session. The daemon runs as a detached background process and re-hydrates all loops that were active when the daemon was last stopped.
loop-task startloop-task new <interval> -- <command>
Create a background loop. The command is scheduled according to the given interval and managed by the daemon. The loop persists across daemon restarts.
loop-task new 5m -- curl https://healthcheck.example.com/ping| Argument | Description |
|---|---|
interval | Interval syntax string (e.g. 10s, 5m, 1h, 1d) or manual |
command | Shell command to execute on each tick (everything after --) |
loop-task run <interval> -- <command>
Run a loop in the foreground (blocking). The command executes repeatedly at the given interval and streams output to the terminal. Press Ctrl+C to stop.
loop-task run 30s -- echo "tick"| Argument | Description |
|---|---|
interval | Interval syntax string (e.g. 10s, 5m, 1h) |
command | Shell command to execute on each tick (everything after --) |
loop-task stop <id>
Stop a loop and interrupt its running child process. The loop is removed from the daemon and its persisted state. If a command execution is in progress, the child process receives a termination signal.
loop-task stop abc123| Argument | Description |
|---|---|
id | Loop identifier (UUID or short ID) |
loop-task restart
Kill the daemon and all running loops, then start fresh. All persisted loop configurations are restored, and any previously running loops are re-scheduled.
loop-task restartloop-task status [--json]
Show status of all loops. By default, displays a formatted table with loop IDs, intervals, projects, last execution time, and current state. Pass --json for machine-readable output.
loop-task status
loop-task status --jsonloop-task export [file]
Export all loop configurations to JSON. If a file path is provided, the output is written to that file. If omitted, the JSON is printed to stdout.
loop-task export
loop-task export ./backup-loops.json| Argument | Description |
|---|---|
file | Optional output file path |
loop-task import <file>
Import loop configurations from a JSON file. The imported configs are merged into the daemon's state and trigger a hot-reload - no restart required.
loop-task import ./backup-loops.json| Argument | Description |
|---|---|
file | Path to the JSON file to import |
loop-task api
Show HTTP API information - base URL, Swagger UI endpoint, and OpenAPI specification path.
loop-task apiloop-task project list
List all projects. Shows project name, assigned color, and the number of loops assigned to each project.
loop-task project listloop-task project new <name> [--color <color>]
Create a new project with an optional color assignment.
loop-task project new production --color red
loop-task project new staging| Argument | Description |
|---|---|
name | Project name |
loop-task project rename <id|name> <new-name>
Rename an existing project. Accepts either the project ID or current name as the identifier.
loop-task project rename production prod-infra
loop-task project rename abc123 prod-infra| Argument | Description |
|---|---|
id|name | Project identifier (UUID or current name) |
new-name | New project name |
loop-task project color <id|name> <color>
Change the color assigned to a project. Accepts either the project ID or name.
loop-task project color production blue
loop-task project color abc123 green| Argument | Description |
|---|---|
id|name | Project identifier (UUID or current name) |
color | Color name or hex value |
loop-task project delete <id|name>
Delete a project. Loops assigned to the project are unassigned but not deleted.
loop-task project delete production
loop-task project delete abc123| Argument | Description |
|---|---|
id|name | Project identifier (UUID or current name) |
loop-task http-host [address]
Show or set the network interface the HTTP API and MCP server bind to. By default, both bind to 0.0.0.0 (all interfaces), making the API reachable remotely. Use this command to restrict to localhost or bind to a specific IP.
# Show current bind host
loop-task http-host
# Restrict to localhost only
loop-task http-host local
# Bind to all interfaces (default)
loop-task http-host all| Argument | Description |
|---|---|
address | IP to bind — or local (127.0.0.1) / all (0.0.0.0). Omit to show current value. |
The HTTP API is unauthenticated. When binding to anything other than 127.0.0.1, secure access at the network layer (SSH, Tailscale, firewall) or restrict to local.
loop-task telemetry
Manage OpenTelemetry configuration. When called without a subcommand, shows the current telemetry status. See OpenTelemetry for the full guide.
# Show status (default)
loop-task telemetry
loop-task telemetry statusloop-task telemetry on
Enable OpenTelemetry instrumentation.
loop-task telemetry onloop-task telemetry off
Disable OpenTelemetry instrumentation.
loop-task telemetry offloop-task telemetry endpoint <url>
Set the OTLP export endpoint.
loop-task telemetry endpoint http://127.0.0.1:4318| Argument | Description |
|---|---|
url | OTLP endpoint URL (e.g. http://127.0.0.1:4318) |
loop-task telemetry protocol <protocol>
Set the OTLP export protocol.
loop-task telemetry protocol grpc
loop-task telemetry protocol http/protobuf| Argument | Description |
|---|---|
protocol | Export protocol: grpc or http/protobuf |
loop-task telemetry test
Send a diagnostic span to verify the OTLP endpoint is reachable.
loop-task telemetry testFlags
Flags for new and run
| Flag | Type | Description |
|---|---|---|
--now | boolean | Run immediately before waiting for the interval |
--max-runs <n> | number | Stop the loop after N executions |
--cwd <dir> | string | Working directory for the command |
--project <name> | string | Assign loop to a project |
--offset <duration> | duration | Phase offset (e.g. 5m, 15m) for spread scheduling |
--description <desc> | string | Human-readable description of the loop |
-C, --context <json> | JSON string | Initial context JSON (e.g. {"env":"staging"}) |
--verbose | boolean | Show execution details |
-h, --help | - | Show help for the command |
-V, --version | - | Show version number |
Flag for status
| Flag | Type | Description |
|---|---|---|
--json | boolean | Output status as JSON instead of a table |
Flag for project new
| Flag | Type | Description |
|---|---|---|
--color <color> | string | Color assignment for the project |
Global flags
| Flag | Description |
|---|---|
-h, --help | Show help for any command |
-V, --version | Show version number |
Interval syntax
| Syntax | Description |
|---|---|
10s | 10 seconds |
30s | 30 seconds |
5m | 5 minutes |
15m | 15 minutes |
1h | 1 hour |
6h | 6 hours |
1d | 1 day |
1w | 1 week |
manual or 0 | No automatic scheduling - trigger on demand only |
Examples
Create a background health-check loop
loop-task new 1m -- curl -f https://api.example.com/healthRuns curl every 60 seconds in the background.
Run a database backup loop in the foreground
loop-task run 1h -- pg_dump mydb > /backups/mydb.sqlExecutes pg_dump every hour. Output is printed to the terminal. Press Ctrl+C to stop.
Schedule a loop with a specific working directory
loop-task new 30m --project backend --cwd /var/www/app -- ./deploy.shAssigns the loop to the backend project and runs ./deploy.sh from /var/www/app.
Create a loop that runs immediately and stops after 5 executions
loop-task new 10s --now --max-runs 5 -- echo "hello"Runs echo "hello" immediately, then repeats every 10 seconds, stopping automatically after the 5th execution.
Spread loops with phase offset
loop-task new 1h --offset 0m --project workers -- echo "worker A"
loop-task new 1h --offset 30m --project workers -- echo "worker B"Both loops run every hour, but worker B runs 30 minutes after worker A, spreading the load.
Attach context to a loop
loop-task new 5m --context '{"env":"staging","region":"eu-west-1"}' -- ./sync.shPasses structured context data that the command or downstream tools can consume.
Export and import loop configurations
# Export all loops to a file
loop-task export ./backup.json
# Import them on another machine (or after a reset)
loop-task import ./backup.jsonAdd a description for readability
loop-task new 1d --description "Daily DB vacuum" --project maintenance -- vacuumdb --allDescribes the loop's purpose in the TUI board and status output.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error (invalid arguments, daemon unreachable, etc.) |
| Non-zero | Propagated from the child command if the loop command exits with an error |