Introduction
StateAnchor is a Git-native enforcement layer for API contracts. One file in your repo -- stateanchor.yaml -- is the single authoritative desired state. Every push triggers a gate evaluation. Breaking changes are blocked before they reach production.
What StateAnchor does in 60 seconds
The gate classifies every incoming spec change into one of three lanes:
| Lane | Behavior | Examples |
|---|---|---|
| ERR | Always blocks | Endpoint removed, required field deleted, type changed, auth scheme changed |
| WARN | Blocks above threshold | Optional field removed, deprecation violated, response shape changed |
| INFO | Always passes | New endpoint added, optional field extended, description changed |
The lane is categorical, not a score. No threshold to tune. No grade inflation. The verdict drives the action.
Two modes
StateAnchor ships in two modes so you can adopt it without replacing what you already have:
- Gate-only mode -- enforcement on top of your existing generator (Speakeasy, Fern, or anything else). You keep generating; StateAnchor blocks breaking changes before generation runs on a broken spec.
- Full pipeline mode -- gate + SDK generation (TypeScript, Python, Go) + MCP server + OpenAPI docs, all triggered by one push. If the gate blocks, nothing regenerates. The last good state holds.
Both modes start free. See Gate-only mode for the complement-framing details.
Detection accuracy
StateAnchor's spec-diff engine detects 100% of breaking changes on our 34-scenario ground-truth corpus. The closest open-source alternative (api-smart-diff) detects 65% on the same corpus. Full scenario-by-scenario breakdown at StateAnchor vs. diff tools.
What you'll find in these docs
- Getting Started -- quickstart, architecture overview, who it's for.
- Core Concepts -- how the gate works, the spec file, the four-syndrome model, exception ledger, syndrome independence.
- Guides -- connecting a repo, handling a block, gate-only mode, exceptions, compliance export.
- Reference -- stateanchor.yaml spec, all 33 gate kinds, API reference, CLI reference.
Start here
Pick your framework and get your first sync running in 5 minutes.