Check a delivery contract in CI
scf delivery validate checks a delivery contract against the commit that is checked out. A CI job of
a pull request can run it to stop delivery with a precise reason. It only reads: it never writes a file,
never fixes or makes a contract, and runs git read-only. The same script also runs without scf, with
Node.js alone: node tools/delivery-validate/validate.mjs ….
scf delivery validate --contract contract.json --signature contract.json.sig \
--public-key "$DELIVERY_PUBLIC_KEY" --repo . --checks checks.json --comment comment.md --events evidence.jsonl
| Option | What it is |
|---|---|
--contract <file> | The contract (canonical JSON, version 1). Required |
--signature <file> | Its SSH signature (Ed25519, namespace scf-delivery-contract). Required; an empty file is a stop |
--public-key <key> | The trusted key: an ssh-ed25519 AAAA… line, or a file whose first line that is not empty and not a # comment is that key. Required |
--repo <dir> | The repository to check. Default: the current folder |
--checks <file> | The CI checks reported for the commit (see below) |
--comment <file> | The text of the pull request comment that carries the marker (see below) |
--events <file> | The run's evidence events (evidence.jsonl, JSON lines, 256 MiB at most). Checked against the contract's evidence (see below). Optional; without it the evidence check is skipped |
--json | Print one JSON object instead of the lines |
--version | Print the validator version (N.N.N) and exit 0. The release file is named after it |
--help | Print the usage |
Checks. The checks run in this order. Each prints one line, <check>: ok, <check>: stop <condition>:
<reason> or <check>: skipped (<why>).
| Check | Stops with | Stops when |
|---|---|---|
contract | signature-unverified | The contract is not JSON, is not canonical, is not version 1, or breaks the rules of the contract |
signature | signature-unverified | The signature is missing, does not verify, or is not made with the trusted key |
commit | commit-changed | The checked-out commit is not the contract's commit |
locks | lock-changed | A lock file at that commit is changed, missing, or not a file |
workflows | workflow-changed | A file under .github/workflows/ is added, removed or changed (other files are ignored) |
checks | required-check-failed | A required check is missing or did not pass (see below) |
evidence | evidence-unverified | With --events: the events file has fewer events than the contract says, a line is not a valid event of the chain, or the event at count - 1 does not carry the contract's terminalHash. Also when the chain is a local test (localTest on run.created); the reason is the run is a local test, so it is not eligible for delivery |
comment | superseded or evidence-unverified | The comment names another contract, or another evidence hash |
- If
contractorsignaturestops, every later check isskipped (the contract is not trusted), and git is not called. evidencereads the firstcountlines of--eventsand nothing after them. Each line must be a canonical JSON object of a known event version (a version newer than this script knows is refused), a complete event of the chain (every event type, strict keys, and the rules that tie fields together), with the rightseq,runIdand a uniqueid, and a hash and link that match. Events aftercountdo not matter. Without--events, the check printsskipped (no --events given).- The validator and the library agree. The script gives the same verdict as the Foundry's own check on the same contract, signature, key and events. Its copy of the event rules is kept in step by a test: a new event type or version makes the test fail until the script is updated.
skippedis not a pass. Without--checks,checksis skipped, and without--comment,commentis skipped. A job must not treat a skipped check as ok.
Exit codes. 0: no stop. 1: at least one stop. 2: a usage or read error (for example an unknown
option, a file that cannot be read, a --checks file of the wrong shape, or a --repo that is not a
repository). The error goes to stderr, starts with delivery-validate:, and never shows file content.
--checks format. A JSON list. Each entry has a name and a conclusion (a string, or null):
[{"name": "test", "conclusion": "success"}, {"name": "lint", "conclusion": "success"}]
A required check that appears more than once must have success in every entry, so one failed entry
stops delivery even when a re-run later passed. The job that builds the list should leave out the
earlier runs of a check.
The marker. A pull request comment must hold exactly one line of this form (CRLF line ends are allowed; a quoted line does not count):
<!-- claude-factory delivery-contract digest=<64 hex> evidence=<64 hex> -->
A comment with no marker, or with two different markers, is a read error (exit 2). digest is the digest of
the contract text. evidence is the terminal hash of the evidence chain. Both must match, or the comment is
stopped.
Example GitHub Actions job. The job checks out the pull request, puts the trusted key in a variable and
runs the script with Node.js. It needs no npm ci:
delivery-contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Check the delivery contract
env:
DELIVERY_PUBLIC_KEY: ${{ vars.DELIVERY_PUBLIC_KEY }}
run: |
node tools/delivery-validate/validate.mjs \
--contract contract.json --signature contract.json.sig \
--public-key "$DELIVERY_PUBLIC_KEY" --repo . --json
Pass the --checks, --comment and --events files as well when the job has them. The job fails when the exit code is
not 0. Do not add || true.
Pin a version from a release. Each release of the Foundry's release-build carries the validator as
scf-delivery-validate-<version>.mjs and its .sha256 file (see "Upload to a draft release"). A job can
download one version, check its hash and run it. The job needs no Foundry server, token or model provider.
The GitHub Actions example below collects the checks and the marked comment itself. The check results are a
JSON list of {"name", "conclusion"} entries (see "--checks format"); this example writes them from the
check-runs API of the commit.
delivery-contract:
runs-on: ubuntu-latest
env:
VALIDATOR_VERSION: "1.4.0" # the version you pin
RELEASE_BASE: "<download folder of that release>" # the release's assets, from the release page
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download the validator and check its hash
run: |
mkdir -p "$RUNNER_TEMP/validator" && cd "$RUNNER_TEMP/validator"
curl -fsSLO "$RELEASE_BASE/scf-delivery-validate-${VALIDATOR_VERSION}.mjs"
curl -fsSLO "$RELEASE_BASE/scf-delivery-validate-${VALIDATOR_VERSION}.mjs.sha256"
sha256sum -c "scf-delivery-validate-${VALIDATOR_VERSION}.mjs.sha256"
- name: Collect the check results and the marked comment
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
gh api "repos/${GITHUB_REPOSITORY}/commits/${HEAD_SHA}/check-runs" --paginate \
--jq '[.check_runs[] | {name: .name, conclusion: .conclusion}]' | jq -s 'add' > "$RUNNER_TEMP/checks.json"
gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" --paginate \
--jq '[.[] | select(.body | contains("<!-- claude-factory delivery-contract "))] | last | .body // empty' \
> "$RUNNER_TEMP/comment.md"
- name: Check the delivery contract
env:
DELIVERY_PUBLIC_KEY: ${{ vars.DELIVERY_PUBLIC_KEY }}
run: |
node "$RUNNER_TEMP/validator/scf-delivery-validate-${VALIDATOR_VERSION}.mjs" \
--contract contract.json --signature contract.json.sig \
--public-key "$DELIVERY_PUBLIC_KEY" --repo . \
--checks "$RUNNER_TEMP/checks.json" --comment "$RUNNER_TEMP/comment.md"
The contract (contract.json, contract.json.sig) and the evidence file come from the run's delivery
folder, which the job gets from the workflow's artifacts or from the pull request. The job fails on exit 1
(a stop) and 2 (a usage or read error); do not add || true.
Generic CI in plain shell. Any CI with Node.js 22 or later and sha256sum can run the same steps:
V=1.4.0
BASE="<download folder of that release>" # the release's assets, from the release page
curl -fsSLO "$BASE/scf-delivery-validate-$V.mjs"
curl -fsSLO "$BASE/scf-delivery-validate-$V.mjs.sha256"
sha256sum -c "scf-delivery-validate-$V.mjs.sha256" || exit 1
# checks.json and comment.md are written by your CI from the commit's check results and the pull request comment
node "scf-delivery-validate-$V.mjs" --contract contract.json --signature contract.json.sig \
--public-key "$DELIVERY_PUBLIC_KEY" --repo . --checks checks.json --comment comment.md
What stays outside the validator. The validator only says go or stop. Building, signing of artifacts, environment promotion, drift checks, deployment and rollback stay in your external delivery system. The validator checks the delivery contract and nothing else.
Delivery handoff of the release pull request#
The daily release flow (release-daily) ends with a step handoff. It checks the latest delivery contract
of the run before the release pull request (develop → main) is marked ready to merge. It is the same contract
that scf delivery verify checks, and it runs on the Foundry machine.
Draft while checking (with a signing key). When the Foundry has a public key for delivery (see "Delivery contract"), the pull request is made a draft before the check starts. It is marked ready only after the check says
HANDOFF: ok. If the step is killed (timeout or cancel), the pull request stays a draft.Without a key. Nothing is made a draft first, and the step prints
HANDOFF: skipped (…)with the reason. Unsigned installs keep today's behaviour: the pull request is ready when the checks pass.One comment per pull request. The step keeps one delivery comment on the release pull request and edits it in place. A run that repeats the same result leaves the comment as it is ("delivery comment: unchanged"). The comment shows the status, the contract (when it can be read), the signature and the key's fingerprint. A line that is not secret-free is scrubbed before it is printed or posted.
Stops. A stop makes the pull request a draft and fails the run. The first failed check gives the stop, in this order:
Stop Means Example reason signature-unverifiedThe contract or its signature is missing, changed or signed by another key. HANDOFF: stop signature-unverified: …supersededA newer contract exists, or the contract is for another pull request, repository or run. the contract is for pull request #12, the run's is #99commit-changedThe pushed head, or the checked-out commit, is not the contract's commit. the pushed head is X, the contract is for Ylock-changed/workflow-changedA dependency lock file or a CI workflow file changed since the contract. package-lock.json was changedrequired-check-failedA required check is missing, failed, or cannot be read. test did not passevidence-unverifiedThe run's evidence does not match the contract. the events cannot be readA head that moves while the checks are waited for also stops the handoff, with the same reason and "(after waiting for the checks)" added. So a push during the wait cannot hand over a pull request whose head is not the contract's commit.
Waiting for checks. The step waits for the required checks to finish, polling every 15 seconds. The wait is
FACTORY_DELIVERY_CHECKS_WAIT_SECseconds: a whole number from 0 to 3600, default 600. Any other value gives the default, and 0 means one read with no wait. The step stops after 30 minutes, and then the pull request stays a draft, so keep the wait below about 1700 seconds.Output. The step prints one
HANDOFF:line for the verdict, then the reasons. Then it prints the result of the checks (checks passed — PR #… is ready to merge, orchecks failed — PR #… is a draft).CI. The same contract is checked again in a pull request's CI job with
scf delivery validate(see "Check a delivery contract in CI"). That check is the hard one; this step is the gate before the release pull request is marked ready.
Verify a run's delivery contracts offline#
scf delivery verify <run-id> checks the delivery contracts in a run folder (delivery/) against the trusted
public key. It needs no server and no network, and it only reads.
scf delivery public-key > allowed_signers # the trusted key as an allowed_signers line
scf delivery verify 20260131-120000-ab12 --public-key allowed_signers
--public-key <file> takes a key line or an allowed_signers line. Without it, the key is the one set as
delivery.signing_key_path in the settings, which must be in delivery-keys. --json prints the result as one
JSON object; every path in it and in the lines is relative to the run folder.
✔ verified · run 20260131-120000-ab12
2 contract(s) signed by the trusted key and continuing the evidence
contracts: 2, latest <digest>
events: 14, last hash <hash>
What is checked. Every contract-<n>.json and its .sig: the signature is made with the trusted key, the
numbers are 1, 2, 3 … without a gap, each contract continues the one before (supersedes), there is no .sig
without a contract, and contract.json and contract.json.sig are the same bytes as the highest numbered
contract. The evidence (evidence.jsonl) must be whole, must not be marked evidence.incomplete, and each
contract's count events must form the chain its evidence hash names. Events after the last contract's count
may be added, and the result is still verified; a broken event after that count is a failure. A file that is
not plain UTF-8 or ends in a line that is not complete is a failure.
A contract over a local-test run (its events have localTest on run.created) fails with the fault local-test,
whether it is signed or not. No contract is written for such a run, so this only applies to a folder made before.
Exit codes.
| Exit | Result | Meaning |
|---|---|---|
0 | verified | Every contract is signed by the trusted key and continues the evidence |
1 | not verified | A check failed; the first failed check is named (for example signature-bad, wrong-key, numbering, orphan-signature, latest-copy, evidence-broken) |
2 | unsigned | At least one contract has no signature, so it cannot be checked against the trusted key |
2 | no delivery contract | The run has no delivery/ folder |
A usage problem or a bad input (an invalid run id, a run that does not exist, no trusted key set, a
--public-key file that cannot be read or has no ssh-ed25519 key) prints error: … on stderr and exits 1.
The message never shows a path.
Check with OpenSSH alone. Each contract can also be checked with ssh-keygen, without scf. This checks one
contract and its signature, not the chain:
ssh-keygen -Y verify -f allowed_signers -I scf-delivery -n scf-delivery-contract \
-s contract-1.json.sig < contract-1.json
CI. This command reads a run folder on the machine that runs the Foundry. How a CI job gets the contract and its signature is not decided yet (it is part of #163).
Versions of the components#
scf components [kind] prints each part of the Foundry that a promotion can name, with its version and
a SHA-256 hash of its contents:
COMPONENT flow my-flow v0 sha256:<64 hex digits>
COMPONENT model-routes default v1 sha256:<64 hex digits>
COMPONENT policy-pack foundry.baseline <version> sha256:<64 hex digits> builtin
The kinds are flow, policy-pack, tool-profile, model-routes and context-selector. Pass one kind to
list only that kind. The command reads the Foundry home only and changes nothing; it exits 1 when a
component is a problem.
- Where each part comes from. Flows are the
.yamlfiles inflows/. Policy packs arepolicies/<id>.json. Tool profiles aretool-profiles/<id>.yamland context selectors arecontext-selectors/<id>.yaml. Both folders are optional. The model routes are theroutersettings ofconfig.yaml. A context selector file holds the settings thatselectContextreads; no run reads it yet. The context of an issue run comes from thecontext:section ofconfig.yaml(see Context of a run). - Built-ins. The built-in flows and the built-in baseline pack are listed too, and end with
builtin. They are never counted or recorded. - Versions. A flow's version is its
publish.versionwhen it is published, and0when not; a new published number alone does not change its hash. A policy pack's version is theversionof its policy. A tool profile, the model routes and a context selector are counted: the version is the place of their hash among the different hashes seen so far. Going back to an earlier definition gives its old number. - Recording. A counted component whose hash is not recorded prints
v-andunrecorded. Runscf components record [kind]to give the new hashes their version. It writes onlypromotions/versions.json, and only when something is new. Do not edit that file by hand: the command refuses a file it cannot read, and it never overwrites one. Apromotionsfolder that is a link is refused. - Same content, same hash. The hash does not depend on key order or on YAML comments. A tool profile may
have a
descriptionsmap, one text per granted tool; it is part of the hash only when it has an entry, so a profile without it keeps its hash. - Problems. A file that cannot be read or checked gives one
! <kind> <id>: <reason>line. The reason never shows the file's content or its place on the disk. The other components still print.
Governance of a component#
Each promotable component can have a governance record: its owner, risk, lifecycle, approved version, last
review and evaluation suite. The records are kept by hand in promotions/governance.yaml in the Foundry home,
and are keyed by <kind>/<id>, for example flow/my-flow or policy-pack/foundry.baseline:
version: 1
components:
flow/my-flow:
owner: team-ops
risk: medium
lifecycle: active
approved_version: "2"
last_review: 2026-10-01
eval_suite: my-flow-smoke
Every field is optional. A record accepts only these fields; an unknown field makes the file a problem.
- Defaults. A component with no record, or a missing file, has no owner, risk
low, lifecycleactive, no approved version and was never reviewed. Nothing that worked before stops working. - Status.
scf componentsends each line withowner=… risk=… lifecycle=… status=…. The status is:retiredwhen the lifecycle isretired;unapprovedwhen there is no approved version or it is not the component's current version;review-duewhenlast_reviewis missing or more than 365 days old; otherwiseok. - Records that name nothing. A record for a component that does not exist gives a
! <kind> <id>: governance record names no componentline, and the command exits 1. - A bad file. A file that is a link, larger than 1 MiB, or not valid gives one
!line with a fixed reason. The components are still listed, and no record is used until the file is fixed. - Changes nothing. Governance records are only read. They do not change a component's hash or its version,
and
promotions/versions.jsonis not touched.
Components table (admins)#
Administration → Settings has a Components card, and GET /api/admin/components (admin only) gives the same data. Each row is one
component with its kind, id, version, owner, risk, lifecycle, approved version, last review, evaluation suite and status.
The status is shown as text: Retired, Not approved, Review due or OK, the same rules as scf components.
- No record. A component with no governance record shows No owner and Never reviewed.
- Problems. The read problems of the components and of the governance file are listed above the table as fixed text, with no paths. A governance file that cannot be used is shown as a red line, and the rows then have no owner.
- Read only. The card only reads. Change owners and review dates in
promotions/governance.yaml.
Refused production runs#
A production run is any run with a connected repository (github_repo set to a real owner/repo), because it
can push to that repository or open a pull request on it. This is the same for runs from the web, from a watcher and
from the command line, and for a workspace of any kind. A run without a connected repository is development: it is
never checked and keeps the default profile.
Before its workspace is made, a production run checks each component it uses: its flow and published version, the
policy packs (from config.yaml and the baseline), its tool profile, its model routes and its context selector (the
default context selector, from config.context). A resumed run is checked the same way. The run ends as failed
before its first step when a component is:
- retired:
flow my-flow is retired; stop using it, or change its lifecycle in promotions/governance.yaml - high risk and not approved:
flow my-flow v3 is high risk and not approved; review it and set approved_version in promotions/governance.yaml. With no recorded version, the reason says to runscf components record <kind>first.
Other cases never refuse a run: a component with no record (it has risk low), a medium or low component that is
not approved, and a component that is review-due. A broken promotions/governance.yaml (a link, larger than 1 MiB, or
not valid) refuses every production run with a fixed reason, and so does a check that cannot run. Development runs are
not affected by a broken file.
The log gets one ! governance: … line per refused component, or · governance: allowed (N components) when nothing
is refused. The run's evidence gets a governance.decided event with the outcome, the kind, id, version and status of
each component, and a fixed reason code. It never holds file content. Evals are not checked for governance.
Autonomy levels#
Each repository and each flow has an autonomy level: a stored maximum for how far a run may go. The levels,
lowest first, are observe, plan-only, guarded-write and delivery-handoff. The level is a real limit:
| Level | What the run may do |
|---|---|
observe | Read-only agent steps only. A writing agent step, a shell step with repo_access: true, and any push or pull request are refused. |
plan-only | As observe, and a shell step with repo_access: true may run (for example, to post the plan comment). Writing agent steps, pushes and pull requests are still refused. |
guarded-write | Writing agent steps run in the workspace. Every push and every pull request is refused. |
delivery-handoff | No extra limit. This is how Foundry worked before autonomy levels. |
A refused step fails with a message such as autonomy observe does not allow a writing agent step; next step: promote
the repository or flow. A refused push or pull request also names the command that raises the level, for example
: scf autonomy promote repos <id> guarded-write --reason "<why>", then approve it and resume this run; it is left
out at the top level or when the repository or flow cannot be named. The run's own failure handling (on_failure) then runs, and the refusal is recorded in the
evidence as a step.denied event with the reason autonomy.denied. A refused writing agent step starts no agent. A
refused push is stopped by the pre-push hook, which is installed for runs below delivery-handoff, so a step that
swallows the exit code of git push still fails. Pull requests are opened and merged by the story tools
(story pr-open, story pr-merge) and by the daily branch tool (open-pr); those refuse below delivery-handoff
too.
A repository with no entry, and a flow with no entry, is delivery-handoff. A repository connected through the
API starts at guarded-write unless the request gives autonomy (see "Starting level" below). A repository of an
existing install gets no entry, so it stays at delivery-handoff.
Starting level. POST /api/repos takes an optional autonomy and autonomyReason. A repository that starts at
guarded-write can never push or open a pull request, so the promotion gate can never pass for it. Choose the level
when you connect it instead of editing autonomy.json:
- An admin may give any of the four levels. A non-admin may give
observe,plan-onlyorguarded-write; asking fordelivery-handoffgets 403, and nothing is stored. - A level that is not valid gets 400, and so does
autonomyReasonwithoutautonomy. - The reason is checked like the other autonomy reasons: 1 to 200 characters, no control characters, and nothing that looks like a credential. Without one, "chosen when the repository was connected" is used.
- With a level,
autonomy.jsonholds it for the new repository, withbyset to the admin. One audit line,autonomy-set-initial, records the level and the reason. - In the terminal,
scf repos add,add-token,add-https-token,add-keyandadd-apptake--autonomy <level>and--autonomy-reason <text>. - In the web interface, the Add repository dialog shows admins a Starting autonomy level select on the sign-in
step. It is set to
guarded-write, and the level is sent only when you pick another one.
Each run gets the lower of its repository's level and its flow's level. The repository is the connected
repository with the run's GitHub name (owner/repo); a run without one gets only the flow's level. The level is
kept in three places:
run.json, asautonomy(level,repositorywhen there is one, andflow);- the live log, as a line such as
autonomy: plan-only (repository guarded-write, flow plan-only); - the evidence, as the event
run.autonomy, written right afterrun.created.
A stopped run is not stuck at the level it started with. On each resume the level is worked out again from the current
settings, as at the start, and stored in run.json. So after you raise the level, resume the stopped run: it pushes and
goes on, with no need to start the issue over. If the level changed, the live log says resumed, was <level>, raised
<from>→<to> (or lowered <from>→<to>) and the evidence gets run.autonomy with resumed: true. A resume with no change
writes no new event and adds nothing to the log.
A run that is queued when you raise the level also uses the new level. The job keeps the level it had when it was queued,
and when the run starts at another level, the start line says so: …; raised <from>→<to> while queued (or lowered …).
The level a run starts with is always worked out from the current settings, so a lowered level is used by a queued run too.
Levels are stored in autonomy.json in the Foundry home. A level changes only through the promote, approve and demote
routes or scf autonomy (Change a level), or through the monitor's automatic demotion
(Automatic demotion). If autonomy.json or repos.json cannot be read when a run starts, the run counts as
observe, and the log has a ! line that says which file it was. Connecting a repository fails when
autonomy.json is broken.
The level is enforced by the engine, not only in the agent's prompt. A run at delivery-handoff behaves as before.
Promotion gate#
The promotion gate shows whether a repository or a flow has earned the next autonomy level, and each piece of evidence behind that answer. It only reads. Nothing is promoted by it.
The gate has five checks. The first four count; approval is shown as pending until the accountable owner
approves a request (Change a level). The gate of a promotion is checked again at approval.
- Evidence completeness. The share of the component's runs in the window that have complete evidence. Needs
min_runsruns with an evidence file. - Eval pass rate. From the newest eval report that covers each flow (a flow's own report, or one of its
<flow>@<model>variants). A repository checks each flow it ran in the window; each must reach the threshold. - Policy conformance. No
deny,policy.unavailableorpolicy.invaliddecision in the window, also those in observe mode. A run that has not ended yet, or whose evidence cannot be read in full, counts as unknown and fails the check. - Operational SLOs. No open SLO finding that names the repository or flow. The check fails when the monitor has not finished a check in the last 24 hours, because then open problems are not known.
- Approval. Pending, until the request is approved (see Change a level).
A missing piece of data fails its check with a plain reason, such as "no eval report covers it" or "Only 4 runs ended in the last 30 days; at least 10 are needed". A check never passes on missing data. A repository with no GitHub name shows no runs, so every check fails with a reason.
The numbers are in config.yaml under governance.promotion, and Administration → Settings has the card "Promotion
gate" for them:
min_runs(default10): the fewest runs in the window;evidence_completeness(default0.95): the lowest share of runs with complete evidence;eval_pass_rate(default0.9): the lowest pass rate of an eval report;within_days(default30, from 1 to 90): the window in days.
The levels and the gate of every repository and flow are on GET /api/autonomy (admin only, see the permission
table). scf autonomy status prints the same, one line per check; --json prints the answer as it is. It
calls that route, so it needs a running Foundry and a signed-in admin.
The checks and thresholds are the same for every level. The target level is not used yet.
Change a level#
A level moves in two ways, and both are written to the audit log (autonomy-promote-request, autonomy-promote,
autonomy-demote, with target repos:<id> or flows:<id> and a detail such as plan-only→guarded-write).
Promote is one level at a time and needs an approval:
- An admin asks:
scf autonomy promote <repos|flows> <id> <to> --reason "…", orPOST /api/autonomy/promotewithkind,id,toandreason. The request is refused (409) unlesstois exactly one level above the current level, the gate passes, and no request for the component is waiting. The answer carries atoken. - The accountable owner approves:
scf autonomy approve <repos|flows> <id> <to> <token>, orPOST /api/autonomy/approvewithkind,id,toandtoken.
The owner is governance.owner in config.yaml (the id of an admin account). When it is not set, or the account is
no longer an active admin, the first active admin is the owner; GET /api/autonomy and the audit line say so.
- A move to
guarded-writeordelivery-handoffneeds an approver who did not make the request. If the owner made the request and there are two or more active admins, another admin approves instead. - With one active admin, that admin may approve their own request. The audit line and the answer say
self-approved. - When the approval comes, the level and the gate are checked again. A request whose level has changed, or whose gate no longer passes, expires and is answered with 409. Ask again to start over.
Demote lowers a level at once, by any admin, with no gate: scf autonomy demote <kind> <id> <to> --reason "…"
(it asks for confirmation unless --yes is given), or POST /api/autonomy/demote. A component that was demoted goes
up again only through a new request and an approval, so every step can be undone.
The reason follows the break-glass rules: required, at most 200 characters, no control characters and no
credential-like text. Requests waiting for approval are kept in autonomy.json next to the levels.
The Autonomy page#

Admins find the levels on the Autonomy page, under Administration, in the section People and access
(#/autonomy). It lists each repository and each flow, with:
- its level, and the level of its newest run (a link to that run);
- the gate: the five checks with their value, threshold and detail (the same as
GET /api/autonomy, see Promotion gate); - the waiting requests: who asked, who may approve, and
self-approvedwhere it applies.
The buttons follow the rules above. Promote shows only when the gate passes and no request waits. Approve shows only to the person who may approve. Demote asks for a level and a reason. Each action reloads only this section; the rest of the page does not change.
The history is the audit log: every autonomy-* line (promotion requests, promotions and demotions, also the
automatic ones), newest first, with who made the change and the detail. The page shows the newest 500 lines. For one
component, Show the changes of this component reads all of its lines.
If the section cannot load, it says so and offers Retry. The rest of the page keeps working.
On a repository's page, the owner sees the repository's Autonomy level in the overview. An admin sees a link to the Autonomy page there. Only an admin changes a level.
Automatic demotion#
After each monitor check, the monitor lowers a repository or flow by one level when a new serious finding names it.
A finding is serious when it is critical, or major from policy-service-failure or evidence-finalization. The
finding must name a repository or a flow; a finding about Foundry as a whole demotes nothing.
- A component at
observeis left alone. It is never lowered belowobserve. - Each finding lowers a component at most once. It can lower it again only after the finding has gone and a new one comes.
- Findings that were already open when the upgrade ran do not lower anything. Only findings that appear afterwards do.
- Each demotion is written to the audit log as
autonomy-demote, withbymonitor(shown asmonitoron the Audit page) and the detailauto: <detector> <fingerprint>. The server log gets a line for each one, and each active run of that repository or flow gets a live-log line that says it keeps its level. - A failed demotion does not fail the check. It is tried again at the next check, and the problem is logged without a path or a value.
- A component that was demoted goes up again only through a request and an approval (Change a level).
The switch is governance.auto_demote in config.yaml (default true). The Settings page shows it as "Automatic
demotion" in the "Promotion gate" card. Turned off, the monitor lowers nothing; findings that appear while it is off do not lower anything
when it is turned on again.
Promote a component#
scf promote <kind> <id> [--live] says whether a component may be promoted, from the safety reports
already on disk. Without --report it is read-only: it promotes nothing and writes nothing, not even versions.json.
scf promote <kind> <id> --report <report-id> [--live] makes the same check and, when nothing blocks, records the
promotion in promotions/records.json. It then prints PROMOTED <kind> <id> v<version> sha256:<hash> report:<report-id>
and exits 0. A blocked promotion prints the same BLOCKED lines, records nothing and exits 1. The report id is the
report's file name without .json, such as timeout-2026-10-30T07-21-04-123Z.
Promote in the Foundry (admins)#
An admin can do the same in the web interface:
- Administration → Settings, "Promoted versions". Lists the published flows and the other components with their state: promoted (with the report id), ready to promote, or blocked (with each blocking suite and what to do). Promote appears for a component that is ready to promote. A refused promotion shows the blocking list and writes nothing.
- Flow editor. A published flow shows Not promoted: <suite> (<reason>). <remediation> until it is promoted, or the report id once it is. Saving still works, so an unpromoted flow can be saved.
The web interface and scf promote --report write the same record and log the same BLOCKED line for a refused
promotion. A promotion in the web interface is audited as component-promote.
PASSED timeout <report file>
BLOCKED tool-profile my-profile: output-caps (suite-failed) — scf eval safety
It prints one PASSED line per suite that holds, then either PROMOTABLE <kind> <id> v<version> sha256:<hash>
or one BLOCKED line per problem.
- Required suites. Every kind needs the whole safety catalogue:
approval-bypass,credential-exposure,cross-repository,injected-instructions,output-caps,partial-parallel-failure,protected-branch,repository-boundaryandtimeout. For each one the newest report decides. The fix is alwaysscf eval safety. - A report counts when it is valid, complete, passed, and still matches what is there now: the suite file, its fixtures, its flows, its cases and models. The component being promoted must also have the same hash as when the eval ran. A report from before this change has no record of its inputs and counts as missing.
- Blocked reasons.
suite-missing,report-invalid,suite-failedandreport-stalename a suite. A counted kind (tool-profile,model-routes,context-selector) without a recorded version isBLOCKED <kind> <id>: (unrecorded) — scf components record <kind>. - Live reports. A report is live when its suite names no fake
claudeand no--claude-binwas given. Such a report blocks withreport-invalid: liveunless--liveis passed. No suite in the catalogue is live.
The command exits 0 when the component is promotable and 1 when it is blocked.
Use only promoted versions#
The setting Use only promoted versions (promotion.enforce) decides what a new run does with the
components it uses. The check is the rule of scf promote above, applied to the flow, its sub-flows,
the policy packs of the repository, the model routes and the tool profile of the run.
off. No check.warn(the default). Each component that is not promoted prints one line, such as! flow my-flow v0 is not promoted: <suite> (<code>) — <fix>, and the run saves the findings with its details. The run goes on.on. The run ends asfailedbefore its first step, with the reasonrefused: this run uses components that are not promoted. A check that cannot run also counts as not promoted.- Local tests.
scf run --local-test <flow>is always allowed, even underon. Its run sayslocal test: this run never counts as a promoted delivery. Evals and skill evals are local tests too, so they are never checked. A local-test run gets no delivery contract, and the handoff refuses it (evidence-unverified), with or without a signing key. Its evidence carries the marker (see "Evidence of a run"). Governance is not skipped: a local test with a connected repository can push, so it is a production run and is checked (see "Refused production runs"). Evals are the only runs that skip it. - Packs are read once. A new run reads its policy packs once, at its start, and the promotion check uses that same list, so the check and the run judge the same pack files, even if a file changes while the run starts. A resumed run reads the packs again.
Runs started before this setting existed have no findings saved. The check reads the reports on disk and changes no component; it only saves its findings in the run.
Lifecycle telemetry#
The Foundry writes one short telemetry line for each important fact of a run: a run starting or ending, a step starting, retrying, failing or finishing, a model being routed, a policy decision, a tool call, a push, a pull request, a watcher check and the measures of a run that has ended. You can read these lines to see what the Foundry does, without opening each run folder.
What is recorded. Names, ids, numbers, times and outcomes. Never a prompt, a model's output, the arguments of a tool, an error text, a file's content or a credential. The format has no free-text field, so such a value has no place to go. If a label (for example a branch or a sensitive pattern from your settings) holds a credential, that label is dropped and named in the event's
redactedlist.Where it is. One file per day in
<data folder>/telemetry/events-YYYY-MM-DD.jsonl, named by the UTC date. The folder is readable only by you (0700) and the files too (0600).Keep it for.
keep_daysinconfig.yaml. Files older than that are removed when the Foundry opens a day's file for writing. The default is 30 days; the range is 1 to 365.telemetry: local: true keep_days: 30Turn it off. Set
local: false. Then no telemetry folder is made and nothing is written. The setting is not in the web interface.Independent of evidence. Telemetry is a separate copy of the events. Turning it off does not change
evidence.jsonl, and a problem with the telemetry file never stops or changes a run. When the evidence of a run has stopped, its telemetry still goes on, without the link to the evidence.When something is dropped. An event that does not match the format, holds private data or cannot be written is not stored. The first time each kind of drop happens, the log shows one line such as
! telemetry: the telemetry file could not be written; events are dropped until it can. The line never shows a value.Push attempts. A push is recorded only where the protected-branch or secret-scan hook runs, or where a policy pack is set. Those are the only places where the Foundry checks the pushes of a step. A push is an attempt, not a confirmed delivery: a refused push is recorded too, and a step can write that log itself. The repository is shown only for a GitHub remote.
Tool calls.
tool.calledholds the tool's name only, never its arguments. It is written for Claude Code steps only; Codex steps give none. It also getsdurationMs, the time from the call to its result. A call that never got a result has no duration.Run measures. When a run ends (succeeded, failed or cancelled), one
run.measuredline holds its numbers, and no text: the duration and queue time, the steps, retries, tokens, cost and denials, the largest context of a model turn and the time the tools took, the stops, resumes and approvals (with their waiting times), the policy outcomes, and whether the pull request was delivered. A number that the run does not have is left out. A run that is only stopped or waiting gets no line until it ends. The owner of each measure is an admin or the repository owner, and each one informs a detector or a setting; these are fixed in the code and are not in the web interface.Watchers. A watcher records each check (ok, or failed without the error text), each queued run and each pull-request feedback run.
scf watchwrites these too.
Send the events to an OpenTelemetry collector#
If you run an OpenTelemetry collector, the Foundry can send the same events to its OTLP/HTTP logs
endpoint. It is off by default, and nothing is sent until you turn it on in config.yaml:
telemetry:
otlp:
enabled: true
endpoint: http://127.0.0.1:4318/v1/logs
timeout_ms: 5000 # optional: 100 to 60000, one request may take this long
- Address.
http:orhttps:, with no user name, password,?or#. Plainhttp:works only forlocalhost,127.x.x.xand[::1], so the example above is fine on the same machine. For any other host usehttps:. There is no login for the collector: keep it on a machine or network you trust. - What is sent. The events described above, as OTLP log records. Repository names and account ids
(UUIDs) are sent as they are. Each record has its fields as
scf.*attributes, and all events of a run share one trace id. The local file is written the same way, with or without this setting. - Failure never stops a run. Events are sent in batches of up to 50, one request at a time. A request that
fails, is refused, or takes longer than
timeout_msis not retried. Events are held in a queue of 1000; when it is full, the oldest is dropped and counted. - What the log lines mean.
! telemetry: the OTLP collector could not be reached or did not accept events; they are dropped until it does: sending has started to fail. It is shown once for each period of failures, not for each request.· telemetry: the OTLP collector accepts events again: the first successful request after a failure.
- On exit. When
scfstops (Ctrl+C inwatch, or a stop ofserve), it sends what is still queued, for at most 3 seconds. Events that cannot be sent in that time are dropped and counted.