Orchestrata Ultimate › Gates › Process-level gates
Gate family: Process-level gates
At a glance
| Purpose | Say no to a workflow step (dispatching, landing evidence, folding, committing, pushing, ratifying, merging) rather than to a tree, a run or a tool call. |
| Where it runs | Workflow law, the tracked git hooks under scripts/hooks/, scripts/health_check.py, and Mohamed's ratification. |
| Trigger | The workflow step itself: git commit (pre-commit, commit-msg), git push (pre-push), a dispatch, a fold, a merge. |
| Exact command | Per row below; the mechanical ones are scripts/hooks/pre-commit, scripts/hooks/commit-msg, scripts/hooks/pre-push, check_ai_attribution.py, check_adr_graph_sync.py and gen_plugin.py --check. |
| Blocks | pre-commit and commit-msg: exit 1 refuses the commit; pre-push: exit 1 refuses the push; process-law rows have no exit code. |
| Ruling / ADR | RUL-007, RUL-008 — review before commit, RUL-022, RUL-040; ADR-0046 — three synchronized ADR homes; ADR-0101 — the real hook stages are measured first; ADR-0120 — test subprocesses import from the installed environment. |
The battery gates say no to a tree; the suite preflight says no to a run; the session hooks say no to an action. This family says no to a workflow step — dispatching a reviewer, landing evidence, folding findings, committing, ratifying, merging. Some of these resolve to a script (and are cross-referenced to their own pages); some are process law whose "command" is a git practice; one is a person.
The canonical 14-row table lives on Ruleset Engine — The Complete Picture, section 5 and (in inventory form) on the ruleset design-review page (§2.4). This page expands the rows.
1. Briefs-before-dispatch
- Refuses: any reviewer or subagent working from undocumented instructions.
- How it runs: lens/agent briefs are committed to
plans/briefs/before dispatch, and "the agent's prompt IS the committed file." The design-review page's lifecycle diagram states it as a gate node: "GATE: briefs COMMITTED before dispatch —git add plans/briefs && git commit." - Failure semantics: process law, not an exit code — the audit trail is
git log plans/briefs/("practice", per the design-review gate inventory). A dispatched agent whose brief has no commit is the violation. - Why it exists: so a review's findings can always be traced to the exact instructions that produced them. Origin beyond that practice note is not recorded in the source.
2. Evidence-on-landing
- Refuses: review data living only in volatile storage (a scratchpad, a chat transcript).
- How it runs: "every report committed to
plans/reviews/ruleset/the turn it lands" — the design-review diagram's phase-B gate: "GATE: evidence committed on landing —cp → plans/reviews/ruleset/ && git commit." - Failure semantics: process law; the check is that each review round's commits contain the report files, per-round.
3. Author sweep
- Refuses: half-propagated folds — "a term retired in one place, alive in another."
- How it runs: after a fold, a grep of every retired term over the design "must return zero live hits before commit" (complete-picture table, row 3).
4. Per-id ledger
- Refuses: fold claims hiding behind "all fixed."
- How it runs: "the design's own §12 bans bare quantifiers; every finding id gets its own disposition" (complete-picture table, row 4).
5. Fold-verifier
- Refuses: false fold claims, inert mechanisms, orphaned deletions.
- How it runs: an independent auditor agent, "8 mechanical checks per version; its file is folded, never its summary" (complete-picture table, row 5). The design-review inventory names its scope: "false §12 claims, inert mechanisms, rule-5/6/7/8 breaches."
- Why it exists: the fold step is where findings die silently — a verifier that reads the folded artifact (not the folder's summary of it) is the only way a fold claim is evidence rather than assertion.
6. RUL-007 attribution — scripts/check_ai_attribution.py
- Refuses: AI attribution in commit/tag/PR message text — Mohamed is the sole author.
- Why it exists / scoping (module docstring): "Scans commit / tag / PR message TEXT only — never file contents, never the diff. That scoping decision is what keeps the gate silent on its own source, on CLAUDE.md, on the wiki ruling page that quotes the forbidden trailer verbatim, and on the whole SPEC-021 / SPEC-025 Claude-Code-producer subsystem, all of which legitimately contain the exact strings this gate forbids in a message."
- How it runs: four combinable modes —
--message-file PATH("the commit-msg hook moment: git passes$1. Blocks before the commit object exists, the only point where blocking costs nothing"),--range [REV_RANGE](repo-history scan for CI, baseline-aware),--tags(annotated tags, "strict, no baseline"),--stdin(arbitrary text, e.g.gh pr create --body-file -). - When it fires: on every
git commitvia the tracked hookscripts/hooks/commit-msg, whose last line is exactlyexec python scripts/check_ai_attribution.py --message-file "$1". Also invoked byscripts/health_check.py. - Failure semantics: exit 0 clean ("baselined findings are reported but do not fail"), 1 at least one new violation, 2 usage/environment error.
- Tests:
tests/scripts/test_check_ai_attribution.py.
7. ADR drift — scripts/check_adr_graph_sync.py
- Refuses: an ADR that differs across its three homes (repo
docs/adr/, wikidecisions.md, live graphArchitectureDecisionnodes) — or an id claimed by two different decisions. - Why it exists (module docstring): "This project has two independent ADR registers that number their entries the same way… An audit (2026-08-19) found the two corpora disagree on the DECISION ITSELF for all 25 overlapping ids (ADR-0001..ADR-0025) — e.g. graph/wiki ADR-0001 = 'Memgraph as Semantic Graph Backend', repo ADR-0001 = 'Enforcement boundary is committed worktree state, not tool interception'… This gate does not resolve that. It reports the three-way state … and FAILS loudly on any ambiguity or gap. Resolving the id collision … is a decision for a human, not this script."
- How it runs:
uv run python scripts/check_adr_graph_sync.py(add--jsonfor machine output). Per ADR number it checks presence in repo/wiki/graph and title agreement; verdict classes are AMBIGUOUS_COLLISION, MISSING_FROM_GRAPH, DRIFT (violations) and ORPHAN_IN_GRAPH (reported, not a violation — "no deletions, ever"). Read-only by contract. - Failure semantics: 0 pass / 1 violations / 2 could not determine (unreadable corpus, graph unreachable) — "an inconclusive run is never reported as a pass."
- Wiring: invoked by
scripts/health_check.py; the complete-picture table's acceptance line is "every id must readOK in sync." - Tests:
tests/scripts/test_check_adr_graph_sync.py.
8. Ruling authority
- Refuses: anyone but Mohamed flipping a decision; unrecorded rulings.
- How it runs: process law — "one decision at a time, data in the ADR first,
same-turn recording with shas" (complete-picture table, row 8). The mechanical
neighbours are the ADR-drift gate above and the decision-skill injection hook
(
decision-adr-trigger.sh).
9. RUL-022 design-before-build
- Refuses: implementation with no design authority.
- How it runs: the PreToolUse(Agent) hook
.claude/hooks/require-design-before-build.sh"blocks builder dispatch without a contract or an Accepted-ADR waiver" — full detail on the session-hooks family page.
10. F13's traceability battery
- Refuses: untraced or drifting code — a citation without a spec, a spec without an implementation, an id with two spellings.
- What it is: not one gate but a battery of complementary mechanisms, each owning
one direction (complete-picture table row 10 lists them; each script's docstring
demarcates its own scope against the others):
- check-traces + trace-audit — AST-toolkit ratchets in the review battery over
@tracesdecorators. scripts/trace_intel.pyorphans / untraced-reqs — exhaustive, advisory Prolog queries over the current tree.- Evidence-graded RTM (
scripts/generate_rtm_evidence.py) — "every row carries its proof class" (TESTED / CITED / DECLARED / UNLINKED). - feature-loss — the git- history direction: implementation existed, is now gone.
- spec-authority (
scripts/check_spec_authority.py, RUL-013) — "when someone resolves a contract from a test instead of from a spec, they must invent a requirement id to cite… That fabricated id is a permanent, corpus-wide, machine-checkable artifact — and until this gate, nothing looked for it intests/." Ratchets on--max. - req-format (
scripts/check_req_format.py) — "the ONE canonical GRAMMAR, enforced forever" over requirement-id shapes, plus cross-spec uniqueness; the declared mechanism for RUL-031 ("requirement ids have exactly one spelling"). - factory conformance (SPEC-033 B2/B3 engines) — AST≡design conformance and structural trace validation.
- And in the registered battery, requirement-corpus guards the corpus the rest grade against.
- check-traces + trace-audit — AST-toolkit ratchets in the review battery over
- Tests:
tests/scripts/test_check_spec_authority.py,tests/scripts/test_check_req_format.py,tests/scripts/test_trace_intel.py,tests/scripts/test_generate_rtm_evidence.py,tests/scripts/test_ast_check_traces.py,tests/scripts/test_ast_trace_audit.py.
11. The suite
- Refuses: red tests; false-green runs.
- How it runs:
python scripts/run_tests.py— kernel REQUIRED, no mocks, no xdist, real infra. See the suite-preflight family page.
12. Plugin currency
- Refuses: skills/hooks missing from the delivery path.
- How it runs:
python3 claude/scripts/gen_plugin.py --check— the same mechanism as the registered plugin-drift gate, invoked as a process checkpoint.
13. Session honesty
- Refuses: guessing ("likely"), "pre-existing" as an excuse, offering instead of fixing, claims without verification.
- How it runs: the RUL-017 / RUL-024 / RUL-006 Stop hooks plus deception audits on every reply — detailed on the session-hooks family page.
14. Mohamed
- Refuses: everything above him.
- How it runs: "ratification sessions and the merge gate — no branch reaches master without his word" (complete-picture table, row 14). This is the one gate with discretion, which is why it is last.
The git-hook moments (where process gates bite mechanically)
The tracked hooks under scripts/hooks/ (installed by
scripts/hooks/install-git-hooks.sh, which sets core.hooksPath to the relative
path scripts/hooks so every worktree runs its own branch's hooks). Read from
wt-MAP-PRECOMMIT on 2026-10-23; the commits cited are on origin/master
(a4cbc2bdf) unless marked otherwise.
| Hook | Runs, in order |
|---|---|
commit-msg |
exec python scripts/check_ai_attribution.py --message-file "$1" (row 6). |
pre-commit |
1. check_staged_secrets.py with the repo .venv/bin/python (plaintext-secret refusal). 2. If no .py file is staged: the map refresh, then exit 0. 3. ruff check --fix on each staged .py file, then git add it (never blocks). 4. "$PY" scripts/gate.py review-staged: the verdict is derived in Prolog by commit_review.pl (8e0df6ff3, 2026-10-11, "no verdict is not a pass"); exit 1 = blocking issues, any other non-zero = "a review produced no verdict", both refuse the commit. 5. _refresh_maps: regenerate and stage docs/CODEBASE_MAP.md and docs/CODEBASE_MAP_FULL.md when the commit stages Python (b5468cb1c, 2026-10-22; a failure prints one WARN line and never blocks). The hook no longer calls code-review.py or test-review.py directly; review-staged runs them. With PRECOMMIT_WALLS_FILE set it appends per-stage walls to reports/precommit-walls.ndjson (ADR-0101 rule 2). |
pre-push |
1. Refuses when master or main is checked out in the pushing worktree ("Push from a feature-branch worktree instead"). 2. Skips the suite when reports/.ship-verified matches this exact source and reports/run-tests-latest.json shows zero failures at that commit. 3. Refuses, fail-closed, when origin/master does not resolve (2669f4882, 2026-10-21: the old "BASE not found → FULL suite" arm is gone, RUL-040). 4. Builds the range from the commit being pushed, origin/master...<pushed sha> (e27c12b50, 2026-10-21); no committed change → exit 0. 5. .venv/bin/python scripts/run_tests.py --affected "$RANGE" (949c1628c, 2026-10-21: the venv python, not uv run, because uv run re-syncs the package editable and source provenance rejects it, ADR-0120). |
post-checkout, post-merge |
scripts/hooks/_materialise-env.sh for the worktree (branch checkouts only for post-checkout). |
The ruff step's uv run flag differs by branch. On origin/master
(a4cbc2bdf) the pre-commit ruff line is a plain uv run ruff check --fix. On
feat/maps-via-codetools it is uv run --no-sync ruff check --fix, with the
comment "a plain uv run makes the install editable and the pre-push provenance gate
then refuses"; that change is commit 8a2cb42ad, which is not on origin/master
(checked with git merge-base --is-ancestor, 2026-10-23).
Typical failures and how to fix them
- "Commit blocked — the review found blocking issues".
review-stagedexit 1: fix the listed code-review errors or test-review errors/warnings and commit again. See review-staged. - "Commit blocked — a review produced no verdict". A reviewer did not run,
wrote no report, or disagreed with its own exit code. No verdict is not a pass:
fix the reviewer (often a missing
.venvor a timeout) rather than retrying. - A commit refused for a secret.
check_staged_secrets.pyfound a plaintext value; unstage it and move it into the encrypted env. See secrets. - A commit message refused.
check_ai_attribution.pyfound an attribution line (RUL-007); reword the message. - A push refused on master. Push from a feature-branch worktree.
- A push refused because
origin/masterdoes not resolve. Fetch, or pass an explicit decision throughrun_tests.py --affected-decision. - A push refused by source provenance after a plain
uv run. The venv was re-synced editable; re-sync it withuv sync --dev --no-editablebefore pushing. See source-provenance. - An unchanged map warning. "codebase map regeneration failed" never blocks; regenerate the maps and amend before pushing so the tree stays clean.
Related
- Gates master index
- Development workflow
- review-staged, secrets, ai-attribution, commit-precheck — the commit-time gates
- pre-push-guards, affected-selection, ship-verify, source-provenance — the push-time gates
- dispatch-brief — the mechanical side of briefs-before-dispatch
- ci-pipeline
- RUL-007 — No AI attribution
- RUL-008 — Review before commit
- RUL-022 — Design before build
- RUL-040 — Scope measured at symbol granularity, never full suite
- ADR-0046, ADR-0101, ADR-0120
- Ruleset Engine — The Complete Picture — the lifecycle these gates attach to
- The ruleset design-review page (§2.4 gate inventory) for the review-loop-specific rows (briefs, evidence, sweep, ledger, fold-verifier)