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="memory_stats — simplified trace (2026-07-09, core 5.117 / backend 5.30)
trace 6f209e49 · total 722.4 ms · key cost: SurrealDB query ×6 = 284.67 ms (39%)";
  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="memory_stats() entry\nMCP dispatch → tool.memory_stats\n@3ms\n2.92 ms"];
    "s0" [shape="box", style="rounded,filled", fillcolor="#fce3d6", label="SurrealDB query ×6\n_ClientMixin._q\n@3ms\n284.67 ms"];
    "s1" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="engram slot statistics\nEngramAllocator.get_slot_statistics\n@288ms\n94.29 ms"];
    "s2" [shape="box", style="rounded,filled", fillcolor="#fce3d6", label="fetch causal DAG\n_CausalMixin.get_all_causal_edges\n@512ms\n21.43 ms"];
    "s3" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="check SR data sufficiency\nCognitiveMap.has_sufficient_data\n@534ms\n18.2 ms"];
    "s5" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="per-table row/byte stats\nadmin_other._ms_per_table_stats\n@558ms\n162.4 ms"];
    "done" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="result returned\n@722ms\n1.45 ms"];
  }
  subgraph "cluster_backend" {
    label="Backend (yadgar-backend)";
    style=filled;
    bgcolor="#fbf0ea";
    color="#b5744a";
    fontcolor="#7a4620";
    fontname="Helvetica-Bold";
    "s4" [shape="box", style="rounded,filled", fillcolor="#dbe9fb", label="backend DB-size query\nGET /admin/dbsize\n@557ms\n1.07 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" -> "done" [color="#333333", style="solid", label="7"];
}
