BPMN from protocol
Build evidence-based BPMN artifacts using the canonical ARMAN semantic model
schema 2.1. This package is agent-neutral: use the current host's filesystem,
shell, document extraction, and image inspection capabilities.
Before the first run, read runtime.md and run
python scripts/check_runtime.py. For modeling,
read process-model-schema.md and enforce
ROLE != SYSTEM.
Quality level
Choose one level before modeling and state it in the first progress update:
- L1 — Basic validation: complete model and requested files with only
structural usability checks and no visual correction round.
- L2 — Standard validation: the default working workflow, with actual-SVG
geometry checks, one full visual inspection, and at most one targeted fix.
- L3 — Extended validation: the same complete model under exhaustive,
cross-format, regression-aware review and up to three targeted fixes.
Infer an explicit request such as быстро, рабочая схема, or аудитная
without asking a follow-up question. A plain request to create a diagram uses
L2. Read quality-levels.md after selecting the
level and follow its validation, correction, and stopping budget. Quality
level changes validation effort only. It never changes source coverage,
modeling granularity, artifact completeness, or requested formats. Do not omit,
merge, or simplify a source-backed action, role, system, object, gateway,
exception, transfer, input, or output to satisfy a faster level.
Workflow
- Resolve the supplied attachment/path and create an isolated writable workspace.
- Extract once with
scripts/extract_protocol.py.
- Separate independent processes without mixing their facts.
- Create one atomic schema-2.1
process_model.json per process. One Activity
has one action, role, system, main business object, basis, observable result
or verification criterion, knowledge status, and source trace. Never invent
missing facts or source locators.
- Run
scripts/normalize_model.py, then scripts/validate_model.py.
Semantic validation must pass before either registry or renderer runs.
- Build both registries plus
information-gaps.md: use
build_semantic_registry.py, build_information_gaps.py, and
build_registry.py for the deterministic renderer.
- Run
scripts/run_pipeline.py --model <model> --workspace <workspace> --quality-level <L1|L2|L3>;
add --bpmn when BPMN XML is requested. SVG is the default preview; add
--png only when the user explicitly requests the legacy raster format.
If draw.io Desktop is unavailable, preserve the editable
draw.io candidate and report NEEDS_REVIEW instead of failing the run.
The --bpmn path must publish BPMN-DI from the final draw.io geometry,
render it through bpmn-js, and pass the independent BPMN-DI visual gate.
- Apply the selected level's validation and correction budget. When SVG
validation is required, use the SVG exported from the same draw.io
candidate. Inspect the complete SVG at overview and readable detail scales.
- Only after the inspection required by the selected level, record the
decision with
scripts/post_render_review.py <id> --workspace <workspace> --quality-level <L1|L2|L3> --status PASS|FAIL --reviewer <name>. At L1,
do not fabricate a full visual PASS when only the quick catastrophic-layout
inspection was performed; return NEEDS_REVIEW with deferred findings.
- Rebuild the final report with
scripts/build_validation_report.py and
return direct links to requested artifacts plus validation results.
Invariants
- Protocol decisions and scenario are the source of business truth.
- Model completeness and requested formats are identical at L1, L2, and L3;
only validation depth and correction effort differ.
- The current white-box Process has no internal Lane. Human roles and systems
are per-Activity overlays; overlays are never Flow Nodes.
system names one execution system; devices/interfaces belong in
execution_channel; physical manual work uses system: "Вне ИС".
CONFIRMED Activity requires source_refs. Recommendations,
assumptions, open questions, and 1C metadata checks remain visibly distinct.
- A regression fixture may index evidence but cannot be the only source for a
CONFIRMED fact; retain a primary DOCX/transcript reference and locator.
- A Task displays only a short operational
name (maximum 72 characters and
2–3 rendered lines). Full action/object/interface/basis/result/check data
stays in the model and semantic registry and is exported to
bpmn:documentation, never encoded into name or HTML.
- Never fill unknown contract fields with generic completion phrases. Mark the
Activity
OPEN and add an information_gaps[] row.
- Use
send_task only across separate participants/pools with a Message Flow.
Model automatic in-system exchange as service_task.
- Place a same-type merge only when at least two branches really reconverge.
A one-input merge is invalid and split/merge symmetry alone is insufficient.
- Route Sequence Flows from explicit ports on the actual Flow Node bounds,
never from an enclosing Activity Group. Keep the happy path left-to-right;
reserve distinct outer corridors for alternatives and cyclic returns. Two
flows may not share a segment, including flows with a common endpoint.
- Calculate ports on the actual perimeter: rectangles for Activity,
Participant, and the safe Data Object contract; diamonds for Gateway;
ellipses for Event. Validate both endpoints of Sequence Flow, Message Flow,
and Data Association in draw.io and the rendered SVG.
- Keep Tasks on one baseline whether a role overlay exists or not. Human
Activities require a role; automated Activities have no invented role.
Render a system as a compact rounded badge and route Data Associations
around it. Size each Activity Group from its artifact count and keep all
children contained without intersections with neighboring groups.
- Render Start/End Event and Gateway captions as separate wrapped label cells.
Put each branch condition beside its own outgoing flow. Preserve a selected
default flow in draw.io and BPMN XML.
- Use
call_activity only with called_process_id so BPMN XML can emit
calledElement; otherwise choose the real Task type and performer.
- A Message Flow that launches the Process requires
event_definition: message and a BPMN messageEventDefinition. Never invent a human role for
automated/process Activities; record a missing sourced owner as an OPEN
information gap.
- Place external Participants near the nodes they communicate with. Message
Flows must avoid Flow Nodes, Sequence Flows, and data artifacts.
- Keep Data Association semantic endpoints as
Artifact ↔ Activity. Give
every input/output occurrence its own bottom Activity port and corridor;
it may not overlap or cross Sequence Flow, another Association, Activity,
Artifact, role badge, or system badge.
- Treat
logical_object_id + state as path-sensitive: a consumed state must
have been explicitly produced on every incoming path. A state change exists
only after the Activity that emits that state as an output.
- Source adapters extract facts only. Excel, table, and text adapters must not
emit layout coordinates, bands, ports, or corridors; normalize every source
to one
process_model and use this renderer.
- Visual PASS is blocked by edge-edge intersections, label overlaps, invalid
backward routing, edge-through-node paths, Message Flow obstruction,
Data Association crossing a system badge, text overflow, excessive width,
or large empty intervals. Validate actual SVG routes, not only model points.
- Do not store
visual_review in the model or predeclare it before render.
Critical OPEN/ASSUMPTION items force NEEDS_REVIEW; overall PASS requires
a separate hash-bound post-render review. For BPMN requests the hashes also
include the .bpmn and its bpmn-js SVG. Include optional PNG hashes only
when the user explicitly requested PNG.
- Split processes above 22 Tasks into an overview and readable detailed
subprocess diagrams. Use Task geometry 120–160 × 70–90 and a 14–16 px marker.
- Never preserve legacy
source_status after normalization.
- Do not combine different actions, roles, systems, controls, alternatives,
knowledge statuses, or source requirements into one Activity.
- Never impose an Activity-count target or omit content because a faster
quality level was selected.
- Follow corporate-bpmn-standard.md
and color-system.md.
- Do not run indefinite correction loops.
- Never spend the whole run polishing without a deliverable. Follow the
progressive-delivery and hard-stop rules in
quality-levels.md; return the
best generated candidate with an honest status when its budget expires.
Completion
The task is complete when every requested process has a valid schema-2.1
model, semantic registry, requested artifact files, and validation reports.
The portable package is generated from canonical repository sources; run the
repository sync checker before distributing it.
1---2name: bpmn-from-protocol3description: Create editable BPMN process diagrams from an attached file, local path, or pasted protocol text when draw.io, SVG, or BPMN 2.0 XML is requested. Not for UML, ER diagrams, charts, or timelines.4---56# BPMN from protocol78Build evidence-based BPMN artifacts using the canonical ARMAN semantic model9schema 2.1. This package is agent-neutral: use the current host's filesystem,10shell, document extraction, and image inspection capabilities.1112Before the first run, read [runtime.md](references/runtime.md) and run13`python scripts/check_runtime.py`. For modeling,14read [process-model-schema.md](references/process-model-schema.md) and enforce15[ROLE != SYSTEM](references/system-role-policy.md).1617## Quality level1819Choose one level before modeling and state it in the first progress update:2021- **L1 — Basic validation**: complete model and requested files with only22 structural usability checks and no visual correction round.23- **L2 — Standard validation**: the default working workflow, with actual-SVG24 geometry checks, one full visual inspection, and at most one targeted fix.25- **L3 — Extended validation**: the same complete model under exhaustive,26 cross-format, regression-aware review and up to three targeted fixes.2728Infer an explicit request such as `быстро`, `рабочая схема`, or `аудитная`29without asking a follow-up question. A plain request to create a diagram uses30L2. Read [quality-levels.md](references/quality-levels.md) after selecting the31level and follow its validation, correction, and stopping budget. Quality32level changes validation effort only. It never changes source coverage,33modeling granularity, artifact completeness, or requested formats. Do not omit,34merge, or simplify a source-backed action, role, system, object, gateway,35exception, transfer, input, or output to satisfy a faster level.3637## Workflow38391. Resolve the supplied attachment/path and create an isolated writable workspace.402. Extract once with `scripts/extract_protocol.py`.413. Separate independent processes without mixing their facts.424. Create one atomic schema-2.1 `process_model.json` per process. One Activity43 has one action, role, system, main business object, basis, observable result44 or verification criterion, knowledge status, and source trace. Never invent45 missing facts or source locators.465. Run `scripts/normalize_model.py`, then `scripts/validate_model.py`.47 Semantic validation must pass before either registry or renderer runs.486. Build both registries plus `information-gaps.md`: use49 `build_semantic_registry.py`, `build_information_gaps.py`, and50 `build_registry.py` for the deterministic renderer.517. Run `scripts/run_pipeline.py --model <model> --workspace <workspace>52 --quality-level <L1|L2|L3>`;53 add `--bpmn` when BPMN XML is requested. SVG is the default preview; add54 `--png` only when the user explicitly requests the legacy raster format.55 If draw.io Desktop is unavailable, preserve the editable56 draw.io candidate and report `NEEDS_REVIEW` instead of failing the run.57 The `--bpmn` path must publish BPMN-DI from the final draw.io geometry,58 render it through bpmn-js, and pass the independent BPMN-DI visual gate.598. Apply the selected level's validation and correction budget. When SVG60 validation is required, use the SVG exported from the same draw.io61 candidate. Inspect the complete SVG at overview and readable detail scales.629. Only after the inspection required by the selected level, record the63 decision with `scripts/post_render_review.py <id> --workspace <workspace>64 --quality-level <L1|L2|L3> --status PASS|FAIL --reviewer <name>`. At L1,65 do not fabricate a full visual PASS when only the quick catastrophic-layout66 inspection was performed; return `NEEDS_REVIEW` with deferred findings.6710. Rebuild the final report with `scripts/build_validation_report.py` and68 return direct links to requested artifacts plus validation results.6970## Invariants7172- Protocol decisions and scenario are the source of business truth.73- Model completeness and requested formats are identical at L1, L2, and L3;74 only validation depth and correction effort differ.75- The current white-box Process has no internal Lane. Human roles and systems76 are per-Activity overlays; overlays are never Flow Nodes.77- `system` names one execution system; devices/interfaces belong in78 `execution_channel`; physical manual work uses `system: "Вне ИС"`.79- `CONFIRMED` Activity requires `source_refs`. Recommendations,80 assumptions, open questions, and 1C metadata checks remain visibly distinct.81- A regression fixture may index evidence but cannot be the only source for a82 `CONFIRMED` fact; retain a primary DOCX/transcript reference and locator.83- A Task displays only a short operational `name` (maximum 72 characters and84 2–3 rendered lines). Full action/object/interface/basis/result/check data85 stays in the model and semantic registry and is exported to86 `bpmn:documentation`, never encoded into `name` or HTML.87- Never fill unknown contract fields with generic completion phrases. Mark the88 Activity `OPEN` and add an `information_gaps[]` row.89- Use `send_task` only across separate participants/pools with a Message Flow.90 Model automatic in-system exchange as `service_task`.91- Place a same-type merge only when at least two branches really reconverge.92 A one-input merge is invalid and split/merge symmetry alone is insufficient.93- Route Sequence Flows from explicit ports on the actual Flow Node bounds,94 never from an enclosing Activity Group. Keep the happy path left-to-right;95 reserve distinct outer corridors for alternatives and cyclic returns. Two96 flows may not share a segment, including flows with a common endpoint.97- Calculate ports on the actual perimeter: rectangles for Activity,98 Participant, and the safe Data Object contract; diamonds for Gateway;99 ellipses for Event. Validate both endpoints of Sequence Flow, Message Flow,100 and Data Association in draw.io and the rendered SVG.101- Keep Tasks on one baseline whether a role overlay exists or not. Human102 Activities require a role; automated Activities have no invented role.103 Render a system as a compact rounded badge and route Data Associations104 around it. Size each Activity Group from its artifact count and keep all105 children contained without intersections with neighboring groups.106- Render Start/End Event and Gateway captions as separate wrapped label cells.107 Put each branch condition beside its own outgoing flow. Preserve a selected108 default flow in draw.io and BPMN XML.109- Use `call_activity` only with `called_process_id` so BPMN XML can emit110 `calledElement`; otherwise choose the real Task type and performer.111- A Message Flow that launches the Process requires `event_definition:112 message` and a BPMN `messageEventDefinition`. Never invent a human role for113 automated/process Activities; record a missing sourced owner as an OPEN114 information gap.115- Place external Participants near the nodes they communicate with. Message116 Flows must avoid Flow Nodes, Sequence Flows, and data artifacts.117- Keep Data Association semantic endpoints as `Artifact ↔ Activity`. Give118 every input/output occurrence its own bottom Activity port and corridor;119 it may not overlap or cross Sequence Flow, another Association, Activity,120 Artifact, role badge, or system badge.121- Treat `logical_object_id + state` as path-sensitive: a consumed state must122 have been explicitly produced on every incoming path. A state change exists123 only after the Activity that emits that state as an output.124- Source adapters extract facts only. Excel, table, and text adapters must not125 emit layout coordinates, bands, ports, or corridors; normalize every source126 to one `process_model` and use this renderer.127- Visual PASS is blocked by edge-edge intersections, label overlaps, invalid128 backward routing, edge-through-node paths, Message Flow obstruction,129 Data Association crossing a system badge, text overflow, excessive width,130 or large empty intervals. Validate actual SVG routes, not only model points.131- Do not store `visual_review` in the model or predeclare it before render.132 Critical OPEN/ASSUMPTION items force `NEEDS_REVIEW`; overall `PASS` requires133 a separate hash-bound post-render review. For BPMN requests the hashes also134 include the `.bpmn` and its bpmn-js SVG. Include optional PNG hashes only135 when the user explicitly requested PNG.136- Split processes above 22 Tasks into an overview and readable detailed137 subprocess diagrams. Use Task geometry 120–160 × 70–90 and a 14–16 px marker.138- Never preserve legacy `source_status` after normalization.139- Do not combine different actions, roles, systems, controls, alternatives,140 knowledge statuses, or source requirements into one Activity.141- Never impose an Activity-count target or omit content because a faster142 quality level was selected.143- Follow [corporate-bpmn-standard.md](references/corporate-bpmn-standard.md)144 and [color-system.md](references/color-system.md).145- Do not run indefinite correction loops.146- Never spend the whole run polishing without a deliverable. Follow the147 progressive-delivery and hard-stop rules in `quality-levels.md`; return the148 best generated candidate with an honest status when its budget expires.149150## Completion151152The task is complete when every requested process has a valid schema-2.1153model, semantic registry, requested artifact files, and validation reports.154The portable package is generated from canonical repository sources; run the155repository sync checker before distributing it.