{
  "schema_version": 1,
  "diagram_type": "dataflow",
  "meta": {
    "title": "Context Pipeline Dataflow",
    "output": "03-context-pipeline.html",
    "quality_profile": "showcase",
    "viewBox": [1280, 820]
  },
  "stages": [
    { "label": "Source" },
    { "label": "NPU slicer :npu-slicer" },
    { "label": "Prompt assembly" },
    { "label": "27B seat" },
    { "label": "Splice + verify" }
  ],
  "nodes": [
    { "id": "page_file", "type": "frontend", "label": "index.html", "sublabel": "working copy (g8_baseline)", "stage": 0, "row": 0 },
    { "id": "publish", "type": "backend", "label": "Deterministic publish", "sublabel": "/tmp/pilot-jepa-working/<slug>-<sha12>", "stage": 0, "row": 1, "tag": "(path, content) key" },
    { "id": "index_file", "type": "backend", "label": "POST /index_file", "sublabel": "AST symbols + MiniLM on NPU", "stage": 1, "row": 0 },
    { "id": "pack_context", "type": "backend", "label": "POST /pack_context", "sublabel": "token_budget 240", "stage": 1, "row": 1, "tag": "jepa_mode=live_18097" },
    { "id": "arena", "type": "database", "label": "/dev/shm/mechsuit-ast-arena", "sublabel": "512 MiB quota, LIVE", "stage": 1, "row": 2, "tag": "hit 26% this boot" },
    { "id": "assembly", "type": "backend", "label": "Prompt assembly", "sublabel": "seed projection + slice + SHARED_CONTEXT_END", "stage": 2, "row": 0, "tag": "PILOT_PREFIX_ORDER=1" },
    { "id": "preflight", "type": "security", "label": "Preflight", "sublabel": "<=1,950 tokens else SETUP", "stage": 2, "row": 1, "tag": "max_tokens 1280/1536" },
    { "id": "seat", "type": "backend", "label": "HEARTH door + vLLM 27B seat", "sublabel": "thinking off, deadline 300 s", "stage": 3, "row": 0, "tag": "radix 64-tok, GDN block 832" },
    { "id": "piece", "type": "frontend", "label": "Piece", "sublabel": "<section data-module>, 12-28 lines, <800 tok", "stage": 3, "row": 1, "tag": "MEASURED median 563 out" },
    { "id": "splice", "type": "backend", "label": "Splice apply_ui_json_patch", "sublabel": "insert before </main>, anchor guard", "stage": 4, "row": 0 },
    { "id": "verifier", "type": "security", "label": "Frozen verifier + gates", "sublabel": "dup id / JS syntax / no regression", "stage": 4, "row": 1 },
    { "id": "ratchet", "type": "database", "label": "Ratchet baseline", "sublabel": "keep on progress, else restore", "stage": 4, "row": 2 }
  ],
  "flows": [
    { "from": "page_file", "to": "publish", "label": "sha256 identity", "variant": "emphasis" },
    { "from": "publish", "to": "index_file", "label": "file_path, label", "variant": "emphasis" },
    { "from": "index_file", "to": "arena", "label": "embeddings (FP16)", "variant": "default" },
    { "from": "arena", "to": "pack_context", "label": "symbol index", "variant": "default" },
    { "from": "index_file", "to": "pack_context", "label": "shared 6 s deadline", "variant": "dashed" },
    { "from": "pack_context", "to": "assembly", "label": "numbered slice, verified line-by-line", "variant": "emphasis" },
    { "from": "assembly", "to": "preflight", "label": "estimate 3.3 chars/tok", "variant": "emphasis" },
    { "from": "preflight", "to": "seat", "label": "submit_execution", "variant": "emphasis" },
    { "from": "seat", "to": "piece", "label": "raw HTML piece", "variant": "emphasis" },
    { "from": "piece", "to": "splice", "label": "text_replacements", "variant": "emphasis" },
    { "from": "splice", "to": "verifier", "label": "candidate page", "variant": "emphasis" },
    { "from": "verifier", "to": "ratchet", "label": "pass: new baseline", "variant": "emphasis" },
    { "from": "ratchet", "to": "page_file", "label": "next module turn", "variant": "dashed", "route": "bottom-channel" }
  ],
  "cards": [
    { "dot": "cyan", "title": "Budgets (MEASURED, 227 r36b module attempts)", "items": ["tokens_in median 1,072, max 1,811", "tokens_out median 563, max 1,061", "wall median 16.7 s, max 27.5 s"] },
    { "dot": "rose", "title": "Loud failures", "items": ["jepa_mode must be live_18097, else SETUP", "packer unavailable is SETUP, not a fallback", "truncation (tokens_out >= 0.98 x cap) is SETUP"] },
    { "dot": "amber", "title": "Caches touched", "items": ["L1 OpenVINO blobs: /dev/shm/mechsuit-ov-cache", "L2 arena: /dev/shm/mechsuit-ast-arena", "L3 symbol-body LRU, 16,384 entries", "L4 vLLM radix (B70 hits 2.96% / 4.88% on 10-28)"] }
  ]
}
