Skip to main content

Purpose

This is the canonical architecture contract for repository infrastructure. It defines what each layer owns, what each layer must never do, and where enforcement belongs.

Design Tenets

  1. Single responsibility per layer. Each gate owns one class of risk.
  2. Fast local feedback. Pre-commit is local, offline, and bounded.
  3. Governance at branch and CI boundaries. Contract, issue-readiness, and policy checks run at pre-push/CI.
  4. One canonical policy source. Operational docs link here instead of copying rule text.
  5. Measurable SLOs. Runtime budgets are enforced, not aspirational.

Severity Model

  • P0: merge/deploy safety failure (broken routes, broken rendering, blocked docs delivery)
  • P1: correctness/governance failure (scope violations, invalid contract/issue readiness)
  • P2: quality drift (style, docs hygiene, generated index drift)
  • P3: advisory debt (non-blocking cleanup, optimization backlog)

Stack Architecture (End-to-End)

Runtime and Scope Budgets

  • pre-commit: must complete in <= 60s by default. No browser sweep, no WCAG crawl, no external link/network dependency.
  • pre-push (codex/*): owns contract, lock, stash, issue-readiness, and push safety checks.
  • CI changed-scope: owns blocking quality checks for changed files in PR context.
  • CI heavy sweeps: owns browser/page/link/domain/WCAG full or broad scans.

Ownership Contracts

  1. Pre-commit must not implement codex governance policy.
  2. Pre-push must not duplicate style/authoring checks already in pre-commit and PR CI.
  3. CI must be source of truth for heavyweight, potentially flaky, or network-dependent checks.
  4. Any new rule must declare its primary gate layer before implementation.
  5. Any duplicated policy text outside this file is documentation debt and should be replaced by a link.

Migration Rules for New Changes

  1. Define risk class (P0..P3) before adding a new check.
  2. Place the check in exactly one primary layer.
  3. Add runtime budget impact if the check runs locally.
  4. Add CI mirror only when local feedback is insufficient.
  5. Update this document in the same PR when gate boundaries change.
Last modified on May 22, 2026