For agents
Rules file for your agent
A block to paste into CLAUDE.md, AGENTS.md, or an editor rules file so an agent draws diagrams with the Plotwork tools in the right order. It is the same guidance the MCP server sends when a client connects.
For
- Claude Code
- Codex
- Cursor
- GitHub Copilot
- Gemini CLI
TL;DR
| Question | Answer |
|---|---|
| What do I paste? | The block below, as it is. |
| Where does it go? | In the rules file your agent reads: the table below names the file for each client. |
| Do I need the MCP server for it to work? | The block names the tools, so connect them first. See connecting an agent. Without MCP, an agent can call each tool over HTTP. |
| Does it stay current? | It holds the guidance the server sends and the names of its tools, so it changes when they do. Paste it again after an upgrade. |
The block
Paste this into the rules file of your project:
Markdown
## Diagrams with Plotwork
Plotwork draws flow, sequence, database, git graph, Gantt, class, state, timeline, user journey, and mind map diagrams from a small text language. Use its tools for every diagram. Do not draw one by hand and do not invent an icon name.
- Draws flow, sequence, database schema, git graph, Gantt chart, class diagram, state, timeline, user journey, mind map, treemap, share chart, quadrant chart, layered architecture, C4 diagram, matrix, Sankey diagram, XY chart, tree, and swimlane diagrams from a small line-oriented text language.- Prefer the workflow tools: each does the work of several single tools in one call.- When you are unsure which kind of diagram fits, call suggest_diagram with the request in plain words and any data: it ranks the kinds and gives a starter that parses; for a whole document, plan_document_diagrams returns the sections a picture would help, each with a starter.- When the diagram should come from a file the person has (SQL, Prisma, or Drizzle models, an OpenAPI document, Terraform, Bicep, ARM, Pulumi, CloudFormation, or the CDK, docker-compose, Kubernetes manifests, Helm, Kustomize, a Backstage catalog, a Structurizr workspace, AsyncAPI documents, a GitHub Actions workflow, a GitLab CI/CD or Azure Pipelines pipeline, CSV or JSON data, a folder listing, or a git log), call import_source with its text and format: it builds the whole diagram from the file in one call, and its diagnostics say what was left out get_diagram_syntax with topic import-formats says what each format reads.- For a request to draw a common architecture, such as a three-tier network, a serverless API, a container platform, or a queue with workers, call find_pattern first with the request in plain words; when a pattern fits, call draw_from_pattern with its id, a provider flavour (neutral, aws, azure, or gcp), and slot values that rename its parts, or get_pattern to read and edit its source, and when nothing fits, write the diagram from scratch with draw_diagram.- Call get_diagram_syntax once with no kind to read the shared language, and again with kind set to the kind you draw for its statements, limits, and example.- Write the source and call draw_diagram: it returns every error with line, column, and hint and draws nothing until the source is valid, so fix every error and call again; once valid it returns the warnings, an outline to check the meaning, and the SVG for light and dark.- The pictures are most of the answer and you cannot look at them, so pass svg "never" to check a diagram, and draw only when you will save, show, or publish the pictures; when a drawing is too big to read in one answer the SVG is left out, picturesOmitted says so, and svg "always" forces it.- To change a diagram that already exists as a Plotwork SVG, a hosted link such as https://cdn.plotwork.dev/d/<22 characters>.svg or an .svg file in the repository, call read_diagram first with its url or its text, change the source it returns with edit_diagram (rename, set an option, add, remove, or move a statement) or by hand and draw_diagram, then write the SVG file again; compare_diagrams says what changed, for a review.- Set embedSource true on draw_diagram whenever you save an SVG into a repository, so the file carries its source and read_diagram can give it back next time; the source is then readable by anyone who has the file.- To save a valid diagram into the person's repository, run the saveCommand a drawing tool returns in a shell, changing --out to the path you want (add --theme dark for the dark picture): the Plotwork command line reads the diagram from the link on that machine, fetches nothing, and writes the SVG with its source embedded, so you never copy the SVG yourself.- With no shell, draw with svg "always" and embedSource true and write the returned svg.- Give viewUrl to a person to look at the diagram, and svgUrl or pngUrl to download it in their browser; neither is a file address for curl.- An item with no icon= gets the icon its label names when the match is certain, such as the Postgres mark on a node labelled "Postgres", so label items with the product they are; icon=none keeps one item plain and icons=off on the header keeps them all plain.- For a finished look, label flow arrows with verbs ("reads", "publishes", "deploys to") so they draw icons, add role= (data, async, identity, private) to the lines that carry those, and give groups a type=; style in get_diagram_syntax says more.- Use map_icons to choose icons for many names at once; it never guesses, so choose from the candidates for an ambiguous name, and never invent an icon.- To move Mermaid to Plotwork, call convert_mermaid with one diagram, read every diagnostic and its hint, then choose node types and icons; for a whole Markdown file call sync_markdown with the document, its path, and convertMermaid true, write the returned markdown and files, then review the diff.- When the repository has a plotwork.config.json (or .plotwork/config.json) at its root, read it and pass it as settings to every tool that takes settings: its defaults fill the header options the source leaves out, and broken style rules come back as warnings to fix.- Use validate_diagram, outline_diagram, render_diagram, and search_icons only for one fine-grained step.- Choose node types and tones for meaning; colors are chosen by the theme and cannot be set.
Tools: draw_diagram, edit_diagram, convert_mermaid, import_source, map_icons, sync_markdown, suggest_diagram, plan_document_diagrams, find_pattern, get_pattern, draw_from_pattern, read_diagram, compare_diagrams, get_diagram_syntax, validate_diagram, render_diagram, outline_diagram, search_icons.Documentation for agents: https://docs.plotwork.dev/llms.txtWhere to put it
| Client | File |
|---|---|
| Claude Code | CLAUDE.md in the project, or ~/.claude/CLAUDE.md for every project |
| Codex and most other coding agents | AGENTS.md in the project |
| Cursor | A rule in .cursor/rules/, for example .cursor/rules/plotwork.mdc |
| GitHub Copilot | .github/copilot-instructions.md |
| Gemini CLI | GEMINI.md in the project |
Without MCP
Each tool is also an HTTP route. Send the arguments as the JSON body of a POST, or as the query of a GET, with an API key in the X-API-Key header. The same checks run, and the answer has the same shape as the tool's result.
| Tool | Method | Address |
|---|---|---|
draw_diagram | POST | https://api.plotwork.dev/v1/diagrams/draw |
edit_diagram | POST | https://api.plotwork.dev/v1/diagrams/edit |
convert_mermaid | POST | https://api.plotwork.dev/v1/diagrams/convert-mermaid |
import_source | POST | https://api.plotwork.dev/v1/import |
map_icons | POST | https://api.plotwork.dev/v1/icons/map |
sync_markdown | POST | https://api.plotwork.dev/v1/markdown/sync |
suggest_diagram | POST | https://api.plotwork.dev/v1/diagrams/suggest |
plan_document_diagrams | POST | https://api.plotwork.dev/v1/markdown/plan |
find_pattern | POST | https://api.plotwork.dev/v1/patterns/find |
get_pattern | POST | https://api.plotwork.dev/v1/patterns/get |
draw_from_pattern | POST | https://api.plotwork.dev/v1/patterns/draw |
read_diagram | POST | https://api.plotwork.dev/v1/diagrams/read |
compare_diagrams | POST | https://api.plotwork.dev/v1/diagrams/compare |
get_diagram_syntax | GET | https://api.plotwork.dev/v1/vocabulary |
validate_diagram | POST | https://api.plotwork.dev/v1/diagrams/validate |
render_diagram | POST | https://api.plotwork.dev/v1/diagrams/render |
outline_diagram | POST | https://api.plotwork.dev/v1/diagrams/outline |
search_icons | GET | https://api.plotwork.dev/v1/icons |
See also
| Doc | Why |
|---|---|
| Plotwork for AI agents | The same guidance with the tools described |
| Prompts and recipes | Requests that work and the tools an agent calls for each |
| API reference | Every endpoint, with its request and response |
| Writing diagrams with an agent | The loop in practice |