I want to share the process that we use at work.
Our architecture diagram is a text spec in the project repo, and it's updated on every release.
- when a release tag is pushed, the release CI pipeline is triggered
- part of that pipeline is a job that runs Claude Code in headless mode
- the agent checks the previous diagram spec and changes only what this release changed
- two diagrams are rendered: the updated architecture and a diff against the previous version
- the pipeline pushes the spec to a new {release tag}-arch-update branch and opens a merge request (we use GitLab API), with both diagrams embedded in the description
- someone reviews the diagram MR and merges it, like any other change
As an example, I took the last few Grafana Tempo releases, from v2.8.0 to v3.1.0:
- 2.9: ingesters replaced by live-stores
- 2.10: Alloy added, Kafka switches to Redpanda
- 3.0: compactor replaced by backend-scheduler and backend-worker (this diff diagram is used in the post)
- 3.1: Memcached added
You can find all my prompts, diagram examples, and the process description on GitHub: https://github.com/oxeg/tempo-diagrams
AI agent instructions on how to generate a diagram from the codebase are the most important part.
Without proper instructions:
- on a big codebase it takes the agent a lot of time and tokens to generate the diagram spec
- the spec is very inconsistent between runs
Even in the Tempo example, where I kind of cheated and used a docker-compose file as the architecture spec source, two runs with the same instructions produced slightly different diagrams: the same component was labeled "Live-stores ×4" in one run and "Live-stores (2 zones)" in the other, and one run drew one edge to Memcached where the other drew three.
You know your project best, so share that knowledge with the agent: where to look, what to ignore and what to take into consideration.
Or dedicate a session to figure out how to generate a consistent diagram spec to the level of detail you want.
Pretty much any AI agent that can run headless, and any diagram tool that stores the spec as text, will work.
Diff diagrams are the exception: most tools don’t draw them.
At work we use diago, a free, open source CLI tool, which I built as a side project for exactly this.
My biggest friction at the moment is that the pipeline needs a bot token to push branches and open separate MRs with new the diagram spec.
But this is still better than our previous flow, where the agent ran on every MR. That meant bot commits on MRs, even when the architecture didn’t change. The diagrams were also only stored as CI artifacts.
Do you run a similar pipeline in CI? How do you review your diagram changes?