KB-25AF

IU / 4-Mothers / Event 5-Layer Foundation — Master Design (DRAFT, 2026-05-27)

30 min read Revision 1
designmaster-designiumowmotmoitmoutevent-foundationdraft2026-05-27

IU / 4-Mothers / Event 5-Layer Application Foundation — Master Design

Path: knowledge/dev/design/iu-mow-mot-event-foundation-design.md Status: DRAFT — design foundation, not a law. Companion to requirements brief. Date: 2026-05-27 Companion files:

  • knowledge/dev/requirements/iu-mow-mot-event-foundation-requirements.md
  • knowledge/dev/design/law-extraction-plan-application-process-workflow-task.md
  • knowledge/dev/implementation/iu-4mothers-event-foundation-roadmap.md

1. Architecture overview

The system is a 6-tier production stack:

┌──────────────────────────────────────────────────────────────────────┐
│ T6 GOVERNANCE UI (Nuxt — render shell only)                         │
│   <MOWDiagram>  <MOTCard>  <MOITForm>  <MOUTTable>  <ProposalDialog>│
│   Governance dashboard — problem-only, summaries, DLQ rescue        │
└──────────────────────────────────────────────────────────────────────┘
                       ▲                          ▲
                       │ Directus API             │ Realtime Gateway (WS/SSE)
                       │                          │   (filter by permission, summaries)
┌──────────────────────────────────────────────────────────────────────┐
│ T5 API / ADMIN (Directus + REST/GraphQL)                            │
│   permissions, schema view, admin tools                             │
└──────────────────────────────────────────────────────────────────────┘
                       ▲
                       │
┌──────────────────────────────────────────────────────────────────────┐
│ T4 ORCHESTRATION & EXECUTION (workers running on PG-native queue)   │
│   MOW orchestrator    Executor pool (DOT/SQL/AI/Human/External/     │
│                       Notification/Render)                          │
│   Heartbeat callers   DLQ reaper    Replay coordinator              │
└──────────────────────────────────────────────────────────────────────┘
                       ▲
                       │ job lease, event subscription, outbox poll
┌──────────────────────────────────────────────────────────────────────┐
│ T3 QUEUE & EVENT CORE (Điều 45 OWNED — do NOT redesign)             │
│   event_outbox   event_pending   event_read   event_subscription    │
│   event_type_registry            job_queue    job_dead_letter       │
│   queue_heartbeat                cut_request* (cut pipeline owner)  │
│   trigger-in / trigger-out PG functions                             │
└──────────────────────────────────────────────────────────────────────┘
                       ▲
                       │
┌──────────────────────────────────────────────────────────────────────┐
│ T2 4 MOTHERS APPLICATION LAYER (NEW — this design)                  │
│   MOW (workflow_registry + workflow_steps + workflow_change_request)│
│   MOT (task_registry + tasks + task_checkpoints + task_comments)    │
│   MOIT (field_registry + input_form_registry + staging tables)      │
│   MOUT (output_table_registry + DOT function registry + matviews)   │
└──────────────────────────────────────────────────────────────────────┘
                       ▲
                       │ unit_id reference, IU events
┌──────────────────────────────────────────────────────────────────────┐
│ T1 KNOWLEDGE BRICK — INFORMATION UNIT (IU laws OWNED)               │
│   information_unit  iu_tree_path  iu_three_axis_envelope            │
│   iu_metadata_tag(*) iu_sql_link  iu_piece_collection/membership    │
│   iu_relation        iu_lifecycle_log  iu_route_*  iu_qdrant_*      │
│   compose/split/merge/render/validate ops                           │
└──────────────────────────────────────────────────────────────────────┘
                       ▲
                       │ SQL link, DOT-pair execution
┌──────────────────────────────────────────────────────────────────────┐
│ T0 POSTGRES BASE (Điều 33 v2.1 OWNED — 4-DB, 3-layer)               │
│   directus DB · iu_core schema · public schema · dot_* substrate    │
└──────────────────────────────────────────────────────────────────────┘

5-layer sync (Hiến pháp): PG ↔ Directus ↔ Nuxt ↔ AgentData/KB ↔ Qdrant.

2. Responsibility boundaries

Concern Owner
PG schema, 4-DB, 3-layer, NT3 exception Điều 33 v2.1 (existing)
DOT lifecycle, registration, run mode Điều 35 v5.2 (existing)
Approval logic, quorum Điều 32 v1.1 (existing)
Display tech / template Điều 28 v2.0 (existing)
Classification Điều 29 v2.0 (existing)
Regression protection Điều 30 v1.2 (existing)
System integrity Điều 31 v1.2 (existing)
Governance organization Điều 37 v3.3 (existing)
Text-as-Code, IU foundation Điều 38 v3.0 DRAFT + dieu38-trien-khai (existing)
Knowledge graph law Điều 39 v2.1 (existing)
Queue & event core, executor boundary, MOT-not-executor Điều 45 v1.0 BAN HÀNH (existing — do NOT duplicate)
Workflow law nền Điều 34 v1.0 DRAFT — needs decision (merge / promote / replace)
Birth registry Điều 0-G (existing)
Application workflow/task platform (MOW/MOT/MOIT/MOUT/proposal flow) Điều XX — new framework law (to be drafted)

3. No-double-ownership matrix

Topic Belongs to New law MAY do New law MUST NOT do
event_outbox schema Điều 45 reference + use redefine schema or semantics
job_queue lifecycle Điều 45 use leasing + heartbeat replace state model
heartbeat caller obligation Điều 45 §15.5 require for new workers weaken cadence
event vs job distinction Điều 45 §6.6 apply blur the line
executor boundary Điều 45 §11.5 extend with executor classes MOT-as-executor
DOT-pair test policy Điều 35 require redefine
IU axis A/B/C Điều 38/39 reuse redefine axis
Compose/split/merge ops IU foundation call re-implement
Approval quorum Điều 32 call re-implement
Display template Điều 28 comply introduce alternate render
PG-first / 3-layer Hiến pháp NT13 + Điều 33 comply bypass
Birth registry Điều 0-G comply bypass

4. IU / Task / Workflow / Event relationship

IU (knowledge brick) ──── unit_id  ────► WORKFLOW step description
                              ▲              │
                              │              │  step_id
                              │              ▼
                              └─── unit_id ──── TASK (operational brick)
                                                   │
                          input_form_id ────────── │ ──── output_table_id
                                ▼                  ▼            ▼
                              MOIT              EXECUTOR        MOUT
                            (form)             (DOT/SQL/AI/    (table)
                                                Human/Ext/
                                                Notify/Render)
                                                   │
                                                   ▼
                            ┌──────── EVENT 5-LAYER ────────┐
                            │ produce → broker → consume   │
                            │ → realtime gateway → DLQ     │
                            └───────────────────────────────┘

Key invariants:

  • Every workflow step references an IU (description, design doc, SOP).
  • Every task references an IU + an input_form (optional) + an output_table (optional) + an executor_class.
  • Every executor publishes events; queue is the substrate.
  • Events feed gateway → governance UI receives summaries.

5. The 4 Mothers — master design

5.1 MOW — Mother of Workflows

Tables (extend existing, do not replace):

  • public.workflow_registry (NEW) — semantic registry per workflow_def (workflow_id, code, name, version, owner_role, trigger_config jsonb, status, iu_unit_id FK, created_at).
  • public.workflows (EXISTING — extend) — runtime instances (workflow_run_id, workflow_id FK, run_state, started_at, deadline_at, correlation_id, trace_id, parent_run_id NULL FK for nested, snapshot_jsonb).
  • public.workflow_steps (EXISTING — extend) — per-instance step (step_run_id, workflow_run_id FK, step_def_id, step_state, started_at, completed_at, task_run_id NULL FK).
  • public.workflow_step_def (NEW) — design-time step definition (step_def_id, workflow_id FK, order_index, branch_condition jsonb, parallel_group, sub_workflow_id NULL FK, trigger_in_config jsonb, trigger_out_config jsonb, iu_unit_id FK, task_def_id NULL FK).
  • public.workflow_step_relations (EXISTING) — predecessor/successor edges.
  • public.workflow_change_requests (EXISTING — reuse) — proposal mode queue.
  • public.workflow_categories (EXISTING).

State machine (workflow_run):

pending → ready → running ⇄ paused → completed
                       │
                       ├─→ failed → recoverable_failed → running (replay)
                       └─→ cancelled
running → archived (after retention)

Orchestration loop:

  1. Trigger fires → fn_mow_create_run(workflow_id, trigger_payload) — emits workflow.run.created event.
  2. fn_mow_advance(run_id) — pick next step(s) by graph + branch condition + parallel_group; create task_run(s); emit workflow.step.activated.
  3. Task completion event consumed by fn_mow_step_complete(step_run_id, outcome) → re-advance.
  4. Paused on human gate → resume signal.
  5. Timeout → escalation policy → emit workflow.escalated.
  6. All terminal → fn_mow_complete(run_id) → emit workflow.run.completed.

Proposal mode:

  • UI = PHU-LUC-A/B/C HTML/JS (ground truth).
  • Normal mode: read-only flow with tabs T6→T1.
  • Proposal mode toggle "Đề xuất cải tiến" → reveals + yellow toggle (edit), red toggle (delete), green + (add).
  • Each proposal → INSERT workflow_change_requests (action=add/edit/delete, target_step_def_id, payload_jsonb, reason, submitter_id, status=pending).
  • MOW approval workflow consumes proposal → if approved → apply diff to workflow_step_def; bump version; archive old version.
  • Backend filter permission; UI does not change per role.

5.2 MOT — Mother of Tasks

Tables:

  • public.task_def (NEW) — design-time task definition (task_def_id, code, name, executor_class, input_form_id NULL FK, output_table_id NULL FK, instruction_iu_unit_id FK, deadline_policy jsonb, escalation_policy jsonb, retry_policy jsonb, idempotency_key_strategy, status, version).
  • public.tasks (EXISTING — extend) — runtime task_run (task_run_id, task_def_id FK, workflow_run_id NULL FK, step_run_id NULL FK, assignee_id NULL, state, due_at, started_at, completed_at, output_jsonb, correlation_id, trace_id, idempotency_key UNIQUE NULLS NOT DISTINCT).
  • public.task_checkpoints (EXISTING — reuse).
  • public.task_comments (EXISTING — reuse).
  • public.task_subscription (NEW — optional) — explicit subscription record if not derivable from def.

Task state machine:

created → assigned → in_progress → completed
                          │
                          ├─→ blocked → in_progress
                          ├─→ overdue → escalated → in_progress
                          ├─→ failed → retry_pending → in_progress
                          ├─→ failed → dead_letter (after max retry)
                          └─→ cancelled

Layout (4 vùng) — UI contract:

Vùng Source Component
1 HEADER task_def + task_run metadata <MOTHeader />
2 INPUT input_form_registry via MOIT <MOITForm />
3 REFERENCE output_table_registry via MOUT <MOUTTable />
4 INSTRUCTION iu_unit (instruction_iu_unit_id) <MOTInstruction />

Two branches:

  • A. Fully automated. executor_class ∈ {dot, sql, ai_agent, external_api, notification, render}. No UI rendered for end user; task observable in governance UI only.
  • B. Human-in-the-loop. executor_class = human. Full 4-vùng UI rendered; submit → routed by config (direct vs queue).

Executor boundary (Điều 45 §11.5):

MOT publishes the task envelope. Executor pool (separate workers) leases jobs from job_queue, performs work, posts result back as task.completed event. MOT does not execute.

5.3 MOIT — Mother of Input Tables

Tables:

  • public.field_registry (NEW) — (field_id, code, label, data_type, validation_rules jsonb, status, owner_role, version, iu_unit_id FK).
  • public.input_form_registry (NEW) — (form_id, code, name, field_list jsonb (array of field_id), routing_channel ENUM(direct,queue), collection_destination text, staging_collection text NULL, task_def_id NULL FK, status, version).
  • public.input_staging_<form_code> (DYNAMIC per form) — temp landing for queue channel.
  • public.input_form_proposal (NEW) — Kaizen proposals for forms.

Validation rule schema (per field):

{
  "data_type": "integer|string|date|boolean|decimal|enum|json",
  "required": true,
  "min": null, "max": null,
  "regex": null,
  "enum": null,
  "cross_field": [{"if": {"field":"X","op":"=","val":"Y"}, "then": {"required":true}}]
}

Flow:

Nuxt <MOITForm formId> ──► Directus REST /items/input_form_registry?id=…
        │                              │
        │                              ▼
        │             DOT assembly (fn_moit_assemble_form): join field_registry, build schema
        │ ◄────────────────────────────┘
        │ {fields:[…], rules:[…], routing_channel, destination}
        ▼
User fills + submit
        │
        ▼
Directus POST /items/<destination or staging>   ── validated PG-side (CHECK + trigger + fn_moit_validate)
        │
        ├── direct ──► collection_destination
        └── queue ───► staging_collection ──► MOW approval workflow ──► collection_destination

5.4 MOUT — Mother of Output Tables

Tables:

  • public.output_table_registry (NEW) — (table_id, code, name, source_collection, fields jsonb, aggregation_fn text NULL, filter_rules jsonb, context_key text NULL, kind ENUM(inline,matrix), permission_filter_fn NULL, refresh_strategy ENUM(live,materialized,realtime_push), iu_unit_id FK NULL).
  • public.dot_function_registry (NEW or extend dot_operations) — named aggregation functions (fn_name, language, signature, returns, status, owner, performance_class).
  • Generated columns / materialized views — created via DOT migration when registered.

Render path:

Nuxt <MOUTTable tableId contextId> ──► Directus /items/output_table_registry?id=…
        │
        ▼
DOT assembly (fn_mout_resolve_query): builds SELECT using fields + aggregation_fn + filter_rules + context bindings
        │
        ▼
Directus query (PG executes) ──► JSON rows ──► Nuxt renders

For realtime kind, gateway subscribes to events (e.g. task.completed for "active tasks today") and pushes deltas via WS/SSE.

6. Event 5-layer master design

6.1 L1 Producers — register-before-emit

  • event_type_registry row required (code, schema_version, owner, status).
  • Sources allowed: PG trigger, DOT command, workflow/task lifecycle, proposal submission, human decision, AI agent, external API (approved adapter).

6.2 L2 Broker — substrate progression

Stage Substrate When
Now event_outbox + job_queue (PG-native) up to ~10k jobs/day
Later PG-native + listener pool (LISTEN/NOTIFY) medium throughput
If needed Wrap with NATS / Redis Streams / pg-boss / Graphile Worker profile justifies
Last resort Temporal / Kafka true long-running + multi-DC

Event channel separation:

  • Bus (pub/sub): event_outbox rows fan out to subscribers via event_subscription.
  • Job queue (durable): job_queue with lease, attempts, retry, DLQ.

6.3 L3 Consumers — executor registry

CREATE TABLE executor_class_registry (
  class_code text PRIMARY KEY,    -- dot | sql | ai_agent | human | external_api | notification | render
  description text,
  worker_endpoint_pattern text,
  concurrency_default int,
  retry_default int,
  status text,
  owner_role text
);

Workers MUST:

  • LEASE from job_queue with timeout = queue.lease.duration_sec.
  • Emit heartbeat (Điều 45 §15.5).
  • Idempotent processing using job_id + idempotency_key.
  • On failure → exponential backoff, then DLQ.

6.4 L4 Realtime Gateway

  • Single backend service (Node WS or Nuxt server route or separate Centrifugo) — TBD.
  • Subscribes to event_outbox (LISTEN/NOTIFY or polling outbox cursor).
  • Applies permission filter (role → topic allowlist).
  • Emits only summary deltas to UI (e.g., {problems_count: 7, by_class: {…}}), not raw events.
  • Drill-down request → REST to Directus → full detail.

6.5 L5 DLQ / Recovery / Governance

  • job_dead_letter (EXISTS) — store poison messages.
  • dlq_replay_request (NEW) — operator initiates replay; requires approval if DLQ row > N (config).
  • Governance UI panels:
    • "Workflows in trouble" — count by state, drill-down.
    • "Stuck tasks" — overdue / stale lease.
    • "DLQ" — counts + sample + replay action.
    • "Event lag" — outbox tail to read cursor.
    • "Heartbeat" — silent workers (Điều 45 §15.5 caller obligation).

7. Governance lifecycle

Universal pattern (apply to field / form / workflow / task / event_type / output_table / executor_class):

1. PROPOSE  → INSERT *_proposal table by submitter (any role)
2. REVIEW   → governance UI lists pending; reviewer/approver action
3. APPROVE  → Điều 32 quorum (or owner-only for low-risk)
4. REGISTER → write to registry, bump version
5. USE      → MOW/MOT/MOIT/MOUT pick up by config
6. DEPRECATE→ status = deprecated; usage error from next deploy
7. ARCHIVE  → after grace period

Birth gate (Điều 0-G) applies to every registry insert.

8. Data flow

8.1 Direct write (90% case)

User → <MOITForm> → Directus → input_form_registry resolve →
fn_moit_validate → collection_destination INSERT → PG trigger → event_outbox.field_changed

8.2 Queue write (10% case)

User → <MOITForm routing=queue> → staging_collection INSERT → trigger event `input.proposed` →
MOW spawns approval workflow → human reviewer task → on approve → fn_moit_apply_to_destination → event `input.applied`

8.3 Workflow run

Trigger (schedule|prev-task|manual) → fn_mow_create_run → workflows row + step graph →
job_queue rows for first ready steps → executors lease → run → task.completed →
fn_mow_advance → next steps … → fn_mow_complete

9. Event flow (example: nhập kho)

1. Task "Nhập kho" assigned (executor=human) → event task.assigned
2. Human submits form (MOIT direct) → event input.recorded + task.completed
3. fn_mow_advance: next step "Kiểm tra chất lượng" → event step.activated
4. QC executor (could be human or AI) → completes → event task.completed (with outcome={pass|fail})
5. Branch condition: outcome=pass → step "Cập nhật số liệu"; outcome=fail → sub-workflow "Trả hàng"
6. All terminal → workflow.run.completed

10. Human-in-the-loop flow

  • Task created with executor_class=human → INSERT job_queue with executor_class=human filter.
  • Gateway notifies the assignee role.
  • Assignee opens task UI (4 vùng) → submits.
  • Output validates → event task.completed → workflow advances.
  • If no submit within deadline → escalation policy → reassign or notify supervisor.

11. Fully automated flow

  • Task created with executor_class ∈ {dot, sql, ai_agent, external_api, notification, render}.
  • Worker pool for that class leases job → executes → posts result.
  • Idempotency key = task_run_id (default) prevents double execution.

12. Existing infrastructure reuse matrix

Existing artifact Decision Reason
event_outbox, event_pending, event_read, event_subscription, event_type_registry KEEP + use as-is Owned by Điều 45, fits L1/L2.
job_queue, job_dead_letter, queue_heartbeat KEEP + use as-is Owned by Điều 45, fits L3/L5.
cut_request, cut_request_transition KEEP + reference Cut pipeline already runs over this.
dot_iu_command_catalog, dot_iu_command_run, dot_iu_runtime_lease, dot_operations, dot_tools, dot_domains, dot_domain_rules KEEP + extend DOT substrate (Điều 35).
dot_config KEEP — single source of runtime flags All new toggles registered here.
fn_iu_post_cut_axis_materialize KEEP + AUTOWIRE Phase 0 gap — wire from fn_cut_complete or subscriber.
fn_iu_piece_split, fn_iu_piece_merge KEEP + close review_decision_id gap Phase 0.
iu_tree_path, iu_three_axis_envelope, iu_metadata_tag, iu_sql_link, iu_piece_collection/membership, iu_relation KEEP + reuse IU substrate.
iu_collection_template_* KEEP + reuse for MOT/MOW templates Already exists.
iu_route_*, iu_route_dead_letter, iu_route_worker_cursor KEEP + reuse route_master+route_worker on.
iu_qdrant_collection_registry, iu_vector_sync_point KEEP Vector boundary.
iu_notification_event, iu_notification_read KEEP + extend for governance UI Notification substrate.
workflows, workflow_steps, workflow_step_relations, workflow_categories, workflow_change_requests KEEP + EXTEND schema MOW will build on these.
tasks, task_checkpoints, task_comments KEEP + EXTEND schema MOT will build on these.
iu_outbound_route KEEP — review for §15.5 caller wiring Outbound delivery.
Directus integration layer KEEP API/admin layer per NT13.
Nuxt KEEP — render shell only Per Điều 28 + S178.
Qdrant boundary KEEP No-vector pollution rule.
iu_auto_instantiate_event_log KEEP Already linked to auto-instantiate gate.

Gaps → things to CREATE (not in DB yet):

  • workflow_registry, workflow_step_def, task_def.
  • field_registry, input_form_registry, output_table_registry, dot_function_registry.
  • executor_class_registry.
  • dlq_replay_request.
  • input_form_proposal (or generic proposal table).
  • review_decision table (if absent; survey in Phase 0).

13. Technology decision matrix

Option PG-first Config-driven VPS-light Scales Adds ops complexity Duplicates existing Verdict
Stay PG-native (event_outbox + job_queue) medium low immediate
Add LISTEN/NOTIFY + cursor poller medium-high low minor (use existing) immediate
pg-boss / Graphile Worker partial high medium overlaps job_queue later if profile demands
Benthos / Redpanda Connect CDC partial medium high medium later for CDC use cases
NATS / Redis Streams × partial medium high medium-high overlaps pub/sub later if cross-host needed
Hasura subscriptions partial medium high medium overlaps Directus reject (boundary conflict)
Temporal / Camunda × × × very high very high replaces MOW orchestration reject for now — revisit only when MOW state machine proven insufficient
Airflow × partial × high high overlaps MOW reject — different paradigm
WS/SSE gateway (Node or Nuxt server route) n/a high low-medium new immediate (need realtime)
OpenTelemetry trace_id model n/a high low new immediate (correlate workflow→task→event)
Schema registry approach ✓ via event_type_registry high low immediate — already in DB

Decision frame summary: stay PG-native for L1–L3; add gateway for L4; profile before adopting external broker for L2.

14. Scale model

Concern Strategy
Workflow count 10k+ workflow_registry partitioned by category; workflow_def static rows.
Workflow runs 100k+ workflows table partitioned by month or workflow_id hash.
Task runs 1M+ tasks partitioned by month; task_checkpoints rolled up after retention.
Event_outbox row growth tail-cursor + archive/truncate policy already required by Điều 45.
Long workflow (year) snapshot_jsonb per workflow_run + resume function; checkpoint events.
Nested workflow parent_run_id self-FK; correlation_id passed down; budget for depth.
Cross-DC not in scope yet; PG single-host until Điều 33 4-DB strategy demands.
Vector 1 IU = ≥1 point in iu_core_iu_chunks (no pollution); reindex via DOT command.

15. Governance UI master design

Panel Behaviour
Today's problems aggregate counts of: stuck tasks, overdue, failed steps, DLQ growth, silent workers, lag.
Workflow board list per state; click → drill-down to step graph.
Task board filter by assignee/role/state; only open + overdue by default.
DLQ rescue DLQ counts; replay action gated by approval; trace per row.
Event timeline per workflow_run; correlation_id; events grouped, summary first.
Proposal queue pending Kaizen for workflow/form/field; one-click approve/reject.
Health gate states (composer / job_substrate / heartbeat / dlq_replay / route_master), per Điều 45 §15.
Search by workflow_id, task_id, IU unit_id, correlation_id, trace_id.

Surface principle: problem-only by default; click reveals detail. AI/worker generated 1-line summaries when possible.

16. Layer diagram (text — for KB embedding)

                          ┌────────────────────────────────┐
                          │       Governance UI            │
                          │  Nuxt (render shell, no logic) │
                          └───────────────┬────────────────┘
                                         │REST/WS
                          ┌───────────────▼────────────────┐
                          │           Directus             │
                          │      API / admin / perms       │
                          └───────────────┬────────────────┘
                                         │
       ┌─────────────────────────────────┴──────────────────────────────────┐
       │                  REALTIME GATEWAY (WS/SSE)                         │
       │              filter by permission, emit summaries                  │
       └─────────────────────────────────┬──────────────────────────────────┘
                                         │ LISTEN/NOTIFY + outbox poll
       ┌─────────────────────────────────┴──────────────────────────────────┐
       │                       EVENT 5-LAYER (Điều 45)                      │
       │ L1 producers │ L2 broker (outbox+job_queue) │ L3 executors │ L5 DLQ │
       └────────────┬───────────────────┬─────────────────────┬─────────────┘
                    │                   │                     │
                    │                   │                     │
       ┌────────────▼─────┐  ┌──────────▼─────────┐  ┌────────▼──────────┐
       │   MOW (workflows)│  │  MOT (tasks)       │  │ MOIT (input forms)│
       └────────────┬─────┘  └──────────┬─────────┘  └────────┬──────────┘
                    │                   │                     │
                    │                   │                     │
                    │            ┌──────▼─────────┐           │
                    │            │ Executor pool  │           │
                    │            │ DOT/SQL/AI/HHL │           │
                    │            │ Ext/Notif/Rend │           │
                    │            └──────┬─────────┘           │
                    │                   │                     │
                    └──────────►◄───────┴──────►◄─────────────┘
                                         │
                          ┌──────────────▼─────────────┐
                          │  MOUT (output tables)      │
                          └──────────────┬─────────────┘
                                         │
                          ┌──────────────▼─────────────┐
                          │ IU foundation (knowledge)  │
                          │ axis A/B/C, compose,       │
                          │ split/merge, sql_link, tag │
                          └──────────────┬─────────────┘
                                         │
                          ┌──────────────▼─────────────┐
                          │ PG base + DOT substrate    │
                          └────────────────────────────┘

17. Design packs needed next

Pack Output Phase
POST_CUT_AUTOWIRE_AND_SPLIT_MERGE_REVIEW_DECISION wire fn_iu_post_cut_axis_materialize into fn_cut_complete; add review_decision table; close split/merge gap Phase 0
EVENT_FOUNDATION_UPGRADE event_type_registry hardening, schema registry contract, executor_class_registry, dlq_replay_request, trace_id model Phase 1
MOT_MINIMUM task_def schema, executor_class wiring, lease + heartbeat for first 2 executor classes (dot + human) Phase 2
MOW_CORE workflow_registry + workflow_step_def + state machine + advance loop + proposal mode wiring Phase 3
MOIT_MOUT_FACTORY field_registry, input_form_registry, output_table_registry, dot_function_registry, validation engine Phase 4
GOVERNANCE_UI_PROBLEM_SURFACE gateway, panels, summary aggregator Phase 5
SCALE_HARDENING partitioning, indexes, retention, observability, perf tests Phase 6

End master design.