What does Bicameral AI Architecture conclude, in numbers, about “State-Sync Packets: Hash Chains, Version Vectors and Idempotency Keys”?

Answer: Chapter 5 builds state-sync packets with hash chains, version vectors and idempotency keys; when 10,000 instructions are delivered 849 extra times, the keys keep side effects at exactly 10,000.

Scope of the numbers: Its parameters are illustrative; all calculations are generated by its programs; "bicameral" is an engineering metaphor and no model is claimed to have awareness; the book is not personalised business or engineering advice. Marked boxes separate published evidence, runnable Python calculations (23 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 10000, 849

A. 10,000 instructions, 10,849 deliveries after duplicates and resends
B. no key : side effects 10,849, extra runs 849 (0.0849)
   with key: side effects 10,000, stored receipts replayed 849
C. worst instruction ran 4 times without a key
   key of seq 0 (first 16 hex): ecd81e8280206a5f
Show the full program
# Chapter 5. p53: replay safety with idempotency keys.
# The strategy layer sends N instructions over an unreliable channel:
# each delivery is duplicated with prob DUP and a lost ack triggers a
# resend with prob RESEND. Without a key the executor runs every
# copy; with a key (sha256 of the canonical intent id and sequence)
# it runs each instruction once and returns the stored receipt to
# every repeat. Fixed seed; illustrative rates; fake identifiers.
import hashlib
import random

N = 10000
DUP, RESEND = 0.03, 0.05


def key(intent, seq):
    return hashlib.sha256("{}#{}".format(intent, seq).encode(
        "ascii")).hexdigest()


def deliveries(rng):
    out = []
    for seq in range(N):
        copies = 1
        if rng.random() < DUP:
            copies += 1
        while rng.random() < RESEND:
            copies += 1
        out.extend([seq] * copies)
    rng.shuffle(out)
    return out


if __name__ == "__main__":
    rng = random.Random(41007)
    msgs = deliveries(rng)
    naive = {}
    for seq in msgs:
        naive[seq] = naive.get(seq, 0) + 1
    extra = 0
    for v in naive.values():
        extra += v - 1
    store = {}
    runs = replays = 0
    for seq in msgs:
        k = key("INT-B", seq)
        if k in store:
            replays += 1
        else:
            store[k] = "receipt-{}".format(seq)
            runs += 1
    print("A. {:,} instructions, {:,} deliveries after duplicates and "
          "resends".format(N, len(msgs)))
    print("B. no key : side effects {:,}, extra runs {:,} ({:.4f})"
          .format(len(msgs), extra, extra / N))
    print("   with key: side effects {:,}, stored receipts replayed {:,}"
          .format(runs, replays))
    worst = max(naive.values())
    print("C. worst instruction ran {} times without a key".format(worst))
    print("   key of seq 0 (first 16 hex): {}".format(key("INT-B", 0)[:16]))

Single source and citation

Fan, Y. (2026). Bicameral AI Architecture: Fusing Long-Context Holographic Strategy Models with Local Deterministic Execution Agents (Version 1.0.0), Chapter 5: State-Sync Packets: Hash Chains, Version Vectors and Idempotency Keys. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-410 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026410,
  author    = {Fan, Yafu},
  title     = {Bicameral AI Architecture: Fusing Long-Context Holographic Strategy Models with Local Deterministic Execution Agents},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book