Requirement diagrams
A requirement diagram shows what a system must do and what proves it: the requirements, each with its id, its sentence, its risk, and how it is verified, and the code, tests, and documents that satisfy or verify them. Use it for a regulated feature, a hardware specification, a safety case, or the traceability table of an audit. It is for anyone, human or AI agent, who needs the answer to "is every requirement met, and how do we know".
TL;DR
| Question | Answer |
|---|---|
| What is it for? | Traceability: requirements, the elements that satisfy or verify them, and the SysML relations between them, so a gap shows at a glance. |
| How does it start? | requirement "Title", then need id "Name" for each requirement, element id "Name" for each piece of proof, then a relation such as stripe -> card : satisfies. |
| What does a requirement hold? | type=, risk=, verify=, ref= (the id people say, such as REQ-001), and text= (the requirement sentence). All are optional. |
| How do they relate? | Seven words after the colon: contains, copies, derives, satisfies, verifies, refines, and traces. Each draws its word in a pill, so a reader needs no key. |
| Which way does it read? | down (the default) puts what is required at the top and what proves it below; direction=right puts the requirements on the left. |
| Can I convert Mermaid? | Yes. Mermaid requirementDiagram converts with the convert_mermaid tool. See From Mermaid. |
| How big may it be? | 150 requirements and elements together, and 300 relations. Past a limit the diagram is refused with error E140. |
| How is it drawn? | A requirement is a card with a strip that names its type and ref, the name and the sentence, and chips for risk and verification. An element is a card with its icon. Layout is automatic, and the theme chooses every color. |
Ask your agent
Name each requirement with its id, say how risky it is and how it is proved, then name the code, tests, and documents that meet it.
Use Plotwork to draw a requirement diagram of our checkout. REQ-001: the checkout accepts Visa, Mastercard and Amex; it is functional, high risk, and proved by test. REQ-002: a payment completes in under two seconds at the 95th percentile; performance, medium risk, tested. REQ-003: card data never touches our servers; a design constraint, high risk, proved by inspection, and it refines REQ-001. Stripe Elements satisfies REQ-001 and REQ-003, the end-to-end suite verifies REQ-001 and REQ-002, and the PCI self-assessment verifies REQ-003.Use Plotwork to draw the hardware requirements of our drone flight controller, reading left to right: it weighs under 40 g and fits a 30.5 mm mount (physical), talks CAN and UART (interface, high risk), and runs its control loop at 8 kHz (performance, proved by analysis). The board satisfies the weight and the mount, the STM32H7 satisfies the bus and the loop, the bench rig verifies the bus and the weight, and the timing model verifies the loop.Use Plotwork to draw the traceability of our account security. The business requirement BR-1, accounts are hard to take over, is high risk and contains SR-1, offer a second factor, and SR-2, lock out repeated failures. SR-1 derives from BR-1. The auth design note traces to SR-1 and SR-2, the auth test suite verifies both, and the annual penetration test verifies BR-1.Example
This is the checkout from the first prompt. Three requirements sit at the top, the constraint that refines the first sits below it, and the elements that satisfy and verify them sit at the bottom. Every line carries its word, and every requirement carries its risk and how it is verified.
requirement "Checkout requirements" desc="What the checkout must do, and the code and tests that prove it."
need card "Accept card payments" type=functional risk=high verify=test ref="REQ-001" text="The checkout shall accept Visa, Mastercard and Amex."need fast "Pay in under two seconds" type=performance risk=medium verify=test ref="REQ-002" text="A payment completes within 2 seconds at the 95th percentile."need pci "Card data never touches our servers" type=constraint risk=high verify=inspection ref="REQ-003"
element stripe "Stripe Elements" type="Library" icon=simple:stripeelement e2e "Checkout end-to-end suite" type="Test suite" icon=lucide:check-checkelement audit "PCI self-assessment" type="Document" doc="SAQ A" icon=lucide:file-check
stripe -> card : satisfiesstripe -> pci : satisfiese2e -> card : verifiese2e -> fast : verifiesaudit -> pci : verifiespci -> card : refinesRequirements:
- REQ-001 Accept card payments: functional requirement, high risk, verified by test. The checkout shall accept Visa, Mastercard and Amex.
- REQ-002 Pay in under two seconds: performance requirement, medium risk, verified by test. A payment completes within 2 seconds at the 95th percentile.
- REQ-003 Card data never touches our servers: design constraint, high risk, verified by inspection.
Elements:
- Stripe Elements (Library)
- Checkout end-to-end suite (Test suite)
- PCI self-assessment (Document, SAQ A)
Relations:
- Stripe Elements satisfies Accept card payments
- Stripe Elements satisfies Card data never touches our servers
- Checkout end-to-end suite verifies Accept card payments
- Checkout end-to-end suite verifies Pay in under two seconds
- PCI self-assessment verifies Card data never touches our servers
- Card data never touches our servers refines Accept card payments
A hardware specification
Physical and interface requirements, each met by a part and proved by a rig or a model. Eight cards side by side would be too wide for a column, so direction=right stacks the requirements on the left and the parts and tests on the right.
requirement "Drone flight controller" direction=right desc="The flight controller's physical and interface requirements, and the parts and tests that meet them."need weight "Weighs under 40 g" type=physical risk=medium verify=inspection ref="HW-01" text="The assembled board, with connectors, weighs less than 40 grams."need size "Fits a 30.5 mm mount" type=physical risk=low verify=inspection ref="HW-02"need bus "Talks CAN and UART" type=interface risk=high verify=test ref="HW-03" text="The controller exposes one CAN bus and two UART ports for the motors and the radio."need loop "Control loop at 8 kHz" type=performance risk=high verify=analysis ref="HW-04"element pcb "Board rev C" type="PCB" doc="hw/board-rev-c.kicad_pcb" icon=lucide:cpuelement mcu "STM32H7" type="Microcontroller" icon=lucide:cpuelement bench "Bench rig" type="Test fixture" icon=lucide:gaugeelement sim "Timing model" type="Analysis" doc="analysis/loop.xlsx" icon=lucide:chart-linepcb -> weight : satisfiespcb -> size : satisfiesmcu -> bus : satisfiesmcu -> loop : satisfiesbench -> bus : verifiesbench -> weight : verifiessim -> loop : verifiesRequirements:
- HW-01 Weighs under 40 g: physical requirement, medium risk, verified by inspection. The assembled board, with connectors, weighs less than 40 grams.
- HW-02 Fits a 30.5 mm mount: physical requirement, low risk, verified by inspection.
- HW-03 Talks CAN and UART: interface requirement, high risk, verified by test. The controller exposes one CAN bus and two UART ports for the motors and the radio.
- HW-04 Control loop at 8 kHz: performance requirement, high risk, verified by analysis.
Elements:
- Board rev C (PCB, hw/board-rev-c.kicad_pcb)
- STM32H7 (Microcontroller)
- Bench rig (Test fixture)
- Timing model (Analysis, analysis/loop.xlsx)
Relations:
- Board rev C satisfies Weighs under 40 g
- Board rev C satisfies Fits a 30.5 mm mount
- STM32H7 satisfies Talks CAN and UART
- STM32H7 satisfies Control loop at 8 kHz
- Bench rig verifies Talks CAN and UART
- Bench rig verifies Weighs under 40 g
- Timing model verifies Control loop at 8 kHz
A traceability chain
A business requirement broken down into system requirements with contains, which starts with a circled plus at the container, and the derived relations drawn dashed. The high-risk business requirement is verified by a test of its own, so nothing is left unproved.
requirement "Account security" desc="A business need broken down into system requirements, each traced to a design and a test."need secure "Accounts are hard to take over" ref="BR-1" risk=high text="A stolen password alone must not open an account."need mfa "Offer a second factor" type=functional ref="SR-1" verify=testneed lockout "Lock out repeated failures" type=functional ref="SR-2" verify=test risk=mediumelement design "Auth design note" type="Design" doc="docs/auth.md" icon=lucide:book-openelement suite "Auth test suite" type="Tests" icon=lucide:check-checkelement pentest "Penetration test" type="Report" doc="2026 annual test" icon=lucide:scan-searchsecure -> mfa : containssecure -> lockout : containsmfa -> secure : derivesdesign -> mfa : tracesdesign -> lockout : tracessuite -> mfa : verifiessuite -> lockout : verifiespentest -> secure : verifiesRequirements:
- BR-1 Accounts are hard to take over: requirement, high risk. A stolen password alone must not open an account.
- SR-1 Offer a second factor: functional requirement, verified by test.
- SR-2 Lock out repeated failures: functional requirement, medium risk, verified by test.
Elements:
- Auth design note (Design, docs/auth.md)
- Auth test suite (Tests)
- Penetration test (Report, 2026 annual test)
Relations:
- Accounts are hard to take over contains Offer a second factor
- Accounts are hard to take over contains Lock out repeated failures
- Offer a second factor derives from Accounts are hard to take over
- Auth design note traces to Offer a second factor
- Auth design note traces to Lock out repeated failures
- Auth test suite verifies Offer a second factor
- Auth test suite verifies Lock out repeated failures
- Penetration test verifies Accounts are hard to take over
The language
A line is one statement. A # starts a comment. Ids are words such as card, req-1 or _x, labels are in double quotes, and options are written key=value. The first line is the header.
The header
requirement "Checkout requirements" direction=down desc="What the checkout must do, and what proves it."| Part | Meaning |
|---|---|
requirement | The kind. |
"Title" | The title. It is the accessible name of the picture and heads the text description. Optional. |
direction= | down (the default) or right. |
icons= | auto (the default) gives an element with no icon= the icon its name names, such as Stripe's mark for "Stripe Elements"; off keeps every element plain. |
desc= | A plain-language description for the text description. Optional. A desc "text" statement does the same. |
Statements
| Statement | Meaning | Example |
|---|---|---|
need <id> "Name" type= risk= verify= ref= text= tone= | A requirement, drawn as a card. Every option is optional. | need card "Accept card payments" type=functional risk=high |
element <id> "Name" type="<text>" doc="<text>" icon=<set:name> tone=<tone> | Something that satisfies, verifies, or traces to a requirement: code, a test suite, a document. type= is drawn under the name, and doc= under that in mono. | element stripe "Stripe Elements" type="Library" |
<from> -> <to> : <relation> | A relation. The word after the colon is required. | e2e -> card : verifies |
desc "text" | The description of the diagram. | desc "What the checkout must do." |
The statement is need, not requirement, because requirement is the header. A Mermaid block such as functionalRequirement x { is an error whose hint shows the line to write.
Requirement types
type= | Strip | Tone | Use it for |
|---|---|---|---|
plain (the default) | requirement | neutral | A requirement with no finer kind, such as a business need. |
functional | functional requirement | blue | What the system does. |
interface | interface requirement | violet | How it connects to another system or part. |
performance | performance requirement | aqua | How fast, how much, how often. |
physical | physical requirement | orange | Size, weight, power, temperature. |
constraint | design constraint | neutral | A limit on how it may be built. |
tone= overrides the type's tone. A diagram cannot set a color: the theme chooses every color, in light and dark.
Risk and verification
risk= is low, medium, or high, drawn as a chip with a green, amber, or red dot. verify= is analysis, inspection, test, or demonstration, drawn as a chip with its icon. The chips sit at the foot of the card, and the words say the same as the colors, so the diagram still reads for someone who cannot tell two tones apart.
ref= is the id people use, such as REQ-001, drawn on the right of the strip. Quote it, since it often holds a -. text= is the requirement sentence, wrapped in the card; past five lines it is cut with warning W203, and the full sentence stays in the text description.
Relations
A relation reads from left to right as a sentence: stripe -> card : satisfies is "Stripe Elements satisfies Accept card payments". The layout puts what is required above what relates to it, so most arrows point up, at the requirement.
| Word | Reads | Drawn | Above |
|---|---|---|---|
satisfies | a satisfies b | Solid arrow | b |
verifies | a verifies b | Solid arrow | b |
refines | a refines b | Dashed arrow | b |
derives | a derives from b | Dashed arrow | b |
copies | a copies b | Dashed arrow | b |
traces | a traces to b | Dashed arrow | b |
contains | a contains b | Solid line with a circled plus at a | a |
Every relation draws its word in a pill on the line, next to the card below. Lines run through the gaps between ranks and never through a card.
Limits and warnings
Warnings never stop a diagram from being drawn. Errors do.
| Limit | Value | What happens past it |
|---|---|---|
| Requirements and elements | 150 | E140 |
| Relations | 300 | E140 |
| Requirements and elements before the density warning | 30 | W200 |
| Relations before the density warning | 60 | W200 |
| Lines of a requirement sentence | 5 | Cut with an ellipsis, and W203 |
Layout is plain arithmetic, so even a diagram at the limits is laid out in a few milliseconds.
| Code | Severity | When | Fix |
|---|---|---|---|
E100 | error | A missing id or label, a relation with an arrow other than ->, no word after the colon, a relation from a card to itself, or a Mermaid block. | Each says what to write. |
E136 | error | A type=, risk=, or verify= that is not one of the choices, or a relation word that is not one of the seven. | The hint lists the choices and the nearest one. |
E140 | error | The diagram is over a limit in the table above. | Split it by feature. |
E110, E121, E123, E130, E131, E135 | error | An unknown statement, tone, or direction, a duplicate id, an unknown requirement or element in a relation, or an unknown option. | Each says what to write, with the nearest name for a mistyped one. |
W200 | warning | More than 30 requirements and elements, or 60 relations. | Split it into one diagram for each feature. |
W201 | warning | A requirement nothing satisfies or verifies (once the diagram has elements, and not for one that contains others), a high-risk requirement nothing verifies, an element that relates to nothing, or a loop of contains. | Add the relation that proves it, or remove the card. |
W202 | warning | The diagram is wider than a column would keep readable. | Use direction=right, shorten the names, or split it. |
W203 | warning | Text was cut with an ellipsis. | Shorten the name or the sentence. |
From Mermaid
Mermaid's requirementDiagram converts with convert_mermaid. The fields of each block become options on one line, and a relation written either way round becomes one -> line.
| Mermaid | Plotwork |
|---|---|
requirementDiagram | requirement, with the front matter title: as its title |
direction TB, direction LR | the default, direction=right |
direction BT, direction RL | drawn as TB and LR, M202 |
requirement x { } | need x "x" |
functionalRequirement, interfaceRequirement, performanceRequirement, physicalRequirement, designConstraint | type=functional, interface, performance, physical, constraint |
id:, text: | ref=, text= |
risk: High, verifymethod: Test | risk=high, verify=test |
element x { type: docRef: } | element x "x" type= doc= |
a - satisfies -> b, b <- satisfies - a | a -> b : satisfies |
style, classDef, class, ::: | dropped, M200 |
| A risk or method outside the choices, a field Plotwork has no option for, a relation word outside the seven, or a relation to a name with no block | dropped, M203 |
A name that is not a valid id, such as "Card payments" | renamed, M206; the label keeps the name |
| The same relation twice | the second dropped, M209 |
A block never closed, or a } that closes nothing | repaired, M217 |
Mermaid draws a requirement's name as its title, so the converter keeps the name as the label. Rename the labels to the words people use, and check in the outline that each relation reads the right way round.
See also
| Doc | Why |
|---|---|
| Writing diagrams | The flow, sequence, and schema kinds, and the options every kind shares |
| Use case diagrams | Who uses a system and for what, which a set of requirements often starts from |
| Migrating from Mermaid | The converter, its diagnostic codes, and what carries over |
| Diagram evidence for audits | Diagrams as evidence, where a traceability picture belongs |
| Icon reference | Every icon name you can put in icon= |
| Language reference | Every word of the language, one page for each topic |