Skip to content
Connect an agent

Hosted diagrams and plans

Repository settings

Keep how your team draws in one file, plotwork.config.json, at the root of the repository: defaults for the header options a diagram leaves out, style rules that CI enforces, the organisation whose brand hosted calls use, and the diagrams made from files of the repository. The command line, the GitHub Action and the local MCP server read the file; a hosted agent passes it as the settings argument.

TL;DR

QuestionAnswer
Where does the file go?plotwork.config.json at the repository root, or .plotwork/config.json. Plotwork looks in the diagram's folder (or the working folder) and each folder above it, up to the repository root.
What can it hold?defaults for header options, rules that CI checks, brand naming an organisation, and sources, the diagrams made from files (see Diagrams as code). Every section is optional.
Does a diagram's header still win?Yes. A default fills only an option the header does not write.
Can my editor complete it?Yes. Add "$schema": "https://docs.plotwork.dev/schemas/plotwork.config.json".
What fails CI?A broken rule, unless the rule says "level": "warning". Defaults never fail anything.
Which plan?The file is free on every plan and needs no account. Saving rules in an organisation, and a brand, are part of Pro.
One SVG or two per diagram?One by default, that follows the reader's setting. "scheme": "light-and-dark" writes a light and a dark file, and "light" or "dark" one picture in that scheme.
What is theme?The colour theme, written theme= on every header that names none, such as ocean. The light or dark picture is scheme.
Is anything sent?Not by default. The file is read on the machine that runs Plotwork. Its brand colors are never in it: brand is only a name.

1. Write the file

json
{  "$schema": "https://docs.plotwork.dev/schemas/plotwork.config.json",  "defaults": {    "icons": "auto",    "direction": "right",    "legend": "off",    "theme": "slate",    "scheme": "auto",    "embedSource": true,    "kinds": {      "mindmap": {        "layout": "radial"      },      "tree": {        "style": "org"      }    }  },  "rules": {    "requireDescription": true,    "ids": {      "pattern": "^[a-z][a-z0-9_]*$",      "hint": "Use snake_case ids."    },    "icons": [      {        "label": "postgres|mysql",        "use": [          "aws:rds",          "simple:postgresql",          "simple:mysql"        ]      }    ],    "tones": [      {        "types": [          "database"        ],        "allow": [          "green",          "neutral"        ]      }    ]  },  "brand": {    "organization": "acme"  }}

A file that does not check is reported with its line and column (S100), and nothing is drawn or checked with it.

2. Defaults

A default fills a header option the diagram leaves out. The header of a diagram always wins, and a default a kind's header does not take is left out for that kind.

FieldWhat it setsWhere it applies
iconsicons=auto or icons=off: whether an item with no icon= gets the icon its label names.Every kind whose header takes icons=
directiondirection= (auto, right, down, left, up).Every kind whose header takes the value
legendlegend=on, left, center, right, or off: on draws a legend that names what the picture uses (each kind of line and line role, type of box, product icon, group type, and planned change), centred under the diagram; left or right aligns it. When it would not fit under the diagram in one row, it moves down the right side if the picture reads better that way, aligned top, middle, or bottom. On when left out: a header or this default of off turns it off.Flow
legendpartsWhich parts the legend shows: "all" (every part the picture uses, the default), "basic" (every part but the icons), or a list such as ["lines", "boxes"] of lines, boxes, icons, groups, and changes. Written as legendparts= on the header.Flow
spacingspacing=compact, normal, or roomy: how far apart the boxes and layers sit. compact suits a dense page, roomy a slide; text and padding stay the same. normal when left out.Flow
edgesedges=orthogonal, spline, or straight: how lines are drawn. orthogonal when left out.Flow
fitfit=auto, wide, tall, or square: the shape direction=auto lays a picture out for. auto when left out.Flow
enforcedDefaults written over the header's own value, so a diagram cannot turn them the other way: ["legend"] with "legend": "on" draws the legend whatever the header says (a header's own left or right alignment is kept), with warning S204 where the header said otherwise. An organisation that requires the legend sets it on its members' hosted calls. Any of icons, legend, legendparts, spacing, edges, fit, direction, animate, numbered, theme.The same kinds as each default
allowedThe values a part may take: { "spacing": ["normal", "roomy"], "edges": ["orthogonal"] }. A diagram that asks for a value left out (in its header, or by a default) is drawn with the default when it is allowed, or the first allowed value, with warning S205 where the header asked; a list of one requires that value. An organisation's own allowed values narrow it further on hosted calls.spacing, edges, each a list of one value at least
animate, numberedanimate= and numbered=, on or off.The kinds that take them
themetheme= on the header: the colour theme, such as ocean or contrast. A scheme (light, dark, auto) here is refused with a hint to write it as scheme.Every kind
kindsHeader options for one kind, such as { "mindmap": { "layout": "radial" } }. A value the kind refuses is left out with warning S200.That kind
schemeThe pictures a diagram gets. auto writes one SVG that follows the reader's light or dark setting, which GitHub shows right in dark mode, about 43% smaller than two files. light or dark writes one SVG in that scheme. light-and-dark writes a light and a dark SVG, which a <picture> element shows by GitHub's own theme setting rather than the system's; render and publishing draw its light picture. Left out: auto for the files sync and generate write, light for render and publishing. A source of sources can set its own. See One picture for both themes.The command line's render, sync, generate and publish, the GitHub Action's sync, generate and publishing, and the sync_markdown tool
embedSourceWhether a saved SVG carries its source.The command line's render, the GitHub Action's render, and the drawing tools (true turns embedSource on). Never publishing: a published picture carries its source unless the call sends embedSource false.

The pictures, the source an SVG carries, and a drawing's view link include the defaults, so a picture reads back the same without the file. A change to the defaults makes the pictures under every diagram fence stale, and sync redraws them.

3. Rules

Rules are checked by plotwork check, by the GitHub Action's check and validate, and by the drawing tools, which return a broken rule as a warning and never stop a drawing.

FieldWhat it checksFinding
requireTitleEvery diagram has a title in its header.R207
requireDescriptionEvery diagram has desc= in its header, the text a screen reader announces.R200
maxNodesNo diagram has more nodes than this.R201
forbidKindsNo diagram is of these kinds.R202
idsEvery node id matches pattern.R203
labelsEvery node label matches pattern.R204
iconsEvery node whose label matches label (case ignored) draws one of the icons in use. aws:* accepts any icon of a set.R205
tonesNodes of types (or every node) take only the tones in allow, or none of those in forbid.R206
levelAt the top of rules, the level of every rule; on a rule, its own. error (the default) or warning.
kindsOn a naming, icon or tone rule: only diagrams of these kinds.
hintOn a naming, icon or tone rule: what to tell the author.

A pattern is a JavaScript regular expression without the slashes. One that repeats a group that itself repeats, such as (a+)+, or uses a back reference, is refused (R101), because it can take too long to match. An icon must be one Plotwork bundles; find its name with npx @buun_group/plotwork icons postgres.

Node rules look at the parts each kind calls a node: the nodes of a flow, the actors of a sequence, the tables of a schema, the elements of a C4 view, the classes of a class diagram (never asked for an icon), the states of a state diagram, the blocks of a layered architecture, the lanes and items of a swimlane, the topics of a mind map, and the entries of a tree. A kind without nodes, such as a chart or a timeline, is held to the rules about the whole diagram only. A mind map topic and a tree entry have no id, so an ids rule passes them.

4. Brand

brand.organization names the organisation (its slug or id) whose saved brand colors hosted calls use. It takes effect when the caller is a member of that organisation and its owner's plan includes brand themes; otherwise the call draws as it would without it. The file never holds colors: a brand is saved in the organisation by its owner or an admin. See Brand themes.

5. Sources

sources lists the diagrams made from files of the repository: for each, the files (from), their format, and where the diagram goes (out). plotwork generate and the Action's command: generate read it; every other command leaves it alone. The fields, the overrides file each diagram may have, and the workflows are in Diagrams as code.

6. Where the file is read

HostHow it gets the settings
Command lineEvery command reads the file from the diagram's folder up to the repository root. --config <file> or PLOTWORK_CONFIG names another. check needs a rules section.
GitHub ActionReads one settings file per run: the first found from working-directory up to the repository root. A settings file in a subfolder is not read; run the Action once per folder, with working-directory, if folders need their own. config names another file, or off reads none.
Local MCP serverReads the file once at start, from the folder it starts in up to the repository root, or the file PLOTWORK_CONFIG names, and gives it to every drawing tool whose call passes no settings.
Hosted MCP server and REST APICannot read a repository. An agent reads the file and passes it as settings to draw_diagram, validate_diagram, render_diagram, outline_diagram, edit_diagram, draw_from_pattern, convert_mermaid, sync_markdown and publish_diagram, so a published picture follows the defaults too. Settings that do not check are refused with the path of each problem. A call made with an organisation's API key also gets the organisation's saved rules as warnings, unless it brings rules of its own.

An organisation's legend choice and diagram style, set on its Settings tab, are its standard, so they are written over these settings: a legend the organisation requires is drawn whatever the file or a header says, and its on or off, spacing, line shape and group tabs replace the file's own. A part the organisation leaves to its members keeps the file's value, which wins over each member's own choice. The hosted MCP server, the REST API and publishing apply them on every call. The command line and the Action read them when the run has a key in PLOTWORK_API_KEY (or the Action signs in as a trusted publisher) and an organisation is named: --org, PLOTWORK_ORG or the Action's rules-org, else brand.organization of the file. Without both, nothing is asked.

The commands that write also write them into the file, so the repository shows what the organisation enforces and follows its changes:

RunWhat happens to the settings file
plotwork sync, plotwork render, plotwork generateIts defaults are rewritten to match the organisation, and each change is printed.
plotwork sync --check, plotwork generate --checkNothing is written. A file that differs is drift and the run exits 1, with each change listed.
The Action, sync or render, or generate in write modeThe file is rewritten; generate puts it in the same commit or pull request as the diagrams.
The Action, check, or generate in check modeA file that differs is an error on its defaults line, and nothing is written.

The file is written as JSON with two spaces, keeping its other keys and their order. A read that fails leaves the file as it is.

7. Check in CI

bash
npx @buun_group/plotwork check docs README.md

check reads every Markdown and .diagram file the words name, writes the defaults into each header, and checks the rules. It exits with 1 when a rule at level error is broken or a diagram has an error, and with 2 when there are no rules or the settings do not check.

yaml
- uses: actions/checkout@v7- uses: plotwork-official/plotwork-action@62c17dfd42c3e67e29de0f6d0adbad6b4831136a # v1.9.0  with:    command: check

The samples pin the latest release of the Action by its commit. @v1 becomes available at the first stable release.

The Action finds plotwork.config.json by itself. Every finding is an annotation on its line of the pull request: an error for a rule at level error, a warning otherwise.

8. Share rules across repositories

On Pro, an owner or admin saves rules in the organisation with PUT /orgs/{org}/style-rules, and CI in every repository applies the same ones with an organisation API key. The saved rules take the fields of the rules section, with "version": 1.

yaml
- uses: plotwork-official/plotwork-action@62c17dfd42c3e67e29de0f6d0adbad6b4831136a # v1.9.0  with:    command: check    rules-org: acme  env:    PLOTWORK_API_KEY: ${{ secrets.PLOTWORK_API_KEY }}

An agent connected to the hosted MCP server gets the same rules back as warnings when it calls with the organisation's key, or as a member whose settings name the organisation in brand.organization. On your machine, npx @buun_group/plotwork check docs --org acme with PLOTWORK_API_KEY set does the same. The organisation's rules replace the file's rules; the file's defaults still apply. The key is never printed. If the owner moves to Free, the saved rules are kept but CI is told they no longer apply.

9. Privacy

The file stays where it is: Plotwork reads it on the machine that runs the command line, the Action or the local server, and fetches nothing it names. Settings an agent passes to a hosted tool are worked on in memory with the diagram and are not stored. Rules saved in an organisation are stored as the text typed, with who saved them and when. See the privacy policy.

See also

DocWhy
Keep diagrams in sync in CIThe GitHub Action's other inputs, and checking that pictures are up to date
Diagrams as codeThe sources section, overrides, and drift
Brand themesWhat a brand changes, and how an organisation saves one
OrganisationsRoles, members and organisation API keys
Writing diagramsThe header options the defaults fill
Privacy policyWhat is stored about an organisation and its rules