Architecture diagrams go stale because they live somewhere else: a drawing tool, a wiki, someone's laptop. The person changing the code can't update them, or doesn't know they exist. CoPage keeps the diagram's source in the repository, where the agent that changes the code can change the picture too.
How it works
Put the diagrams in the repo.
Terminal copage init # creates .copage/ in the project; commit it copage skill install # your agent learns the copage commandsDraw the first version. Ask your agent: "Draw our architecture from the Terraform and the services in this repo, and put it in docs/architecture.svg." It draws, renders the result to look at it, runs the checks, fixes what they find and exports the SVG. Link that file from your README or docs.
Change code and diagram together. When a pull request adds a queue or splits a service, ask the agent to update the diagram as part of the change. It reads the diagram (
copage diagram show <id>), applies its edits (copage diagram apply <id> ops.json) and rewrites the exported files (copage diagram export <id>). The pull request then holds the code, the diagram's JSON and the new SVG.Review it like code. Reviewers see the SVG change in the diff, and the JSON shows exactly which elements moved or changed. Anyone can open the picture to adjust it:
copage diagram open docs/architecture.svg.Check it in CI.
copage diagram check <id>needs no browser and no account, and its exit status is the result.
What goes in git
| Path | What it is | Commit it? |
|---|---|---|
.copage/diagrams/*.json |
The diagrams | Yes |
.copage/exports.json |
Which files each diagram is exported to | Yes |
.copage/config.json |
Project settings, such as "cloud": false |
Yes |
.copage/cloud.json |
Which diagrams you copied to or from the CoPage app | No (ignored) |
docs/architecture.svg |
The exported picture, with the diagram inside | Yes |
.copage/.gitignore keeps working files (history, renders, the editor's state) out of git.
Exports are remembered: while the editor is running (copage open), any change to a diagram rewrites its exported
files within a couple of seconds, whoever made it. Without the editor, copage diagram export <id> rewrites them;
the CLI reminds the agent after each edit.
Checks in CI
copage diagram check exits with:
- 0 when every check passes,
- 1 when a check found something,
- 2 when a check couldn't run (which is not a pass).
The default pack for diagrams, Diagram essentials, checks that connectors are attached at both ends, icons are labelled, nothing is stacked or left unconnected, and no placeholder text is left. A script that checks every diagram in the repo:
curl -fsSL https://copage.semerjyan.dev/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
status=0
for f in .copage/diagrams/*.json; do
copage diagram check "$(basename "$f" .json)" || status=$?
done
exit $statusBuilds exist for Linux x64, macOS (Apple silicon and Intel) and Windows x64. The CLI never looks for updates by itself in CI. AI checks, which would send a diagram's text to an AI model, are left out of the CLI: they run in the CoPage app.
Client repositories
For a repository that must never leave your own machines, copage init --local-only writes "cloud": false to
.copage/config.json. It is committed, so uploads to the CoPage app are refused for everyone working in the repo.
Who it's for
Tech leads and developers who own a service's documentation, platform teams with architecture decision records, and consultancies working in a client's repository. The CLI is free and needs no account.
Read more
- CoPage CLI documentation: every command, the
.copage/folder, exit codes, work computers. - Checks: what each check looks for and which pack to use.
- Connecting your agent and Diagrams.
- Install the free CLI
Questions
Where does CoPage keep diagrams in a project?
In .copage/diagrams/ as JSON files, next to your code. copage init creates the folder; commit it along with
.copage/exports.json, which records where each diagram is exported.
Does the exported SVG update when the diagram changes?
Yes. CoPage remembers each export. While copage open runs, changes rewrite the files automatically; otherwise
copage diagram export <id> rewrites every file that diagram was exported to.
What exit codes does copage diagram check return?
0 when every check passes, 1 when a check found something, and 2 when a check couldn't run. A 2 is not a pass, so CI should treat it as a failure.
Do checks in CI need a browser or an account?
No. Checks run on the diagram's JSON. Only rendering and SVG or PNG export need Chrome, Edge, Chromium or Brave, and nothing needs an account.
Can the agent and people edit the same diagram?
Yes. People edit in the browser editor; when the agent next reads the diagram, it gets a list of their changes since its own last edit and builds on them.