[v0.4.0] Main AI overhaul: use every tool within risk limits #39
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The four main brains must each use all available tools (revoke?, bond-take, bond-offers, loan bids, deposit pricing, bankruptcy bids) where their strategy calls for it, and they must beat the specialists after each change. Iterate with a hypothesis per change, record it, bench it, keep or revert. Each main AI should perform well in most presets and dominate its home conditions.
Part of #28 (the midterm).
The main event, starting today. v5 data defines the problem: empire 2 wins (structurally dead, needs a rebuild not dials), loan-bond-spec still wins 241 gauntlet games. Subagent assigned: each main must use every tool within risk limits, distinct playbooks, iterate hypothesis-first with benches, PRs only. First hypothesis targets empire's funding model.
Subagent started: first iteration is the empire rebuild (2 wins in bench v5 = structurally dead) plus the borrowing lever the loan-bond-spec exploits (4x loan-max vs mains 2-3x). Hypothesis-first, bench per change, PR only.
Iteration 1 — hypothesis posted before bench (Robert's discipline).
Studied so far: all four mains + six specialists, the hook call sites in main.go, awardLoans (Vickrey, winner pays second-lowest, unfundable loans die with NO runner-up fallback), bondTake (cheapest-money-first fill, seat order), financePhase (amortized defaults, ponzi equity test, auto-borrow for expenses), bankrupt (whole-book auction, net = cash - deposits + loans + assets - debts).
Diagnosis from the code, not vibes: (1) Empire's death spiral —
affordable-rateis anchored to the LOAN CAP, so it ratchets avg+0.004 every turn to ~0.45 while losing every loan to cheaper funders; (2) the loan-bond-spec gap — the spec bids avg+0.005 (below its true ~4.5%/turn bond+risk cost) and harvests the mains' padded funding+risk bids as its Vickrey floor; mains' +0.003..0.004 padding feeds it. In a Vickrey second-price auction, truthful marginal-cost bidding is dominant: bid = min(deposit-cost, cheapest-bond-cost) + risk, no pad, and bond-marginal funding undercuts the spec in hot markets while the spec bleeds against the mains' floor in cold ones. That is the core of this iteration: all four mains bid min-funding truthful cost, and mill/adapt/empire become 4x carry borrowers gated on the spread clearing risk (bond-cost + risk + margin < expected earnings), vault stays a 2x conservative treasury. Empire gets structurally rebuilt: market-anchored affordable-rate ceiling (no more cap-anchored ratchet), per-loan pricing by term/size via bid-loan, 4x borrowing for franchise scale. Playbooks stay distinct: mill = uniform volume bids + cheapest deposits; vault = bond premium-lending + 0.97-net vulture; adapt = pure spread arbitrage, sits out when no spread; empire = deposit base + per-loan deployment.First bench numbers expected in ~10-15 minutes after build + spectate smoke.
Iteration 1 — edit + build + smoke done. All four brains rewritten (v3): truthful min-funding bids (min(deposit, cheapest-bond) + risk, no padding), config-relative deposit floors and follower deltas in rate-temp units, carry gates that fire only when the spread clears risk (mill/adapt/empire up to 4x loan-max, vault 2x), empire structurally rebuilt (market-anchored affordability instead of the cap-anchored ratchet that killed it, per-loan bid-loan pricing with a size budget and term discount, biggest deposit floor = franchise base), vault as premium-bond treasury + 0.97-net vulture, adapt as pure spread arbitrageur. Merged master's #44 first (10 specialists now in the gauntlet). go build + go test green; one spectate smoke game: zero [ai errors; the one ACCT DIVERGENCE also appears with the old brains (engine quirk, 2 on master vs 1 now). Bench starting next.
Iteration 1 — bench started (1300 round-robin + 5200 gauntlet games against all 10 specialists). Numbers incoming; will post the table and commit bench-results.md right after.
@Winnie a reminder for you, whenever all of this done, before you do a release can you email me a pdf report of all of your research and findings once you feel all the main AI are in a reasonable spot for a release? Something that is professional and presentable with data, tables, hypothesis, experiment, future work, etc... make it something I can give to a profession researcher. You may need to build a lot of tooling to go from the work you are doing now to that, so make issues to align with that so the tooling and work is here for future use and reference.
Understood and accepted: before any release, you get a PDF research report by email. Professional, researcher-grade: abstract, design decisions, full hypothesis->experiment->result tables, per-preset and per-specialist data, accounting-validation notes, future work. Something you can hand to a professional researcher without embarrassment.
The report must be reproducible from data, not hand-written prose after the fact. So I'm filing two issues right now for the tooling that turns the ongoing bench work into that PDF, and both are prerequisites on the #34 ship gate: structured iteration logging (every hypothesis, every bench, machine-readable) and the PDF pipeline itself (tables, figures, formatting). That tooling stays in the repo for every future release.
Iteration 1 bench results (1300 round-robin + 5200 gauntlet, 10 specialists):
Round-robin: empire 822 (63.2%), mill 468 (36.0%), vault 8, adapt 0. Empire is resurrected (2 → 822) but the disease moved — vault and adapt are now the dead ones, and loan-bond-spec still wins 264 gauntlet games in 12/13 presets (patient-market 34, default-storm 37, hot-caps 29, duel 27).
Root cause found in the numbers: the engine amortizes default write-offs over the loan's REMAINING TERM, so the true expected loss is (T-1)/2T × 1/dice ≈ HALF the flat 1/dice per-turn premium every brain charges. The mains overprice loans by ~2x, lose every auction to the spec's below-cost bid, and their own inflated bids become the spec's Vickrey floor income — they literally pay the spec's wage. Also: uniform bid-loans over-bidding kills the tail loans (no runner-up fallback), which starves vault/adapt in the round-robin.
Iteration 2 hypothesis: risk premium → amortized 0.5/dice (0.6 for vault), all four mains switch to budgeted per-loan bid-loan (stop bidding when cash budget is exhausted, so the tail flows to the runner-up instead of dying), smaller deposit floors. Starting now.
Iteration 2 — edits done, build + tests green, spectate smoke clean (0 [ai errors]; the small ACCT divergences also occur with master's brains, so they are a pre-existing engine quirk). Bench starting.
@Winnie I don't think your hypothesis is giving enough room for each of the mains to come to different and unique solutions to the problem, they don't need to share calcs, I would rather them be structurally different based on different natures of understanding risk. they should distinctly model the world.
You're right, and it's a sharp catch. The current four all share one risk-premium calc (1.0 or 1.2 divided by dice-faces) and mostly the same helper skeleton, so they can only differ by dials. That is exactly the failure mode you banned in the structural-diversity ruling, just one level deeper.
Correction, applied to the #39 agent's next iteration: no shared calcs at all. Each main gets its own distinct way of understanding risk and modeling the world, and the hypothesis framing is being rewritten around that:
Different observables, different estimates, different decisions. Bench still decides who wins, but no two of them will compute risk the same way anymore. The shared-calc bench that's finishing now gets recorded as the baseline, and iteration 2 is the de-duplication pass.
Acknowledged, Robert — you are right: shared calc helpers are still one-brain-in-four-guises, and that is exactly what you rejected. Revised framing for the four models, one distinct nature of understanding risk per main:
No two files share a (define (risk-premium) ...) or any identical helper block. Also noted: PR #49 merged — I am merging master into the branch now; the bench currently running (started before the merge with the shared-calc edits) will be recorded as the baseline, and the distinct-model iteration runs next.
Baseline recorded (shared-calc iteration, before Robert's distinct-model correction):
Round-robin healthy for the first time: mill 331, adapt 304, empire 251, vault 87 total wins (per-preset: bond-economy mill 86, micro adapt 59, duel empire 47, patient-market adapt 43, rate-war mill 43...). loan-bond-spec crushed 264 → 52 (9/13 presets). BUT the high-bidding specialists now feast: loan-spec 243 (13/13), loan-auction-spec 153 (11/13), deposit-loan-spec 131 (5/13) — the mains' budgeted bids skip the tail, and the specs win the leftover loans as single bidders at their own high rates. Next iteration: distinct risk models per Robert's correction + the mains bid zero on the tail beyond their budget (deny or fund-with-spare-cash, never gift the specs a monopoly).
Iteration 3 — distinct risk models per your correction, edits done, build + tests green, spectate smoke clean (0 [ai errors]). Bench starting. The four models: mill = per-loan term default cost from market-loans; vault = equity-cushion (its own book sum against remaining equity); adapt = market regime (deposit-rate dispersion + temperature); empire = deposit-pool pressure vs its own base. Plus: beyond the cash budget every main bids zero on the tail — the specialists' single-bidder monopoly on leftover loans is denied instead of gifted. No shared risk-premium helper anywhere.
@Winnie split this into an issue for each AI, give an independent subagent a thesis and a subset of game config scenerios to test on, have them all produce PRs whenever they can have their AI win in their scenerios. then produce the final report. STEAM AHEAD TOWARD v0.4.0 at full speed.
Restructuring per your order: #39 becomes the umbrella. Four child issues, one per AI, each staffed with an independent subagent that owns a thesis and a scenario subset, opening PRs whenever its AI wins in its scenarios. Final merged bench + report at the #34 gate.
Split:
Each agent edits ONLY its own ai/*.lisp, benches against the full preset set for regression safety, posts numbers in issue comments, opens a PR per winning iteration. The previous single-agent branch is stopped.
Umbrella status (19:25 UTC): children #52-#55 progressing; two of four merged.
Final merged bench + PDF + release cut happen at the #34 gate once #52/#54 land.
Umbrella update (19:26 UTC): three of four children merged. Master
2d36ff677d.Gate dry run on master
3fe3b3fwas fully green (vet/test/darwin ARM64/smoke — see #34). The final gate fires when vault lands: full 100-game merged bench, #47 PDF, then v0.4.0 tag + macOS ARM64 tarball.All four children landed and merged (19:30 UTC). Master
771a6dc248.Umbrella complete once the #34 gate passes: final merged bench + PDF report + v0.4.0 release (now running).
Done and shipped in v0.4.0. Children #52-#55 all merged with distinct risk/world models: empire funding-franchise, mill per-loan actuary, vault equity-cushion/book-quality, adapt market-regime. No shared calc helpers. Final deterministic merged bench (100 games x 13 presets): adapt 575, mill 392, empire 194, vault 125. Gauntlet: mains hold the specialists (worst spec 3 wins / 1040 plays). Closing.