Skip to main content

Code Mode pipelines

Declare the steps a Code Mode session runs in .schemabounce/pipeline.yaml: planning, checks, reviews and approvals, and which of them can block a push.

A pipeline is the ordered list of steps a Code Mode session runs in your repository. You write it in .schemabounce/pipeline.yaml. The platform runs the steps in order and decides whether the work may be pushed. The agent cannot declare a gate passed.

Four kinds of step exist. Everything else is configuration of those four.

KindWhat it doesCan it block the push?
turnThe agent works in a role you describe and writes named artifacts.No
checkRuns shell commands in the work container. Pass or fail.Yes, when a command is blocking
reviewGrades the work against criteria with thresholds.Only a fresh review
approvalParks the session until a person approves, edits or rejects.Yes, always

A repository with no .schemabounce/ folder gets one step, implement, and nothing gates the push. Add a pipeline when you want planning, tests or sign-off to be part of every session.

A minimal pipeline​

apiVersion: schemabounce.com/v1
kind: RepoPipeline
pipeline:
- uses: implement
- name: tests
uses: check
commands:
- { name: unit, run: npm test }

The agent does the work, then tests runs npm test. If it fails, the agent gets the output in a fix turn and tests runs again, up to 2 times. After that the session ends failed.

Every step has a unique name: lowercase letters, digits, dashes and underscores, 40 characters at most. A step without a name is named after what it uses (implement, then implement-2).

A fuller pipeline​

This one plans twice, designs the screens, asks a person to sign off, then implements each planned unit with its own check. Three whole-repository checks and two reviews follow.

apiVersion: schemabounce.com/v1
kind: RepoPipeline
setup:
- { name: install, run: npm ci }
pipeline:
- name: architecture
uses: plan
guidance: Decide the approach in a few sentences. Name the modules you will touch.
- name: ui-design
uses: platform/designer
with: { output: screens }
reads: [architecture]
- name: breakdown
uses: plan
reads: [architecture, ui-design]
maxUnits: 6
- name: sign-off
uses: approval
reads: [architecture, ui-design, breakdown]
onReject: { goto: breakdown }
- forEach: breakdown.units
steps:
- uses: implement
- name: unit-check
uses: check
commands:
- { name: unit-tests, run: npm test -- --related }
- name: types
uses: check
commands:
- { name: tsc, run: npx tsc --noEmit }
onFail:
retry: { maxAttempts: 3 }
then: hold
- name: lint
uses: check
commands:
- { name: eslint, run: npx eslint . }
- { name: prettier, run: npx prettier --check ., severity: advisory }
- name: e2e
uses: check
commands:
- { name: smoke, run: npx playwright test smoke, timeout: 15m }
artifacts: [playwright-report]
- name: self-review
uses: review
context: shared
criteria:
- { name: matches-ticket, threshold: 0.7 }
- name: final-review
uses: review
context: fresh
criteria:
- { name: correctness, threshold: 0.8 }
- { name: tests-cover-change, threshold: 0.7, blocking: false }
complete:
endpoint: pr

What the keys do:

  • setup runs once before the first step. A failed setup stops the session.
  • reads names earlier steps whose artifacts this step receives. An approval must read something.
  • forEach: breakdown.units repeats its steps once per unit of an earlier plan step. It cannot nest.
  • when: { paths: [...] } skips a step unless the session changed matching files.
  • optional: true keeps a step out of the gate and out of the honesty rule below.
  • budget: { time: 15m, spendUsd: 2 } caps one step inside the session's own cap.
  • artifacts lists files a check keeps as evidence.
  • complete.endpoint is branch (push the branch, the default) or pr (open a pull request). merge is refused.

In a pipeline, a command blocks by default. Mark one severity: advisory to report it without failing the step.

Built-in steps and uses:​

uses: accepts three kinds of reference.

ReferenceResolves to
turn, check, review, approvalThe primitive itself. Configure it inline.
plan, implement, platform/designerA platform built-in.
repo/<name>.schemabounce/steps/<name>.yaml in your repository.
workspace/<name>[@n]A step in the workspace step library.

plan is a read-only turn that splits the ticket into units. implement does the work, or the current unit inside a forEach. platform/designer is a read-only turn that describes the screens a change touches; its output parameter says what to design. Anything else is refused with the list of valid names.

uses: also accepts workspace/<name>[@n] for a step in your workspace's step library. Marketplace steps (market/...) are not available yet.

A step definition file​

A definition is a reusable step. The file name must match name, and kind is StepDefinition.

# .schemabounce/steps/api-designer.yaml
apiVersion: schemabounce.com/v1
kind: StepDefinition
name: api-designer
primitive: turn
description: Describe the API surface before any code is written.
readOnly: true
with:
surface:
default: HTTP endpoints
description: What to design.
role: |
You design the {{ with.surface }} this ticket needs. List each one with its
request, response and error cases. Do not edit files.
produces:
- { name: design, path: design.md, schema: design/v1 }
# .schemabounce/steps/security-review.yaml
apiVersion: schemabounce.com/v1
kind: StepDefinition
name: security-review
primitive: review
context: fresh
criteria:
- { name: no-secrets-logged, threshold: 0.9 }
- { name: input-validated, threshold: 0.8 }

Use them from the pipeline:

apiVersion: schemabounce.com/v1
kind: RepoPipeline
pipeline:
- name: api-design
uses: repo/api-designer
with: { surface: REST endpoints }
- name: build
uses: implement
- name: tests
uses: check
commands:
- { name: unit, run: go test ./... }
- name: security
uses: repo/security-review

Passing a with: key the definition does not declare is an error, as is leaving out a parameter marked required: true. A step can add commands or criteria to its definition, but not reuse a name the definition already has.

A definition is text and settings. It narrows what the agent may do (tools.deny, tools.ask) and never widens it. It cannot carry a plugin.

When a step fails​

A failing check or review does not end the session at once. The default:

  1. The agent gets the failing output or critique in a fix turn.
  2. The same step runs again.
  3. After 2 attempts (the default), the step's then applies.

Change this with onFail:

- name: e2e
uses: check
commands:
- { name: smoke, run: npx playwright test smoke }
onFail:
retry: { goto: build, maxAttempts: 3 }
then: hold
  • retry.maxAttempts sets the attempts. The platform ceiling is 5; a higher number is clamped.
  • retry.goto replays the pipeline from an earlier turn in the same block instead of fixing in place. It must name a turn step.
  • then is what happens when the attempts run out. fail ends the session as failed (you can continue it). hold parks the session for the owner to decide. continue reports the failure and moves on.

A step that gates the push cannot choose continue. fail is the default for a gating step. A shared review defaults to continue.

For an approval, onReject: { goto: <step> } sends the person's note back to an earlier step.

When a sandbox limit stops a check​

The platform gives the Node commands it runs a heap of half the sandbox memory, unless the command's env sets NODE_OPTIONS. Set NODE_OPTIONS on a step (for example --max-old-space-size=3072) when a heavy check such as tsc needs a different limit.

When the sandbox stops a check, the session labels that check with the cause and shows a one-sentence fix beside it. If the session then ends because required checks did not pass, the failure notice names the checks a sandbox limit stopped. A check that fails without a label failed on its own.

LabelWhat happenedHow the platform knows
Sandbox ran out of memoryThe command was killed for memory, or Node hit its heap ceilingThe kill signal; Node's own error
Command hit its time limitThe command ran past its timeout (30 minutes at most)The platform stopped it
Sandbox ran out of diskA scratch directory filled upThe disk watch stopped it, or the command reported no space left
Network call refused by the sandboxThe command reached for a host outside the allowlistThe sandbox proxy's refusal in the output
Wrote to a read-only pathIt wrote outside the checkout, your home directory and /tmpThe command's error
Sandbox process limit reachedIt started more processes or threads than allowedThe command's error
Too many open filesIt opened more files than allowedThe command's error
Not supported in the sandboxIt used a system call the sandbox does not provideThe command's error
Needs privileges the sandbox does not grantIt needed root, sudo, a mount or an ownership changeThe command's error
Tool not available in the sandboxIt called Docker, Kubernetes or a system serviceThe command's error

The platform sees a timeout, a disk-watch stop and a memory kill itself. Every other label is read from the command's error, so treat it as a strong hint: a command can print the same text for another reason.

Reviews: shared and fresh​

context decides who judges.

shared (default)fresh
Where it runsInside the session, in the agent's own contextIn an isolated reviewer, separate from the session
Blocks the pushNeverYes
Can prove a plan criterionNoYes
Use it forAdvice the agent can act onThe verdict you trust before a push

A verdict produced inside the coder's sandbox is not trustworthy, so a shared review only advises.

Choosing the reviewer​

A fresh review can name the engine and model that grade the work, for example Codex reviewing code Claude Code wrote.

- name: final-review
uses: review
context: fresh
engine: codex
model: your-model-id
criteria:
- { name: correctness, threshold: 0.8 }
  • engine is claude-code or codex. gemini-cli is not available yet and is refused.
  • model is required with engine. The platform never picks a model for another engine's reviewer.
  • A model without an engine is refused. A shared review cannot name an engine.
  • With no engine, the review uses the session's own engine, model and credential.

A named reviewer is paid for in this order: the session owner's own connected license for that provider, then workspace credits (billed as the session's spend), then the work waits for the owner. A SchemaBounce-held key is never used.

What a fresh review does today​

The isolated reviewer runs only where the platform holds a reviewer isolation certification. Hosted SchemaBounce does not hold one yet, so today a fresh review does not grade the diff:

  • If the session changed no files, the step passes.
  • Otherwise the session parks and the owner gets a push approval for the exact diff. Approve it and the pipeline goes on. Deny it and the session ends failed with review_rejected.

Once the certification is in place, the reviewer runs on the engine and model you declared. The platform reads them from the pipeline it stored when the session started, so nothing inside the session can change which reviewer grades it.

Plans with proof​

A plan step writes a plan. In a pipeline, each acceptance criterion in the plan names the evidence that proves it. The platform computes "done" from that evidence instead of taking the agent's word.

{
"schema": "plan/v2",
"summary": "Retry failed webhook deliveries with backoff",
"units": [
{
"id": "retry",
"title": "Retry with backoff",
"intent": "Retry a failed delivery 3 times, doubling the wait each time, so a short outage does not drop events.",
"files": ["internal/webhooks/retry.go"],
"acceptance": [
{ "text": "A failed delivery is retried 3 times", "proof": "check:unit-check/unit-tests" },
{
"text": "The wait doubles between retries",
"proof": "check:unit-check/backoff-timing",
"command": { "name": "backoff-timing", "run": "npm test -- backoff", "proposed": true }
},
{ "text": "No secret appears in retry logs", "proof": "review:final-review" }
]
},
{
"id": "docs",
"title": "Document retries",
"intent": "Describe the retry schedule in the webhooks page.",
"docsOnly": true,
"acceptance": [{ "text": "The page states the schedule", "proof": "review:final-review" }]
}
]
}

A proof is one of:

  • check:<step> proves the criterion when the whole check step passes.
  • check:<step>/<command> narrows it to one command of that check.
  • review:<step> cites a fresh review.

The planner is given the list of proofs your pipeline can produce. It can also propose a new command for a check ("proposed": true). A proposed command runs in the work container like any repository command, and the approval card marks it as proposed.

Why a plan is refused​

The planner gets the reason back and tries again. A plan is refused when:

  • A proof names a step or command the pipeline does not have.
  • A proof cites a shared review.
  • A unit has no criterion proven by a check, so nothing runs the code. Mark the unit "docsOnly": true if it changes no behavior, and it may rest on reviews alone.
  • A unit has no acceptance criteria, or more than 8.
  • The plan has more units than the plan step's maxUnits (default 12, ceiling 40).

The proof matrix​

The session page shows every criterion with its status:

StatusMeaning
ProvenThe cited step passed. The evidence links to its recorded result.
FailedThe cited step or command failed.
Waiting on youThe step is held, skipped, or a person's override has no approval on file.
Not run yetThe step has not run, or the code changed after it ran.

A per-unit check keeps its verdict when a later unit changes the code. That criterion shows Proven on an earlier commit. A top-level check counts only on the code as it stands: if the agent changes code after it passed, it runs again before the push.

Review the plan first​

The composer has a Review the plan first switch. It makes the session stop after planning so you approve the plan before any code is written.

  • If the pipeline already has an approval step that reads a plan and comes before any step that writes code, the switch uses it. A step marked optional is turned on.
  • Otherwise the platform adds an approval step named review-plan after the last plan step, reading the plan steps before it.
  • A pipeline with no plan step has nothing to review, and the switch does nothing.

On the approval card you can edit the plan: change units, criteria and proofs. Approve with my edits continues the work from your version. Send back returns the plan to the agent with a note. The card shows problems (an unknown proof, for example) before you can approve.

At least one blocking check​

A declared pipeline.yaml must contain at least one non-optional check with a blocking command, anywhere in the pipeline including inside a forEach. Without one, nothing runs the code before a push, and the file is refused:

pipeline: the pipeline has no non-optional check with a blocking command,
so nothing runs the code before a push (dec-041). Add a check step

A check whose only commands are severity: advisory does not count.

Repositories with workflow.yaml and validate.yaml​

A repository with only the older files keeps working. The platform converts them into a pipeline when a session starts:

  • Plan phases in workflow.yaml become plan steps before implement.
  • The gate in validate.yaml becomes one validate check after implement, retrying with the gate's maxFixAttempts.
  • Review phases become fresh reviews. They already held the work for the owner, so nothing gets less strict.

If pipeline.yaml exists, it wins and the older files are ignored for the steps.

Note that validate.yaml requires severity: blocking or advisory on every step. pipeline.yaml defaults to blocking.

Workspace step library​

The step library holds reusable steps for the whole workspace. Open Code steps in the workspace's Code section (/workspaces/<id>/code/steps). The page has three tabs: the library, the workspace pipeline, and a repository's pipeline.yaml.

A library step uses the same StepDefinition format as a repository file. A pipeline refers to it as workspace/<name> (the newest version) or workspace/<name>@<n> (a fixed version).

pipeline:
- name: build
uses: implement
- name: security
uses: workspace/security-review@2
  • Create a step from its YAML. The page validates it before you save.
  • Edit saves a new version. Versions are never changed after they are written, so workspace/security-review@2 always means the same content.
  • Conflicts. A save carries the version it was based on. If someone saved a newer version first, the save is refused with STEP_VERSION_CONFLICT and the editor offers to load the latest.
  • Revert copies an older version forward as a new version. History stays intact.
  • Delete is a soft delete: the name stays reserved and its versions are kept. A step that the workspace pipeline settings use as a required step, or as part of the default pipeline, cannot be deleted. The delete is refused with STEP_IN_USE and says where it is used.
  • Built-in steps (plan, implement, platform/designer and the primitives) are listed read-only with YAML you can copy as a starting point.

Everyone with adl:view can read the library. Only workspace owners and admins can change it, because a library step can run on every session. That is the roles:manage permission. Domain managers and personal access tokens cannot hold it. Every create, save, revert and delete is written to the audit log.

Workspace pipeline settings​

The Workspace pipeline tab sets two things for every Code Mode session in the workspace.

  • A default pipeline. It runs when the repository has no .schemabounce/pipeline.yaml. Without one, the platform default applies: implement, then the checks readiness detected. A repository's own pipeline always wins over the workspace default.
  • Required steps. Up to 8 library steps appended to every session's pipeline, after everything else. A required check usually runs last, so nothing placed behind it could change code it approved.

A repository cannot remove or reorder a required step, because it is added after the repository's file is read. A session cannot switch one off, and nothing can be inserted after one.

The order a session's pipeline is built in:

  1. The repository's pipeline.yaml, else the workspace default, else the platform default.
  2. The workspace's required steps, appended last.
  3. The session's own adjustments (next section).

The settings are saved only if the resulting pipeline is valid, including the rule that it needs at least one blocking check. Saving needs roles:manage. Reading needs adl:view.

The settings response includes a read-only pipelinesEnabled flag. When it is false, the control plane does not resolve pipelines at all, so required steps and defaults do not apply, and the console says so.

Adjust a pipeline for one session​

The person starting a session can change its pipeline without touching the repository. The composer shows the resolved pipeline with a switch for each optional step and a way to add library steps.

The same adjustments go in the pipelineAdjustments field of the session create request:

{
"pipelineAdjustments": {
"disable": ["e2e"],
"add": [
{
"name": "security",
"uses": "workspace/security-review@2",
"after": "build",
"with": { "focus": "auth" },
"reads": ["build"]
}
]
}
}

An agent passes the same adjustments when it starts a session with adl_start_code_session, within the same limits a person has.

What is allowed:

  • disable switches off steps by name. Only steps marked optional: true can be switched off. A required step, a gating step, or a step another step reads from is refused, and so is a name that is not in the pipeline.
  • add adds a library step for this session. uses is workspace/<name>[@n] or a platform built-in such as platform/designer. Repository steps (repo/...) cannot be added this way. name, after, with and reads are optional.
  • Placement. Without after, an added step goes at the end of the pipeline, still ahead of the workspace's required steps. With after, it goes right behind that top-level step. Naming a required step in after is refused.
  • Limits. At most 16 entries in disable and 16 in add. The whole pipeline still has to fit the 32-step limit.

When the session starts, every added reference is pinned to an exact version, such as workspace/security-review@2, and the definition's digest is recorded with the step. The platform stores the resolved pipeline on the session. Editing the library afterwards does not change it.

If the platform has pipelines turned off, a create that carries adjustments is refused with a 400 PIPELINES_DISABLED rather than dropping them silently.

What Continue, fork and Re-run replay​

  • Continue and fork replay the stored pipeline exactly. They do not read the library, the workspace settings or the repository's pipeline again. They work even if a library step was edited or deleted since.
  • Re-run starts a fresh attempt. It resolves the pipeline again against the current repository, library and settings, using the session's stored adjustments with their pinned versions. If a library step it added was deleted, or the step an added step sat behind has left the pipeline, the re-run is refused with the reason. It never drops the step. Start a new session instead.

Preview the pipeline before you start​

POST /workspaces/<id>/code-sessions/pipeline-preview resolves the pipeline a session would run, without creating one. Send repoUrl (required), baseBranch, reviewPlanFirst and pipelineAdjustments. It needs adl:manage, the same permission as starting a session.

The response holds:

  • pipeline: the resolved steps, in order.
  • optionalSteps: every optional step with its gating and enabled state, which is what the composer switches show.
  • definitionPresent: whether the repository has a .schemabounce/ folder.
  • warnings: problems found while resolving.
  • fetchError: set when the repository's definition could not be read, for example when the git provider answered 403. The pipeline shown is then the workspace default, or the platform default if there is none, and a session started now runs that pipeline. The composer strip says so instead of claiming the repository has no definition.
  • pipelinesEnabled: false when pipelines are off. The preview is then empty.

The preview refuses what a create would refuse: a repository definition that does not parse, or adjustments that cannot be applied.

Run a check on demand​

A check marked onDemand can be run at any time during a session, without waiting for its turn in the pipeline. Checks are on demand by default. Set onDemand: false on a check to turn that off. Turns and approvals cannot be on demand.

There are two ways to run one:

  • From the session page. Choose Run a check and pick a step.
  • From the sandbox. The agent calls the run_step tool with a step name.

Both end up at POST /workspaces/<id>/code-sessions/<session>/run-step with { "step": "<name>" }, which needs adl:manage. It answers 202 and the result arrives as step events on the session stream.

The rules:

  • You name a step of the session's stored pipeline. You never send a command.
  • Only a check marked onDemand runs. Anything else is refused with 422 STEP_NOT_ON_DEMAND. A session with no stored pipeline gets 404 NO_PIPELINE.
  • One at a time. A second request while one is running gets 409 ON_DEMAND_BUSY. A run that never reports back stops blocking after 20 minutes.
  • The session must be running, idle or waiting for an approval. While the pipeline runs a check, or the sandbox is parked, the request is refused with 409 INVALID_STATE and a reason.

An on-demand result is advice. The session page labels it Not proof. It never counts as gate evidence, it never moves the pipeline forward, and the push still waits for the pipeline's own run of that step. Its step events carry onDemand: true.

Step artifacts​

Steps can record small files as evidence: a design document, a report, a screenshot. GET /workspaces/<id>/code-sessions/<session>/step-artifacts lists them with adl:view. Add step (and unit) to narrow the list, or path to fetch one artifact with its content.

  • A session keeps at most 200 distinct artifacts. Recording the same path again replaces it and does not count.
  • Only a step of the session's own stored pipeline can record an artifact, and only under that step's directory.
  • Text is capped at 64 KB and images at 256 KB. Text is redacted for credentials. Content is served only by this route and never appears on the event stream.

Worktrees​

A workspace admin can let agents open git worktrees in sessions SchemaBounce hosts. Open the Code page's settings, choose Hosted runner, turn on Let agents open worktrees and pick how many may be open at once (1 to 4). It is off until you turn it on, and sessions on a trusted runner never get it.

With it on, the agent has four more tools: worktree_create, worktree_list, worktree_merge and worktree_remove. A worktree is a second checkout of the repository on its own local branch, outside the session's checkout, so the agent can work on independent parts of a task side by side, for example one per parallel subagent.

The rules:

  • The agent names a worktree. The platform runs every git command. Worktree branches never leave the sandbox: only the session's own branch is pushed.
  • When a step ends, the platform merges every open worktree into the session's branch and closes it, before the step's result and checkpoint are recorded. A worktree never outlives the step that opened it.
  • On a conflict the agent gets a turn to settle it, and the platform checks that no conflict marker is left before it commits the merge. If two turns cannot settle it, the session fails rather than losing the work in silence.
  • A push, a landing or a fresh review is refused while a worktree is open.
  • The limit is pinned in the session's pipeline when the session starts. Changing the setting applies to sessions started after it.
  • Worktrees need the session to run a pipeline. A workspace with worktrees on runs even the platform default as one.

The session page's Definition tab shows the limit, and the timeline shows each worktree opened, merged, closed or discarded.

Verify after the deploy​

A pipeline that lands on development can add a top-level verify: block. After the change lands, the session waits for your CI to deploy it, runs the block's steps against the deployed environment, and fixes forward on failure. See Deploy verify.

See the effective pipeline​

Open a session's page and choose the Definition tab. It lists the steps in the order they run, after defaults, limits and legacy conversion, and shows each step's result as the session goes. A session keeps the pipeline it started with, so editing pipeline.yaml later does not change a running session.

To see the pipeline before a session exists, use the composer's pipeline strip, which is backed by the preview. To check a repository before you start a session, use the readiness grader described in Code Mode on your machine.

Limits​

Going over a limit is an error for structure and a clamp with a warning for counts. These come from the platform.

LimitValue
Steps in one pipeline, nested steps included32
Step definition files in .schemabounce/steps/32
Commands in one check16
Setup commands8
Criteria in one review12
reads on one step16
with parameters on one step or definition16
Artifact globs on one check8
Fix attempts5 (default 2)
Plan units40 (default 12)
Acceptance criteria per plan unit8
One command's timeout5 seconds to 30 minutes (default 10 minutes)
Definition role text8,000 characters
Step guidance text2,048 characters
One .schemabounce/ file256 KB
Worktrees open at once4 (off by default)

Common questions​

Can the agent skip a check?​

No. The platform stores the pipeline when the session starts and lets a push through only when every gating step in it has passed. The runner reports results. It cannot mark a gate passed.

Why does my shared review never block anything?​

A shared review runs in the agent's own context, so its verdict is not independent. It advises and never gates. Set context: fresh for a review that blocks the push.

Can I use workspace/... or market/... steps?​

workspace/<name> steps work: add them in the step library and use them in a pipeline or as a session adjustment. market/... steps are not available yet.

Does running a check on demand satisfy the gate?​

No. An on-demand run is advice and is marked Not proof. The push waits for the pipeline's own run of that step.

Are worktree branches pushed?​

No. Only the session's own branch is pushed. The platform merges each worktree into it when the step ends, so the checks, reviews and landing see all of the work on one branch.

Continue exploring