Skip to content

The chain DAG

Every chain in MAESTRO CARE is a small DAG — boxes for steps, arrows for the data flow between them. The TUI draws that graph everywhere a chain appears: inline under a fresh generation, in the inspect pane, live during a run, and full-screen in the chain DAG modal (the View chain button under a fresh generation). This page is a tour of what the picture shows you and the keys that drive it.

Each box is tinted by what the step is, so you can read a chain’s shape at a glance without opening a single step:

ColourStep type
CyanAI / LLM step
MagentaTool call
BlueMCP tool
GreenCode / Python step

A numbered legend rides under the graph — one N — description row per step, with its leading number tinted the same colour as its box. Where a box can’t show every dependency as a drawn arrow (a “skip” edge across layers), the legend carries it along as a ◀ N annotation, so no dependency is ever hidden.

After a successful generation the chat surface mounts a View chain button next to the ✓ Chain generated line. Press it to open the chain DAG modal, which puts three views side by side:

  • the box-and-arrow graph of the whole chain at the top,
  • a clickable step list on the left — one button per node, and
  • a CARL detail pane on the right that prints the selected step exactly as it rides inside the serialised CARL chain (indented, syntax-coloured).

Click a step in the list — or click its box directly in the graph — and both the detail pane and the highlight update together. The picture and the list are two ways to drive the same selection.

The moment you pick a step, everything outside that step’s data-flow lineage fades to a muted grey, so the path that feeds and follows your selection reads as the foreground. Pick a different step and the dim follows it.

ButtonWhat it does
Save to libraryWrite the chain to Memory (locks once saved).
Evolve this chainSave if needed, then hand off to the Platform for evolution.
Edit stepSend the selected step to /revise for a targeted revision (see below).
CloseDismiss the modal (Escape does the same).

The graph is read-only, but you can reshape how it’s drawn — live, in place, preserving your current selection.

Flip the graph between top-down (tb) and left-to-right (lr). Wide, shallow chains read better left-to-right; tall, linear ones top-down. The default orientation is set by config (see below).

Boxes are drawn with Unicode box-drawing characters by default. ASCII mode swaps every glyph for a plain equivalent (+ - | v <), width-for-width, for terminals without good Unicode support or for clean copy-paste. It’s a config knob that applies to every DAG surface — the inline trail, the inspect pane, the run overlay, and this modal.

A dependency that jumps more than one layer (“skip” edge) clutters a top-down graph with long crossing arrows. Bus lanes route those skip edges down a tidy left-margin gutter instead, keeping the spine of the graph clean. It’s a config knob and applies to the top-down layout.

The modal has room a one-line trail doesn’t, so its boxes wrap full step labels across two lines rather than truncating them — you read the whole label without opening the step.

These defaults set the initial state; the l key still flips the layout live.

Env varValuesEffect
CARE_DEFAULTS__DAG_LAYOUTtb · lrInitial orientation of the modal’s graph (default tb).
CARE_DEFAULTS__DAG_ASCIItrue · falseDraw every DAG with plain ASCII glyphs (default false).
CARE_DEFAULTS__DAG_BUS_LANEStrue · falseRoute multi-layer skip edges down a margin lane (default false).
Terminal window
export CARE_DEFAULTS__DAG_LAYOUT=lr
export CARE_DEFAULTS__DAG_ASCII=true
export CARE_DEFAULTS__DAG_BUS_LANES=true

Overlays — when the graph carries run data

Section titled “Overlays — when the graph carries run data”

The same renderer re-tints the boxes when there’s run information to show. The overlay takes precedence over the plain step-type colours.

During execution each box is tinted by how far the chain has progressed, so the graph doubles as a live progress view:

ColourStatus
GreyPending / skipped
Bold yellowRunning
GreenDone
Bold redFailed

On the execution screen, press m to flip the live graph between the run-status tint and a latency heat-map: each box is shaded by its wall-clock time on a low→high scale — green → yellow → bold red — so the slowest steps jump out. A step with no recorded metric stays muted. The toggle is a no-op until the run finishes and timings are available.

When you revise a chain, the new version is drawn against the old one as a diff graph: added steps in green, changed in yellow, removed in red, and unchanged muted — so you see exactly what the revision touched. Renumbering a revise does isn’t mistaken for churn.

Press y to copy the chain to your clipboard as Mermaid flowchart source, ready to paste into Markdown, a PR, or these docs. The direction follows your current layout toggle: top-down exports as flowchart TD, left-to-right as flowchart LR.

You can walk the graph by its topology, not just its line order. The selection moves and keyboard focus follows it onto the matching step button:

KeyMoves to
kA dependency of the current step (up the graph)
jA dependent of the current step (down the graph)
pPrevious step by position
nNext step by position
lToggle layout (top-down ↕ / left-to-right ↔)
yCopy the chain as Mermaid
EscapeClose the modal

Select a step, then press Edit step. The modal closes and seeds a targeted /revise in the chat for that step’s number — so you can describe the change in plain language and regenerate just the part you want, instead of redoing the whole chain.