Project Layout

After running cloche init --new, a project has the following structure:

my-project/
+-- .cloche/
|   +-- develop.cloche        # Container workflow
|   +-- host.cloche           # Host orchestration workflows (list-tasks, main)
|   +-- project.cloche        # Root binds: which module fills each tracker phase (optional)
|   +-- modules/              # Vendored workflow modules (optional)
|   +-- modules.lock          # Pinned module sources and content hashes
|   +-- dras/<name>/          # Domain Responsible Agents: charter.md, notes.md (optional)
|   +-- Dockerfile            # Container image definition
|   +-- config.toml           # Project configuration
|   +-- version               # Schema version marker (used for upgrade checks)
|   +-- prompts/              # Prompt templates
|   |   +-- implement.md
|   |   +-- fix-tests.md
|   |   +-- fix-merge.md
|   +-- scripts/              # Host-side scripts
|   +-- docs/init/            # Bundled getting-started tutorials
|   +-- overrides/            # Files copied (or *.merge.* merged) on top of /workspace/
|   |   +-- CLAUDE.md         # Container-specific CLAUDE.md (optional)
|   |   +-- .claude/settings.merge.json  # Keys merged into .claude/settings.json (optional)
|   +-- runs/                 # Runtime state (gitignored)
|   |   +-- <task-id>/
|   |       +-- prompt.txt    # User prompt
|   |       +-- result_nonce/ # Per-step result-marker nonces (reused across retries/resumes)
|   +-- activity.log          # Append-only JSONL activity log (attempt/step events)
|   +-- .loop-stopped         # Loop-stopped marker, present after `cloche loop stop`
|   +-- logs/
|       +-- <task-id>/        # Grouped by task
|           +-- <attempt-id>/ # One directory per attempt
|               +-- full.log                  # Unified log (all steps)
|               +-- image-build.log           # docker build output (pre-agent pseudo-step)
|               +-- <workflow>-<step>.log     # Per-step script output
|               +-- <workflow>-llm-<step>.log # Per-step LLM conversation
+-- cloche_init_test/
|   +-- cloche/
|       +-- test_cloche.py    # Validation tests for the Cloche setup
+-- .beads/                   # Beads task tracker state (created by bd init)
+-- .clocheignore             # Workspace file exclusions (patterns to omit from container)
+-- src/                      # Your project source (untouched by Cloche)
+-- .git/

Key Files

Workflow files (*.cloche)

Define the step graph, wiring, and configuration for each workflow. See the DSL Reference for syntax.

project.cloche, modules/, modules.lock

project.cloche holds only root bind statements, choosing which workflow fills each task-tracker phase (list-tasks, claim-task, close-task, …). modules/ holds vendored workflow packages added with cloche module add, pinned in modules.lock. All three are optional — cloche init --new scaffolds plain scripts instead. See Modules.

dras/

One directory per Domain Responsible Agent, holding its charter.md and notes.md. Optional; Cloche never commits notes.md.

Dockerfile

Builds the container image used for container workflows. Must include the cloche-agent and clo binaries, git, an agent user, and your project’s build dependencies. See Dockerfile Requirements.

config.toml

Per-project configuration controlling orchestration behavior, attention thresholds, and per-agent settings. See the Configuration Reference.

prompts/

Markdown prompt templates referenced by file() in workflow steps. By convention, one file per prompt step.

scripts/

Host-side scripts used by script steps in host workflows. The scaffold generates get-tasks.py, claim-task.py, prepare-prompt.py, merge.py, close-task.py, cleanup.py, and unclaim.py.

docs/init/

A bundled copy of the getting-started tutorial series, generated by cloche init --new. Six short guides covering initialization, the default beads task tracker, running the loop, passing data between steps, how changes land, and swapping the task tracker.

overrides/

Files placed here are copied on top of /workspace/ in every container at start time. Useful for container-specific configuration like a CLAUDE.md file. This directory is checked into version control — do not put secrets here.

Merge overrides. A file named with .merge just before its extension is merged into the matching project file instead of replacing it: .claude/settings.merge.json merges into .claude/settings.json, app.merge.yaml into app.yaml, pyproject.merge.toml into pyproject.toml. JSON, YAML, and TOML are supported. Merging follows JSON Merge Patch (RFC 7386): maps merge recursively, scalars and lists replace the project’s value, and null deletes a key (TOML has no null, so TOML merges can’t delete keys). If the project file doesn’t exist in the container, the merge applies to an empty document. The merged file is re-serialised (sorted keys, no comments).

Any problem fails the run at container start rather than falling back to a copy: a merge file or target that doesn’t parse, a top level that isn’t a map, an unsupported extension, or a plain override and a merge file for the same target. cloche validate runs the same checks.

Overrides stay out of results. Overrides shape the container’s environment, not the run’s output. At extraction, any override file the agent left unchanged is put back as it was at the base commit (or removed if the base commit didn’t have it), so it never reaches the result branch. An override file the agent edited is kept and committed like any other change.

runs/

Runtime state directory, automatically gitignored. The daemon creates a subdirectory per task for prompt files and temporary data, including result_nonce/, which persists each step’s result-marker nonce so it survives retries and resumes of that step. Cleaned up automatically when runs complete.

activity.log

An append-only JSONL file recording attempt and step lifecycle events with timestamps and outcomes. Readable with cloche activity.

logs/

Step output logs grouped by task and attempt. Each attempt directory contains a unified full.log and per-step logs split by type (script output vs LLM conversation), plus image-build.log when the daemon rebuilt the project image for that attempt.

.clocheignore

Works like .gitignore — patterns listed here are excluded from the project copy sent to containers. Useful for large directories (build artifacts, datasets) that the agent doesn’t need.