The pipeline file
A pipeline is a TypeScript file named for the pipeline, such as pipelines/bug-fix.ts for bug-fix. It lives in a repo on the forge, under pipelines/ on the default branch. It exports one pipeline as its default export. It imports types only, with import type, because the server loads each version from its stored source, outside the repo. The types come from shared/pipeline.ts.
Pipeline fields
Section titled “Pipeline fields”descriptionis the sentence shown on the pipeline’s page and in the pickers.agentnames the agent whose sessions run the agent stages, unless a stage names another. A run cannot start while the team has no unarchived agent with that name.runsOnisboxorhome.boxclaims a box for each run.homeuses the agent’s home machine.spendCapUsdis a number above 0. A run stops once its sessions have cost that much. A repo’s policy can lower it.triggersis a list of the ways a run can start.startnames the first stage.stagesmaps each stage name to a stage.
Triggers
Section titled “Triggers”{ kind: 'manual' }and{ kind: 'webhook' }record that people start the pipeline from the app or another system starts it through its webhook. Agents does not read them. Any pipeline with a working version starts from the app and from its webhook.{ kind: 'forge', event: 'issues', action: 'opened', label?: string }starts a run from a forge issue. With alabel, the issue must carry that label. Without one, the issue must be newly opened.{ kind: 'cron', schedule, title, body?, repo }starts a run on a schedule.schedulehas five fields, minute, hour, day of month, month and day of week, in the server’s local time. Each field takes*, numbers, lists, ranges and steps.repois the forge path of the repo, such asteam/shop. After downtime, the server starts at most one run per schedule, for the latest time that came due in the last day.
Stages
Section titled “Stages”Every stage has next, a map from each outcome the stage can end with to where the run goes. A destination is one of three things.
- A stage name.
{ done: 'succeeded' | 'failed', note }, which ends the run with the note.{ handoff: reason }, which asks a person, as How a run goes describes.
The server requires next to handle every outcome the stage can end with. The outcomes of a stage depend on its kind.
An agent stage is a turn of an agent’s Claude session in the task’s workspace. Its outcomes are the keys of its next.
prompt(ctx)returns the text sent to the agent.agentnames another agent for this stage.modelsets the Claude model for this stage, such ashaikufor cheap reading. The agent’s own model applies when unset.allowlists tools the stage may use without asking a person, in Claude’s--allowedToolsform.maxAttemptssets how many tries before a person takes over. It defaults to 3.playbooksruns the stage inside the playbook plugin, as a person’s coding session does.documentnames a file the agent must leave in the task folder, with the headings it must have, before the stage counts as done.plan: truemarks the file as the plan, which is linted and pinned at its gate.
A check stage runs command(ctx) in the repo’s folder on the run’s machine. It ends as passes on exit code 0 and fails otherwise. It times out after 600 seconds. maxAttempts defaults to 3.
Action
Section titled “Action”An action stage does something the runner does itself. title(ctx) sets a pull request’s title, which is the report’s title by default. text(ctx) sets a pull request’s description or a comment, and is required for open_pull_request, close_issue and ask_reporter. Every action can end as failed.
open_pull_requestpushes the task branch and opens a pull request. Outcomes aredoneandfailed.merge_pull_requestmerges that pull request and marks the run’s proposal approved. Outcomes aredoneandfailed.close_issuecomments on the report’s issue and closes it. Outcomes aredoneandfailed.ask_reportercomments one question on the report’s issue and leaves it open. Outcomes aredoneandfailed.score_changepushes the task branch and scores the one pipeline file it changed on replays. Outcomes arebetter,not_better,refusedandfailed.pick_sessionspicks an agent’s unread sessions. Outcomes arepicked,noneandfailed.record_findingskeeps the findings whose quotes the runner can find. Outcomes areready,waitingandfailed.propose_hunksturns the reported hunks into a proposal. Outcomes areproposed,refusedandfailed.replay_sessionsreplays the turns behind a proposal with and without the change. Outcomes arereplayed,unscoredandfailed.decide_replaysscores both versions from the judge’s verdicts. Outcomes arebetter,not_betterandfailed.settle_hunksrecords the decision on every hunk and applies the kept ones. Outcomes areapplied,declinedandfailed.merge_changemerges on a repo with a policy. Outcomes aredone,staleandfailed.deployasks the deployer to release what the run merged. Outcomes aredone,rolled_backandfailed.
How coach and improve prove a change explains the learning actions. Run a change through a repo policy explains merge_change and deploy.
A gate stage waits for a person and ends as approved or rejected. question(ctx) returns the text shown. labels names the two buttons with approve and reject when those words would not say what happens. role is one of plan, protected, suite, merge or deploy, and applies only on a repo with a policy.
Coding framework stages
Section titled “Coding framework stages”Five more kinds run only on a repo with a policy. The runner, not an agent, decides how each ends.
routehas an agent pick a playbook. Its outcomes are the playbooks named innextthat the policy allows, fromchange,bug,docsanddependency.verifyruns the static gates and the box’s commands. Outcomes arepasses,failsandstopped.reviewhas reviewers on other models judge the change. Outcomes areclean,fixandoverruled. It needsreviewers,author,promptandallow.confirmhas a fresh agent check the plan against the change. Outcomes areverified,fixandoverruled. It needsverifier,author,promptandallow.suiteruns the policy’s full suite on the change merged into main. Outcomes arepassesandfails.
What a prompt can read
Section titled “What a prompt can read”prompt, command, question, title and text each receive a context with these fields.
reportis the title, body, and where present the issue number, link and author.openIssuesis the other open issues on the repo when the run started.resultsholds the latest result of each finished stage, with its outcome, summary and data.attemptscounts how often each stage ran.repois the workspace’s first repo as a folder name.taskFolderis the task’s folder for documents.commentsis the open comments on the task’s documents, oldest first.replayis true when the run replays a past one.playbookis the playbook a route stage picked, with its guide, or null.
What the server checks
Section titled “What the server checks”The server loads every version before it can become current. A version that fails any of these shows It does not load and the reason on the pipeline’s page, and is never current.
- The file exports a pipeline whose
stagesis an object. agentis a non-empty string,runsOnisboxorhome,spendCapUsdis above 0, andtriggersis a list.startnames a stage, and everynextdestination names a stage that exists or is adoneorhandoff.- Every stage has a
kindfrom the list above and the fields its kind requires. - Every stage’s
nexthandles every outcome the stage can end with. - A route stage’s
nextnames only the four playbooks. - A gate’s
roleis one of the five roles, and adocumenthas a path, headings and aplanflag.