Release Gates
Release Gates
Section titled “Release Gates”ContextBrew’s governance surface turns “a check you can run” into “a verifiable artifact you can attach to a PR”. A release gate is a programmatic check tied to a model family: it either holds (the spec is safe to ship) or produces findings. Every run is honest by construction — a gate that cannot run says so instead of passing.
The five gate types
Section titled “The five gate types”The gate types are a fixed, closed vocabulary. Each one governs one model family and proves one thing:
| Gate type | Model | What it proves | Status |
|---|---|---|---|
drift_resolved |
SIM | Contract drift between declared SIM contracts and observed consumer calls is resolved (no error-severity findings) | Implemented |
eval_suite_pass |
ABSL | Generated eval suites pass at or above the 0.7 pass-rate threshold | Implemented |
schema_evolution_safe |
ESDM / DSM | Schema changes are backward compatible — old consumers can still read new events | Implemented |
distillation_complete |
Context Map | The context map has been distilled into the committed context artifact agents consume | Honest not-implemented |
deployment_synced |
C4 | Declared C4 workloads match the observed deployment state (no error-severity image drift) | Implemented (live-state drift adapter) |
One of the five is deliberately not-implemented, and the CLI says so
rather than pretending:
distillation_complete— the distiller primitives exist, but no project-level context-map distillation artifact is produced yet, so there is nothing to check.
deployment_synced used to sit in the same bucket: the check now
registers its live-state drift adapter with the gate — the same check
ctxbrew observe k8s --gate runs directly (see the
CLI Reference).
Related gates
Section titled “Related gates”Four more gates live alongside the five release-gate types. They share the same posture — deterministic, fail-closed, receipted:
- Drift gate —
ctxbrew check --gate: the five-signal drift sweep. See Drift. - Plan gate —
ctxbrew gate plan show|veto|approve(preview, behindCTXBREW_FF_RACE): counts plan coverage from the dispatch envelope’splanCoverageand issues veto/approve receipts. - Done gate —
ctxbrew orchestrate done --bundle: recomputes the semantic-diff hash, re-runs evals, bounces unsupported completion claims, and emits its own evidence bundle (ctxbrew.evidence/1) plus receipt. - Action gate —
ctxbrew action-gate: irreversibility tiers. Reversible actions run on the audit trail, degradable ones carry a recorded rationale, irreversible ones require a recorded human gate, and unclassified actions block — an ungoverned action never runs on a guess.
The glossary lists the full family, including the accountability-side convergence and completion gates.
Fail closed, never throw
Section titled “Fail closed, never throw”Three rules hold for every gate check:
- A check never fabricates a pass. Verdicts have three states —
pass,fail, andnot-implemented. A missing model, a missing observed-state capture, a missing implementation: each is an honestnot-implementedwith the exact reason, never folded into pass (a fake green) or fail (a fake red). - A crashing check fails closed. If a check implementation throws,
the run records a
fail— a gate must not silently pass because its checker crashed. - No silent green on no signal. The overall verdict passes only
with zero
fails AND at least one realpass. A gate whose every check came backnot-implementedhas NOT passed.
Running the gate: ctxbrew gate
Section titled “Running the gate: ctxbrew gate”ctxbrew gate # all five checksctxbrew gate -t drift_resolved -t eval_suite_passctxbrew gate --evidence --receipt md # bundle + markdown receiptctxbrew gate --receipt-out receipt.md --emit-ci github| Flag | Description |
|---|---|
-p, --project <dir> |
Project root (the .contextbrew tree to read) (default .) |
-t, --gate-type <id...> |
Restrict to gate type id(s) from the table above |
--evidence |
Write the hash-chained evidence bundle to .contextbrew/evidence/<ts>.json |
--receipt [format] |
Render the receipt (format: md) |
--receipt-out <file> |
Write the receipt to a file instead of stdout (implies --receipt md) |
--observed-calls <file> |
Observed contract calls JSON (drift_resolved observed side) |
--esdm-baseline <file> |
Baseline ESDM model (schema_evolution_safe before-side) |
--eval-suites <dir> |
Directory of generated eval suites (*.test.ts) |
--emit-ci <target> |
Also write the CI receipt publisher: github | gitlab | both |
Exit codes:
0— gate passed1— gate failed, including the every-check-not-implementedcase2— operational error (bad input, unreadable project)
In CI, exit 1 blocks the build — that is the intended use:
# any CI: the gate is the build blockerctxbrew gate --evidence --receipt mdChecks read their inputs from the project plus the flags above; a check
whose input is absent (for example drift_resolved without
--observed-calls) reports not-implemented naming the missing input.
Evidence bundles
Section titled “Evidence bundles”--evidence writes a bundle to .contextbrew/evidence/<ts>.json
(schema ctxbrew.gate-evidence/1). Every check result is recorded
verbatim and hash-chained: each entry commits to the hash of the
previous one, and the chain’s genesis is the bundle manifest’s own
hash. The chain head (chainHash) pins the entire run — results,
findings, policy ids, timestamps.
That makes the bundle tamper-evident. Verify it anywhere, later:
ctxbrew evidence verify .contextbrew/evidence/<ts>.jsonOutput is VERIFIED (with the schema, run id, project root, genesis,
and head) or TAMPERED with the reason any entry stopped matching the
chain. Exit 0 intact, 1 tamper detected, 2 operational error
(missing file, not a bundle). If someone edits a recorded verdict after
the fact, the chain breaks — the artifact on the PR no longer proves
what the local run says.
Receipts and CI publishers
Section titled “Receipts and CI publishers”--receipt md renders the gate run as a markdown receipt — the
per-check verdicts, findings, and the chain head — suitable for a PR or
MR comment. --receipt-out <file> writes it to a file instead of
stdout.
--emit-ci writes the publisher that posts the receipt for you:
ctxbrew gate --evidence --receipt md --receipt-out gate-receipt.md --emit-ci github# writes .github/workflows/ctxbrew-gate-receipt.yml
ctxbrew gate --evidence --receipt md --receipt-out gate-receipt.md --emit-ci gitlab# writes ci/ctxbrew-gate-receipt.gitlab-ci.yml
ctxbrew gate --emit-ci # bare flag means both templatesThe generated GitHub workflow runs the gate on every pull request and
posts gate-receipt.md as a PR comment (updating an existing comment
on re-runs); the GitLab include does the same as an MR note. The
receipt carries the chain head, so the comment itself is anchored to a
tamper-evident artifact.
Traceability, audit, and the EU AI Act
Section titled “Traceability, audit, and the EU AI Act”The governance surface doubles as the record-keeping layer that regulated-industry reviews ask about: what was the AI told, and what was verified about it, and when. Three artifacts answer that, one per question:
| Question | Artifact |
|---|---|
| What did the agent see? | The recipe’s provenance stamps — source models, versions, generator plan per brewed context |
| What was checked about it? | The hash-chained evidence bundle (schema ctxbrew.gate-evidence/1) |
| Who can re-verify it later? | ctxbrew evidence verify + the PR receipt anchored to the chain head |
Because every bundle entry commits to the hash of its predecessor, the record is tamper-evident by construction — editing a verdict after the fact breaks the chain instead of rewriting history. That is the shape of an audit trail: a record an auditor can re-verify without trusting the person who produced it.
For teams operating under the EU AI Act’s transparency and record-keeping expectations (e.g. Article 12’s automatic logging of events for high-risk systems), ContextBrew’s gate/evidence/receipt surface is designed to serve that audit trail — the technical record a compliance process would otherwise have to assemble by hand. This is an engineering claim, not legal advice or a compliance certification: whether a given deployment satisfies the regulation depends on scope, risk classification, and counsel. What ContextBrew guarantees is the artifact layer — complete, hash-chained, independently verifiable.
Schema evolution: ctxbrew evolution check
Section titled “Schema evolution: ctxbrew evolution check”ctxbrew evolution check <beforeFile> <afterFile> compares a
before/after model pair — .cbrl, .dsm, .sim, or .absl, as DSL
or serialized JSON — under a versioning policy. It is the same
engine the schema_evolution_safe gate uses.
ctxbrew evolution check old.cbrl new.cbrl --policy semver --format md| Flag | Description |
|---|---|
--policy <id> |
Override: semver | calver | immutable. A policy declared in the models loses to this flag. |
--format <fmt> |
text (default) | json | md |
Exit 0 pass, 1 fail-or-not-implemented, 2 operational error.
Policy semantics:
semver— additive evolution is safe: additions and non-breaking modifications pass with zero removals and zero renames. Removals, renames, and error-class modifications are unsafe unless a MAJOR version bump is declared — the semver contract is that the number, not the review thread, is what warns consumers.calver— the version is a date, so compatibility is not encoded in the number. The discipline is different: if the content changed, the version must move monotonically forward. Content changed with an unmoved version fails; a version moving backwards fails; a missing declared version warns (non-blocking).immutable— any change is a break. The artifact was replaced in place; publish a NEW artifact id instead of editing this one.
The check applies to cbrl, dsm, sim, and absl. Other formats
report an honest not-implemented rather than a guessed verdict. This
is the runtime half of the schema versioning policy described in
File Schemas — additive
changes, new version directories alongside old ones, and a file judged
forever against the version it declares.
Next Steps
Section titled “Next Steps”- CLI Reference — every flag of
gate,evidence,evolution, andobserve - File Schemas — the versioning policy the evolution check enforces
- Core Concepts — the “tooling refuses rather than warns” doctrine
