Skip to content

Pipeline

llms.txt lists every page for an agent

A member’s pipeline is the file .chant/pipeline.ts beside its chant.config.ts. It folds to a spec of kind chant.pipeline/v1, which chant build writes to .chant/pipeline.json and chant pipeline spec prints. A stage is an environment in promotion order. The guide shows the path from merge to the last stage.

@intentius/chant/pipeline exports PIPELINE_FLOOR, the first chant that reads the file. @intentius/chant/op exports GATE_REJECTION_FLOOR, the first chant with chant reject, approval rule groups and names, and a hold’s description.

HoldsRule
import { pipeline } from "@intentius/chant/pipeline"the one module it imports a value from; type imports are free
const declarationsliterals, objects, arrays, spreads of other consts, templates
export default pipeline({ ... })the declaration; a plain object literal folds too

Anything else is refused with a finding: EVL001 or EVL003 for an expression outside the subset, EVL012 for a statement that is not one of the above or a declaration the spec check refuses. The build, chant lint and the LSP report the same finding. The file is folded, never run.

FieldValue
namethe pipeline’s name: lowercase letters, digits, -, _. Stage gates and skips are recorded under it
stagesthe stages in promotion order, first to last; at least one
defaultsop-waves settings every stage shares: op, step or plan and apply, runner, notify, respond, evidence, approvals without quorum, hooks, holds, point
release{ cut, label, bin, first }: the merge cuts a release once the first stage applied. cut defaults to true, label to auto, bin to ["chant"]. first is the version an auto cut takes when the member has no release in its ledger or its version tags, so a repository’s first merge cuts its first release; it defaults to 0.1.0
controlthe control repo told once the first stage applied, as an op-waves spec’s control
FieldValue
namethe environment’s name. components promote --to takes it, the release ledger records under it, and a step’s per-environment inputs are read by it
wavesthe op waves the stage applies, in order; each wave as in the op-waves spec
gate{ policy, approval, quorum, point, holds, urgent }. policy is always (the default), on-destructive or never; approval is ledger, pr-review, sealed or pull-request; quorum is a list of approval rules and all/any groups, all of which must be met (groups); holds is { policy, cost, risk }, where risk is { approveAbove, quorum }: over the score the stage’s waves wait and take quorum on top of the gate’s own rules, and a promote into the stage reads the score its release carries the same way (Change Risk); urgent is { role }, the stage’s urgent rule
hooksstage hooks, run after the pipeline’s own
holdtrue, or { reason, until, description } with an ISO 8601 time. description is what the person who lifts the hold reads first: the refused promote, chant workspace status and the plan note of the change that lifts it show it
freezea list of { from, until, reason } windows, ISO 8601 times
failureTolerancefailed runs a wave lets through: a whole number, or a share such as "10%". A wave’s own wins. Default 0
canarytrue marks the canary stage. Its soak holds every stage after it: a promote into any stage downstream of the canary reads the canary’s soak through gate <canary>-soak before that stage’s gate. The stage needs a soak with at least one check. A wave takes canary: true too: the stage’s first wave, whose soak (its own, else the stage’s) holds every wave after it. See The canary
forgeEnvironmentthe forge deployment environment of the stage’s jobs, unless a wave names its own
pauseAfterRollbacktrue pauses the stage once a rollback of it finishes (Pause and resume). Default false
replanDependentsthe members whose dependents are planned again when an output they read changes: once a wave of the stage applied, its job runs chant components replan for the runs it applied. A stage’s list, else defaults.replanDependents. Absent, no step runs
publishthe release artifacts the stage publishes once it applied, by name: { member, output } or { secret }. Absent, it publishes none
readsthe artifacts of upstream stages the stage reads (an ancestor through after, else an earlier stage), of the release it takes, keyed by the variable each reaches its deploy in: { stage, artifact }. Absent, it reads none
agentStepsthe stage’s agent steps, by name, each { prompt, schema, reads, command, keyEnv, timeout, maxRuns, maxCostUsd }; run in declared order for the release the stage takes. Refused on the first stage. Absent, none
afterthe stages a release applies in before this one opens for it. Absent, the stage before it in stages. The first stage takes none, and a cycle among stages fails the build with the stages named
queue"replace": the stage takes one release at a time. A newer release waiting replaces an older one, and a release in the stage finishes before the next enters. Absent, each promote goes through on its own
soak{ duration, checks, overrides }: checks that must keep passing for duration after the stage’s last apply before a release is promoted into the stages after it. A promote during the soak exits 3 with the time left. A wave takes a soak too, which holds the wave after it. See Soak. Absent, nothing soaks
onVerifyFail"hold" or "rollback". With "rollback", a failed verify after a promote into the stage, or a failed check of its soak, requests the rollback to the stage’s previous release, which waits at gate <stage>-rollback for a person. See Roll back. chant build refuses it on a stage that applies a sql-migrate step or a step that changes something through a kind without releaseInputs. Default "hold"

The pipeline itself also takes recheck: { schedule }, a five-field cron line. With it, chant pipeline generate renders a recheck-<stage> job per later stage that runs components promote --to <stage> --pending on that schedule, which promotes again the release a soak holds. Absent, no scheduled job is rendered.

A gate’s quorum lists rules and groups, and every entry must be met. A group is { all: [...] }, met when every entry in it is, or { any: [...] }, met when one is. Groups nest up to three deep (QUORUM_MAX_DEPTH); a fourth is refused when the spec is read. Each rule and group may take a name, lowercase letters, digits, - and _, once per gate.

gate: {
quorum: [
{ name: "release", any: [
{ name: "two-approvers", count: 2, proven: true },
{ name: "release-manager", count: 1, roles: ["release-manager"] },
] },
],
}

A group whose rules a gate’s targets leave out is dropped, and a gate left with no rule asks for one human approval, so an any is met only by a rule that counts real approvers. A name shows in the rule’s progress line (release-manager (every target): 1 of 1 approval (github:carol), met), in the group’s line (any release: met by release-manager), in the plan note of a change to the pipeline, in chant workspace status, and in the pending fact on the ledger, which carries the rules. An Op waves spec’s approvals.quorum takes the same groups and names.

chant pipeline spec --stage <name> prints the stage’s op-waves spec:

Op-waves fieldFrom
name<pipeline>-<stage>
opdefaults.op, else the pipeline’s name
labels.Envthe stage’s name
each wave’s gate, approval, environment, failureTolerancethe wave’s own, else the stage’s
approvals.quorum, holds, pointthe stage’s gate, else defaults
hooksdefaults.hooks, then the stage’s
the last wave’s hooks.after.applyon the first stage, <bin> release cut <label> --first <first> --yes --wait-checks --own-run-jobs <jobs> (--first with the label auto, or with release.first set; --own-run-jobs with the jobs the last wave’s jobs depend on and the product’s firstWaveNeeds, as pipeline generate names them), unless release.cut is false; then <bin> pipeline artifacts publish --stage <name> when the stage has publish
controlon the first stage, the pipeline’s control
releasedefaults.release; with a defaults.step and run targets that some other stage lacks (targets that name environments), component is defaults.release.component, else the pipeline’s name

A wave job reads its spec, and its gate at the base commit, through chant pipeline spec --stage <name>, which folds .chant/pipeline.ts at the commit in CHANT_WAVES_SPEC_AT. A commit with no pipeline prints nothing, which a wave reads as a spec absent at base: it waits for an approval.

A product’s renderSpec command keeps working. Its output is checked against the same schema: an op-waves spec must check as a stage’s spec does, and a chant.pipeline/v1 document runs the stage CHANT_PIPELINE_STAGE names, or its first.

With a pipeline at the default branch’s tip, chant components promote --to <stage> reads it:

CaseResult
the pipeline at the tip does not foldexit 1, with the finding: its gates cannot be read
the stage is held, or inside a freeze windowexit 3, naming the time it opens (pipeline-stage-held)
--to is the first stage and --from is absentexit 1 (promote-no-previous-environment)
--from skips a stage, without --allow-skipexit 1 (promote-skips-environment)
--allow-skipeach skipped stage’s gate <stage>-skip passes first, or the promote exits 3; each skip is recorded on _gates/<pipeline>/applied.jsonl
the release was rejected at the stage’s gate, or at a skipped stage’sexit 8 (pipeline-release-rejected), naming who rejected it, when and why; read before any approval, whatever the gate’s policy
the stage’s gategate <stage> under the pipeline’s name, bound to the release’s digest (or the promoted digests’); never passes, always and on-destructive wait (exit 3, pipeline-gate-waiting). Under approval: "sealed" only a sealed approval counts

A stage with reads refuses the promote with exit 1 before its gate when no --release is named, or when an upstream stage has not published a read artifact for that release. A stage with publish publishes once the promote under --release deployed; a publish it refuses fails the promote with exit 1 after the deploy.

chant workspace train promote <env> refuses with exit 3 when a member’s pipeline holds the stage.

A member with a defaults.step and its work in op waves, with *.component.ts files absent, promotes into a stage by that stage’s op waves:

CaseResult
no --releaseexit 1: the waves apply one release, and the stage’s gate binds it
--digest, --plan-only, --wave-gate or --resumeexit 1
the stage promoted from has no record of the release or of the commit it was cut fromexit 1
the stage’s gate passesthe promote writes stageRunSpec to .chant/op-waves/<pipeline>-<stage>.spec.json (a step input spec names that file) and runs each wave in order as chant run wave does, with no stand-down
a wave’s gateread from the pipeline at the tip through pipelineStageShow; the gate is decided on the wave’s plan digest under op <pipeline>-<stage>, and a wave that waits exits 3 with its chant approve line
the checkout lacks the release’s commitexit 1, before any wave plans
a wave ends with another exitthe promote ends with it, and runs no wave after it

Its release records name the release (releaseDigest) with the step’s plan digest (digestKind: "plan"). @intentius/chant/pipeline exports runStageWaves, stageRunSpec, pipelineStageShow, stageReleaseItems and PROMOTE_STAGE_WAVES_FLOOR. An engine that checks chant’s wave decision again reads a stage’s gate with readOpWavePolicy(specFile, wave, base, cwd, pipelineStageShow()).

A stage with after, and a stage with queue, add these cases. A pipeline where some stage declares either keeps a log of its promotes at _gates/<pipeline>/stages.jsonl on chant/lifecycle.

LineWritten when
waitinga release reaches a queued stage
replaceda newer release replaces one waiting; by names the newer one
enteredthe release passed the stage’s gate and its deploy started
finishedthat deploy ended; result is applied or failed
CaseResult
--from is not one of the stages after namesexit 1 (pipeline-from-not-upstream); --from defaults to the first it names
a stage with after, promoted without --releaseexit 1 (pipeline-join-needs-release)
the release has not applied in each stage after namesexit 3 (pipeline-upstream-waiting), naming the stages missing; with --allow-skip each one’s skip gate passes first. The first stage counts once its ledger holds a deploy of the release’s commit
a queued stage, with an older release waitingthe older release is replaced, and the replaced line names the newer one
a queued stage, with a newer release waiting, or a release replaced there beforeexit 1 (pipeline-release-replaced)
a queued stage with another release in itthe gate is read, then exit 3 (pipeline-stage-busy) until that release’s deploy finishes
the release already in a queued stageits deploy carries on without its gate read again

A promote under --release reads the change risk the release’s cut carries at each gate whose stage sets holds.risk, the skip gates included. The first stage’s waves make that score, so a pipeline where a later stage reads holds.risk and the first stage has none, of its own or from defaults, is refused at fold, naming the later stage.

CaseResult
the release carries no riskthe gate as without holds.risk
the score is within approveAbove, or none is setthe gate as without holds.risk; it counts people’s approvals only
the score is above approveAbove, or a question’s answer above its own thresholdthe gate takes holds.risk.quorum on top of its own rules; under policy: never it waits for an approval, exit 3 (pipeline-gate-waiting)

A release is newer than another when it was cut later; without a cut time, the one that reached the stage later is newer. chant workspace status --json reads the log into stageQueues on the member. Each entry has inStage, waiting and replaced; a replaced entry carries by, the release that replaced it.

chant workspace status also shows every stage of the pipeline in pipeline.stages on the member, and one text line per stage: the release it runs, its gate, the change risk the gate reads, its soak and the time left, the canary soaks that hold it, a pause and a rollback request. See Pipeline stages.

chant stage pause <stage> --reason <text> stops releases entering a stage, and chant stage resume <stage> --reason <text> lets them in again. Each writes a line naming who (--actor, else the CI or shell user) and why to <stage>/stage.jsonl on chant/lifecycle, and pushes it.

CaseResult
a promote into a paused stageexit 3 (pipeline-stage-paused); the release is recorded as waiting on the stage’s own stage.jsonl. A promote that is applying when the pause lands finishes
chant stage resumenames the newest release that waited, which is the one that enters, and the older ones it replaces
a promote of a release the resume replacedexit 1 (pipeline-release-superseded), naming the release to promote
a rollback of a stage with pauseAfterRollback: trueonce it finishes, the stage is paused and the rollback says so

A pause is a stage’s state on the ledger. hold and freeze are in the pipeline’s file, and a change to the file lifts them.

A stage’s gate may declare urgent: { role }. chant components promote --to <stage> --release <label> --urgent --reason <text> then passes the stage’s gate on one approval of gate <stage>-urgent under the pipeline’s name, bound to the release’s digest, in place of the stage’s quorum. The approval counts when its approver holds the role in .chant/trust.json at base and a seal from chant approve --sign, verified against the signers file at base, proves who they are. A plain chant approve line never counts, whatever the stage’s approval mode.

CaseResult
the stage declares no urgent ruleexit 1 (pipeline-no-urgent-rule)
--from skips a stage, with or without --allow-skipexit 1 (pipeline-urgent-skips)
the release has not deployed every promoted component in each stage upstream of the target, or a run of one failed there sinceexit 1 (pipeline-urgent-upstream), naming the stages and components. A stage with after checks the stages it names and the stages those follow; a stage without after checks every stage before it
--allow-skip toward a stage with afterthe urgent path takes no skip gate, so a stage still missing refuses as above
a rejection of the release at gate <stage> or <stage>-urgentexit 8 (pipeline-release-rejected), before any approval is read
no proven approval from the role yetexit 3 (pipeline-gate-waiting), with the chant approve ... --sign command
approvedthe approval is spent on _gates/<pipeline>/applied.jsonl, an urgent line on the stage’s ledger records the approver, their role and note, who promoted and why, and the pipeline’s defaults.notify gets a chant.notify/v1 event urgent

A hold, a freeze window, a pause and a rejection refuse an urgent promote as they refuse any other.

CommandDoes
chant buildfolds the file and writes .chant/pipeline.json; a finding fails the build
chant pipeline spec [--stage <stage> [--own-run-jobs <name,...>]] [--at <commit>]prints the folded spec, or one stage’s op-waves spec; --own-run-jobs gives the jobs its release cut counts, which pipeline generate writes into the wave jobs’ render command
chant pipeline generate <github|gitlab|forgejo> [--output <dir>]writes the first stage’s waves workflow and the <pipeline>-promote workflow
chant pipeline artifacts publish --stage <stage> [--release <ref>] [--dry-run] [--json]publishes the stage’s artifacts for the release named, else the release cut from HEAD, reading publish from the pipeline on the default branch
chant pipeline artifacts read --stage <stage> [--release <ref>] [--name <artifact>] [--from <dir>] [--json]prints a stage’s artifacts for the release named, else the one in CHANT_CONTROL_RELEASE, else the release it last published for. --name prints one value; --from reads another repository’s chant/lifecycle
chant pipeline release-of <commit>prints the digest of the release cut from a commit, or exits 1
chant pipeline agent run --stage <stage> --release <ref> [--output <dir>]runs the stage’s agent steps for the release and writes each record to <dir>/<step>.json (default .chant/agent-steps/<stage>); reads the ledger and writes nothing to it; exits 1 when a step failed
chant pipeline agent record --stage <stage> --release <ref> [--from <dir>]checks each record against the schema at base, records it on <stage>/agent-answers.jsonl with a run record per model run, and pushes; exits 1 when a step failed
chant pipeline agent answer --stage <stage> --release <ref> [--name <step>] [--json]prints the stage’s answers for the release, or one step’s answer as JSON
chant reject <pipeline> <stage> --reason <text> [--plan <digest>] [--env <stage>] [--release <digest>] [--sign [<key file>]]rejects the release the stage’s gate waits on, on _gates/<pipeline>/rejected.jsonl. --statement, then --signature <file> --at <time>, records a signature made elsewhere
chant stage pause <stage> [--reason <text>]pauses the stage
chant stage resume <stage> [--reason <text>]resumes it; the newest release that waited enters

A release artifact is a named value a stage publishes for the release it applied: a cluster endpoint, an image tag, a database host. Artifacts are strings or JSON values, at most 64 KiB of JSON text each, and never files.

stages: [
{
name: "dev",
waves: [{ name: "dev", runs: [{ target: "dev" }] }],
publish: {
endpoint: { member: "cluster", output: "endpoint" },
db_password: { secret: { awsSecretsManager: "arn:aws:secretsmanager:us-east-2:111111111111:secret:dev/db" } },
},
},
{
name: "staging",
waves: [{ name: "staging", runs: [{ target: "staging" }] }],
reads: { TF_VAR_dev_endpoint: { stage: "dev", artifact: "endpoint" } },
},
]
SourcePublishes
{ member, output }the member’s output in the stage once it applied, read through its steps as chant components replan reads them. An output the engine marks sensitive (Terraform sensitive = true, a Pulumi secret) is refused by name, and nothing of that publish is recorded
{ secret }where a secret is kept, in the words a config and secret set takes: a forge secret’s name, awsSecretsManager, gcpSecretManager or azureKeyVault. The reference is recorded and the secret is never read

Each publish appends one line to <stage>/artifacts.jsonl on chant/lifecycle: the pipeline, the stage, the release digest and label, the commit, the time, and every artifact the stage declares. A stage publishes every artifact or none.

ReadRule
at builda read names a stage earlier in promotion order and an artifact that stage’s publish names; chant build refuses any other. A first stage that publishes while release.cut is false is refused too
at promoteeach read comes from the upstream stage’s record of the release being promoted. The deploy gets a string as it is, another JSON value as its JSON text, and a secret as its reference’s JSON, in the variable the read is keyed by
from another repositorychant pipeline artifacts read --stage <stage> --from <dir>, where <dir> is a checkout of that repository or a directory holding its chant/lifecycle

With control.release: true, the <product>-applied dispatch looks up the release cut from the applied commit (chant pipeline release-of) and sends its digest as release. The control repo’s step gets it in CHANT_CONTROL_RELEASE, and chant pipeline artifacts read reads that release when no --release is named, so a downstream run reads the artifacts of the release the member applied. A commit with no release sends none.

@intentius/chant/pipeline exports the reading API: readStageArtifacts(port, { stage, release }), resolveStageReads(spec, stage, release, port), gitStageArtifactPort({ cwd }), stageArtifactText(entry) and releaseCutFrom(commit), with STAGE_ARTIFACTS_FLOOR, the first chant that has release artifacts.

An agent step is a model’s reading of the release a stage takes, with an answer of a declared shape: a summary for the release notes, or the services to watch during the soak. It reads, and approves nothing and applies nothing.

{
name: "prod",
waves: [{ name: "prod", runs: [{ target: "prod" }] }],
gate: { holds: { policy: true } },
agentSteps: {
watch: {
prompt: "List the services to watch during the soak, from the endpoint staging published.",
reads: { endpoint: { stage: "staging", artifact: "endpoint" } },
schema: { type: "object", required: ["services", "risk"], properties: { services: { type: "array", items: { type: "string" } }, risk: { enum: ["low", "medium", "high"] } } },
maxRuns: 20,
maxCostUsd: 5,
},
notes: { prompt: "Write one paragraph for the release notes.", reads: { watch: { step: "watch" } }, schema: { type: "string", maxLength: 2000 } },
},
}
FieldValue
promptwhat the model is asked, at most 4000 characters. The prompt adds the step’s inputs as data between tags, and the schema
schemathe JSON Schema (2020-12) the answer must match; chant build refuses one that does not compile
readsby the name the prompt shows each under: { stage, artifact }, an artifact an upstream stage published for the same release, or { step }, the answer of a step declared before it. A secret artifact reads as where it is kept, never as its value
commandthe model command, prompt on stdin and answer on stdout. Default: the review command with --output-format json, which runs Claude Code with no tools and one turn
keyEnvthe variable holding the model’s key, the one secret the command sees. Default ANTHROPIC_API_KEY
timeoutminutes the command may run, 1 to 360. Default 10
maxRuns, maxCostUsdthe most runs, and US dollars, per day, counted on the run records under op <pipeline>-<stage>-<step>, as every agent’s limits are

chant build refuses agent steps on the first stage, which applies before the merge cuts the release a step answers for, a read of a stage that is not upstream or an artifact it never publishes, and a gate policy of never on a stage whose gate sets holds.policy.

StepWhat happens
runchant pipeline agent run runs each step in order, in a job that holds a read token only: the job token reaches its checkout, and the step drops every forge token before the command and holds the model keys alone. The model’s environment holds its key and the process basics. Each step’s record goes to a file; nothing is written to the ledger
failan answer that is not JSON, or does not match the schema, fails the step with the schema’s complaint, and a step reading it fails too. So do a missing key and a run past a limit
recordthe promote job runs chant pipeline agent record before it promotes, also when a step failed. It checks each answer against the schema at base again and appends it to <stage>/agent-answers.jsonl on chant/lifecycle, with the release digest and label, the prompt’s digest, the schema’s digest and the cost the command reported, and one run record per model run
holdchant components promote --to <stage> --release <ref> exits 3 (pipeline-agent-step-holding) while a step has no answer for the release, or its answer failed or does not match the schema at base, naming each step and why. With no --release it exits 1
policywith gate.holds.policy, the promote runs the workspace’s ci.policy at base with the answers as input.agent.<step>: { answer, stage, release, label, promptDigest, schemaDigest, costUsd, model, at }. A deny refuses the promote with exit 1 (pipeline-agent-policy-denied); a hold is printed
gatethe stage’s gate counts a person’s approval only: an approval an agent recorded is refused, and the wait names it. The gate waits for a person even when its policy says never
riskan answer that is an object with risk of low, medium or high is one reason agent.<step> of the change risk the stage gate’s holds.risk reads, weighed as the review’s level. It only raises the score

chant pipeline generate gives each stage with agent steps a job agent-<stage> before its promote job, and the promote job takes its answers. A stage with none renders as before.

@intentius/chant/pipeline exports readStageAgentAnswers(port, { stage, release }), gitStageAgentAnswerPort({ cwd }), stageAgentPolicyInput(answers) and agentStepRiskLevels(answers) for a reader such as the risk record, with STAGE_AGENT_STEPS_FLOOR, the first chant that has agent steps.

ExportDoes
pipelineFromConfig({ name, promotion, environments, approvalRules, gate, approval, waves, defaults, release, control })a declaration from the stage keys of a product’s config, environments.<name>.publish and .reads included
pipelineSource(declaration, { product, config, command })the file’s text, with a header naming the command that writes it
checkPipelineFile(dir, expected, { command })current, missing or stale with a line diff: what <product> ci --check runs
writePipelineFile(dir, text)writes the file, and says whether it changed
foldPipelineSource(text)the spec, or the finding
stageWavesSpec(spec, stage)a stage’s op-waves spec
pipelineChange(base, head, cwd)the folded spec’s diff between two commits, which the plan note shows

chant