Agent Governance Mechanisms
Generative AI is shifting software engineering from a practice built around scarce implementation toward one built around abundant, low-cost code. The hard part stops being writing code and becomes governing the conditions under which fast code can be trusted. That means keeping it inspectable, correctable, and maintainable at speed.
QUICK START: Install the skills for Claude →
Between two schools of thought
Two common ways to build with agents sit at opposite ends of a spectrum. This site is about the midway.
Vibe coding
Prompt an agent, accept what looks right, iterate by feel. Fast and fluid, but quality rests on the model and your eye. At scale the same failures keep recurring, and human review becomes the bottleneck.
all velocity — no durable guardrailsGovernance-centric
The midway. Velocity exposes failures; you convert each recurring one into a guardrail: a type, a lint, a gate. The guardrails grow out of real failures, so code stays fast and stays trustworthy.
velocity + guardrails grown from failureOversight-centric
Check everything before you trust it, whether a human reviews every change or a formal specification is verified against. Rigorous and safe, but checking becomes the bottleneck: all of it must be vetted, and neither humans nor specs anticipate the failures that only appear at velocity. (Spec-driven development is this, with the spec as the checker.)
all oversight — everything checked← all velocity • all oversight →
Both ends of the spectrum pay the pet tax. Each spends per-change human attention, whether you're coaxing the output at one end or inspecting it at the other, and that attention grows with the size of the fleet until it becomes the bottleneck. The midway is cattle, not pets: build the fences and chutes once, and the guardrails ride every change instead of a person.
The midway is a discipline: establishing and maintaining a governed engineering environment. It works in two directions at once.
- Up front, you specify what you can: the architecture that makes a class of error impossible, the model the fleet reasons through (more on that below), the templates and checklists that put a change on rails before it's written.
- In flight, you let velocity surface the failures you couldn't foresee, and convert each recurring one into a durable guardrail.
This site describes both halves. The first is the guidance on what to fix in advance; the second is the machinery for responding when something slips through. It packages both as three Claude skills with a quick-start. The catalogue itself is 69 governance mechanisms across three roles, each written like a design pattern — the recurring failure it kills, and why it is not just the cheaper thing everyone already does.
Documentation, taken to its limit
Start with the up-front half. Anyone who has built with agents has found the first move on their own: give them good documentation and tests, then point them at it. Agents write and maintain those artifacts as fast as they write code, so the cost that always made thorough docs a fantasy is gone. The step the training data won't suggest is the next one. Documentation has a hierarchy, and its top is not prose. It is a typed model.
A context-bounded agent working on a context-exceeding system needs a typed, queryable, drift-checked model of that system to reason through, the blueprint for a structure too large to hold in one view. That is model-based software engineering, and it is the bridge between the agent and the codebase it cannot fit in its head. Two things make it more than a tidier README:
Agent-legible & precise
A six-state machine with typed invariants is something an agent reasons over without error the way it never could over 300,000 lines of prose-and-code. Abstraction shrinks the space it can be wrong in, not just the token count. A model is more precise than any document.
It can’t lie
A document rots the moment the code moves; a model wired to a build-time drift check cannot: the gate stays red until the map matches the territory again. That guarantee is what prose can never give.
Because agents build and maintain the model the way they maintain docs and tests, pointing them at it costs almost nothing, and it pays back in higher code quality, fewer tokens spent rederiving what the model already states, and fewer mistakes. The catalogue's models-bridge role is this bridge, made concrete.
Governance has two mechanisms
A guardrail is one of two kinds: prevent the error, or catch it.
Architecture
Make the error impossible by construction: the typed model above, a state that cannot be represented wrongly, one sanctioned seam. Software poka-yoke, error-proofing, so the bad move can’t happen in the first place.
Control
Where you can’t prevent it, observe and guard the behavior: a lint, a gate, a validator, an audit that fires on a violation and holds the line. Error-catching, deterministically, before the failure escapes.
A control works like a sensor: it detects a mistake and surfaces it after the fact. Architecture works like a wall: it makes the whole class of mistake impossible to make. Reach for the wall first, because a sensor still lets the mistake happen. But a wall built across the only exit blocks the people trying to leave — an over-constrained design stops legitimate work as surely as it stops the error, so the wall belongs around the class you can name, not across the whole floor.
The way of thinking
Three stances that make the midway work, distilled from the AI-First Engineering Method (architecture, controls, and the stance that wields them); the full set ships in the starter CLAUDE.md.
Architect deliberately
- Implementation is cheap; architecture compounds. Buy the right design, not the fast one.
- Name shapes with types; primitive-passing leaves the architecture anonymous.
- Make models, state, and policy explicit: state machines over scattered counters, enums over magic strings.
- One canonical way beats many clever ones. Agents will apply patterns they see 200× with no debate.
- Attack accidental complexity; budget for the essential kind.
Convert failure into machinery
- When a failure recurs, encode it (a lint, type, gate, or schema) instead of re-inspecting for it.
- Move audits to lints: cheap, at-commit, deterministic beats expensive and post-hoc.
- Let the compiler and gates hold the line; review is not a substitute for static analysis.
- Never fail quiet: every caught error logs, re-throws, or is justified in a comment.
- No compatibility shims. Migrate every call site in the same change.
Keep judgment scarce & central
- Carry work autonomously; surface only the architectural calls.
- Hyper-experimentation: pilot, compare, measure; a cheap experiment beats a debate, and negative results are wins.
- Verify claims and trust nothing stale. Re-run the gates yourself, because markers rot.
- Reason about second-order dynamics: what happens at T+100, or under concurrency?
- Documentation encodes invariants that drive tests, not prose that rots.
The three skills — govern, operate, communicate
The catalogue ships as three partner Claude skills (one plugin). Two are one substrate seen from opposite ends (self-governance designs the controls, self-operations runs them), and self-communicate makes what they produce legible: the docs, and the operator's own reports to the human.
self-governance · harden
The design-time lens: the census of controls plus the engine that mints new ones — what exists, what you're missing, how to add one.
self-operations · operate
The run-time lens: it runs the substrate those controls govern — the lifecycle you operate, the runbook you follow, the hook you wire.
self-communicate · communicate
The prose-and-diagram craft: a rhetoric toolkit, the Diátaxis register, a house lexicon, and an audit that emits fixes — for the docs the other two produce and the operator's own reports to the human.
Govern and operate are one substrate seen two ways; communicate is the craft that keeps their output legible. The loop closes across all three: operate surfaces a recurring break, govern mints the control, communicate writes it up in the shared register. Install all three →
Walking through the loop
Governance conversion is a non-terminating loop: higher velocity keeps surfacing failure classes that earlier governance didn't address.
Governability compounds. The environment absorbs more agent work, so velocity stays sustainable.
Implementation is cheap; the judgment that decides which governance should exist is the costly, human part. Two paired concepts hold it together:
- Governance makes velocity sustainable — guardrails are what let the fleet keep shipping fast without drowning in its own failures.
- Judgment decides which governance to build — recognizing which failures deserve a guardrail (and which are one-offs) is the hard, human call.
Explore the catalogue
69 governance mechanisms — the repertoire this loop produced in one real production system.
The catalogue
A representative selection — mechanism patterns, not an exhaustive list of every lint and gate in the system. Each row is one mechanism with its one-line Summary and how it Enforces: Hard is deterministic (blocks, audits, or signals regardless of agent cooperation), Soft is probabilistic (aims an agent but cannot block), and Soft·Hard is soft guidance with a hard counterpart. Click a name for the full writeup.
Governance: Agents
Context & dispatch substrate
What an agent knows and how it is launched.
| Mechanism | Summary | Enforcement |
|---|---|---|
| Brief-linting | Reject a malformed dispatch brief before it can launch. | Hard |
| Docs hierarchy + governance index | One enforced, numbered rule index every agent boots with. | Soft·Hard |
| Dynamic context injection | Inject the rules governing these files into the brief. | Soft |
| Role-typed dispatch | A typed role fixes LLM, isolation, and gates per dispatch. | Hard |
Gates & merge-train
The path-to-production staircase for agent work.
| Mechanism | Summary | Enforcement |
|---|---|---|
| Pre-commit hook (3-stanza, tree-sha markers) | Cheap changed-file checks gate every commit, marker-verified. | Hard |
| Sentinel first-commit early-abort | Abort a broken agent at its first commit, not its last. | Hard |
| Merge-train MIS batching | Land non-conflicting worktrees together via a maximum independent set. | Hard |
| Staged deploy gates (canary → smoke → promote) | Canary → smoke → promote; gate before users see it. | Hard |
Mediators & resource locks
Host-level wrappers that ration shared compute across concurrent worktrees. Three cap by
| Mechanism | Summary | Enforcement |
|---|---|---|
Test-serializer (N=1 flock on dotnet test) | Serialize dotnet test to a single writer per host. | Hard |
| Build-serializer (M=8 semaphore) | Cap concurrent heavy builds with an M=8 host semaphore. | Hard |
Aggregate-compute protection (lint-all host mutex) | One lint-all per host; one in flight per orchestrator. | Hard |
| Resource-pressure gating (admit before, shed during) | One pressure signal gates heavy work at admission and execution — admit before, shed during. | Hard |
Lifecycle & observability
Live signal surfaces over the fleet.
| Mechanism | Summary | Enforcement |
|---|---|---|
Agent-registry (agent-registry.jsonl + marker cache) | Authoritative record of which agents are live right now. | Hard (signal) |
| Orchestrator-as-reactor over an event bus | The orchestrator reacts to typed fleet events via a per-topic playbook. | Hard (signal) |
| Deploy heartbeats + stale-worker detection | Periodic liveness so a hung deploy differs from a slow one. | Hard (signal) |
| Tombstone commits (lifecycle close records) | A close record proving a worktree is safe to reclaim. | Hard (audit) |
| Cron-alerts gate | Block new dispatch while a HIGH cron alert is unresolved. | Hard (blocking) |
| Lifecycle hooks (turn-stop / compaction / session-start / pre-action) | A hook on a runtime lifecycle event so an operator's omitted step can't be forgotten. | Soft·Hard |
| Reflection-facet substrate (tempo-gated policy nudges) | Many policy-reflection nudges as one facet registry over a shared tempo budget — ≤1 emission/window. | Soft·Hard |
| Caused-by provenance (agent-side change traceability) | A typed caused-by field, minted at the cause and gated at commit, threads a change to its reason. | Hard |
Governance-doc mechanisms
Documentation treated as enforced infrastructure.
| Mechanism | Summary | Enforcement |
|---|---|---|
| CLAUDE.md rule index + cap lint | The governance document itself, enforced by its own lints. | Soft·Hard |
| Mandatory snippet-table enforcement | Brief-linting asserts every required brief snippet is present. | Hard |
| Epic Definition-of-Done (Final-Opus trust-nothing re-run) | Close an Epic only after re-running its checks at HEAD. | Hard |
| Doc-hygiene lints (index coverage, autogen provenance) | Lints keep docs indexed, provenance-headed, and cross-reference-valid. | Hard |
| Operational playbooks (situation-keyed devops procedures) | Situation-keyed devops procedures agents follow instead of improvising. | Soft |
| Operator runbook skill (positive map + symptom index, ref-lint-kept) | Positive substrate map + symptom→doc routing, generated from typed YAML, ref-lint-checked. | Soft·Hard |
| Epic & design-doc templates | Fixed section-templates for Epics and design docs so plans are complete. | Soft·Hard |
| Enforce at the right semantic level | Match a mechanism's enforcement scope to the semantic scope of the property it checks. | Soft |
Governance: Models — a bridge between agents and product
System models
One MBSE
| Mechanism | Summary | Enforcement |
|---|---|---|
| Executable source-of-truth (data-not-code, can't drift) — trunk / method | Typed models read every run and generated from; can't drift. | Hard |
| Drift & parity gates (model↔reality) — trunk / method | Bidirectional model↔reality checks so models cannot drift. | Hard |
| Agent-first MBSE harness (frozen records; adopt schema, skip runtime) — trunk / method | Typed frozen-record models + five hand-rolled disciplines; adopt the schema, skip the runtime. | Hard |
| Formal invariant verification (temporal form → model check) — trunk / method | Each invariant's temporal-logic form derives its checker — proven, not sampled. | Hard |
| Coverage → model-node mapping (which invariants are tested) — trunk / method | Project test coverage onto model nodes (states, seams, invariants) so untested ones are visible. | Soft·Hard |
| Journey-criticality → test-tier placement (which host a test runs on) — trunk / method | A journey's criticality derives its test's host tier; a lint holds the local-coverage floor. | Soft·Hard |
| Invariant-DAG execution policy (typed Scheduler: correctness vs resource + cost) — trunk / method | A DAG holds correctness + cost-gate edges only; a typed Scheduler rations load + budget per host. | Soft·Hard |
| Model-driven codegen — trunk / method | Generate real artifacts from the models, provenance-headed. | Hard |
Model query surface (repo-query) — trunk / method | repo-query — the agent-facing read API over the models. | Soft |
| Meta-model consumption (read, don't hardcode) — trunk / method | Read the model at runtime; never hardcode a snapshot. | Hard |
| Control↔substrate dependency (computed blast-radius) — trunk / method | Each control declares its substrate assumption as metadata; a query computes the blast radius. | Hard |
| Symbol-anchored traceability graph (derived edges) — trunk / method | A typed model↔lint↔code↔proof↔registry graph whose edges are derived, symbol-anchored, re-checked. | Hard |
| Model-graded finding severity (distance-graded gate) — trunk / method | A gate grades each finding block/warn/silence by its model-distance from the changed files. | Hard |
| Service-flow / API model — product-facing | The SOA source-of-truth NetworkPolicy and wiring are generated from. | Hard |
| User-journey model (product-goal → implementation) — product-facing | User journeys as typed entities: actor, goal, ordered steps joined to the endpoints they cross. | Hard |
| Domain registries — product-facing | Frozen typed registries for the system's domain facts. | Hard |
| Synchronization model (meta-sync) — orchestration-facing | A registry of every lock, what it guards, and its ordering. | Hard |
| Agent-orchestration model (developer journeys) — orchestration-facing | The fleet + orchestrator loop modeled with the product's own MBSE method: developer journeys. | Hard |
| Component & zone model — shared spine | A typed map of every component's code zone and seams. | Hard |
| Mediator & single-writer contracts — shared spine | Declared mediator and single-writer contracts, coverage-checked. | Hard |
| Deployment & tier topology — shared spine | Typed models of where things run and how they layer. | Hard |
Governance: Product
This is the part that's specific to the DocAble project — you'll need your own for your project.
Canonical models & seams
The one sanctioned typed model or seam per concern, each held in place by a ban-lint.
| Mechanism | Summary | Enforcement |
|---|---|---|
| PdfModel (sole PDF mutation surface) | All PDF I/O through one typed model; raw canonical-PDF-library access banned. | Hard |
| Office Models ({Slides,Docs,Sheets}Model) | All OOXML through typed models; raw SDK access banned. | Hard |
| ServiceClient (typed cross-service seam) | A BinaryIO seam makes file-path-over-wire impossible. | Hard |
| Canonical walkers (one traversal per tree) | One canonical traversal per tree, not ad hoc recursion. | Hard |
| Sole raw-Redis seam (the dispatch module) | All raw Redis in one seam; queue atomicity encoded once. | Hard |
Validation & conformance
Deterministic pass/fail checks over the artifact.
| Mechanism | Summary | Enforcement |
|---|---|---|
| ContentValidator (input ⊆ output fidelity) | Assert input content survives remediation — a fidelity gate. | Hard |
| Blocking semantic lints | The blocking semantic-lint fleet over the tool's own source. | Hard |
| Standards / WCAG rule engine | Map each finding to the WCAG/508/PDF-UA criterion it closes. | Hard |
| Cross-source coherence lints | Assert independent sources agree — catch cross-source drift. | Hard |
Regression tests
Repeatable behaviour-pinning bodies.
| Mechanism | Summary | Enforcement |
|---|---|---|
| Test-onion tiers (Smoke / Lite / targeted / full) | Cost-stratified test tiers: Smoke, Lite, targeted, full. | Hard |
| FsCheck property tests | FsCheck invariants over generated inputs find hidden bugs. | Hard |
| Fuzz campaigns (+ auto-coverage) | Malformed-input campaigns; fix to the spec, not the seed. | Hard |
| DDT pin-trailers | Doc-derived characterization pinned to a cited source. | Hard |
Provenance & attribution
Durable records of what the tool changed.
| Mechanism | Summary | Enforcement |
|---|---|---|
| Per-mutator attribution stamps | Every mutation embeds an attribution stamp in the artifact. | Hard (audit) |
| F10 mutator-stamp-wiring lint | Fail the build if any mutator verb lacks a stamp. | Hard |
derive-changelog (reconstruct mutations) | Reconstruct the attributed mutation history from the stamps. | Hard (audit) |
a11y_ prefix convention | Prefix invisible inserts so they're distinguishable and tracked. | Hard |
Repair vocabulary
The bounded move-space of the remediator.
| Mechanism | Summary | Enforcement |
|---|---|---|
Typed ViolationCategory / FailureCategory enums | Typed enums replace free-form failure strings. | Hard |
| Closed remediation-verb sets | A closed, named set of remediation actions — bounded moves. | Hard |
| Codemod-first threshold (N≳50 → AST transformer) | For 50+ deterministic sites, write one AST transformer. | Soft |