# Pipeline recipes `machinist init` ships one starter pipeline, [`default.yaml`](../examples/factory/pipelines/default.yaml), so every new install starts simple. When a workflow needs different models, human approval gates, parameterized inputs, linked deploys, or human-only pull requests, copy a recipe into `factory/pipelines/` (legacy `factory/presets/` also remains supported) and run `machinist reload`. Every recipe in [`examples/pipelines/`](../examples/pipelines/) is automatically validated against `factory.Load` in `go test ./examples/...`. ## Recipe gallery Pick the closest match and copy it into `factory/pipelines/`: | Recipe | Best for | Features used | Extra files needed | | --- | --- | --- | --- | | [`cross-model-review.yaml`](../examples/pipelines/cross-model-review.yaml) | Catching blind spots with a second model family | `extends: default`, `after:`, step `harness` / `model` and `run:` override | None (requires `codex` or `agy` on runners) | | [`spec-and-build.yaml`](../examples/pipelines/spec-and-build.yaml) | Larger features where a person signs off on the plan first | `extends: default`, `before:`, `gate:` with `details` and `timeout` | Copy [`agents/spec.md`](../examples/pipelines/agents/spec.md) to `factory/agents/spec.md` | | [`ship-and-deploy.yaml`](../examples/pipelines/ship-and-deploy.yaml) | Automatically deploying once a PR merges | `extends: default`, `on_merge:` with `vars` | Copy [`staged-deploy.yaml`](../examples/pipelines/staged-deploy.yaml) too | | [`staged-deploy.yaml`](../examples/pipelines/staged-deploy.yaml) | Staged rollouts with isolated deploy credentials | `runs_on: [deploy]`, `inputs:`, `MACHINIST_MERGE_SHA`, `gate:` | Your `deploy.sh` and `smoke-test.sh` in `factory/scripts/` | | [`release-cut.yaml`](../examples/pipelines/release-cut.yaml) | Parameterized release cuts with downstream handoff | Required & optional `inputs:`, `gate:`, `trigger:` step | Copy [`staged-deploy.yaml`](../examples/pipelines/staged-deploy.yaml) too | | [`pr-only-observe.yaml`](../examples/pipelines/pr-only-observe.yaml) | High-sensitivity repos or trial runs that never auto-merge | `extends: default`, step `run:` override (`MACHINIST_AUTO_MERGE=false`) | None | See [Factory files](factory.md) for the full pipeline syntax and rules, and [Merge policies](merge-policies.md) for tuning `.machinist/merge-policy.md`. ## Cross-model review **File:** [`examples/pipelines/cross-model-review.yaml`](../examples/pipelines/cross-model-review.yaml) Extends the single-agent `default` pipeline with `extends: default`, inserts `review` (running the shipped `review.sh` on a second model family: `harness: codex`, `model: gpt-5-codex`) and `revise` (`revise.sh`) after `implement`, and overrides `merge` to `machinist merge --require-gate` so `review.json` is enforced — without duplicating any scripts or agent prompts. To review with Google Antigravity instead of Codex, change the `review` step to `harness: agy` and `model: gemini-4-neon-high`. See [Extending pipelines and overriding harness or model](factory.md#extending-pipelines-and-overriding-harness-or-model). ## Spec with approval gate **Files:** [`examples/pipelines/spec-and-build.yaml`](../examples/pipelines/spec-and-build.yaml) and [`examples/pipelines/agents/spec.md`](../examples/pipelines/agents/spec.md) Uses `extends: default` and `before: implement` to insert two steps in order before any code is written: 1. `spec` runs `factory/agents/spec.md` to write `$MACHINIST_DIR/spec.md`. 2. `approve-spec` checkpoints the workspace, frees the runner slot, and moves the job to `Waiting` (in the Board's **Review** column with a `Gate` badge). A reviewer reads `spec.md` in the job's **Gate** panel and clicks **Approve** (or calls `POST /machinist/jobs/{id}/approve`) to resume at `implement`, or **Deny** to cancel. Time spent waiting never consumes the pipeline's `timeout`, and setting `timeout: 72h` on the gate also makes the pipeline safe for scheduled automations. See [Approval gates](factory.md#approval-gates). ## `on_merge` staged deploy with `runs_on` **Files:** [`examples/pipelines/ship-and-deploy.yaml`](../examples/pipelines/ship-and-deploy.yaml) and [`examples/pipelines/staged-deploy.yaml`](../examples/pipelines/staged-deploy.yaml) Splits coding and deployment across two pipelines for credential isolation: - `ship-and-deploy` extends `default` and declares `on_merge: { pipeline: staged-deploy, vars: { environment: staging } }`. Once the pull request merges (auto-merged or merged by a person), Machinist idempotently starts a linked `staged-deploy` child job with `MACHINIST_PARENT_JOB_ID` and `MACHINIST_MERGE_SHA` set. - `staged-deploy` pins `runs_on: [deploy]` so only dedicated deploy runners holding deployment credentials can claim it. It checks out `${MACHINIST_MERGE_SHA:-origin/HEAD}`, deploys and smoke-tests `$MACHINIST_INPUT_ENVIRONMENT`, pauses at `approve-production` showing `smoke.md`, and promotes that exact pinned commit to production once approved. Because `staged-deploy` only declares an optional `environment` input (`default: staging`), it can also be run standalone from **New job**, the [run API](run-api.md), or an automation. See [Triggers and `on_merge`](factory.md#triggers-and-on_merge). ## Parameterized `inputs` workflow with `trigger` **Files:** [`examples/pipelines/release-cut.yaml`](../examples/pipelines/release-cut.yaml) and [`examples/pipelines/staged-deploy.yaml`](../examples/pipelines/staged-deploy.yaml) Shows how to parameterize a pipeline with both required and optional `inputs:` and chain a mid-pipeline `trigger:` step: - `release_tag` has no `default:`, making it **required** (callers must supply it in **New job**, `vars` in `POST /machinist/run`, MCP `run_job`, or an automation's `vars:`; omitting it returns `400`). - `environment` defaults to `staging`. - Steps read inputs as `$MACHINIST_INPUT_RELEASE_TAG` and `$MACHINIST_INPUT_ENVIRONMENT`. - After `approve-release` passes, the `start-deploy` step runs `trigger: staged-deploy`, forwarding matching parent inputs (`environment`) without needing network access from the runner sandbox. > [!NOTE] > Pipelines that declare required inputs (inputs with no `default:`) cannot be assigned to > `server.default_pipeline`, `linear.pipeline`, or `github_issues.pipeline` (or their legacy > `preset` aliases), because issue trackers cannot prompt for custom inputs. See [Pipeline inputs](factory.md#pipeline-inputs). ## PR-only / observe workflow **File:** [`examples/pipelines/pr-only-observe.yaml`](../examples/pipelines/pr-only-observe.yaml) Extends `default` and overrides the `merge` step with `MACHINIST_AUTO_MERGE=false machinist merge --without-review --require-gate`. Even when `github.auto_merge: true` is enabled globally in `config.yaml`, jobs on this pipeline: 1. Run `implement`, `publish`, and `merge-gate` as usual. 2. Post the merge-gate judgment comment and outcome label (`merge-gate:observe`, `merge-gate:human-review`, or `merge-gate:tripwire`) on the pull request. 3. Always leave the pull request open in **Review** (`Needs you`) for a person to merge. Use this recipe for sensitive repositories, new team rollouts, or when you want observe mode per job instead of turning off `github.auto_merge` globally. If you do not want merge-gate evaluation or comments at all, define a pipeline whose steps end at `publish`. ## Installing and reloading recipes ```sh cp examples/pipelines/cross-model-review.yaml factory/pipelines/ machinist reload ``` `machinist reload` validates the updated factory and activates the new pipeline immediately without restarting the control plane or interrupting running jobs.