Git Trailer Schema
The machine-checkable grammar for the structured git trailers every agent
commit carries, and the hook estate that enforces the parts of it that are
enforced today. This is git doctrine adoption item 1 of 5 (v2 roadmap
draft, ai/_inbox/archive/tui-roadmap-update.md §5.9; approved for Program
24 P1, project/roadmap.md §4, 2026-07-20): “trailer schema + generated PR
bodies + in-repo hook estate.”
Why trailers, not a status document
§5.3 of the draft names the problem this solves: “History is provenance.” A commit binds its work to a plan, a train, a pin, and a baseline claim through structured trailers, so that plan progress, PR bodies, and the ceremony ledger can all be derived from the commit record instead of hand-maintained beside it — the repository is the shared memory of a system whose workers (agents, across sessions) have none.
The schema below is what tools.trailer_schema parses and validates,
and what tools.generate_pr_body surfaces into a generated PR body.
Nothing here invents new git machinery: no git notes, no custom ref
namespaces beyond tags (§5.9’s own anti-exotica rule) — just conventional
trailer lines, parsed with git’s own %(trailers:...) machinery
(git log --format), not a hand-rolled heuristic.
The schema
Every field below is a standard git trailer (a Key: value line in the
trailing block of a commit message, one per line). The worked example is the
literal §5.3 sample commit:
Task: 2026-07-18-track1-organizers-map#10
Train: train/archive-keel
Lane: pages
Safety: P
Pinned: dev@72def41c
Baselines: untouched
Session: <run id>
Co-Authored-By: …
Trailer |
Grammar |
Example |
Meaning |
|---|---|---|---|
|
|
|
The plan task this commit discharges. |
|
|
|
The train branch this task’s work integrates into. |
|
|
|
Work-order lane label (plan-defined slug; no fixed enum yet). |
|
|
|
Parallel-safe ( |
|
|
|
The base ref + SHA this task branched from — guards the “base-branch
trap” (branching from a stale |
|
|
|
Whether this commit touches |
|
any non-empty token |
a run/session id |
Opaque identifier of the agent (or human) run that produced the commit — the “who, at 3 a.m.” half of the provenance question. |
|
|
|
Standard GitHub co-author trailer. Used constantly in this repo’s
history already; not itself part of the §5.3 coordination-database
schema, but recognized by |
Lane/Safety are shown on one display line in the §5.3 prose sample
for readability; as actual git trailers they are two separate lines (git’s
trailer format is one Key: value per line — a single line cannot carry
two keys).
Required vs. informational
Task, Train, Lane, Safety, Pinned, Baselines, and
Session are the required §5.3 schema (tools.trailer_schema.
REQUIRED_TRAILER_KEYS). Co-Authored-By is documented for grammar
checking but not required by this schema — it is demanded by convention and
by GitHub’s own co-author UI, not by this doctrine.
What is NOT yet mechanically enforced: no hook in this repo currently
rejects a commit for missing the required trailer set — only the
Baselines: blessed(<slug>) half is enforced today (see Baselines: the
one enforced trailer below). mise run commit (.mise.toml) already
exists as a hook-safe commit wrapper (pre-runs hooks, re-stages fixes,
verifies HEAD moved) but does not today inject Task/Train/
Lane/Safety/Pinned/Session automatically from worktree-local
environment. The project retired its obsolete worktree helpers. Explicit Git
or Codex worktree creation does not inject these trailers.
This item (1) ships the schema and the generator that consumes trailers
where present, not the injection mechanism. Do not read this document as
asserting that every commit in this repository already carries the full
set — it does not, yet.
Baselines: the one enforced trailer
The Baselines trailer’s blessed(<slug>) form is the one part of this
schema with a live enforcement mechanism, predating this item (§6.5,
PR #226, tools/
check_baseline_ceremony.py): any commit touching tests/baselines/**
must carry Baselines: blessed(<ceremony-slug>) or be rejected. See
CLAUDE.md “Baseline ceremonies” for the full doctrine; this document’s
tools.trailer_schema mirrors that gate’s trailer regex exactly (kept
as a sibling literal, not a shared import, so the two modules have no
runtime dependency on each other) so the two never drift apart. Completing
the rest of the blessing mechanization (item 3) is a separate, later
side-task.
Generated PR bodies
tools/generate_pr_body.py (wired as mise run pr:body) reads every
non-merge commit in a range (default origin/dev..HEAD), and renders:
Commits grouped by conventional-commit type, then scope — in Conventional-Commits-spec order (
feat,fix,refactor,perf,docs,test,build,ci,chore,style,revert,other), oldest commit first within each group so the output is a stable function of the range’s content.A Provenance section — every declared trailer key, with the sorted, de-duplicated set of values seen across the range (e.g. every distinct
Taskid touched, every distinctBaselinesstate declared).A Trailer warnings section (only present if triggered) — any trailer value that fails its schema grammar above. Missing trailers are not flagged here (a range legitimately mixes commits that predate the full trailer convention); only malformed present values are.
The standard footer — every generated body ends with:
--- *Generated by `tools/generate_pr_body.py` (git doctrine §5.9 item 1 — trailer schema + generated PR bodies).*
so a reader can tell a generated body from a hand-written one at a glance. This is a new convention established by this item — there was no pre-existing “generated-with” footer text in this repository before it (only the
Co-Authored-Bycommit trailer, which is a different thing). Change the exact footer text and this paragraph together if it ever needs to change.
This tool does not implement train:pr (the full train-integration
generator §5.3 describes, which also consumes rulings and writes directly to
a PR via gh) — that machinery, and the reservations/single-flight-lock
items (4-5), activate only when the first fan-out plan demands them
(project/roadmap.md §4). generate_pr_body.py is the standalone,
composable piece: point it at a range, get a body, paste it (or pipe it to
gh pr create --body-file) yourself.
Hook estate: local hooks vs. their CI leg
All hooks live in-repo, in .pre-commit-config.yaml — no hook lives only
in a developer’s global git config or a CI-only script with no local
equivalent. The table below is the audit this item’s DoD asks for: which
CI job (if any) is the authoritative re-run of each local hook, per
.github/workflows/ci.yml and main.yml.
Local hook ( |
Stage |
Authoritative CI leg |
Notes |
|---|---|---|---|
|
pre-commit |
Unit Tests (selector-policy contract only) |
The local contract validates workstation state. The meta hooks and unit contract reject selectors that no longer match any tracked path. |
|
pre-commit |
Fast Gate — “Lint (ruff check)” / “Format (ruff format –check)” |
Same command family ( |
|
pre-commit (files-scoped) |
Fast Gate — “Type check (mypy strict)” |
Local hook and CI both run |
|
pre-push |
Unit Tests (xdist, coverage gate) |
Explicitly labeled “NOT CI-predictive” in the hook itself — it is a
fast local smoke check (2 dirs, |
|
pre-push |
Fast Gate — “Import-boundary contracts” |
Same command ( |
|
pre-push |
Fast Gate — static sentinels / public-surface baseline |
The local hooks run the same full-tree Mise tasks as hosted CI. |
|
pre-commit / pre-push |
Rust Gate |
Formatting runs on Rust source or formatter/toolchain policy. The push
hook re-diffs pre-commit’s exact remote-to-local refs so deleted paths
still select |
|
pre-push |
Rust Gate |
Covers the non-Rust inputs to the Rust-owned repository sentinels:
|
|
pre-commit (files-scoped) |
Fast Gate — “uv lock consistency” |
Both run |
|
commit-msg / pre-push |
Baseline Ceremony Gate (§6.5 provenance) |
Local leg is explicitly best-effort ( |
|
pre-commit |
Secret Scan (gitleaks, full history) |
Same tool; CI scans full history, the local hook scans the commit. |
|
commit-msg |
none found |
No CI job re-validates conventional-commit subject grammar; this is local-only today. |
|
pre-push |
none found |
No CI job runs |
|
pre-push |
none found |
|
|
pre-commit |
none found (adjacent: Documentation Build) |
|
|
pre-commit |
none found |
Local-only. |
|
pre-commit |
none found |
Local-only; no workflow lints workflows, shell scripts, or the Dockerfile in CI today. |
|
pre-push |
none found |
Local-only. |
trailing-whitespace / end-of-file-fixer / check-yaml / check-json / check-toml / check-added-large-files / check-merge-conflict / check-case-conflict / forbid-new-submodules / no-commit-to-branch |
pre-commit |
Fast Gate — “Repo hygiene gate” (partial overlap only) |
|
Reading this table: “none found” means exactly that — a targeted search
of every .github/workflows/*.yml job step for the tool’s name found no
match, not that the check is unimportant. Per this codebase’s documentation
philosophy (verifiability over comprehensiveness), this table records what
was actually found rather than asserting CI parity that doesn’t exist. If a
“none found” gap should be closed, that is a separate, explicitly-scoped
follow-up — not silently assumed away here.