Documentation That Scales: Constitution, Contracts, and Runbooks

Created: • Updated: • 3 min read
Organized notes and a laptop representing structured documentation

Documentation drift looks harmless until you try to ship a change at 1 a.m. and spend fifteen minutes deciding which conflicting note deserved to be true. I hit that wall after handing more work to AI agents. They read every doc literally, so contradictions turned into slowdowns and risk.

The fix was not "write more documentation." The fix was deciding that every word falls into one of three roles and lives in a known place in the repo. Anything else gets deleted.

Documentation drift wastes time

Before this system, I had:

Every edit meant chasing references across /docs hoping nothing contradicted production. That overhead compounds the moment someone else—or an agent—needs clarity.

Three files, three jobs

All documentation now lives as Markdown in /docs. Each file declares its own role in the frontmatter so agents and humans can filter quickly. The buckets:

  1. Constitution (docs/constitution.md). The non-negotiables: dual-output rule for HAL, no em dashes, router invariants. Any change requires explicit approval.
  2. Contracts (docs/contracts/*.md). Each file mirrors one subsystem—navigation, analytics, brand tokens, content schema. It states what exists today and the interface another system can rely on. No future tense, no runbook steps.
  3. Runbooks (docs/runbooks/*.md). Markdown checklists paired with the relevant contract. They capture cadence ("roll analytics 05:00 UTC"), commands, verification steps, and rollback notes.

If a note does not clearly belong to one of those files, it either moves into the backlog or the trash. That ruthless scoping keeps the doc tree small enough to read end-to-end when onboarding someone new.

How it fits into the repo workflow

Why AI work gets faster

Agents fail in two predictable ways: assuming generic conventions or optimizing locally while breaking an invariant. The constitution tells them what never moves, the contract tells them what exists now, and the runbook tells them how to operate it. That structure took PR review cycles from three passes to one because there are no hidden rules.

What’s next

Now that the doc system behaves, I can safely extract a multi-brand token layer, wire a CMS, and expose more automation to collaborators without turning documentation into sludge. The guardrails are simple: keep each Markdown file in its lane, link to the canonical source instead of copying, and never merge a behavior change without updating the doc that defines it.

Recommended

Anthropic Trained Its Replacement ai startups founders
Pydantic: The Open Source Layer Quietly Running the AI Economy ai open-source python pydantic anthropic tools
Karpathy Was Wrong: OpenClaw Still Outruns Its 5 Real Alternatives openclaw ai tools security

Recommended

Anthropic Trained Its Replacement ai startups founders
Pydantic: The Open Source Layer Quietly Running the AI Economy ai open-source python pydantic anthropic tools
Karpathy Was Wrong: OpenClaw Still Outruns Its 5 Real Alternatives openclaw ai tools security