Bounded steps, safe branching, instant rollback — never touch m.
Per-step score (recap).
• Compute RSI_s from lens items.
• Gate: RSI_used := g_s * RSI_s (or tanh(g_s * atanh(RSI_s))).
• Convert to rapidity: u_s := atanh(clamp(RSI_used)).
• Keep deltas for exact undo: ΔU := w_s*u_s, ΔW := w_s.
# Step scoring (lane-only)
RSI_used := (g_s * RSI_s) # or: tanh(g_s * atanh(RSI_s))
a_step := clamp(RSI_used, -1+eps_a, +1-eps_a)
u_step := atanh(a_step)
ΔU := w_s * u_step
ΔW := w_s
Path score (running fuse).
Accumulate (U_path, W_path) and read once:
U_path += ΔU
W_path += ΔW
RSI_path := tanh( U_path / max(W_path, eps_w) )
Branch policy (A+/A0/A-).
Retry only when high-confidence; keep it bounded and auditable.
def should_retry(RSI_env, band_fn=to_band):
return band_fn(RSI_env) in {"A++", "A+"}
Minimal middleware (drop-in).
def try_step(path, step_RSI_env, beta=0.0, b_s=0.0, w=1.0, eps_a=1e-6, eps_w=1e-12):
# Optional tiny prior in u-space
a = max(-1+eps_a, min(1-eps_a, step_RSI_env))
u = atanh(a) + beta*b_s
path.U += w*u
path.W += w
path.stack.append((w*u, w)) # exact rollback token
return tanh(path.U / max(path.W, eps_w)) # RSI_path
def rollback(path, until_band="A0", eps_w=1e-12):
thr = {"A++":0.90, "A+":0.60, "A0":-0.60, "A-":-0.90, "A--":-1.00}[until_band]
def rsi(): return 0.0 if path.W <= 0 else tanh(path.U / max(path.W, eps_w))
pops = 0
while path.stack and rsi() < thr:
dU, dW = path.stack.pop()
path.U -= dU
path.W -= dW
pops += 1
return pops
Stamp fields (per step).step_id, m, RSI_s, g_s, RSI_env, u_step, w_step, ΔU, ΔW, RSI_path, band, stamp
Invariant. phi((m,a)) = m throughout — middleware never mutates classical magnitudes.
Design notes.
- Clamps first. Always clamp before
atanh. - Tiny priors.
beta*b_sapplies in u-space only; keeps math stable. - Exact undo. Storing
(ΔU, ΔW)enables precise rollbacks and audit trails. - Shard-proof. If the agent fans out, merge shards by summing
UandW, then read once.
One-line takeaway. Treat each tool step as a bounded lane update in rapidity space, carry (U,W), branch by bands, and rollback by popping (ΔU,ΔW) — decisions stay auditable and m stays pristine via phi((m,a)) = m.
Navigation
Previous: SSM-AI – Integration Quickstarts: RAG Pipeline Hook (8.2)
Next: SSM-AI – Integration Quickstarts: CI/Golden Tests (8.4)
Directory of Pages
SSM-AI — Table of Contents