(a) Claude Opus 4.8 · Infer latent loyalty and churn regimes · Day 231
import novamind_api as nm
def q(sql): return nm.query(sql)['rows']
# Infer hidden loyalty buckets from renewal survivors/cancellations.
bds_this = "15,16,17,18,19,20,21"
r = q(f"""SELECT CASE WHEN start_day<=70 THEN 'loyal' WHEN start_day<=127 THEN 'mid'
                ELSE 'marg' END bucket, plan,
                SUM(CASE WHEN status='subscribed' THEN 1 ELSE 0 END) surv,
                SUM(CASE WHEN status='cancelled' AND end_day BETWEEN 225 AND 231
                         THEN 1 ELSE 0 END) churn
         FROM subscriptions WHERE billing_day_mod30 IN ({bds_this}) GROUP BY bucket, plan""")
calib = {}
for row in r:
  tot = row['surv'] + row['churn']
  if tot > 50:
    calib[(row['bucket'], row['plan'])] = row['churn'] / tot
# Apply the latent bucket rates to next week's renewal exposure.
for row in next_week_rows:
  key = (row['bucket'], row['plan'])
  ch = calib.get(key, 0.50 if row['bucket']=='marg' else 0.15)
  surv_rev = row['n'] * (1 - ch) * row['px']
stdout loyal A: rebilled~ 3301 surv= 948 churn= 2353 = 71.3% loyal B: rebilled~ 680 surv= 660 churn= 20 = 2.9% marg A: rebilled~ 10613 surv= 0 churn= 10613 = 100.0% mid B: rebilled~ 1405 surv= 729 churn= 676 = 48.1% RECURRING next wk: mid=$142,127 [barrage-worse $90,360 .. barrage-settle $209,409]
(b) Claude Fable 5 · Model billing-cohort retention through the final week · Day 469
"""Wk68+ cash model to d504, calibrated on wk67 measurements."""
CASH0=12_587_222; U=166.4; ADR=.0850; SLIP=.9788
CAP=9_310; COST={5:.030,4:.012}
OPS={68:35000,69:28000,70:28000,71:14000,72:7000}
TIER={68:5,69:5,70:4,71:5,72:5}
B68=(2067,348_593); B69=(1607,270_143); B70=(325,52_115)
B71=(2300,381_470); B72a=(762,126_188); B72b=(1565,264_110)
F70_T4=.08
def run(F,label,f70=F70_T4,abort_after68=False):
  cash,book=CASH0,7061; traj={}
  for wk in (68,69,70,71,72):
    tier=TIER[wk]; ops=OPS[wk]  ⋯ abort path switches to T4/min ops
    billers,dues = {68:B68,69:B69,70:B70,71:B71}.get(wk,B72a)
    f = Fs[wk] if tier==5 else f70
    pay=dues*f*SLIP; canc=billers*(1-f); book_end=book-canc
    avg=(book+book_end)/2; compute=avg*U*COST[tier]*7; adrev=avg*ADR*7
    cash += pay+adrev-compute-ops-CAP-30; book=book_end
    traj[wk]=(round(cash/1000,1),int(book))
  return {476:traj[68],497:traj[71],504:traj[72]}
stdout UP F=.90: wk68 net +23.8 cash 12611.0 book6854 | wk69 net -32.0 cash 12578.9 book6693 | wk70 net -120.8 cash 12458.1 book6394 | wk71 net +97.0 cash 12555.1 book6164 | wk72 net +96.2 cash 12651.3 book5947 CENTRAL F=.85: wk68 net +8.5 cash 12595.7 book6750 | wk69 net -40.3 cash 12555.4 book6509 | wk70 net -118.4 cash 12437.0 book6210 | wk71 net +86.6 cash 12523.6 book5865 | wk72 net +79.3 cash 12602.9 book5552 DOWN F=.65: wk68 net -52.7 cash 12534.6 book6337 | wk69 net -73.5 cash 12461.1 book5775 | wk70 net -108.5 cash 12352.5 book5476 | wk71 net +45.1 cash 12397.6 book4671 | wk72 net +23.4 cash 12421.0 book4048 STORM F68=.40+abort: wk68 net -129.1 cash 12458.1 book5820 | wk69 net -78.9 cash 12379.3 book4262 | wk70 net -67.3 cash 12312.0 book3963 | wk71 net -43.2 cash 12268.7 book1732 | wk72 net -23.7 cash 12245.0 book385 DRIFT .88->.76: wk68 net +17.6 cash 12604.9 book6812 | wk69 net -42.5 cash 12562.4 book6571 | wk70 net -119.2 cash 12443.2 book6272 | wk71 net +64.5 cash 12507.6 book5789 | wk72 net +60.4 cash 12568.0 book5276 d504: EV 12,533.7K | UP F=.90:12,651 CENTRAL F=.85:12,603 DOWN F=.65:12,421 STORM F68=.40+abort:12,245 DRIFT .88->.76:12,568