A new support lead asks how a refund request is handled. Someone remembers a process diagram and finds it as a PNG attached to a ticket from 2022. It shows a 14-day window and a manual approval step. The code has said 30 days for a while, and the approval step was never built. The diagram's source file is on the laptop of someone who has since left.
FACET keeps a short, checkable description of each feature, called a FACET recordA FACET record is a short, checkable description of one feature, kept as a YAML file next to the code. It states why the feature exists, the behaviour it promises as scenarios, and the tests that check it.In the glossary, next to your code, and FACET Atlas is the browser app that shows those records and the process diagrams beside them. By the end of this guide the diagram's source lives in the repository, next to the code it describes, and everyone on the team reads it in FACET Atlas without a modelling tool: the drawing, its paths from start to end, and a step-by-step walkthrough. A change to the process and the matching code change then go through the same pull request.
The commands below use a small example shop written in TypeScript, set up as in “One answer instead of three”. In your own project, use a BPMN diagram your team already has.
Step 1Put the diagram's source into the repository
Atlas reads BPMN 2.0 XML, the .bpmn file that Camunda Modeler, bpmn.io and most other BPMN tools save. An exported PNG or PDF is a picture of the process; the .bpmn file is the process. Atlas looks for these files in docs/bpmn/:
mkdir -p docs/bpmn
Save your diagram there. To follow along with the example shop, save this as docs/bpmn/refund-request.bpmn:
<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Defs_Refund" name="Refund request" targetNamespace="http://demo-shop.example/bpmn"> <bpmn:process id="Proc_Refund" name="Refund request" isExecutable="false"> <bpmn:startEvent id="Start_Request" name="Customer asks for a refund" /> <bpmn:exclusiveGateway id="GW_Window" name="Within 30 days of delivery?" /> <bpmn:endEvent id="End_Refused" name="Refused with E3001" /> <bpmn:exclusiveGateway id="GW_Payment" name="Paid with a gift card?" /> <bpmn:serviceTask id="Task_Card" name="Refund to the original payment" /> <bpmn:serviceTask id="Task_Credit" name="Refund as store credit" /> <bpmn:endEvent id="End_Refunded" name="Refund issued" /> <bpmn:sequenceFlow id="SF_1" sourceRef="Start_Request" targetRef="GW_Window" /> <bpmn:sequenceFlow id="SF_No" name="no" sourceRef="GW_Window" targetRef="End_Refused" /> <bpmn:sequenceFlow id="SF_Yes" name="yes" sourceRef="GW_Window" targetRef="GW_Payment" /> <bpmn:sequenceFlow id="SF_Card" name="no" sourceRef="GW_Payment" targetRef="Task_Card" /> <bpmn:sequenceFlow id="SF_Gift" name="yes" sourceRef="GW_Payment" targetRef="Task_Credit" /> <bpmn:sequenceFlow id="SF_2" sourceRef="Task_Card" targetRef="End_Refunded" /> <bpmn:sequenceFlow id="SF_3" sourceRef="Task_Credit" targetRef="End_Refunded" /> </bpmn:process> <bpmndi:BPMNDiagram id="Diag_Refund" name="Refund request"> <bpmndi:BPMNPlane id="Plane_Refund" bpmnElement="Proc_Refund"> <bpmndi:BPMNShape id="Start_Request_di" bpmnElement="Start_Request"><dc:Bounds x="100" y="142" width="36" height="36" /> <bpmndi:BPMNLabel><dc:Bounds x="76" y="185" width="84" height="27" /></bpmndi:BPMNLabel></bpmndi:BPMNShape> <bpmndi:BPMNShape id="GW_Window_di" bpmnElement="GW_Window" isMarkerVisible="true"><dc:Bounds x="200" y="135" width="50" height="50" /> <bpmndi:BPMNLabel><dc:Bounds x="180" y="95" width="90" height="27" /></bpmndi:BPMNLabel></bpmndi:BPMNShape> <bpmndi:BPMNShape id="End_Refused_di" bpmnElement="End_Refused"><dc:Bounds x="207" y="282" width="36" height="36" /> <bpmndi:BPMNLabel><dc:Bounds x="180" y="325" width="90" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNShape> <bpmndi:BPMNShape id="GW_Payment_di" bpmnElement="GW_Payment" isMarkerVisible="true"><dc:Bounds x="320" y="135" width="50" height="50" /> <bpmndi:BPMNLabel><dc:Bounds x="300" y="95" width="90" height="27" /></bpmndi:BPMNLabel></bpmndi:BPMNShape> <bpmndi:BPMNShape id="Task_Card_di" bpmnElement="Task_Card"><dc:Bounds x="440" y="60" width="120" height="80" /></bpmndi:BPMNShape> <bpmndi:BPMNShape id="Task_Credit_di" bpmnElement="Task_Credit"><dc:Bounds x="440" y="200" width="120" height="80" /></bpmndi:BPMNShape> <bpmndi:BPMNShape id="End_Refunded_di" bpmnElement="End_Refunded"><dc:Bounds x="632" y="142" width="36" height="36" /> <bpmndi:BPMNLabel><dc:Bounds x="612" y="185" width="76" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SF_1_di" bpmnElement="SF_1"><di:waypoint x="136" y="160" /><di:waypoint x="200" y="160" /></bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SF_No_di" bpmnElement="SF_No"><di:waypoint x="225" y="185" /><di:waypoint x="225" y="282" /> <bpmndi:BPMNLabel><dc:Bounds x="232" y="225" width="14" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SF_Yes_di" bpmnElement="SF_Yes"><di:waypoint x="250" y="160" /><di:waypoint x="320" y="160" /> <bpmndi:BPMNLabel><dc:Bounds x="275" y="142" width="18" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SF_Card_di" bpmnElement="SF_Card"><di:waypoint x="370" y="160" /><di:waypoint x="400" y="160" /><di:waypoint x="400" y="100" /><di:waypoint x="440" y="100" /> <bpmndi:BPMNLabel><dc:Bounds x="410" y="82" width="14" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SF_Gift_di" bpmnElement="SF_Gift"><di:waypoint x="370" y="160" /><di:waypoint x="400" y="160" /><di:waypoint x="400" y="240" /><di:waypoint x="440" y="240" /> <bpmndi:BPMNLabel><dc:Bounds x="410" y="222" width="18" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SF_2_di" bpmnElement="SF_2"><di:waypoint x="560" y="100" /><di:waypoint x="600" y="100" /><di:waypoint x="600" y="160" /><di:waypoint x="632" y="160" /></bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SF_3_di" bpmnElement="SF_3"><di:waypoint x="560" y="240" /><di:waypoint x="600" y="240" /><di:waypoint x="600" y="160" /><di:waypoint x="632" y="160" /></bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram></bpmn:definitions>
The BPMNDiagram part holds the positions your modelling tool saved. Atlas draws the diagram from them, so keep that part when you export.
Step 2Download Atlas with npx
Atlas is FACET's reader in the browser. The npm package facet-framework downloads and starts it. In the shop's folder, run it once:
npx facet-framework ui
The first run names the Atlas archive for your system, its size and the cache folder, and asks Download and start? [y/N]. Answer y. The archive is checked against the SHA-256 pinned in FACET CoreFACET Core is FACET's command-line tool, the facet binary: it checks records and anchors, reports drift and serves the registry to agents, with the same logic in CI, a shell and an agent session.Read more here and contains Atlas and the helper that reads BPMN files. Stop it with Ctrl-C; the next step starts it again, without the question.
Step 3Open the diagram in Atlas
In the shop's folder, start Atlas again:
npx facet-framework ui
npx facet-framework uiFACET Atlas: http://127.0.0.1:7317/Reading: /path/to/demo-shopStop with Ctrl-C.
Open the printed address in your browser. If port 7317 is taken, Atlas picks another one and prints that. Click Processes in the top navigation. The overview shows one card per BPMN file and 0 of 1 files have parser findings. Click Refund request.


Above the drawing, Atlas counts the elements, the flows and the paths from start to end. Three paths here: refused, refunded to the card, refunded as store credit.
Step 4Walk each path and compare it with the code
Click Walkthrough, then Next step (the arrow at the top of the panel). At each decision, choose a branch. Choose yes → Paid with a gift card? and then yes → Refund as store credit:


Walk each of the three paths and hold it against the code that implements it. In the example shop that is src/orders/refund.ts: a refund later than REFUND_WINDOW_DAYS = 30 after delivery fails with E3001, and an order paid with a gift card gets its money back as store_credit. Diagram and code agree. Where they do not, decide which one is right and fix the other in the same pull request.
Step 5Change process and code in one pull request
From now on the diagram changes the way the code does. When the refund window changes, the pull request changes REFUND_WINDOW_DAYS, the gateway label in refund-request.bpmn and, if the feature has one, its FACET record, and the reviewer sees them together. Commit the diagram:
git add docs/bpmn/refund-request.bpmngit commit -m "Add the refund request process as BPMN"
Atlas reads the repository again on every page reload, so an edited .bpmn file shows up without a restart. If your diagrams live in another folder, set it in .facetrc.yaml at the repository root:
bpmn: directory: process
Step 6If Atlas shows something else
No process fileandThere is no .bpmn file under docs/bpmn.: the file is somewhere else or has another extension. Move it todocs/bpmn/, or setbpmn.directoryin.facetrc.yamlas in step 5.These files could not be read, with your file name below the cards: the file is not complete BPMN XML. Export it again from your modelling tool as.bpmn, not as an image.facet: unknown command "ui" for "facet": npm ran an olderfacet-frameworkfrom the project's dependencies. Update it withnpm install --save-dev facet-framework@latest.Atlas archive SHA-256 mismatch: the download is incomplete or altered, and nothing was put into the cache. Run the command again to download it anew.
For more on documentation that stays next to the code instead of going stale elsewhere, read The help article says 14 days. The code says 30.