Pipelines

A pipeline is a named list of steps in .shipyard.yaml. Each run goes through the queue, executes the steps in order and writes every step's result to the run log.

Step type Does Keys
diagnostic Confirms the project is configured and enabled. —
prometheus Runs a named PromQL instant query. source
health Lists the project's latest health check results for the next step. Runs on this Shipyard, not on ships. —
ai_text Sends a prompt to the model for a role. task, prompt, optional fallback
agent Runs Claude Code in a repository directory. agent: claude-code, workdir, prompt, optional ref, args
merge Merges the pull request an earlier agent step opened, once the project's merge gate passes. Off unless the project sets auto_merge: true. source

Every step has an id and an optional timeout (default 2m, at most 15m; agent steps default to 2h, at most 12h). A run's time budget is the sum of its step timeouts, at least 15 minutes and at most 24 hours. A failed step stops the pipeline. A pipeline has 1 to 20 steps.

1. Local project check — no AI credentials

pipelines:
  project-check:
    steps:
      - id: validate-config
        type: diagnostic
        timeout: 30s

Confirms the project's configuration and records the result. Needs no AI credentials.

2. Prometheus observation

prometheus:
  production:
    url: https://prometheus.example.com
    token_env: PROMETHEUS_TOKEN
    query: 'up{job="my-project"}'
pipelines:
  observe-production:
    steps:
      - id: validate-project
        type: diagnostic
      - id: collect-metrics
        type: prometheus
        source: production
        timeout: 15s

The query result is written to the run log. A failed query, an error status or a response with warnings fails the step.

3. Article draft with a different reviewer

pipelines:
  article-draft:
    steps:
      - id: write
        type: ai_text
        task: writing
        prompt: "Draft an article about ${input}. Use only supplied facts; list missing evidence."
        timeout: 2m
      - id: review
        type: ai_text
        task: verification
        prompt: "Review this draft and return a corrected version: ${previous}"
        timeout: 2m

writing and verification resolve through ai.tasks and the project's models override, so the draft and the review can use different models. ${input} is the run input; ${previous} is the previous step's output. They are filled once — placeholder text inside the input is passed on as written. Prompts go to the provider as text, never to a shell. AI calls can cost money.

4. Usage limits: fallback, wait or skip

Models and agents run out of quota. Shipyard notices — an HTTP 429 with its reset headers from the API, or Claude Code's "You've hit your session limit · resets 3:45pm" — and decides per step:

pipelines:
  article-draft:
    steps:
      - id: write
        type: ai_text
        task: writing
        prompt: "Draft an article about ${input}."
        fallback: [local-writer, haiku]   # tried in order when the model is limited
      - id: review
        type: ai_text
        task: verification
        prompt: "Review: ${previous}"
        on_limit: skip                    # carry on without this step
  • fallback — model aliases from ai.models, tried in order when the step's model is limited.
  • on_limit: wait (default) — when every model is limited, the run is parked as Waiting until the earliest reset and continues by itself. Other runs keep going; only runs that need a limited model wait.
  • on_limit: skip — the step is skipped and the pipeline continues; ${previous} keeps the last output.

A resumed run never repeats finished steps: their saved output is reused. Shipyard remembers which model is limited until when, so the next run goes straight to the fallback. The console shows the blocks above the run list.

5. Coding agent with Claude Code

agents:
  claude_code:
    binary: claude            # default; absolute path if not on PATH
pipelines:
  fix-issue:
    steps:
      - id: code
        type: agent
        agent: claude-code
        workdir: /srv/repos/ssg
        prompt: "Fix the issue described here and run the tests: ${input}"
        timeout: 3h
        args: [--permission-mode, acceptEdits, --max-turns, "40"]

Shipyard runs claude -p in workdir with a fixed session ID and the args you set — add the permission flags your setup needs; Shipyard adds none on its own. When Claude Code reports a usage limit, the run waits until the reset printed in the message and then continues the same conversation with --resume, so the agent picks up where it stopped. The step's output is the agent's final answer.

Run agent steps on a ship dedicated to that repository rather than on the Shipyard machine: the agent edits files with that machine's permissions. Log Claude Code in on that machine (or set ANTHROPIC_API_KEY in its environment) before the first run.

Checkout per run

      - id: code
        type: agent
        agent: claude-code
        workdir: /srv/repos/ssg   # a git repository
        ref: main                 # branch, tag or commit
        prompt: "Fix the issue described here and run the tests: ${input}"

With ref, the agent does not work in workdir. Shipyard resolves ref to a commit when the step first starts and gives the run its own working tree at that commit. Your working tree, branches and uncommitted changes in workdir stay as they are, and two runs never share files.

  • The commit is pinned. A run that waits for a usage limit, or is repeated, continues at the same commit even when the branch has moved. The run log names the commit.
  • The tree lives as long as the run. A waiting run keeps it with the agent's changes; it is removed when the run succeeds or fails.
  • The tree is a separate repository that reads history from workdir and has no remote, no branches and none of your hooks. What the agent commits stays in the tree.
  • ref is read from workdir as it is. Shipyard does not fetch; update the repository yourself to start from newer code.
  • Trees are kept in agents.claude_code.checkouts (default: shipyard/checkouts in the account's cache directory); on a ship, ship run -checkouts DIR.
  • Needs git 2.31 or newer on the machine that runs the step. Submodules and Git LFS files are not checked out.

A ship older than this feature ignores ref and runs the agent in workdir; upgrade ships before you set it.

Draft pull request

      - id: code
        type: agent
        agent: claude-code
        workdir: /srv/repos/ssg
        ref: main
        prompt: "Fix the issue described here and run the tests: ${input}"
        pull_request:
          enabled: true
          base: main              # optional; default is the repository's default branch
          title: "Fix the parser" # optional

With pull_request, Shipyard publishes the files the agent changed in its checkout: one commit on a new branch agent/<run ID>-<step ID> and a draft pull request into base. A person reviews and merges it.

  • Needs ref, the GitHub App (github_app) with contents: write and pull_requests: write, and a step that runs on the Shipyard machine. A ship refuses the step.
  • The agent gets no GitHub token. Shipyard sends the changes itself after the agent has finished. It only creates the new branch; it never moves a branch, merges, or writes to base.
  • The commit you started from must be on GitHub. The new commit has the pinned commit as its parent.
  • What counts is the files, not the agent's commits. .gitignore applies. An agent that changed nothing opens no pull request and the step still succeeds.
  • The description names the run and quotes the agent's final answer in a code block. Shipyard runs no tests.
  • A repeated attempt opens no second pull request. The run remembers its branch and pull request and finds them again after a crash or timeout.
  • The run shows its branch and pull request in the console and as branch and pull_url in the API. The patch and the pull request details are kept as artifacts.

Merge after review

projects:
  - id: my-app
    auto_merge: true
    merge:
      method: squash
      required_checks: [test]

pipelines:
  fix:
    steps:
      - id: code
        type: agent
        # … as above, with pull_request
      - id: land
        type: merge
        source: code

A merge step merges the pull request of the step named in source. It is off by default: without auto_merge: true on the project the step leaves the pull request to a person.

  • Everything is checked for the pull request's current head commit. The base branch must be protected on GitHub, every required check must have passed, and the configured number of owners, members or collaborators must have approved that commit. A commit pushed after an approval makes the approval stale.
  • A person still reviews. Shipyard opens drafts; someone marks the pull request ready and approves it.
  • Pending means waiting, broken means failed. A missing or running check, a missing approval or a draft parks the run as waiting; it is checked again every 5 minutes for merge.wait (default 24h). A failed check, a change request, a conflict or an unprotected base fails the run.
  • GitHub's branch protection still applies. The merge names the commit that was checked, so GitHub refuses it when the head moved or a rule is not met.
  • Needs the GitHub App with contents: write, pull_requests: write, checks: read and statuses: read, and a step that runs on the Shipyard machine.
  • Limits: 300 changed files and 20 MiB per step. Changes under .github/workflows are refused by GitHub.

Sandbox

agents:
  claude_code:
    sandbox:
      enabled: true
      read: [/home/op/.nvm]             # optional extra read-only paths
      write: [/home/op/.cache/go-build] # optional extra read-write paths

With the sandbox on, the agent and every command it starts can change only the step's workdir (with ref: only the run's own tree, and it reads the repository's history without being able to change it), a private temporary directory, Claude Code's own state (~/.claude, ~/.claude.json) and the paths in write. It can read the system directories, its own installation, your git configuration and the paths in read. The rest of the home directory, other repositories and Shipyard's data are out of reach.

  • Linux 6.2 or newer (Landlock). No root and no container runtime needed.
  • FreeBSD and macOS: not available. An enabled sandbox fails the step; the agent never runs unconfined.
  • Network, CPU and memory are not limited. Limit those on the service or container that runs the worker or ship.

If a tool the agent needs is installed outside the system directories, add its path to read; add build caches to write.

Run a pipeline

In the console: New run → Pipeline → pick the pipeline and project. Or from the Pipelines view, Run pipeline. API equivalent:

curl -X POST http://127.0.0.1:8080/api/v1/runs \
  -H "Authorization: Bearer $SHIPYARD_API_TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: my-project-check-001' \
  -d '{"project_id":"ssg","kind":"pipeline","task":"project-check","input":""}'

Reusing the idempotency key returns the run already queued. One run per project executes at a time; others wait in the queue.

If Shipyard stops mid-run, diagnostic runs are picked up again (up to three attempts). Pipeline and AI runs are marked failed instead, so a paid model call is never repeated without you — use Retry.

The log records each stage's start and output and ends with pipeline completed. Messages over 16 KiB are truncated.