digraph flow {
  rankdir="TB";
  newrank=true;
  compound=true;
  nodesep=0.35;
  ranksep=0.55;
  graph [fontname="Helvetica", fontsize=11, labelloc="t"];
  node  [fontname="Helvetica", fontsize=10];
  edge  [fontname="Helvetica", fontsize=9];
  label="restore — simplified trace (2026-07-09, core 5.117 / backend 5.30)
trace ecef5bdb · total 944.4 ms · key cost: fetch hot memories (restore) = 500.65 ms (53%)\nERROR — _predict_memories raises TypeError (task #16), stage marked red";
  subgraph "cluster_core" {
    label="Core process (yadgar-core)";
    style=filled;
    bgcolor="#eef4fb";
    color="#4a72a8";
    fontcolor="#26456b";
    fontname="Helvetica-Bold";
    "entry" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="restore() entry\nMCP dispatch → tool.restore\n@3ms\n2.68 ms"];
    "s0" [shape="box", style="rounded,filled", fillcolor="#fce3d6", label="fetch active checkpoint\n_OpsMixin.get_active_checkpoint\n@3ms\n22.59 ms"];
    "s1" [shape="box", style="rounded,filled", fillcolor="#fce3d6", label="fetch anchored memories\n_MemoryMixin.get_anchored_memories_scoped\n@25ms\n92.74 ms"];
    "s2" [shape="box", style="rounded,filled", fillcolor="#fce3d6", label="fetch recent memories (restore)\nCheckpointRestore._fetch_recent_memories_safe\n@118ms\n183.3 ms"];
    "s3" [shape="box", style="rounded,filled", fillcolor="#fce3d6", label="fetch hot memories (restore)\nCheckpointRestore._fetch_hot_memories\n@302ms\n500.65 ms"];
    "s4" [shape="box", style="rounded,filled,bold", fillcolor="#fbd9d9", color="#b03030", fontcolor="#7a1f1f", label="✖ ERROR  SR predictive recall\nCheckpointRestore._predict_memories\n@802ms\n134.1 ms"];
    "s5" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="check SR data sufficiency\nCognitiveMap.has_sufficient_data\n@802ms\n20.99 ms"];
    "s7" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="build SR transition matrix\nCognitiveMap.build_transition_matrix\n@894ms\n34.73 ms"];
    "done" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="result returned\n@944ms\n3.28 ms"];
  }
  subgraph "cluster_backend" {
    label="Backend (yadgar-backend)";
    style=filled;
    bgcolor="#fbf0ea";
    color="#b5744a";
    fontcolor="#7a4620";
    fontname="Helvetica-Bold";
    "s6" [shape="box", style="filled", fillcolor="#f5e1f5", label="embed & store (backend)\nembed_service.embed\n@826ms\n65.64 ms"];
  }
  "entry" -> "s0" [color="#333333", style="solid", label="1"];
  "s0" -> "s1" [color="#333333", style="solid", label="2"];
  "s1" -> "s2" [color="#333333", style="solid", label="3"];
  "s2" -> "s3" [color="#333333", style="solid", label="4"];
  "s3" -> "s4" [color="#333333", style="solid", label="5"];
  "s4" -> "s5" [color="#333333", style="solid", label="6"];
  "s5" -> "s6" [color="#333333", style="solid", label="7"];
  "s6" -> "s7" [color="#333333", style="solid", label="8"];
  "s7" -> "done" [color="#333333", style="solid", label="9"];
}
