Live execution diagrams (PFactory plan DAG → AIFactory build → TFactory verify)

Shipped v1 (2026-06-14) — all three stages live

The animated DAG is in the CFactory task-detail modal, rendering whichever stage is furthest along (test → code → plan), via the shared graph contract on GET /api/workitems/{key}/process. Hand-rolled SVG edges + framer-motion node cards, gruvbox palette — no graph lib (matches the cockpit’s no-dependency ethos).

Shipped since v1:

Deferred (no rework cost — purely additive):

Refinement v2 (agreed scope — 2026-06-14)

Sharpened requirements from the operator. This section supersedes the placement + rendering choices below where they differ.

Where it lives: NOT on the CFactory page/cards. Only when you click a plan / coding / testing task do you open its diagram. Two modes in that view:

The animations are the point (must feel alive):

Time per node (new, required): every node shows time spentmm:ss, live-ticking while active (now − started_at), frozen on done (completed_at − started_at), with a total for the stage. This is the “how much time did each subtask use” view.

Renderer DECIDED (2026-06-14): hand-rolled SVG + framer-motion. The operator’s constraint is “keep the existing branding/design language.” The cockpit is already hand-rolled SVG with NO chart/diagram library (e.g. LiveTaskStamp’s sparkline), and framer-motion is already a dependency. So a bespoke SVG diagram component is the choice that genuinely matches the brand — full control of the robot stamp, flowing edges, pulses, and live timers, no heavy new dep, gruvbox/mono native. Layout is trivial because the DAG is already wave-structured (the contract’s phases): each wave = a column (x), subtasks in a wave = stacked rows (y), edges = lines from depends_on. No graph-layout engine needed. Mermaid is NOT used (it can’t animate); a static “summary” is just the same SVG frozen at the final state. Scope DECIDED: all three stages (plan / code / test).

(Superseded earlier note — Mermaid is excellent for a static picture but its output is a frozen SVG — robot pops, flowing edges, per-node live timers, and pulses are awkward to bolt on. For the live, animated vision I recommend React Flow (@xyflow/react) as the live renderer: it is purpose-built for animated node/edge DAGs in React — custom node components (box = status colour + robot + live timer), built-in animated edges (the flowing dash), and auto-layout (dagre/ELK, left→right by wave). We keep Mermaid for the “summary when done” as a lightweight static snapshot / exportable image. So: React Flow = live; Mermaid = done-summary/export. (Alternative: hand-rolled SVG + framer-motion — full control, more work. React Flow gets us 90% with far less.)

Data we need to surface (the only backend work — data already exists on disk):

Placement detail: the diagram is the centerpiece of TaskDetail.tsx (the click-through modal), one per stage (plan / code / test) — the existing /process 4s poll already drives it. Drop the active-card minimap (operator explicitly does not want it on the page).


The idea in one line

The plan is already a dependency graph. Render it once as a Mermaid diagram, then light its nodes up in real time as the unit of work flows plan → code → test — so the cockpit shows, at a glance, where we are, what’s done, what’s blocked, and exactly where something failed. One map, three live overlays, one correlation key.

This is not decoration. The value is legibility under automation: when an autonomous pipeline runs unattended, a colored node tells you in one second what a log scroll tells you in five minutes.

Why this is cheap to build (the favorable findings)

Need Already exists
Plan as a DAG (nodes/edges/checks) EpicPlan.children — each ChildIssue has key, kind, depends_on (edges), acceptance_criteria (checks), complexity (PFactory/apps/backend/plan/decompose/models.py)
Waves / parallelism the contract’s phases (topological layers) — contract_builder.build_phases()
A Mermaid builder PFactory/apps/backend/agents/diagrams/mermaid.py (MermaidGraph) — reuse it
A clean attach hook assemble_contract() (plan/emit/contract_emit.py) — additionalProperties:true, add contract["diagram"]
Live per-subtask status in CFactory /api/workitems/{key}/processProcessDetail.subtasks[] (title+status pending/active/done/failed) already polled every 4s in TaskDetail.tsx
Cockpit theme + cadence gruvbox CSS vars (--plan/--code/--test/--green/--red), 4s poll, framer-motion

What’s genuinely missing is small: (1) generate + carry the diagram source to CFactory; (2) expose TFactory’s lane status; (3) a render component + mermaid dep in the frontend.

Architecture — three layers, one visual language

PFactory (structure)         AIFactory (build status)        TFactory (verify status)
  EpicPlan DAG                  subtask status                  lane/step status
  → mermaid source             (already in /process)            (new: lane_progress out)
        │                              │                              │
        └──────────────► contract.diagram ─────────────► CFactory ◄──┘
                                                   render once + recolor nodes live
                                              TaskDetail (full) + task card (minimap)

The key design move: the Mermaid source is structural and stable (the DAG doesn’t change mid-run); the live status is a separate {node_id → state} map that updates every 4s. CFactory renders the SVG once, then only swaps CSS classes on node elements (by id) — no re-layout, smooth, ~free. Node ids == contract subtask ids so the status map aligns.

Layer 1 — Generation (PFactory)

Layer 2 — Status (AIFactory / TFactory)

Layer 3 — Render (CFactory)

UI / UX (the frontend-design lens — informative first)

Value-add (purpose, explicitly)

  1. Situational awareness in 1s — where the pipeline is, without logs.
  2. Failure localization — the exact step + reason, not a global “failed”.
  3. Concurrency + bottlenecks — parallel waves and blocked nodes are visible.
  4. The governed loop made legible — plan→build→verify→handback as one map; the acceptance-criteria badges show what is being checked at each node.
  5. Through-line for the unit of work — the same structure carries the RFC-0001 correlation key visually across all three factories.

Phasing (incremental, each shippable)

Risks / decisions

Files (where the work lands)