← Files Flows by plugin.spaceARCHIVED FILE
skills/present-flow/references/format.md
8.01 KB · Nov 30, 2026 · 00:17 UTC
# Flow document version 1
A document contains `version: 1`, a stable `id`, a `name`, an optional `description`, `startNode`, `nodes`, and `edges`. See `../../../flows.schema.json` for the machine-readable contract and `../../../examples/checkout.flows.json` for a complete example.
Optional document-level `application: { "id": "stable-app-id", "name": "Application name" }` groups saved flows by the application where the plugin was used. IDs use the same allowed characters and length as document IDs; names are non-empty text up to 200 characters. New documents should include this metadata from the established project. Reuse the same application ID across documents and machines. Older files remain valid; the local server uses project/package metadata as a fallback.
New mappings also include `roleAudit: { version: 1, roles, warnings }` and `userRoleIds`, the unique IDs of roles participating in this flow. Both fields are optional together for legacy files. Each role has `id`, `name`, `source` and `permissions`; permissions carry allowed/denied/conditional access, evidence and optional node/edge references. Conditional access requires a condition. Every role and permission source requires a kind and nonblank reference. See [user roles](user-roles.md) for the full contract and audit workflow. These are mapped product roles, not Flows account permissions.
Each node needs:
- `id`: unique letters, digits, hyphens, or underscores (at most 100 characters).
- `type`: `screen`, `action`, `decision`, or `state`.
- `title`, optional `description`, optional `actor`.
- `position: { "x": 0, "y": 0 }`: finite canvas coordinates.
- `source: { "kind": "proposed" }`: use for requested design proposals. Use `inferred` for source-derived behavior and `observed` for behavior actually seen. For implementation flows, supply `reference` with a concrete file and line or the observed screen and interaction; the schema keeps this field optional for proposals and older documents. Example: `"source": { "kind": "inferred", "reference": "src/chat/Conversation.tsx:84 — submitMessage validates the draft before sending" }`.
Screens can supply `screenshot`, a legacy relative PNG/JPEG/WebP/GIF path with unspecified viewport (shown as Original screenshot). Responsive captures use `screenshots`, a map from stable profile ID to `{ path, width, height, viewport: { width, height }, capturedAt, method, url? }`. The image dimensions and viewport are recorded separately for full-page captures; `method` is `playwright`, `browser` or `import`, and `capturedAt` is an ISO timestamp. Parent traversal, absolute image paths, external image URLs, and escaping symlinks are unsupported. Images are served only when referenced by a node, and must be at most 8 MB.
For explicitly proposed screens, `preview` supports optional `brand`, `eyebrow`, `title`, `description`, `actionLabel`, and `variant` (`default`, `commerce`, or `success`). `fields` and `items` are arrays of `{ "label": "Email", "value": "alex@example.com" }` objects. These previews are illustrative; their displayed buttons do not operate an external app. Inferred/observed nodes without a screenshot show a missing-screen placeholder even if older documents contain `preview`. Use the viewer's transition controls to navigate.
Optional document-level `captureSettings` contains `profiles`, `fullPage` (boolean) and `colorScheme` (`light` or `dark`). A profile has `id`, `name`, `width`, `height`, `enabled`, `isMobile` and `hasTouch`. Defaults: mobile 390×844 with mobile/touch, tablet 768×1024 with mobile/touch, desktop 1440×900; all enabled, viewport-only, light. Global settings → Screenshots configures future captures across projects. Capture tools retain the settings used in each document; existing document settings remain a fallback until global preferences are saved. See [the capture guide](capture.md) for capture plans, authentication and importing images.
Each edge needs a unique `id`, `source`, `target`, and human-readable `label`. An optional `condition` explains the branch. All references and `startNode` must resolve to existing nodes. Empty edge lists and cycles are valid.
Nodes may include `test: { "action": "…", "assertion": "…" }`, and edges may include `test: { "action": "…" }`. Every supplied action or assertion is nonblank text up to 1,000 characters, grounded in the node's source evidence. Either hint object may also include `userRoleIds`, a nonempty list of unique IDs assigned to the flow, to narrow scenarios through that node or edge. Actions describe real UI operations; assertions describe observable outcomes. Branch conditions are prerequisites, not actions. Avoid duplicating a node action on its incoming edge. Mapping automatically derives the optional `testScenarios` suite from these hints and the graph. It contains draft cases with node/edge references, role IDs, prerequisites, steps, warnings and coverage, plus a `userRoles` ID/name lookup. Regenerate this derived field rather than editing it by hand; old documents without it remain valid. See [test scenarios](test-scenarios.md) for generation and Midscene exports.
Optional `userStories` records actor, goal, benefit, context and acceptance criteria linked to existing nodes/edges. Optional `node.evaluations` records a focus, expected experience and optional task/rationale. Both use `source: { "kind": "provided" | "inferred", "reference"?: "…" }`: supplied requirements and hypotheses remain distinguishable from actual user research. IDs follow the existing ID format; user story IDs are unique within the document and evaluation IDs within their node. Text is nonblank and at most 1,000 characters, except actors (100). Each story references at least one existing node. There is no additional count cap on these lists. See [quality suggestions](quality-suggestions.md) for the complete field contract and mapping examples.
The optional generated `testScenarios.quality` contains draft use cases and qualitative evaluation proposals, source labels, graph/scenario references, review questions, rubric anchors and evidence to collect. It contains no executed results. Older suites without this field remain valid and acquire suggestions on regeneration. Local saves keep the complete suite; cloud snapshots preserve the source graph and hints once, and viewers derive the suite and complete exports locally.
The viewer shows one selected path in both Flow and Patches. Ordinary outgoing edges are mutually exclusive radio choices; the first edge in document order is the initial selection. Choosing another option replaces the inactive continuation and arranges the visible steps in order. Cycles connect back to the existing step with an arrow routed below the cards, without duplicating steps. This visual selection does not assert that the condition occurred in the product.
Use `"parallel": true` on an edge only when the implementation or requested design explicitly establishes that the activity runs alongside the selected continuation (for example, a background activity log). These branches remain visible in a separate Background lane with dashed wires and do not compete with radio choices. A background branch can have its own mutually exclusive outcomes. Do not infer concurrency merely from a node's actor, type, an asynchronous function, or the presence of several outgoing edges. Older documents without this property show ordinary alternatives. See `../../../examples/background.flows.json` for an illustrative proposal.
Limits: 1 MiB for the source document excluding generated `testScenarios`, 1–500 nodes, up to 2,000 edges, up to 20 fields/items per preview. Generated scenarios and quality suggestions have no count or byte-size cap. Files are read on each refresh. Invalid edits leave the last valid graph visible with an error until corrected.
Export keeps image references relative. To share a local artifact, copy the JSON and its referenced image files together. Export is a portable artifact. When the optional hosted account service is configured, Account & sharing saves an authenticated snapshot with its referenced captures and grants or revokes teammate view access.
SHA-256: af0bfb1fbe26ef4bb9e4a938006106bd3a3d78bc5ffcd8d0de6a5257df449dfa