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, swimlane, requirement diagram, block diagram, packet diagram, kanban board, radar chart, use case diagram, Venn diagram, fishbone diagram, and Wardley map 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, a GraphQL or Protocol Buffers schema, Terraform, Bicep, ARM, Pulumi, CloudFormation, the CDK, or a serverless.yml, docker-compose, a Dockerfile, Kubernetes manifests, Helm, Kustomize, nginx configuration, a Backstage catalog, a Structurizr workspace, AsyncAPI documents, a GitHub Actions workflow, a GitLab CI/CD or Azure Pipelines pipeline, a dbt project, the package manifests of a JavaScript workspace, a draw.io diagram, 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.- To make an organisation's approved pattern (a diagram with fixed parts every team draws the same and {{slot}} markers for what each team fills in), write a pattern file: get_pattern with file true gives one to start from, and https://docs.plotwork.dev/schemas/plotwork.pattern.json describes every field.- Check it with check_pattern, fix every problem it names, and send each source it returns to draw_diagram; then save it as <name>.pattern.json for the Patterns tab to import.- 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.- You cannot look at an SVG, so the answer carries no SVG text unless you pass svg "always": it gives viewUrl for the person, saveCommand to write the files, and the pictures go to the diagram viewer.- Every check ran on the drawing all the same.- Pass svg "never" to check a diagram most cheaply, and svg "always" only when you need the SVG text in the answer.- 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 --scheme 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.- When the person wants a diagram in their own web page or React app, interactive and optionally live, call embed_diagram with its hosted link or SVG text (format react for React, live for a /l/ or /o/ link, pin for exactly that picture) and paste the snippet it returns instead of writing an img tag.- An item with no icon= gets the icon its label names when the engine is sure, so name each item for what it is and leave icon= out: a product draws its mark ("Postgres", "Kafka", "Databricks"), a cloud product its provider's icon ("Amazon S3"), and a common part or role its plain icon ("Load balancer", "Circuit breaker", "Data lake", "Read replica", "Customers", "CI/CD"), within the node type you chose; 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", "replicates", "pushes image", "deploys to") so they draw icons, and an arrow into or out of a queue labelled with a message name draws send or receive; add role= (data, async, identity, private) to the lines that carry those, and give groups a type=; style in get_diagram_syntax says more, and its topic icon-words lists every word that draws an icon.- Use map_icons to choose icons for many names at once: it answers with the icon a label of that name draws, so its answer and the picture agree; 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 come from the colour theme, theme=<name> on the header (plotwork, slate, ocean, forest, sunset, mono, contrast), and cannot be set one by one.- You cannot see the picture, so read quality in the answer: its measures (crossings, aspectRatio, emptySpace, smallestTextPx) and its hints, each naming the option to change, such as direction=down or spacing=compact.- On a flow header spacing=compact packs the boxes for a dense page and spacing=roomy spreads them for a slide.
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, check_pattern, get_diagram_syntax, validate_diagram, render_diagram, outline_diagram, search_icons, embed_diagram.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 |
check_pattern | POST | https://api.plotwork.dev/v1/patterns/check |
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 |
embed_diagram | POST | https://api.plotwork.dev/v1/diagrams/embed |
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 |