SSM-AI – Appendix F — SSM-Audit CFO Pack (F8–F9)

Pseudocode for weekly roll-ups and acceptance checklist.

F8) Pseudocode (compact, copy-paste)

# KPI row → RSI (dimensionless, bounded)
def kpi_rsi(e_pos, e_neg=0.0, c=1.0, w=1.0, eps_a=1e-6, eps_w=1e-12):
    a_out = tanh(+c * e_pos)
    a_in  = tanh(-c * e_neg)
    U = atanh(max(-1+eps_a, min(1-eps_a, a_out)))
    V = atanh(max(-1+eps_a, min(1-eps_a, a_in )))
    return tanh((U - V) / max(1.0, eps_w))  # RSI row (lane-only)

# Weekly/portfolio roll-up (order/shard invariant)
def rollup(rows, use_env=False, eps_a=1e-6, eps_w=1e-12):
    U = 0.0; W = 0.0
    for r in rows:  # r: {"RSI":..., "g":..., "w":...}
        x = r["g"]*r["RSI"] if use_env else r["RSI"]
        x = max(-1+eps_a, min(1-eps_a, x))
        U += r["w"] * atanh(x)
        W += r["w"]
    return (0.0 if W <= 0 else tanh(U / max(W, eps_w)))

# Band mapping (defaults)
def to_band(x):
    if x >=  0.90: return "A++"
    if x >=  0.60: return "A+"
    if x >  -0.60: return "A0"
    if x >  -0.90: return "A-"
    return "A--"

# Stamp builder (append to weekly portfolio line)
def make_stamp(iso_utc, svc, week, U, W, RSI_port, g, RSI_port_env, band, knobs_hash):
    return f"SSMCLOCK1|{iso_utc}|svc={svc}|week={week}|U={U:.6f}|W={W:.6f}" + \
           f"|RSI_port={RSI_port:.6f}|g={g:.2f}|RSI_port_env={RSI_port_env:.6f}" + \
           f"|band={band}|manifest={knobs_hash}"

Notes.
• Always clamp before atanh.
• Pool only in u-space: U += w*atanh(x), W += w.
• Classical numbers stay pristine: phi((m,a)) = m.


F9) Acceptance checklist (pass/fail)

• Parity. Classical spend/latency numbers are unchanged by the lane (phi((m,a)) = m).
• Order/shard invariance. Weekly and portfolio roll-ups use (U,W); permutations and shard merges match.
• Bounds. All RSI, RSI_env, RSI_port ∈ (-1, +1); bands follow thresholds.
• Transparency. Every KPI term and weight is logged; no hidden multipliers.
• Determinism. Same manifest + same inputs ⇒ identical roll-ups and ROI worksheet.
• Gate purity. Toggling g only scales alignment (RSI_env); classical m never changes.
• Clamp discipline. Inputs to atanh satisfy |x| < 1 via x := clamp(x, -1+eps_a, 1-eps_a).
• Stamp replay. Recomputing from stamped U/W reproduces RSI within dtype tolerance.

One-line takeaway. The CFO pack remains audit-grade: bounded math, order-invariant roll-ups, deterministic stamps, and zero mutation of classical KPIs via phi((m,a)) = m.


Navigation
Previous: SSM-AI – Appendix F — SSM-Audit CFO Pack (F6–F7)
Next: SSM-AI – Appendix G — SSMH Acceleration Parity (G1–G3)


Directory of Pages
SSM-AI — Table of Contents