CLI Reference
Every subcommand supports --help (or -h). Use cloche help <command> for detailed usage.
cloche init
Set up or refresh a Cloche project. Safe to run on any existing project — existing files are not overwritten.
cloche init [-n | --new] [--install-shell-helpers]
[--workflow <name>] [--base-image <image>]
[--agent-command <cmd>] [--no-llm] [--no-commit]
[--non-interactive] [--ssh-key <path>]
Core behavior (always, no flags needed): Creates the .cloche/ directory structure if missing, creates or updates .cloche/config.toml (setting active = true), adds .gitignore entries for runtime state, and registers the project with the daemon.
| Flag | Default | Description |
|---|---|---|
-n, --new |
false | Generate workflow files, Dockerfile, prompt templates, and scripts. First-project experience. Existing files are skipped. |
--install-shell-helpers |
false | Install shell completion scripts and add sourcing lines to .bashrc / .zshrc. One-time per-machine setup. |
--workflow <name> |
develop |
Workflow name (only with --new). Creates .cloche/<name>.cloche. |
--base-image <base> |
cloche-agent:latest |
Base Docker image for the generated Dockerfile (only with --new). |
--agent-command <cmd> |
(see below) | LLM command for the init analysis phase (only with --new). |
--no-llm |
false | Skip the LLM-assisted placeholder filling phase (only with --new). |
--no-commit |
false | Skip the automatic scaffold commit (only with --new). |
--non-interactive |
false | Skip all interactive prompts (required for CI / scripted use). |
--ssh-key <path> |
(unset) | Write ssh_key = "<path>" into .cloche/config.toml. Works with or without --non-interactive. The path is written verbatim; ~ is expanded by the daemon at runtime. |
--new scaffolding: Creates .cloche/ with the workflow file, Dockerfile, prompt templates (implement.md, fix-tests.md, fix-merge.md), host workflows (host.cloche), Python scripts (get-tasks.py, claim-task.py, prepare-prompt.py, merge.py, close-task.py, cleanup.py, unclaim.py), a bundled copy of the getting-started tutorials at .cloche/docs/init/, .cloche/version, .clocheignore (at project root), and cloche_init_test/cloche/test_cloche.py. Skips existing files.
Beads bootstrap: --new also sets up beads as the task tracker: if the bd CLI is installed and .beads/ does not exist, it runs bd init and creates two starter validation tasks (the second depends on the first). If bd is missing, init prints a warning with install instructions and still generates the scaffold; re-run cloche init --new after installing to create the starter tasks. The tracker is swappable — the bundled .cloche/docs/init/ tutorials cover replacing it.
Scaffold commit: --new finishes by committing the generated files (Add cloche scaffold), because containers are seeded from a clean git snapshot of the last commit — uncommitted files are invisible in-container. Skipped with --no-commit, outside a git repository, or when staged changes are present (init prints guidance in each case). The project image builds automatically on first use, so a manual docker build before the first loop is optional.
Three generated files contain TODO(cloche-init) placeholders that are auto-filled by LLM analysis of your project:
.cloche/Dockerfile— dependency installation block.cloche/<name>.cloche— theteststepruncommand.cloche/prompts/implement.md— project context section
LLM command resolution order: --agent-command flag → CLOCHE_AGENT_COMMAND env var → global config [daemon] llm_command → claude if on PATH. The LLM phase has a 30-second timeout and is non-fatal. Use --no-llm for CI environments.
To locate remaining placeholders: grep -r 'TODO(cloche-init)' .cloche/
Also creates ~/.config/cloche/config (global daemon config) if it does not already exist, enabling the web dashboard on localhost:8080.
cloche doctor
Diagnose Cloche infrastructure.
cloche doctor [--project <dir>] [--verbose] [--timeout <duration>]
Runs checks in order and prints a status line for each, with remediation steps inline for any failure. Exits 1 if any check fails. The Project config, Workflow syntax, DRA image, Modules, Image source dir, Project image build, and Agent binary checks only run when the current (or --project) directory contains a .cloche/ subdirectory.
| Check | Description |
|---|---|
| Docker | Runs docker info to verify the Docker daemon is reachable. |
| Base image | Checks whether cloche-base:latest (or cloche-agent:latest) exists locally. |
| Daemon | Calls GetVersion over gRPC to verify the daemon is reachable. Address from CLOCHE_ADDR or default 0.0.0.0:50051. |
| Agent auth | Checks ANTHROPIC_API_KEY or ~/.claude/ session data (soft check, warning only). |
| Git SSH key | Checks that the [git] ssh_key file, if configured, exists and is readable (soft check, warning only). |
Beads CLI (bd) |
Checks whether bd is on PATH — the generated task workflow reads tasks from beads (soft check, warning only). |
| Project config | Loads .cloche/config.toml, reports parse errors, warns if active = false or TODO(cloche-init) markers remain, and flags known keys placed in the wrong table. |
| Workflow syntax | Parses all .cloche/*.cloche files using the same logic as cloche validate. |
| DRA image | Only shown when a workflow declares container { profile = "dra" }. Fails if cloche-dra:latest is missing; build it with make docker-dra. See DRAs. |
| Modules | For each installed module, fails if a requires binary is not on PATH; warns if a declared credential is not set in the environment. |
| Image source dir | Warns when the existing project image was built from a different source directory; the next image build rebuilds it automatically (soft check, warning only). |
| Project image build | Builds or confirms the project Docker image. |
| Agent binary | Starts a short-lived container from the project image, runs cloche-agent --version, and warns if the baked-in agent version differs from the host version. |
| Flag | Description |
|---|---|
--verbose, -v |
Print details for all checks, including passing ones. |
--project <dir> |
Run against the specified directory instead of CWD. |
--timeout <duration> |
Timeout for the agent binary check (default 60s). The container is always cleaned up. |
cloche run
Launch a workflow run.
cloche run <workflow>[:<step>] [--prompt "..."] [--title "..."] [--issue ID] [--repos a,b] [--keep-container]
| Argument / Flag | Description |
|---|---|
<workflow> |
Workflow name. Resolves to .cloche/<name>.cloche, or a built-in workflow not overridden by a project file of the same name. |
<workflow>:<step> |
Run starting at a specific step within the workflow. |
--prompt "...", -p |
Inline prompt written to .cloche/<run-id>/prompt.txt. |
--title "..." |
One-line summary for status display. Auto-generated if omitted. |
--issue ID, -i |
Associate an existing task/issue ID with the run. |
--repos a,b |
Comma-separated [[repositories]] names this run needs in its containers. Only those (plus their depends_on) are copied in, and only the listed ones get result branches. Omit for every configured repository; an unknown name is rejected. Runs launched by the loop take the list from the task’s repos field instead. See Repository Declarations. |
--keep-container |
Keep the container on success. Failed runs always keep their container. |
Must be run from inside a git repository. The daemon auto-rebuilds the Docker image when .cloche/Dockerfile changes; the build output streams into the run’s log as an image-build step, and a failed build aborts the run with the docker build output. While the daily budget cap is exceeded, cloche run still works but prints a warning: on stderr. Prints the workflow ID, task ID, and attempt ID on success.
cloche resume
Resume a failed or parked workflow run from a specific step.
cloche resume <task-id>
cloche resume <workflow-id>
cloche resume <step-id>
| Argument | Description |
|---|---|
<task-id> |
Bare task or run ID (e.g. cloche-k4gh). Resumes from the first failed step of the latest attempt. |
<workflow-id> |
attempt:workflow or task:attempt:workflow (e.g. a133:develop). Resumes from the first failed step. |
<step-id> |
attempt:workflow:step (e.g. a133:develop:review). Resumes from that specific step. |
The run must be failed, or parked by cloche loop stop --hard or the budget cap (a parked run restarts from the step that was interrupted). For container workflows, the container must still exist (failed runs keep their containers by default). Resume creates a new attempt rather than modifying the failed run — the previous attempt stays in its failed state for lineage tracing.
cloche loop
Start or stop the orchestration loop.
cloche loop [--max <n>]
cloche loop once
cloche loop stop [--hard]
cloche loop status
Continuously runs list-tasks → picks an open task → runs the main workflow → repeats.
| Flag | Default | Description |
|---|---|---|
--max <n> |
config value | Maximum concurrent runs. Defaults to the value in .cloche/config.toml. |
cloche loop once launches the next ready task, then stops the loop itself, leaving the launched run to continue in the background. Exits 0 once a task is launched, or 1 if nothing was assignable. Track the run with cloche poll or cloche list.
cloche loop stop disables the loop. Running tasks are not cancelled. The stopped state is persisted to .cloche/.loop-stopped; if the daemon restarts while the loop is stopped, in-flight runs are not auto-resumed.
cloche loop stop --hard stops the loop and immediately parks all resumable (pending, running, waiting) runs so they will not fire automatically if the daemon restarts. Parked runs have state parked and can be inspected with cloche list --runs. Use this before rebuilding or restarting the daemon.
cloche loop status shows the current loop state, including a Slots: <busy>/<max> busy · <queued> queued line reporting concurrency-slot usage (with · <n>/<m> emergency when emergency slots are configured) and a Resumable runs count of parked runs that would otherwise fire on daemon restart.
When stop_on_error or max_consecutive_failures triggers a halt, run cloche loop again to restart.
cloche list
List tasks for the current project, most recently created first.
cloche list [--all] [--project <dir>] [--state <state>] [--limit <n>] [--runs]
| Flag | Description |
|---|---|
--all |
Show tasks from all projects. |
--project, -p <dir> |
Filter by project directory. |
--state, -s <state> |
Filter by status (pending, running, waiting, succeeded, failed, cancelled, parked). |
--limit, -n <n> |
Limit results. |
--runs |
Show flat run listing instead of task-oriented view. |
Default columns: task ID, type, status, attempt count, latest attempt ID, title. Type is built-in for a task whose runs are for a built-in workflow — marked so it isn’t mistaken for a user-facing work item — or - otherwise.
With --runs: workflow ID, workflow, state, type, origin, task ID, title, error. Type is host or container. Origin is user for a run dispatched by an explicit request (cloche run/resume) or auto for one dispatched by the orchestration loop or an automated trigger, with (built-in) appended when the workflow itself is built-in.
cloche status
Show run status and token usage.
cloche status [<task-id>] [--all] [--no-color]
cloche status <step-id> --input
| Argument | Output |
|---|---|
| (none) | Daemon version, web dashboard status (Web: http://<addr> if up, or Web: DOWN (<error>) if configured but its listener is down; omitted entirely when the dashboard isn’t configured via CLOCHE_HTTP/[daemon] http), run statistics (past hour), a Budget: line when a daily cap is configured (see below), active tasks with composite IDs (e.g. cloche-1234:aj19:main), a “Needs you” section (see below), and per-agent token burn rate for the last hour. In a project directory, also shows project name, concurrency, loop state, a Slots: <busy>/<max> busy · <queued> queued line reporting concurrency-slot usage, and the count of resumable (parked) runs. |
| Task ID | Task status, title, project, latest attempt, result, and total tokens consumed. When waiting at a poll step, shows step name, time since last poll, and poll count. |
| Flag | Description |
|---|---|
--all |
Show global stats instead of project-specific (overview mode). |
--input |
Print the recorded input of the step the ID names, one block per execution attempt (oldest first). The ID must resolve to a step: <attempt>:<workflow>:<step>, <task>:<attempt>:<step>, or <task>:<attempt>:<workflow>:<step>. See Step inputs. |
--no-color |
Disable ANSI color output. Set CLOCHE_FORCE_COLOR=1 to force color on even when stdout is not a terminal. |
“Needs you”
Overview mode includes a Needs you (N): section (omitted when empty) listing items that require human action:
| Kind | Meaning | Actions shown |
|---|---|---|
stale-claim |
The task tracker still shows a task in-progress but no pending/running run is claiming it. | release |
repeat-failure |
A task still open in the tracker has hit the consecutive-failure threshold. | retry, close |
long-poll |
A poll step has been waiting longer than the configured threshold. | logs, cancel |
builtin-failures |
A user-initiated built-in workflow has failed repeatedly within the failure window. | retry, logs |
| budget | The daemon’s daily usage cap is reached, or usage can’t be read (the cap is then not enforced). Daemon-wide, so it belongs to no project, task, or run; it lists any runs the cap parked until each is resumed. | (none; cloche resume continues parked runs) |
Each line shows the kind, the task or run ID, the reason, and how long it has been waiting. Thresholds are configured under [attention] in config.toml.
Budget: line
When a daily cap is configured (see [budget]), overview mode prints a Budget: line just under the run statistics:
Budget: 4.0% of 10% daily cap used today
Budget: OVER CAP — 10.3% of 10% daily cap used; launches paused, in-flight runs parked at 14:35; clears at 00:00 (in 9h30m)
“Used today” is the share of the weekly usage allowance consumed since the first reading of the local day — the figure behind Claude Code’s /usage, covering the whole account, not only Cloche’s runs. If the usage figure can’t be read, the line says so and launching is not blocked.
Step inputs
Every step records the exact input it ran with, just before it starts. This is the post-interpolation text, so it answers “what did the agent actually see?” without reconstructing it from the template:
| Step type | Recorded input |
|---|---|
agent (prompt) |
The fully rendered prompt: template filled in, previous output substituted, result-marker instructions appended. |
script (run) |
The command line; every CLOCHE_* environment variable with its value; the names of all other environment variables (values are never recorded — the inherited environment can hold tokens); and the names of the KV keys a cloche get could read. |
| poll | The interval and the condition command. |
A step that is retried or resumed gets a new attempt with its own input, so the original prompt and the retry prompt are both kept:
$ cloche status a3f7:develop:implement --input
=== a3f7-develop:implement · attempt 1 · prompt · 2026-10-08T17:02:11Z ===
...
In the web console each step chip carries an in affordance that opens the same inputs. Inputs are deliberately kept apart from log output: logs are what a step produced, inputs are what it was given, and a prompt interleaved with log lines could be mistaken for instructions by an agent that later reads those logs. Inputs are stored with the run and deleted with it.
cloche logs
Show step logs.
cloche logs <id> [--type <full|script|llm>] [--step <name>] [-f] [-l <n>]
The first argument accepts any level of the ID hierarchy:
| Form | Example | Scope |
|---|---|---|
| Task ID | shandalar-1234 |
Logs for the latest attempt |
| Attempt ID | a3f7 |
Logs for that attempt |
| Workflow ID | a3f7:develop |
Logs for that workflow run |
| Step ID | a3f7:develop:implement |
Logs for that step |
| Flag | Description |
|---|---|
--type <full|script|llm> |
Log type filter. |
--step, -s <name> |
Filter logs to only those from the named step. |
--follow, -f |
Follow mode: stream new lines as they arrive (like tail -f). |
--limit, -l <n> |
Display only the last n lines. |
Flags are combinable: cloche logs a3f7:develop:implement -l 20 -f
When the daemon rebuilds the project image before a run, the docker build output is recorded as a pseudo-step named image-build: cloche logs <id> --step image-build shows it, including for a run whose build failed.
cloche poll
Block until targets finish.
cloche poll <id> [id...] [--no-color]
Polls every 2 seconds. Exits 0 if all runs succeeded, 1 if any failed or were cancelled.
| Form | Example | Behaviour |
|---|---|---|
| Task ID | shandalar-1234 |
Waits for the most recent run of that task |
| Attempt ID | a133 |
Waits for that attempt |
| Workflow ID | a133:develop |
Waits for that specific workflow run |
| Step ID | a133:develop:review |
Waits until that step completes |
With a single ID, prints step-level progress. With multiple IDs, displays a compact status summary and re-prints on state changes.
cloche stop
Stop all active runs for a task.
cloche stop <task-id>
Container runs have their container terminated; host runs have their execution cancelled. All affected run states transition to “cancelled”. A run stopped on request does not count as a failure for stop_on_error.
cloche delete
Delete a retained Docker container.
cloche delete <container-or-run-id>
cloche extract
Copy a retained container’s /workspace to the host.
cloche extract <id> [--at <dir>] [--branch <name>] [--no-git]
The container must still exist — run the workflow with --keep-container to retain it. <id> accepts the same forms as cloche status and cloche logs: run ID, task ID, attempt ID, or composite task:attempt.
Git mode (default): creates a git worktree and a branch with the extracted files committed on top of the run’s base SHA. Both are kept in place after extraction.
--no-git mode: a plain file copy with no git operations. Requires --at.
| Flag | Default | Description |
|---|---|---|
--at <dir> |
.gitworktrees/cloche/<runID> |
Target directory (must be empty or nonexistent). Required with --no-git. |
--branch <name> |
cloche/<runID> |
Branch name to create (git mode only). |
--no-git |
(off) | Skip worktree, branch, and commit; only copy files. Requires --at. |
On success, prints Extracted to: <absolute-target-dir> and, in git mode, Branch: <branch-name>.
cloche health
Show per-project pass/fail summary.
cloche health [--project <dir>]
Requires CLOCHE_HTTP.
| Flag | Description |
|---|---|
--project <dir> |
Scope the summary to one project directory instead of listing all registered projects. The daemon maps the directory to its registered project, so this works from any checkout. |
If the HTTP request fails, cloche health falls back to GetVersion over gRPC to tell apart a fully-down daemon from one whose web dashboard listener is down (e.g. stuck retrying a bind failure). In the latter case it reports web dashboard is down (<error>); daemon is otherwise healthy (version <version>) instead of a generic connection error.
cloche workflow
List all workflows or render a specific workflow as an ASCII-art graph.
cloche workflow [--project <dir>]
cloche workflow <name> [--project <dir>]
With no arguments, lists all workflows grouped by type (container or host), including built-in workflows not overridden by a project-defined workflow of the same name — labeled (built-in). With a workflow name, renders the workflow graph showing step boxes, wiring, and result paths. Wires are colorized: green for success, red for fail/failed, other colors for custom results.
cloche validate
Validate project configuration and workflow definitions.
cloche validate [--project <path>] [--workflow <name>]
| Flag | Default | Description |
|---|---|---|
--project <path> |
current directory | Project directory to validate. |
--workflow <name> |
(all) | Validate only the named workflow. |
Checks: config.toml parsing, workflow syntax, result wiring completeness, terminal coverage, no orphan steps, file references (prompt file() paths, script run paths), and cross-file consistency (workflow_name references resolve to a defined workflow or to a slot named by a bind). It also checks:
- Config placement — known keys in the wrong table are flagged.
- Merge overrides —
.cloche/overrides/*.merge.*files parse and don’t conflict with a plain override for the same target (seeoverrides/). - Modules, binds, and contracts (all workflows only) — each
module.tomlparses, itsexportsexist, and it has a README;requiresbinaries are onPATH; bind targets exist and are unambiguous; eachworkflow_namestep’s bound workflow has itscontractinputs available at that point. Warnings cover exported workflows without a contract, vendored content that no longer matchesmodules.lock, and unsetcredentials. - DRAs — each
.cloche/dras/<name>/has acharter.mdand a valid name. - Deprecated fields — a workflow-level
reposfield is reported as a warning; it is ignored at runtime.
When validating all workflows, it also warns when a workflow_name step’s explicit timeout is shorter than the sum of the target workflow’s own step timeouts — the sub-workflow could be killed before its own steps can time out. Warnings print to stderr with a WARNING: prefix and do not affect the exit code.
cloche project
Show project info and config.
cloche project [--name <label>]
cloche project purge [<dir>] [--name <label>] [--yes]
By default, looks up the project by the current working directory. Use --name to look up a project by its registered label instead.
Output includes: config settings, orchestrator loop state (running or stopped), currently active runs, and known workflows. When the loop is halted due to stop_on_error, max_consecutive_failures, or a container infrastructure failure, the halt error message is displayed.
cloche project purge removes a project from Cloche: it permanently deletes every record the daemon holds for it — runs, step executions, tasks, attempts, log-file metadata, KV, activity — so it no longer appears in cloche list or the console’s tab strip. Use it to retire finished experiments and deleted checkouts; the project reappears automatically if you run something there again. The daemon refuses while the project’s loop is running or any run is pending or running. Files under the project’s own .cloche/ directory are not touched. The same action is in the console under Tools ▸ Remove project….
| Flag | Default | Description |
|---|---|---|
<dir> |
(cwd) | Project directory to purge. |
--name <label> |
Purge by label instead of directory. | |
--yes, -y |
Skip the confirmation prompt. |
cloche get
Get a value from the KV store.
cloche get <key>
Requires CLOCHE_TASK_ID (and CLOCHE_ATTEMPT_ID if set). Exits 1 if the key is not found.
cloche set
Set a value in the KV store.
cloche set <key> <value|->
cloche set <key> -f <file>
Requires CLOCHE_TASK_ID (and CLOCHE_ATTEMPT_ID if set). Pass - as the value to read from stdin (trailing newlines trimmed). Pass -f <file> to read from a file.
cloche tasks
Show the task pipeline and assignment state.
cloche tasks [--project <dir>]
Displays upcoming/open tasks, which tasks are assigned to which runs, and auto-assignment state. Requires CLOCHE_HTTP.
| Flag | Default | Description |
|---|---|---|
--project <dir> |
current working directory | Project directory to query. The daemon maps the directory to its registered project, so this works from any checkout. |
cloche tasks create | update | find
cloche tasks create --title <t> [--body <b> | --body-file <f>] [--priority <0-4>]
[--label <l>]... [--source <s> --key <k>] [--project <dir>]
cloche tasks update <task-id> [--comment <c>] [--priority <0-4>]
[--add-label <l>]... [--remove-label <l>]... [--project <dir>]
cloche tasks find --source <s> --key <k> [--project <dir>]
Run the project’s bound create-task / update-task tracker phase on demand (see Modules). create prints the new task id. find prints the id of the open task recorded for that signal source and key, or exits 1 if there is none, so a repeat signal can update it instead of creating a duplicate.
cloche signals
cloche signals token [--rotate] [--project <dir>]
Show (or with --rotate, replace) the bearer token for a project’s signal-intake endpoint. Reads and writes ~/.config/cloche/signal-tokens/ directly; the daemon need not be running. There is no command for sending a signal: use curl.
cloche module
Install and manage workflow modules. All subcommands are local file operations on .cloche/ (no daemon needed), and nothing in a module is executed at install or update time.
cloche module add <git-url>[@ref] [--project <dir>]
cloche module add <path> [--project <dir>]
cloche module list [--project <dir>]
cloche module update <name> [<ref>] [--yes] [--project <dir>]
cloche module remove <name> [--project <dir>]
| Subcommand | Description |
|---|---|
add |
Resolves a git source to a commit, vendors it into .cloche/modules/<name>/, and records name, source, ref, commit, and content hash in .cloche/modules.lock. A local path is recorded as path:<dir> and used in place. Prints the module README’s Prerequisites section; Cloche does not install prerequisites. |
list |
Shows installed modules (name, source, ref, commit). |
update |
Fetches the latest commit for the recorded ref (or <ref>), shows the full diff of the module’s files, and asks before applying. --yes/-y skips the prompt. Warns if the vendored copy has local edits. |
remove |
Removes the lock entry and the vendored directory (a local-path module’s directory is left untouched). |
Vendored files are not committed automatically — review and commit them along with .cloche/modules.lock.
cloche dra
List and wake the project’s Domain Responsible Agents.
cloche dra list [--project <dir>]
cloche dra wake <name> --message <text> [--project <dir>]
cloche dra ruling <name> --question <id> --message <text> [--project <dir>]
cloche dra heartbeat <name> [--project <dir>]
| Flag | Default | Description |
|---|---|---|
--project <dir> |
current directory | Project directory. |
--message <text> |
(required for wake, ruling) |
What happened; the DRA reads it when it wakes. |
--question <id> |
(required for ruling) |
The question the ruling answers. |
list prints each DRA’s name, its session id (- until its first wake-up), its last wake-up (run id, result, how the session was obtained, time), and the first heading of its charter.
wake starts a wake-up by hand. It is refused while that DRA already has a wake-up running, and is never blocked by the daily budget cap (only warned).
ruling and heartbeat queue an event for the DRA instead of waking it directly; the daemon delivers queued events together in one wake-up (a heartbeat wakes the DRA only if its interval, default 4h, has passed).
cloche activity
Show the project activity log.
cloche activity [--project <dir>] [--since <duration|time>] [--until <time>] [--json]
| Flag | Default | Description |
|---|---|---|
--project <dir>, -p |
current directory | Project directory. |
--since <value> |
(all) | Show entries on or after this time. Accepts a Go duration (24h, 7d) or RFC3339 timestamp. |
--until <time> |
(all) | Show entries on or before this RFC3339 timestamp. |
--json |
false | Output raw JSONL instead of the table view. |
Reads the daemon’s SQLite database directly (not via gRPC): set CLOCHE_DB to point at a non-default path (default ~/.config/cloche/cloche.db); it must match the database the daemon is using.
Event kinds: attempt_started, attempt_ended, step_started, step_completed.
cloche –version
Print version information for all Cloche components.
cloche -v
cloche --version
Displays the CLI version, queries the daemon for its version, and runs the agent version check from the project’s container image. Version mismatches produce warnings on stderr.
The daemon and agent binaries also support standalone version output: cloched -v and cloche-agent -v.
cloche shutdown
Send a shutdown signal to the daemon.
cloche shutdown [--force|-f] [--restart|-r]
Refuses to shut down if there are active runs unless --force is specified.
| Flag | Description |
|---|---|
-f, --force |
Shut down even if runs are still active. |
-r, --restart |
Relaunch the daemon after stopping it (or start it if it is not already running). The new daemon’s stdout/stderr are redirected to ~/.config/cloche/cloched.log (override with CLOCHE_LOG). |
cloche console
Start an interactive agent session in a fresh container.
cloche console [--agent <command>]
Uses the project’s image and setup (project files, auth credentials, overrides) — and, unlike autonomous runs, your full Claude Code settings.json, settings.local.json, and ~/.claude.json — the same environment as a workflow run, without running a workflow. The terminal is put into raw mode with bidirectional I/O forwarding.
When the session ends, the container is kept and can be deleted with cloche delete <container-id>. The container ID is printed on exit. Must be run from inside a git repository with a .cloche/ directory.
cloche debug
Inspect the running daemon via its debug HTTP server, which must be enabled first.
cloche debug <subcommand> [--debug-addr <addr>]
| Subcommand | Description |
|---|---|
goroutines (alias: dump) |
Print a full goroutine stack dump from the daemon (pprof output). |
state |
Print a summary of active runs, loops, goroutine count, and container sessions. |
The debug server address resolves from --debug-addr, then the CLOCHE_DEBUG environment variable, then [daemon] debug in ~/.config/cloche/config. Enable it on the daemon with any of:
cloched --debug-addr localhost:7778
CLOCHE_DEBUG=localhost:7778 cloched
# or in ~/.config/cloche/config: [daemon] debug = "localhost:7778"
cloche complete
Shell completion helper (not intended for direct use).
cloche complete --index <n> [-i <n>] -- <word0> <word1> ...
Prints one completion candidate per line. Static candidates (subcommands, flags, and workflow names read from the local .cloche/) are always computed first and take precedence, since a daemon reached over CLOCHE_ADDR may be answering for a different filesystem view of the project (e.g. from inside a container). If the daemon is reachable, its dynamic candidates (task IDs, workflow names, attempt IDs) are merged in after, with duplicates dropped.
Set up with cloche init --install-shell-helpers, which writes completion scripts for bash and zsh.
clo (In-Container CLI)
clo is a lightweight binary available inside containers for reading and writing the daemon’s KV store without needing the full cloche client.
clo get <key> # Print value to stdout; exit 1 if not found
clo set <key> <value> # Set a key
clo set <key> - # Read value from stdin (trailing newlines trimmed)
clo set <key> -f <file> # Set a key from file contents
clo keys # List all keys in the current run namespace
clo -v # Print version
clo reads CLOCHE_ADDR, CLOCHE_TASK_ID, CLOCHE_ATTEMPT_ID, and CLOCHE_RUN_ID from the environment. The Docker adapter sets all four automatically.
Environment Variables
Daemon Configuration
| Variable | Default | Description |
|---|---|---|
CLOCHE_ADDR |
0.0.0.0:50051 |
gRPC listen address |
CLOCHE_DB |
~/.config/cloche/cloche.db |
SQLite database path |
CLOCHE_RUNTIME |
docker |
docker or local (subprocess, for dev only) |
CLOCHE_IMAGE |
cloche-agent:latest |
Default Docker image |
CLOCHE_HTTP |
localhost:8080 (via global config) |
HTTP address for web dashboard. Not started unless set. |
CLOCHE_AGENT_PATH |
(auto) | Path to cloche-agent binary (local runtime) |
ANTHROPIC_API_KEY |
(unset) | Passed into Docker containers |
CLOCHE_EXTRA_MOUNTS |
(unset) | Extra bind mounts (comma-separated host:container) |
CLOCHE_EXTRA_ENV |
(unset) | Extra env vars (comma-separated KEY=VALUE) |
CLOCHE_EXTRACT_ALLOW_MASS_DELETE |
(unset) | Set to 1 to let extraction commit a result that deletes more than 50 files and twice as many as it adds. By default extraction refuses, since that pattern usually means the container never had the full project. |
CLOCHE_SAGA_ADDR |
(unset) | host:port of the Saga service that DRA containers may reach through their egress sidecar. |
Client Configuration
| Variable | Default | Description |
|---|---|---|
CLOCHE_ADDR |
0.0.0.0:50051 |
Daemon gRPC address |
CLOCHE_HTTP |
localhost:8080 |
Daemon HTTP address |
Host Step Runtime Variables
Set by the daemon for each host step script invocation.
| Variable | Description |
|---|---|
CLOCHE_PROJECT_DIR |
Absolute path to the project directory on the host. |
CLOCHE_RUN_ID |
The run ID for this workflow execution. |
CLOCHE_PREV_OUTPUT |
Path to the output file from the immediately preceding step. |
CLOCHE_TASK_ID |
Task ID assigned by the daemon (set for the main phase). |
CLOCHE_ATTEMPT_ID |
Attempt identifier for this run. |
CLOCHE_GIT_AUTHOR_NAME |
Git author/committer name (set when [git] name is configured). |
CLOCHE_GIT_AUTHOR_EMAIL |
Git author/committer email (set when [git] email is configured). |
CLOCHE_GIT_SSH_COMMAND |
Pre-composed ssh -i <key> -o IdentitiesOnly=yes (set when [git] ssh_key is configured). Use as GIT_SSH_COMMAND="$CLOCHE_GIT_SSH_COMMAND" git push …. |
CLOCHE_MODULE_DIR |
Root of the module a module workflow’s run command belongs to (also set in containers, as the /workspace/... path). |
CLOCHE_RESULT_NONCE |
Per-invocation nonce for script (run) steps. A script may frame its marker as CLOCHE_RESULT:$CLOCHE_RESULT_NONCE:<name> to stay immune to unrelated CLOCHE_RESULT: text elsewhere in its output; the bare CLOCHE_RESULT:<name> form still works. |
Container Runtime Variables
Injected into the container by the daemon at startup.
| Variable | Description |
|---|---|
CLOCHE_RUN_ID |
The run ID for this workflow execution. |
CLOCHE_TASK_ID |
Task ID assigned by the daemon. Set when the run is associated with a task. |
CLOCHE_ATTEMPT_ID |
Attempt identifier for this container run. |
CLOCHE_PROJECT_DIR |
Working directory inside the container (/workspace). |
CLOCHE_AGENT_COMMAND |
Overrides the default agent command inside the container. |
CLOCHE_ADDR |
Daemon gRPC TCP address (e.g. host.docker.internal:50051). Used by clo get/clo set. |
ANTHROPIC_API_KEY |
Passed through from the host environment if set. |
CLOCHE_REPOS |
The repositories this container holds, set when the run’s repo list narrows the copy. Available in prompts as {{ $repos }}. |
CLOCHE_RESULT_NONCE |
Exported to the agent process for each agent step, for custom agent_command scripts that construct their own CLOCHE_RESULT:<nonce>:<name> marker. Generated once per step and reused across retries and resumes. |