Catch drifts before they catch you.
You fight drift with LLM cleanups. The LLM says "all clean" — but it only covered what fit in the context window. The rest rots. Next PR adds fresh contradictions. The token costs of false starts and misdirections pile up. Pituitary indexes the entire corpus and checks all of it, structurally, every time. This is Karpathy's "Linting" layer for LLM Knowledge Bases — except it already exists.
What It Catches
A new spec covers ground an existing one already handles. Your last cleanup didn't catch it because both looked fine in isolation.
A spec changed, but the CLAUDE.md, AGENTS.md, runbooks, and guides that reference it weren't updated.
Pipe your diff in before you merge. Catch conflicts with accepted decisions at PR time.
The team adopted new language but old terms persist across your docs and specs.
A spec hasn't been reviewed since the code it governs changed. check-spec-freshness flags it.
Turn terminology findings into context-aware edits that distinguish prose from identifiers from historical entries.
What It Becomes
Detecting drift is step one. Pituitary becomes the governance layer that replaces ad-hoc LLM cleanups with full-corpus verification — slashing the token costs of false starts and misdirections caused by drifting specs, conflicting decisions, and obsolete docs.
Declare canonical terms in config. Pituitary separates actionable violations from tolerated historical uses and suggests replacements.
Turn terminology findings into patches. pituitary compile --dry-run generates context-aware edits that distinguish prose from identifiers from historical entries — then apply them in one pass.
Pipe your PR diff in. Catch stale docs and spec contradictions before merge, not during quarterly audits.
Across multiple repositories, Pituitary becomes obligatory — the single place where cross-repo governance converges. Bind sources to named repo roots; all output carries repo identity so results stay unambiguous.
CLAUDE.md, AGENTS.md, runbooks, and architecture docs have different governance roles. Pituitary understands the difference.
Section-level source refs, classification, link reasons, and suggested edits — in JSON. Machine-readable provenance for agent consumption or shareable HTML reports.
Real-World Results
The CCD framework repo — 11 specs, 29 docs, 5 canonical skills — was plagued by doc drifts, runtime contract contradictions, and deprecated terminology surfacing everywhere. The team had been running LLM cleanups that kept declaring victory. Pituitary found what those cleanups missed — because it checks the entire corpus, not a context-window sample. All models ran locally on M2 Ultra. No data left the machine.
Quick Start
Single binary (pure Go, no CGO). No Docker. No API keys required. One SQLite file.
Deterministic by default. Optionally plug in any OpenAI-compatible embedding API for deeper semantic retrieval. Runtime docs →
For Your AI Coding Assistant
Every AI session starts blind. Your agent proposes changes against specs it hasn't read, uses terminology the team deprecated two sprints ago, generates docs that contradict accepted decisions. You clean up after it, but the cleanup is another LLM session with the same partial view. The drift compounds.
Add the MCP server and your agent gets 13 governance tools backed by the full corpus index — not a context-window sample. It stops guessing and starts building against what you actually decided.
Evidence chains carry content_trust metadata so agents treat returned workspace text as untrusted input. pituitary schema <command> lets agents inspect contracts at runtime.
In CI
The shipped GitHub Action runs review-spec on PRs that touch specs and posts the report as a PR comment.
Architecture
Single SQLite file with atomic rebuilds. CLI-first — the MCP server wraps the same analysis packages. Kernel stays pure; extensions register via sdk.Register() and compile into one binary.