Step 09 · Gate layer · Gate layer · Coda: the four gates ENPT
Alembic Complete Visual Course

Coda: the four gates

Proof, validator, course, and publish gates close every Alembic run.

Read the plain version, or open the technical layer on any section.
1

Fail-closed finishing


@alembic/coda implements the four gates that must clear before a run is considered done:

  • Proof Gate checks that every proof[] command exited 0.
  • Validator Gate runs an independent council over each unit's evidence.
  • Course Gate generates a bilingual visual-teach course from the run artifacts.
  • Publish Gate parks or publishes the course based on approval.

If any gate fails, the run fails closed and evidence is written to the run directory.

Think of it like… airport security: each checkpoint must pass before you board, and any failure sends you back for inspection.

Under the hood

runProofGate reads TaskState events from the store and writes units/<unitId>/proof-results.jsonl. runValidatorGateForSpec converts proof results into BusinessSignal evidence and runs a council verifier panel. generateCourse emits self-contained EN + PT-BR HTML. runPublishGate requires approved: true and a gist publisher; unapproved artifacts are parked.

2

In one picture


Proof Gate Validator Gate Course Gate Publish Gate Every gate must clear before a run is considered finished
The four gates run in order; failure at any gate stops the run.
3

In the code


# a Forge-scope run with --yes clears the publish gate
alembic run --goal GOAL.md --plan alembic.plan.ts --yes --offline

Implementation notes

The CLI passes injected publishers in tests so the publish gate can clear even offline. In production, the loop-engineering publish scripts create a private gist and optionally a Cloudflare Pages site. The course directory becomes the artifact published by the gate.

4

Try it


Run a Forge-scope command with --yes and look for publish gate: published in the output. Find the gist URL in the run directory.

Ethics: Why is the validator gate independent from the builder?
5

Quick check


Which gate generates the visual-teach course?