ERP-RFC-002 — BPM / Workflow Engine
- Status: Stub
- Date: 2026-04-12
- Author: Koder Team
- Depends on:
erp-RFC-000-architecture-overview.md,kompass-RFC-001-identity-and-org-unification.md - Phase: 4 (BPM horizontal engine)
- Blocked by:
kompass-RFC-001(identity must land first per the ERP track convention) - Blocks: full-lifecycle tramitação features in
erp-RFC-001(licitação),erp-RFC-003(travel),erp-RFC-004(fiscal),erp-RFC-005(legal)
Summary
A dedicated Business Process Management engine with BPMN 2.0 process design, DMN decision tables, a workflow execution runtime, human task management with form rendering, SLA timers, escalation, digital signature integration, and tramitação — the "document and decision flowing between units with despachos and pareceres" pattern that defines Brazilian public and semi-public administration.
This is the horizontal engine that every vertical in the ERP track eventually consumes for its approval chains and long-running processes. Licitação uses it for the edital → proposta → contrato → execução flow. Travel uses it for solicitação → autorização → prestação de contas. Legal uses it for matter intake → triage → work → closing. HR uses it for admissão → onboarding → confirmation → offboarding. Fiscal uses it for closing cycles and audit workflows.
The engine is distinct from platform/pipe, which orchestrates technical DAG-based data pipelines (DAG → cron → task → done). BPM is human-in-the-loop, stateful, multi-day to multi-month, with forms and signatures. Pipe and BPM are complementary; neither substitutes the other.
Name decision
Deferred to the RFC itself when it is promoted from stub to draft. Candidates to evaluate per meta/docs/stack/specs/naming/brand-score.kmd:
rumo(pt: "course, direction")trama(pt: "weave, fabric of decisions")loom(en: tear, weaves processes)relay(en: hands off between stages)cadere(latin: "to fall into place") — not to be confused withplatform/cadence(music)iter(latin: "path, journey")via(latin: "way")
Hard filters: must not collide with platform/flow (git hosting), platform/pipe (data pipelines), platform/cadence (music), platform/orbit (social), platform/cron (scheduling). Must score Brand ≥ 60 (engine target). Must not read as a generic descriptor (so workflow, process, proc are out).
Scope
In scope (MVP)
- BPMN 2.0 process designer — visual diagrammer for pools, lanes, start/end events, user tasks, service tasks, exclusive and parallel gateways, intermediate events, timers, error boundary events. Web-based canvas. Output is standards-compliant BPMN XML that round-trips with external tools.
- Execution runtime — stateful token-based engine that advances process instances through the diagram, persists state to KDB, handles retries and compensations.
- DMN 1.3 decision tables — declarative decision rules for automated branching. Decision tables are authored in a spreadsheet-like UI and invoked from service tasks or gateway conditions.
- User task inbox — per-person view of assigned tasks across all tenants, with filters (due soon, SLA risk, by process type, by tenant).
- Form rendering for user tasks — tasks that need user input reference a Form from
products/horizontal/form; the BPM engine embeds the rendered form and captures the response as task output. - Digital signature for tasks — tasks that require formal approval delegate to
products/horizontal/signfor ICP-Brasil or generic signature capture. - SLA timers and escalation — declarative timers (duration or schedule) on any task; on timeout, the configured escalation action fires (reassign, notify, auto-decide per DMN).
- Audit trail — immutable event log of every state transition, input, output, and actor, per process instance.
- Kanban board view — alternative presentation of work-in-progress across process instances, grouped by stage, filtered by tenant and unit.
- Tramitação primitive — a document (any attached entity) moves between units with events: despacho, parecer, solicitação, deferimento, indeferimento. First-class modeling of the Brazilian administrative flow idiom.
- Multi-tenant isolation — every process instance and definition is scoped to a
Tenantfrom Kompass. User assignments resolve toMembership, notPerson, so the same human can have different task queues in different tenants.
Out of scope (MVP)
- Data pipeline orchestration — belongs to
platform/pipe. - Agile issue tracking (sprints, backlogs, velocity) — possibly a submodule of BPM later, possibly a separate module. Deferred.
- Complex event processing / CEP — correlation of real-time events across many streams. Not part of BPM.
- Robotic process automation (RPA) — scripted UI automation against external web apps. A sibling tool, not BPM itself.
- CMMN (Case Management Model and Notation) — loose-flow case management as an alternative to BPMN's strict flow. Interesting but deferred; can be added later as a second process notation without rewriting the engine.
Dependencies
| Dependency | Used for | Required day one |
|---|---|---|
services/foundation/kompass |
tenant, unit, role, membership — task assignment resolution | yes |
services/foundation/id |
authentication | yes |
infra/data/kdb |
persistence of process definitions, instances, events, tasks | yes |
products/horizontal/form |
form rendering for user tasks | yes |
products/horizontal/sign |
signature capture on approval tasks | yes for regulated processes |
products/horizontal/kmail |
task notification | yes |
products/horizontal/cal |
SLA calendars and business-day calculations | yes |
platform/pipe |
optional system-task delegation for technical sub-flows | optional |
| `observe |