The explanation format (xenise.explanation/v1)
An explanation is one JSON file, explanation.json, next to a workflow’s code. It says what the workflow does in plain English, and it is also what the workflow screen draws: the cards, the definitions each step uses, the examples, the action lines and the tables. Benji calls that second job the visualisation manifest. It is the same document, not a second one.
The builder writes it: the session that changes the workflow’s code writes or updates its explanation in the same change, following the explain-workflow skill, which ships with the platform package (node_modules/xenise-platform/skills/explain-workflow/). The platform never writes one. It checks it against the code in xenise check (in CI) and on every deploy, runs its examples through the code, and when something is wrong says what to change and where. The words used here are defined in ontology.md. To write one, follow skills/explain-workflow.
A file with no format is the first version: a summary and steps only. It no longer passes xenise check or deploys. Versions deployed with one before that still draw, and each of their steps says on screen that how it decides hasn’t been written down.
Every rule about an explanation lives here, in the platform: xenise check, xenise deploy and the platform’s own deploy all run the same code. A workflows repository’s CI only calls xenise check (on every pull request and before every deploy) and adds no rules of its own.
What the platform owns
Section titled “What the platform owns”The platform owns the rendering rules: how workflow steps, checks, conditions, loops, and outcomes become cards and connections. Workflows supply facts and explanations, not layout or styling. The shared contract is the workflow API’s step skeleton plus this versioned explanation format; it does not prescribe how to organise the implementation behind those steps.
xenise check gives builders local feedback on that contract. xenise deploy checks it before upload, and the platform runs the examples again against the uploaded Worker before activating the version.
The folder
Section titled “The folder”| File | What it is |
|---|---|
workflow.ts |
The code, written however the builder likes. Two things in it are read for the screen: the checks a step names, and the definitions it exports |
definitions.ts |
One exported function per definition and one exported constant per table, imported from wherever the real code is. workflow.ts re-exports it: export * as definitions from "./definitions.ts" |
explanation.json |
This format |
prose.json |
Optional: only the words, if you’d rather the platform write explanation.json. See Made from prose |
evals.json |
Saved buyer questions, unchanged |
Who writes what
Section titled “Who writes what”| Part | Comes from | Checked on deploy |
|---|---|---|
| Steps: name, kind, order, tools | The code (step.do, step.gate, step.review, step.model, step.agent, step.sleep) |
None skipped, invented, reordered, or given a wrong kind or tool |
| A step’s checks | The code: step.do("hygiene", { uses, checks: ["merge exact duplicates", "tidy names"] }, fn) |
The explanation describes exactly those checks, in that order |
| A condition | The code: a step inside an if |
The explanation may put words on it only where the code has one |
| A loop | The code: a loop in the step’s own function | Drawn as ↻. Not written in the explanation |
| Plain English | The builder | Not empty |
| Definitions, rules, examples | The builder. Examples are made up; they are never records from a run | Every example is run through the definition’s function and must give the answer drawn |
| Which definitions a step uses, the outcome and the action line | The builder | Each definition exists; every step and every check has at least one; an action for a rule names a real rule |
| Table rows | The code: an exported list, set, map or object | Read when the examples are run. Never typed into the explanation |
The platform proves an example against the function definitions exports. It cannot prove that a step really calls that function, so import the function the step uses; don’t write a second copy.
The shape
Section titled “The shape”{ "format": "xenise.explanation/v1", "workflow": "merge-duplicates", // the name in the code "title": "Merge duplicate people", // optional: the name a buyer would use "summary": "Every morning this looks for people who appear twice…", "view": "sequence", // optional: sequence | table, how the screen first shows the steps "steps": [ { "name": "find duplicates", // the step's name in the code "title": "Find duplicates", // optional: what the card says "kind": "do", // do | gate | model | agent | sleep "says": "Reads everyone in Attio and pairs up people who share an email address.", "tools": [{ "connection": "attio", "tool": "ATTIO_LIST_RECORDS" }], "condition": "Only on days 1–7 of the month", // optional, only where the code has an if "about": "People", // optional: what the step works on; steps that say so sit side by side, one column each "reads": [ // optional: what the step reads, shown under that app; only from a connection the step uses { "connection": "attio", "what": "People", "note": "every record, about 1,500" } ], "decides": [ // for a step with no checks { "definition": "same-email", // a definition's id "says": "Do two people have the same email address?", // one line for the step panel "outcome": "work-out", // fix | ask | leave | work-out "action": "Counted as the same address", // one short result: "Merged, older record kept", "Rename?" "suggest": "yes", // optional, only with "ask": yes | no | { "yes_when": "if there is no surname" } "rules": { // optional: rules whose outcome differs (each may carry its own suggest) "A different address is a different person": { "outcome": "leave", "action": "Not a match" } } } ], "checks": [ // for a step that names checks in the code, instead of decides { "name": "tidy names", "title": "Tidy names", "says": "Fixes names it is sure about.", "decides": [ /* as above */ ] } ] } ], "definitions": [ { "id": "same-email", "name": "Same email", "question": "Do these two people have the same email address?", "in": "2 email addresses", "out": "yes / no", "answered_by": "rules", // rules | agent | agent+rules "code": "sameEmail", // the function's name in the exported definitions "where": "lib/values.ts · emailKey()", // optional: where the real code is, for a reader "note": "…", // optional "tables": ["shared-inboxes"], // optional: ids of tables it looks things up in "uses": ["work-email"], // optional: ids of definitions it builds on "rules": [ { "name": "Capitals never matter", // a short name, the heading of its examples "says": "…", // optional: one short line of nuance beside the name ("Ignores dots in Gmail addresses") "all": ["No people attached", "No notes"], // optional: conditions that must all hold, drawn as a checklist "breaks": "No notes", // optional: this rule is that condition (of another rule) failing; drawn under it as "else …" "examples": [ { "show": "[[Jo]]@acme.com · [[jo]]@acme.com", // [[ ]] marks what the rule looks at; " · " splits it into columns "gives": "yes", "input": ["Jo@acme.com", "jo@acme.com"], // the function's arguments "expect": true, // what it must return "matches": true, // optional: false draws ✕ (rightly doesn't match) "gap": false // optional: true for a known gap } ] } ] } ], "tables": [{ "id": "shared-inboxes", "name": "Shared inboxes", "code": "SHARED_INBOXES", "note": "…" }]}Rules of the format
Section titled “Rules of the format”- Outcomes.
fix✎ changes a record without asking.ask? becomes a question.leave· does nothing.work-out≡ calculates or selects something used later.start▶ is the trigger’s and is the platform’s to use. - Every step has a definition. A
do,modeloragentstep needs at least one indecides, or at least one in each of its checks. A gate, a wait and the trigger carry the platform’s own (Questions, Waits, When it runs), which a workflow can’t redefine or copy. - Every rule has an example, and every example of a definition answered by
rulesoragent+ruleshasinputandexpect. A definition answered byagentneeds no function. If it names one (code), each of its examples that hasinputandexpectis run once through the real model at deploy: the function is called with anExampleAi(model(spec)andagent(spec), the same two calls a step makes) and then the example’s input, and an agent’s tools are answered from the example’stools({ "attio query-records": … }). The pass rate is reported and never stops a deploy. - A known gap is an example the code should get right and doesn’t yet. Mark it
"gap": true. It is shown only under Code, never to a buyer, and it doesn’t fail the deploy. When the code is fixed the deploy fails until the mark is removed. - Answers are compared as JSON. A function that returns a
Setor a class instance can’t be compared: export a function that returns plain values. - One word per result. An action is the result, not a sentence: “Merged, older record kept”, “Rename?”, “Left alone”. Don’t write the outcome into it (“without asking”, “Asks you:”) or the suggestion (“(suggests yes)”): the screen draws both. Every result is one of three boxes: Does it (
fix), Asks you (ask), Leaves it (leave). - Examples are values, not sentences.
showis split on “ · “ into columns, so a rule comparing two things gives two values side by side (linkedin.com/in/[[jane]] · linkedin.com/in/[[jane]], not “… on both”).givesis the result in a word or two. - Conditions. A rule that needs several things to hold lists them in
all. A rule for the case where one of them fails names it inbreaksand is drawn under that condition rather than as a box of its own.breaksmust name a condition another rule of the same definition lists. - Wording, without repeats. The step’s
titleis the job (“Fix company names”), the definition’squestionis the drawer’s title (“Is this company name a web address or a tagline?”), and the action is the result (“Rename?”). The definition’snameis shown only in Reference, so pick it for that list and don’t restate it elsewhere. - Groups and reads.
aboutgroups steps that work on the same thing; give it to every step in the stretch between the first and the last grouped step, or the screen keeps them in one line.readsmust name a connection the step’s tools use. - A table is read as rows: a list or set gives one cell per row, a map or object gives a name and a value. Values that are numbers are drawn with a bar.
Made from prose
Section titled “Made from prose”Instead of writing explanation.json by hand, a builder can write only the words in prose.json and have the platform add everything it reads from the code:
{ "format": "xenise.explanation/v1", // optional, and so are title, view, definitions and tables, copied as they are "title": "Keep the CRM tidy", "summary": "Every morning this…", "steps": { "load people": "Reads everyone in Attio.", // a string: the step's says "tidy names": { "says": "…", "title": "Tidy names", "decides": [ /* … */ ] } // or an object: says, plus any step field (title, decides, checks, condition, about, reads) }, "definitions": [ /* … */ ], "tables": [ /* … */ ]}xenise explain <workflow.ts> --prose prose.json --write explanation.json writes it: steps, kinds, order and tools from the code, the words from the prose. A step the prose leaves out, or one the code doesn’t have, is an error. xenise check <workflow.ts> --explanation explanation.json --prose prose.json fails when the file isn’t exactly what the prose makes, so the two can’t drift.
Examples about Attio records
Section titled “Examples about Attio records”A definition that calls the real step code needs the Attio record that code expects. xenise-platform/attio turns a plain one into it, so an example reads like the person it describes:
import { attioPerson, type PlainPerson } from "xenise-platform/attio";export const notAFit = (p: PlainPerson) => isNotAFit(attioPerson(p)); // input: [{ "first": "Jo", "emails": ["info@acme.com"] }]attioPerson({ id?, first?, last?, emails?, linkedin?, phones?, company?, location?, follows?, added?, values? }) and attioCompany({ id?, name?, domains?, team?, added?, values? }). values adds any other attribute as Attio’s values. A record without an id gets p1, c2… in the order made.
Where the examples run
Section titled “Where the examples run”xenise check <workflow.ts> --explanation <file>andxenise deployload the workflow file and run every example through itsdefinitions.- On deploy, the platform publishes the version’s Worker, asks that Worker to run the examples itself (
POST /examples), and only then lets the version go live. The tables’ rows shown on screen are the ones that Worker read. A builder that skipped step 1 gets no further.
Model and agent steps
Section titled “Model and agent steps”kind is model for a step.model (one model call, no tools: it can’t act) and agent for a step.agent (a model in a loop over the tools the step lists, at least one). An agent step with no tools fails the check and is told to be a model step.
What such a step calls is never typed into the explanation. The static read takes it from the code, and the deploy writes it onto the step as ai, replacing anything typed there:
{ "name": "transcribe the call", "kind": "model", "says": "A model writes down what was said on the recording.", "tools": [], "ai": { // written by the platform at deploy "model": "google/gemini-2.5-flash-lite", // a plain string in the step "prompt": "`Transcribe the call with ${name}.`", // as written: a plain string's text, or the code that builds it "system": "Write down what was said.", "files": [{ "type": "audio", "url": "call.recording" }], // the type, and how the code writes the address "output": { "type": "object", "properties": { "text": { "type": "string" } }, "required": ["text"] }, "limits": { "usd": 0.05 }, // and "calls" on an agent "unattended": true, // agent only: runs with no gate after it, on purpose "acts_on_reads": true // agent only: worked out at deploy from the operator's read-only marks }}So the model, the files (written in place, each with a plain type, at most 5), the output shape and the limits must all be written in the step, not computed. ai is left out of the version’s content hash, since it comes from the source, which is already in it. The outbound Worker holds every model call to this ai: see Model steps and agent steps.
One more check comes with it: an agent that takes in outside content (a file, or what a reading tool returns) and lists a tool that isn’t marked read-only needs a gate after it that always runs, or unattended: true in the step.
Something unclear, or missing? Email us at hello@xenise.com