Skip to content

pipeline.yaml reference

One file declares the whole loop: the stage graph, the LLM connection, per-step isolation, secrets, and the commit policy. fabriek init scaffolds a working copy; this page is the complete reference.

Full example

name: my-construction-loop
extensions:
  - fabriek.engine.extensions.aidlc:AidlcExtension   # bundled AI-DLC doc loader
additional_files:
  - ../README.md                                       # shared context for every agent step

llm:
  model: openai/deepseek-flash
  base_url: https://api.deepseek.com
  api_key_env: OPENAI_API_KEY
  reasoning_effort: medium                         # required for flash: low | medium | high | xhigh | none

# Named LLM profiles: a step names one with `llm: <name>` to move the whole
# profile (model, endpoint, key, effort default) together. The `llm:` block
# above remains the default.
# llms:
#   review:
#     model: openai/deepseek-v4-pro
#     base_url: https://api.deepseek.com
#     api_key_env: REVIEW_API_KEY
#     reasoning_effort: xhigh

max_attempts: 10                                        # CLI --max-attempts overrides
agents_dir: sdk_agents                                  # your <name>.agent.md files

steps:
  - name: brief
    reasoning_effort: medium
    brief_inputs:
      include: [AGENTS.md, coding-standards-ddd.yaml]
      sections: [Repo rules digest, Unit scope digest, Environment facts, Open risks]
      env_facts: ["the workspace is an export with no .git; verify with find/ls, never git status"]
    on_pass: dev

  - name: dev
    agent: dev
    produces: implementation-summary.md
    terminal_timeout: 900
    # forbidden_commands: ["npm install", "npm ci"]      # per-step tool deny-list; engine defaults are git mutations + docker
    on_pass: test

  - name: test
    command: .venv-sandbox/bin/python -m pytest tests/ -q -m "not docker"
    setup: python -m venv .venv-sandbox && .venv-sandbox/bin/pip install -e ".[dev]"
    timeout: 600
    on_pass: review
    on_fail: { goto: dev, retry: true }

  - name: review
    agent: review
    artifact: review-findings.md
    verdicts: { pass: APPROVED, fail: NEEDS CHANGES }
    # reasoning_effort: xhigh                        # per-step override of the effective profile's effort
    # llm: review                                    # select a named `llms:` profile for this step
    on_pass: qa
    on_fail: { goto: dev, retry: true }

  - name: qa
    agent: qa
    artifact: qa-report.md
    verdicts: { pass: PASS, fail: FAIL }
    max_iterations: 100
    finalize_nudge_turns: 10
    on_pass: commit
    on_fail: { goto: dev, retry: true }

  - name: commit
    action: commit
    params: { message: "feat: construct {subject} (agent dev loop)" }

Field reference

Key Notes
agent: / command: / action: / brief_inputs: Exactly one per step. Agents live in agents_dir as <name>.agent.md; commands run sandboxed (mechanical, never an LLM call). commit is the sole host-side built-in action; consumer actions are sandbox-executed scripts (see host boundary).
produces: / artifact: + verdicts: Hygiene-tracked outputs vs structured-verdict routing. The verdict comes from a validated record_verdict tool call, never from prose; stale artifacts are deleted at each attempt start.
brief_inputs: A native brief step: { include: [<paths/globs>], env_facts: [<strings>], sections: [<headings>] }. It digests the included docs into an engine-owned attempt-brief.md that later agents read, and re-runs only when its inputs change.
on_pass: / on_fail: A step name, terminal success/failure, or {goto: X, retry: true}. No loops happen unless you write them.
env: / setup: / network: env: declares step vars (fixed safe base + declared vars only); setup: runs fresh at every step boundary in a one-shot provision container targeting the export (command or agent steps; network ON); network: true grants egress scoped by egress: (default off) - see per-stage networking.
rerun_on_resume: Command steps only. On a resumed run, marked steps before the resumed step run first, then control jumps to the resumed step, so a resume rebuilds build output that lives outside git (for example a virtualenv).
mounts: / egress: Per-step workspace isolation. mounts: lists {path, mode} entries (rw/ro, default ro), strict-by-default: empty/missing mounts nothing, and only declared-rw paths sync back to the repo. egress: names the hosts a networked step may reach ({class, presets, targets}). See mounts and egress.
companions: (top-level) / step companions: Named read-only sibling repositories. The top level maps name -> {path, description}; a step opts in with a name list. Agent, command, and sandbox-action steps only. Each is mounted at /companions/<name> and never synced back. Resolved at run start and --dry-run, not by doctor/run-status. See companion repositories.
secrets: (top-level) / step secrets: Declares secret refs only - never values; each step opts in to the refs it needs. Resolved host-side and injected into that step's exec env only. See secrets.
profile: (top-level) Names a bundled toolchain profile (python, dotnet-node, rust) or a consumer profile file path, merged at load time: isolation key-wise with the pipeline winning, caches unioned profile-first. A path-shaped ref resolves relative to the pipeline file's directory, so path profiles work from any working directory.
isolation: (optional) Configures the sandbox - image override, resource caps, allow_git_mutations, seccomp_profile. It can never disable it. See isolation.
terminal_timeout: Optional agent-step per-action timeout in seconds. When neither the step nor the per-call value sets one, the engine default of 600 seconds applies (the same budget as a command step). Set it higher only for steps whose single invocations legitimately run longer.
finalize_nudge_turns: Optional agent-step final-response nudge; requires max_iterations: and must be less than it.
deps_policy: / lockfiles: locked (default) or open. The human-owned lockfile is the source of truth under locked; see dependency policy.
caches: / sync_excludes: Top-level run-wide lists. caches: names toolchain cache dirs bind-mounted rw from host-side stores (a setup: hook can warm them); sync_excludes: names non-gitignored scratch paths skipped from export and sync-back.
llms: (top-level) / step llm: / reasoning_effort: Named LLM profiles, each a full LlmConfig; a step selects one whole with llm: <name>. reasoning_effort (low/medium/high/xhigh/none) is opt-in on the llm block, a profile, or a step. See reasoning effort.

Isolation

The isolation: section is optional (opinionated defaults apply when absent):

isolation:
  image: ghcr.io/org/custom-dev@sha256:...  # override (digest required)
  memory: 4g              # execution-container memory cap
  cpus: 2                 # execution-container cpu cap
  allow_git_mutations: false
  state_dir: ~/.fabriek/state   # host-side caches + audit (never mounted)
  • env: (per step) - VAR: value sets it in the sandbox; VAR: null inherits the host value. The sandbox env is the fixed safe base (PATH/HOME/LANG/LC_ALL/TERM) plus declared vars only - the global env_allowlist never leaks in and the LLM key is never auto-added. Inside sandbox steps, the literal token {export} in a declared value is replaced with the container-side path of the export/workspace root, so recipes can point absolute-path tool env vars (e.g. CARGO_HOME: '{export}/.cargo-cache') at bind-mounted cache directories.
  • setup: (command and agent steps) - a trusted author command (e.g. python -m venv .venv-sandbox && .venv-sandbox/bin/pip install -e ".[dev]") that runs fresh at the step boundary in a one-shot provision container with network ON, before the step's first turn, targeting the per-run export (never the real workspace). Setup outputs land in the export and are visible to the step's exec container immediately. Steps without setup: trigger nothing; brief and action steps reject setup: at load.
  • rerun_on_resume: (command steps) - a command step marked rerun_on_resume: true runs first on a resumed run when it sits before the resumed step, and control then jumps to the resumed step without running the steps in between. Use it to rebuild build output that lives outside git (such as a virtualenv created by an earlier restore step), which a fresh export does not carry. It has no effect on a fresh run.
  • network: (command, agent, and sandbox-action steps) - network: true runs the step in a bridge-network container whose traffic is forced through the engine-run per-policy egress proxy and reaches only the step's egress: allowlist (--read-only, --cap-drop ALL). Default is false - every step stays network-off unless it opts in. The host-side built-in commit action rejects network: (refused once the registry is known).
  • Git mutations are blocked by default inside the sandbox (commit, push, branch/tag create/delete, rebase); reads (status/log/diff) always work. allow_git_mutations: true re-allows them per-pipeline.
  • state_dir (run state) defaults to ~/.fabriek/runs/<pipeline-hash>/ - the checkpoint DB and last-error.md live there, outside the workspace mount, unreachable by the sandbox. An explicit state_dir: keeps working unchanged; pointing it inside the workspace is an author-accepted exposure.

Fanout run metadata

A run started under fabriek fanout records five informational values in its checkpoint: the fanout id, the repo display name, the resolved repo-root path, the worktree branch, and the document source slug. They drive the Runs repo filter and the per-repo Stats aggregation and nothing else: they do not participate in checkpoint selection, state-dir hashing, resume, or pipeline behavior. Older checkpoints have none of these keys and render blank repo fields, aggregating under (unattributed) in Stats; there is no migration or backfill, and resume does not rewrite them.

Mounts and egress

Per-step workspace isolation: a step mounts only what its mounts: declares (strict-by-default - empty/missing mounts: mounts nothing), and a network: true step reaches only the hosts its egress: allowlist names.

steps:
  - name: dev
    agent: dev
    mounts: [{path: ".", mode: rw}]          # source + tests rw for this step

  - name: restore
    command: .venv-sandbox/bin/pip install -e ".[dev]"
    network: true
    mounts: [{path: ".venv-sandbox", mode: rw}]
    egress: { presets: [package-registries] }   # pypi/npm/NuGet/cargo + VCS

  - name: review
    agent: review
    mounts: [{path: ".", mode: ro}]          # read-only review
  • mounts: - a list of {path, mode} entries. path is repo-relative (no absolute paths, no .. traversal, never .git or a host-only dir, and never state_dir); mode is rw or ro (default ro). Strict-by-default: an empty/missing mounts: mounts nothing. A . entry mounts the whole export with its mode; subpath entries mount the export root read-only and add a writable submount for each declared-rw path (declared-writes). Only declared-rw paths sync back to the real repo after the step. A malformed declaration fails loudly at load, naming the step.
  • egress: - {class, presets, targets}. class: browser is the explicit broad-but-logged browser class (every connection logged, nothing filtered); the default is a strict allowlist. presets: references an engine-shipped preset (package-registries today); targets: adds explicit host/host:port entries. An allowlist miss denies the connection at the engine-run egress proxy and logs an enforcement event. The engine never adds an undeclared target, and an unknown preset or malformed target fails load.
  • network: routes through a per-policy egress proxy (the container is pointed at it via HTTP_PROXY/HTTPS_PROXY and reaches it through the host.docker.internal host-gateway mapping); it does not mean unrestricted egress. The host-side built-in commit action rejects mounts:/egress:/network: (refused once the registry is known).

Companion repositories

A pipeline can declare sibling repository checkouts as named, read-only companions and let a step opt in, so agents and scripts can read shared service code instead of re-inventing its types:

companions:
  platform:
    path: ${FABRIEK_COMPANIONS}/platform
    description: Canonical request and event types shared by the services

steps:
  - name: dev
    agent: dev
    companions: [platform]
  • Declaration. Top-level companions: maps a name to {path, description}. Names match ^[a-z0-9][a-z0-9_-]{0,63}$; description is optional, single-line prompt text. There is no mode: field: companions are always read-only.
  • Path forms. ${VAR} expands from the process environment (the recommended form, because every run executes in an engine-owned worktree, so an environment-rooted path is stable); ~ expands to the home directory; a relative path resolves against the pipeline file's directory; an absolute path passes through.
  • Validation. Every declared companion resolves at run start and under --dry-run, even when no step references it. A path that does not exist or is not a directory, the filesystem root or home directory, a path that overlaps the workspace or either state directory, and a path containing :, a newline, or another control character all fail loudly, naming the companion.
  • Opt-in. Agent, command, and sandbox-action steps may list companions: by name. Brief steps and a step's setup: hook cannot; the host-side commit action rejects companions once the registry is known.
  • Mount. Each opted-in companion is mounted at /companions/<name>, independent of its host checkout location. Agent messages list every opted-in companion with that path and its description; command and sandbox-action steps read the path directly.
  • Read-only. Companions are never written, are never part of the export, and are never synced back. Nothing under /companions belongs to the task repository, its diff, or its commits.
  • Secrets. The whole directory is visible inside the sandbox, including .git. Do not point a companion at a tree that holds secrets.

doctor and run-status load the config but do not resolve companions, so they keep working when a checkout is absent. --dry-run is the preflight: it resolves every companion and fails on the same path errors as a run.

Per-stage networking

The sandbox is network-off by default. A step that legitimately needs egress declares network: true and names exactly what it may reach:

steps:
  - name: fetch-docs
    command: curl -fsSL https://example.com/spec.json -o spec.json
    mounts: [{ path: ".", mode: rw }]      # the cwd + a place to write spec.json
    network: true                          # egress for this step only
    egress: { targets: [example.com] }     # ...and only these hosts

  - name: restore
    command: .venv-sandbox/bin/pip install -e ".[dev]"
    mounts: [{ path: ".", mode: rw }]
    network: true
    egress: { presets: [package-registries] }   # pypi/npm/NuGet/cargo + VCS
  • network: true is scoped by the egress: allowlist, structurally: the step's traffic is forced through a containerized egress proxy on a per-run internal docker network with no route to the host, and a request to an undeclared host is denied and logged. egress: { class: browser } is the explicit broad-but-logged class (every connection logged, nothing filtered); otherwise the allowlist is strict.
  • A networked step that writes output must also declare a writable mount: with no mounts: a step mounts nothing, so curl ... -o spec.json has no writable cwd.
  • Host services are reachable through the proxy's host.docker.internal host-gateway alias, so an S3 SDK against a local MinIO works through the enforced, logged path. Sandbox containers have no host route.
  • Command, agent, and sandbox-action steps may declare it; the host-side commit action never takes it. Author opt-in is the control - reserve it for stages that need it (QA, integration).

Caches and sync-excludes

Two top-level, run-wide lists declare which host-side stores are toolchain caches and which paths are scratch (never copied into the export, never synced back). Both default to [].

caches: [.nuget-packages, qa/node_modules, qa/.browsers]
sync_excludes: ["**/bin/**", "**/obj/**"]
  • caches: - repo-relative toolchain cache dirs resolved host-side to {state_dir}/caches/<name> (content-addressed, shared across runs and repos) and bind-mounted rw into the export at the same relative paths. The host dir is created at startup (a missing workspace path is fine) and becomes the mount source; caches are never synced back. Validation rejects traversal, absolute paths, .git, and a step mount under a cache (the rw cache submount would defeat a declared ro mount there). A whole-tree . mount stays fine - the cache submount layers on top. Declaring a cache on a gitignored path (e.g. node_modules) is the normal, correct case.
  • sync_excludes: - scratch paths. A literal entry (no wildcard) excludes the dir and everything under it (qa/.artifacts). A wildcard entry is fnmatch on the full posix relpath, and * spans path separators, so **/bin/** matches a literal /bin/ segment at any depth and *.dll matches at any depth. Excluded paths are skipped in both snapshots and never classify as added/modified/deleted - no copy-back, no deletion mirroring, and no churn from host-side build-artifact drift. They are also skipped at export materialisation (no bind-mount), so a step cannot read pre-existing excluded content: in-sandbox builds are clean builds. Put the reusable part (restore inputs) in caches: instead.
  • Artifact shadowing footgun: a step's artifact:/produces: path that matches a sync_excludes: entry will never sync back. Load warns (non-fatal) naming the step and path - wildcard overlap is fuzzy, so it is a warning, not a hard failure.

Sync-back

Every run executes in its own git worktree (see the CLI), and that worktree is engine-owned: sync-back itself is the only writer to its working tree. A conflict is therefore impossible, and sync-back applies one rule per path, only to declared-rw paths:

  • present in the export, absent in the worktree: added
  • absent in the export, present in the worktree: deleted
  • present in both but different: modified
  • identical: no-op

.git, bind-mounted caches, and declared sync_excludes: are never touched. The 036 lane boundary still applies: a path outside the active unit's engine-allowlist.yaml fails the step before anything is copied.

Landing a run. Tooling paths (aidlc-docs/, tools/) are excluded from the loop commit, so the loop's per-run appends (for example the AI-DLC audit log) sync back into the run worktree as uncommitted tooling-path drift. Inside the worktree, commit that drift (and any other tooling-path change the run produced), then open the loop/fanout/<slug> branch as a pull request. Merges to origin/main are blocked; every change lands through review. Commit the drift before any re-run: a reused worktree with dirty tooling paths is refused.

Dependency policy (locked by default)

The supply-chain dial is a pipeline-level deps_policy: field, locked by default. The engine injects the policy into every agent step's context:

deps_policy: locked    # or: open    (default: locked)
lockfiles: [uv.lock]   # or: [packages.lock.json, package-lock.json]
  • locked - the human-owned lockfile is the source of truth; the agent may not add dependencies. If the design requires a missing dependency, the agent declares it in its final response under ## Missing dependencies, which fails the run fast with one human lockfile edit - not a retry loop.
  • open - the agent may add exact-pinned manifest entries directly (never a package-manager add command); the network-on restore step fetches them.

A locked pipeline with no lockfiles: entry fails fast at load. The restore step runs the toolchain's locked mode and fails when the manifest and lockfile disagree:

Toolchain Locked restore Lockfile
.NET dotnet restore --locked-mode packages.lock.json
node npm ci package-lock.json
python uv sync --locked uv.lock

The restore step also fails on known-CVE findings (per-toolchain thresholds: NuGetAudit at error, npm audit --audit-level=high, pip-audit). A human generates the lockfile once, on a network machine, and commits it - the engine never fetches on the agent's behalf.

Banned commands (forbidden_commands:)

forbidden_commands: is a per-step list of regex patterns checked against every agent command before any shell spawn; a match returns a structured [forbidden: <label>] observation instead of running. The engine defaults (git mutations and docker) always apply and have no disable switch; a toolchain profile may add tool-specific rules (for example the python recipe denies pip install, uv add, and pip-compile on agent steps). Command steps bypass the filter by design.

Reasoning effort (opt-in)

reasoning_effort is an opt-in latency dial on the pipeline llm block, a named llms: profile, and individual agent steps. Unset means reasoning is off - the field is forwarded as none and reasoning is stripped from requests. A thinking model without an effort level is invalid config and fails fast with an actionable engine error rather than a provider 400. A step's value overrides the effective profile's value.

Recommended lane defaults (guidance only, not enforced):

Lane reasoning_effort Why
brief medium digest and classify, no design work
dev high the most demanding construction work
qa medium classification discipline must stay reliable
review xhigh highest stakes: a missed detection sails past the last gate into commit

Secrets

Secret values never belong in the pipeline yaml, the workspace, or state_dir. Declare the refs at the top level and opt each step into the refs it needs:

secrets:                              # refs only - never values
  kinde-client-secret:
    from: env                         # provider name (env ships first)
    key: KINDIE_CLIENT_SECRET         # host env var to read + step env name

steps:
  - name: qa
    command: ./qa/run-against-kinde.sh
    secrets: [kinde-client-secret]
  • Resolution is host-side, once, at run start. The env provider reads the named host environment variable. A missing variable fails fast naming the ref, the declaring step(s), and the provider error. There is no silent degradation.
  • Injection is per step. A resolved value reaches a step's exec env only when that step lists the ref - the same path step env: uses. It never reaches the provision container, state_dir, an agent's context, or any other step.
  • Providers. env and file ship. The file provider reads a host file: key is the file path and json_key selects one string field (the whole file content when absent). A missing file fails fast naming fabriek copilot-login.
  • LLM keys. The llm: block takes exactly one of api_key_env (the existing shape) or api_key_secret (a SecretSpec, file provider usable). Neither or both fails at load. The resolved LLM key joins the run's redaction set.
  • .env* ban. Before anything else runs, the workspace root is scanned for .env* files. Any hit fails fast, naming the files, with the remedy text ("move these values into secrets: refs / host env and delete the files"). The convention fixtures .env.example, .env.template, .env.sample are whitelisted. The ban applies regardless of network: flags - the workspace must simply not contain secrets.
  • Output scrubbing. Every resolved value is scrubbed from captured step output, retry notes, artifacts, and state_dir files before they are written. This is hygiene, not a control: the declaring step's agent has already seen the value in its own env.
  • Prefer a mechanical command step for secret-consuming work so the LLM and the secret never meet; an agent step holds a secret only when its job genuinely requires it. See the migration checklist when converting an existing repo.

LLM profiles

Named profiles let one pipeline carry several LLM lanes (for example a flash model for dev and a stronger model for review). Each profile is a full LlmConfig; a step opts in with llm: <name>, moving model, endpoint, key, and effort default together. The top-level llm: block remains the default for steps that name none. See LLM providers for the provider-side setup.