See it as a diagram
Everything below, as a diagram you can edit. Describe yours and see it in seconds.
No account needed · Editable canvas, not a picture
The split that makes sync possible
A decision record says "in March we chose Postgres over DynamoDB, because". It is true forever, needs no maintenance beyond a status field, and is covered in depth in keeping ADRs up to date. A current-state view says "these services exist and talk to each other like this". It is false the week after the next big merge unless something regenerates it.
Most architecture wikis fail because their pages are secretly both at once: a diagram drawn during a decision, kept as if it were documentation of the present. Split them. Decisions go into an append-only log. Current state goes into artifacts chosen specifically because they can be rebuilt from the repo: a diagram generated from the code and infra definitions, a dependency list derived from manifests, a schema doc pulled from the database. What cannot be regenerated should not claim to describe the present.
C4 levels age at different rates
If you use the C4 model, the levels give you a maintenance budget. The context diagram, your system among its neighbors, changes on the timescale of partnerships and product strategy, often yearly; keeping it hand-curated is fine. The container diagram, deployable units and data stores, changes every quarter or two and is the sweet spot for regeneration. Component diagrams inside a service change with normal feature work, monthly or faster, and are only worth keeping if generated. Code-level diagrams should never be stored at all; an IDE produces them on demand.
The practical rule: the deeper the level, the shorter its half-life, and the stronger the case for generating rather than drawing. Teams usually get this backwards, lavishing manual care on component diagrams that will be wrong in six weeks.
Wire the trigger: path filters and PR labels
Drift happens at merge time, so merge time is when to catch it. A path filter on the directories that define your architecture, services, infra, proto or schema definitions, marks exactly the pull requests that can invalidate the container view. The cheap version adds a label or a checklist comment: this PR touches architecture, confirm the diagram still holds. The strong version regenerates the view as a CI step on merge.
Datadef's half of that loop is an MCP server, registry name io.datadef/mcp. An agent connected to it, Claude Code or Cursor in a CI job or during review, reads the repository and updates the diagram to match. To be exact about the boundary: Datadef does not watch the repo and nothing detects the merge by itself. The workflow below is what makes it fire, which keeps the trigger in your CI where you can see it. Connecting an agent requires an API key, available on paid plans; the setup is documented in the MCP diagram server guide.
# .github/workflows/regen-architecture.yml
name: regen-architecture
on:
push:
branches: [main]
paths:
- "services/**"
- "infra/**"
- "proto/**"
jobs:
regenerate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# An agent CLI connected to the Datadef MCP server, with its
# API key in the job secrets. The agent reads the repo and
# updates the named diagram to match this commit.
- name: Redraw the container view
run: |
claude -p "Read services/, infra/ and proto/. Update the
'platform-containers' diagram via the Datadef MCP server so
it matches what this commit deploys. List what changed."Publish the view where people already read
Regeneration only pays off if every copy of the diagram follows. A Datadef project shared public serves the diagram at a permanent image URL and an interactive embed page, so the wiki, the README, and the onboarding doc all reference the same source. After the agent updates the diagram, the embeds show the new version within minutes; nobody re-exports or re-pastes anything. That property, one source and many live references, is the point of a single source of truth for architecture.
Where the split model bends
Three boundaries keep this claim honest. First, the loop is invoked, not ambient: a CI job or an agent call regenerates the view, and if nobody wires the trigger, nothing happens. Second, live embeds require the project to be shared public; a confidential architecture keeps the regeneration loop but publishes by re-export instead. Third, Datadef regenerates diagrams, not prose. The paragraph explaining why the queue exists still needs a human, and the decision half of your docs is exactly where that prose belongs.
What drift costs when this is not done, and how to recognize it in your own wiki, is covered in documentation drift.
The sorting test
FAQ
How do I keep documentation in sync with code?
Which architecture diagrams go stale fastest?
Can a diagram update automatically when code changes?
Should architecture decision records be kept in sync too?
What is the best trigger for reviewing architecture docs?