SSM-AI – Appendix C — Stamp & Ledger Schema (replay, roll-up, CLI)

Tiny, vendor-fair stamps and ledgers that replay bit-for-bit.

Purpose. Give teams a publishable way to stamp each decision and keep a ledger that replays exactly and rolls up by hour/day/week using the same invariants: phi((m,a)) = m, U += w*atanh(a), W += w, a_out := tanh(U / max(W, eps_w)). Decisions remain observation-only; classical numbers stay identical.

C1) One-line stamp (ASCII, copy-paste)
Append to each decision log line (fields are examples—extend as needed):

SSMCLOCK1|iso_utc|rasi_idx|theta_deg|sha256(file)|chain|svc=decode|req=abc123|step=beam|RSI=0.604367|g=0.81|RSI_env=0.489537|band=A0|gate_mode=mul|manifest=knobs_hash
# Chooser after gate: RSI_env := g_t * RSI  OR  RSI_env := tanh(g_t * atanh(RSI)) per manifest
# Continuity anchors: theta_deg, rasi_idx
# Repro lock: manifest=knobs_hash freezes clamps, weights, bands, gate, lens params

C2) Ledger CSV (minimal schemas)
Decision CSV (row = one decision/candidate/step) — required columns:

iso_utc, svc, req_id, item_id, RSI, w, g, RSI_env, band, U_dec, W_dec, manifest, stamp
# Optional: m, a, gate_mode, eps_a, eps_w, path_id

Path CSV (row = one path roll-up entry):

path_id, U_path, W_path, RSI_path, g_plan, RSI_env, band, pops, cause, stamp

C3) Replay & roll-up formulas (order/shard invariant)

# Decision replay (sanity)
RSI_replay := tanh( U_dec / max(W_dec, eps_w) )         # equals stored RSI

# Time/window roll-up (uniform or provided weights)
U_win := SUM U_dec
W_win := SUM W_dec
RSI_win := tanh( U_win / max(W_win, eps_w) )

# Shard merge (map-reduce identity)
RSI_global := tanh( (SUM_k U_k) / max(SUM_k W_k, eps_w) )  # equals single-pass

# Band after gate
RSI_env := g * RSI     # or: RSI_env := tanh( g * atanh(RSI) )
band := to_band(RSI_env)

# Never average a directly — always pool U/W, then invert once.

C4) Worked vectors (calculator-fast)

# V1 — Single decision replay (decode example)
Stored: RSI = tanh(0.7) ≈ 0.604367  →  U_dec = 0.7, W_dec = 1
Replay: tanh(0.7/1) = 0.604367 (matches)

# V2 — Window roll-up (3 decisions, uniform)
RSI = 0.910425, 0.691069, 0.291313
U_dec = 1.53, 0.85, 0.30  →  U_win = 2.68 ; W_win = 3
RSI_win = tanh(2.68/3) = tanh(0.893333) ≈ 0.713036 → A+

# V3 — Weighted roll-up (2 decisions, w = 2 and 1)
RSI = 0.604367 (U=0.7, w=2), 0.291313 (U=0.3, w=1)
U_win = 1.7 ; W_win = 3 ; RSI_win = tanh(1.7/3) ≈ 0.512907 → A0

# V4 — Shard merge equals single pass
Shard A: U=0.7, W=1 ; Shard B: U=0.3, W=1
Global: tanh((0.7+0.3)/(1+1)) = tanh(0.5) = 0.462117 (same as single pass)

C5) CLI sketch (5 commands, zero servers)

# 1) Validate rows (replay RSI)
rsi-ledger validate --in decisions.csv
# checks: tanh(U_dec / max(W_dec, eps_w)) == RSI (within tolerance)

# 2) Roll up by hour/day/week (uniform or provided weights)
rsi-ledger rollup --in decisions.csv --by hour --out rollup_hour.csv
# outputs U_win, W_win, RSI_win, band per bucket

# 3) Merge shards (map-reduce)
rsi-ledger merge --inputs shard_*.csv --out merged.csv
# sums U_dec/W_dec for identical keys (e.g., hour buckets)

# 4) Band histogram
rsi-ledger bands --in decisions.csv --by day

# 5) Diff two manifests (knobs drift guard)
rsi-ledger diff-manifest --a manifest_old.json --b manifest_new.json
# fails build if knobs_hash changed without approval
# Implementation note: all math uses U += w*atanh(x); out := tanh(U / max(W, eps_w))

C6) Privacy & scope (ledger)
• Aggregate-only logging; avoid raw PII features.
• Keep m separate for classical analytics; collapse parity: phi((m,a)) = m.
• If telemetry for gate is missing, set g := 1 and flag that row.

C7) Acceptance checklist (pass/fail)

# Replay: tanh(U_dec / max(W_dec, eps_w)) == RSI (dtype tolerance)
# Order/shard invariance: permutations and shard merges → same RSI_win
# Bounds: all RSI, RSI_env satisfy |x| < 1
# Band mapping (canonical):
#   RSI_env >= +0.90 → A++
#   +0.60 <= RSI_env < +0.90 → A+
#   -0.60 < RSI_env < +0.60 → A0
#   -0.90 < RSI_env <= -0.60 → A-
#   RSI_env <= -0.90 → A--
# Determinism: identical knobs_hash and inputs ⇒ identical outputs
# Stamps parse: every stamp line parses; values recompute within dtype eps

One-line takeaway. Stamp each decision and log (U_dec, W_dec, RSI, RSI_env, band); roll-ups are tanh( SUM U / max(SUM W, eps_w) ) — deterministic, order-proof, shard-proof, and vendor-fair, with phi((m,a)) = m always.


Navigation
Previous: SSM-AI – Appendix B — Symbolic Search Lens: Code, Examples & Policies (B6–B10)
Next: SSM-AI – Appendix D — Starter SDK & Golden Vectors


Directory of Pages
SSM-AI — Table of Contents