Spaces:
Paused
Paused
Commit History
-
Fix the AI Editor tab: a blank screen from an undefined STRATEGIES
Claude +1: Claude Opus 5Unverified signatureClicking 🧬 AI Editor threw `ReferenceError: STRATEGIES is not defined` and rendered nothing. The "Start from:" seed row read engine/aiStrategy.js's raw STRATEGIES table, which competition.js deliberately never imports — strategyLabel already says so in a comment 2300 lines above, and reuses setup.js's STRATEGY_OPTIONS instead. The seed row is now read off the same table: same four keys under `mult`, same labels, so what a player sees is unchanged. Why nothing caught it. `checkJs` is off in jsconfig.json (files opt in with a `// @ts-check` pragma) and competition.js has no pragma, so the type-check never looked; running tsc with --checkJs over the whole repo reports exactly these two lines and nothing else. The unit suite never builds this DOM, and the browser smoke test only walked a skirmish. So the smoke test now clicks every Competition tab. Each is asserted against the error log rather than a child count, which is the part worth stating: a half-rendered screen still has children…20d4e50 -
Fix the smoke job: npx --package does not do what I assumed
Claude +1: Claude Opus 4.8Unverified signatureThe smoke job failed on main with `sh: 1: playwright: not found` (exit 127). Two mistakes, and I merged before CI confirmed either — which is precisely the discipline the review said was the root problem. Owning that: the fix is here, and this one waits for a green run before it merges. MISTAKE 1: playwright-core ships no CLI. Only the full `playwright` package carries the binary that downloads browsers. The install step could never have worked. MISTAKE 2, the more interesting one: `npx --yes --package X -- node script.js` does not make X importable by the script. npx puts the package's BIN on PATH; it does not put its module on a child node process's resolution path, so the `require` inside tools/smoke.js fails with MODULE_NOT_FOUND regardless of which package was named. I had verified the script by setting NODE_PATH by hand and never exercised the mechanism the CI command actually used, so my local run proved the test worked and proved nothing about the plumbing around it. Both ve…d3f8729 -
Boot the game in a real browser in CI — the one thing 2502 tests cannot see
Claude +1: Claude Opus 4.8Unverified signatureThere is no build step, so the files in the repo are the files the browser loads. The suite is headless and dependency-free, which is the point of it, and it means nothing in it can catch a page that parses, imports cleanly, and then throws on load. static-integrity.test.js catches STATIC breakage — a syntax error, an import pointing at a moved file, a getElementById for an id that does not exist — and stops exactly there. The failure it cannot reach is a blank white screen, and the way that has been found here before is a human clicking. Measured rather than asserted. Adding a bad draw call to renderUnits.js — one line, valid syntax, imports fine — leaves all 2502 tests passing and takes the game down on its first frame. tools/smoke.js catches it and exits 1 with the stack. A second mutation (a runtime throw in boot.js) is caught by BOTH this and the existing "imports cleanly under Node" guard, which is why the render one is the honest demonstration of what is new here. tools/smoke.…778e159 -
Close the guard gaps behind the last three bugs; withdraw one review finding
Claude +1: Claude Opus 4.8Unverified signatureFindings 4, 5 and 8 of docs/code-review-2026-08.md, plus a correction to 7. #8 tools/ ships to the browser but was outside the purity guard. boot.js imports tools/selfplay.js; competition.js, competitionWorker.js and playerFingerprint.js import tools/duelCore.js and tools/genome.js. So three "Node bench" files run in a browser Worker and decide the outcomes that become persisted Elo ratings, while the purity scan only ever walked engine/ and what engine/ imports — structurally identical code guarded on one side of a directory line and unguarded on the other. The review said moving the files was "simplest and better". Measuring first showed otherwise: 30+ prose references across engine/, README and docs would have had to move with them, for no safety gain. Extended the scan instead, and DERIVED the extra roots by walking out from index.html (plus the Worker entry, whose `new Worker(new URL(...))` edge no import walk can see) so a fourth file pulled into the app tomorrow is covered the…021c865
-
An in-app AI editor: build an opponent dial by dial
Claude +1: Claude Opus 5Unverified signatureThe genome was always meant to be a thing a player OWNS, and until now owning one meant hand-editing JSON -- a fine format for a bench, a poor one for a person. THE WHOLE FORM GENERATES ITSELF FROM GENOME_SCHEMA. Every control's widget, bounds and grouping come from the schema row, which buys two things: adding a gene to the schema makes it appear here automatically with the right control and the right limits, and it is impossible to build an illegal AI through this UI because the bounds ARE the schema's. Sliders for ratios and counts, checkboxes for flags, dropdowns for doctrine/faction, and an ordered chip list for unitMix -- ordered because the first entry is what gets built first, which is why the mix has a rotate operator at all. The feature that justifies a screen over a text box is that it GREYS OUT DIALS NOTHING IS CURRENTLY READING, and says why. Tick "never initiates" and the whole Attacking group dims to "inert while never initiates is on -- it never commits a wave"; match…4979046 -
The cast's labels do not survive held-out maps -- say so
Claude +1: Claude Opus 5Unverified signatureVerified four cells on replicates the archive never trained on. Three moved bin. The harness was checked before the result was believed: re-run on the archive's own replicates it reproduces the filed descriptor exactly, so it is faithful and the descriptor is not stable. Root cause is that the residual variance is ACROSS WORLDS rather than within one. One genome held fixed measures army 3/3 on korrath, 58/143 on ferros and 47/208 on vesper; a pooled median over that is a description of the roster, not of the genome. Both fixes that landed earlier were necessary and neither was sufficient -- the median really did fix the heavy-tail pathology it was aimed at, and the pinned runSeed key really did make re-measurement possible at all, but neither touches cross-world spread. Coverage fell 15/16 to 10/16, and that part IS the fix working: the first run's 94% was inflated by a descriptor scattering genomes into bins at random. The genomes and their strength numbers stand -- 16 real matches…cc7170f -
The corrected cast: 10 cells from the median-descriptor archive
Claude +1: Claude Opus 5Unverified signatureReplaces the 15 cells the first archive produced, six of which existed only because the old mean-based descriptor was scattering genomes into bins at random. Coverage drops 94% -> 63%, and that drop IS the fix working rather than a regression: the earlier number was inflated by measurement noise, and this one is what a tightly-clustered, honestly-measured population looks like. The behaviours now separate cleanly -- waves 0.0 to 13.5, army 1 to 58 -- and the fitness spread (38-88% against the fixed four-baseline panel) tracks something real, with the small-army column scoring highest and the sprawling waves/large lowest. Held-out-replicate verification is running: the archive measured on replicates 0-1, so 2-3 are maps it never saw. Re-measuring on the SAME maps would be tautological now that runSeed is pinned, which is why the check has to use different ones. The README is updated once that lands -- it is the check the first cast failed, when two cells three bins apart swapped ends …dd5b8f9 -
Phase 5: the roster can carry a player's own genome
Claude +1: Claude Opus 5Unverified signatureThe keystone here turned out to be a validator, not a UI. Once a genome can arrive from outside the program -- a mirror someone was sent, an imported ladder, an edited file -- it stops being data this project produced and becomes data it is HANDED. And it is not inert: toOverrides writes it straight into the live ARCHETYPES/STRATEGIES tables the engine reads every think cycle. GENOME_SCHEMA is already the exact statement of what a legal gene is, so it is the exact validator. sanitizeGenome is a WHITELIST: a key the schema does not name is dropped rather than passed through, every number is coerced and clamped to its own gene's bounds, every categorical must be a declared allele, the mix is filtered to the known alphabet and capped in length. Nothing throws -- bad input yields a duller AI, never a broken one or an exception mid-tournament, which is the same tolerance mutation already relies on. Probing it with deliberately hostile input caught a real hole: Number([]) is 0, so `"garris…60d3ef9 -
Phase 4: the adaptation POLICY is evolvable, not just its constants
Claude +1: Claude Opus 5Unverified signatureFive genes in a linkage group of their own -- punishPosture and punishConfidence (when to call an opponent greedy, and how much evidence to demand before acting), adaptRateMult and adaptBandMult (how twitchy or stubborn the stance is), defenceSwingMult (how far the stance swings investment). They are one module because they interact strongly with each other and weakly with everything else, which is precisely the condition module-wise crossover exists for: a low evidence bar paired with a twitchy rate is a completely different opponent from either alone, and a child should inherit that pairing intact rather than half of it. Every one is read through a `?? default` at its use site, so an absent value is exactly the shipped behaviour and the search needs no engine change to explore them -- the same property that made a candidate AI JSON in the first place. This is the difference between breeding a fixed BUILD and breeding a reactive POLICY, and it is what lets MAP-Elites eventually spre…4f42c67 -
Descriptors are a MEDIAN, and runSeed stops hashing the candidate's name
Claude +1: Claude Opus 5Unverified signatureThe archive run filled 15 of 16 cells at 94% coverage, and then verification undercut it: two cells filed three bins apart on the army axis (8 vs 113) differ in exactly one active gene, and re-measuring them returned 93 and 2 -- they had swapped ends of the axis. The cells were not distinct; the measurement was dealing cards. Probing it properly, one genome held fixed on pinned maps over 4 replicates per world: korrath 26/23/22/27 (stable), vesper 1/0/8/0, ferros 36/3/1/296. The distribution is HEAVY-TAILED, not merely noisy -- an Odyssey economy that gets going compounds, so about one run in twelve returns an order of magnitude more army than the rest. That rules out the fix already written. Averaging inherits a heavy tail rather than smoothing it, and the same twelve runs say so: the MEAN reads 21.0 / 14.8 / 36.9 at 1 / 2 / 4 replicates -- diverging, because whichever sample holds the 296 decides the answer -- while the MEDIAN over the identical samples reads 26 / 13 / 15 and conve…ee4f10e -
Calibrate the archive's health screen against the shipped AI, not a fixed list
Claude +1: Claude Opus 5Unverified signatureThe first real `archive` run refused 39 of its first 41 genomes and filled 2 of 16 cells. The diagnosis was unambiguous and it was not the genomes: arch0-arch3 ARE the four shipped strategies, and the screen refused all four. A filter that rejects the game's own hand-written AI is wrong by inspection. The cause was my own parameter choice. CHECKS is calibrated against the `passive` sparring bot; the descriptor run deliberately uses `turtle`, which provokes, so the AI spends on army and takes losses and `devFinal` never clears dev-flatline's threshold. The detector started firing on correct behaviour -- which is precisely the failure this file's own CHECKS header records three rewrites of. Choosing a different opponent reintroduced it a fourth time, in a command whose header comment already warned about it. So the screen is now RELATIVE. The seed strategies are evaluated first and always seated; the union of what they trip under this run's own opponent and match length becomes the tol…ef38dd0 -
Breed a CAST of distinct opponents, not one optimum: MAP-Elites
Claude +1: Claude Opus 5Unverified signature`evolve`'s first real run answered the question it was asked and produced something the game should not ship: a champion that beat all four hand-tuned strategies on held-out worlds by never attacking, because victory.js's score-at-clock tiebreak pays 1.35x for combat units and 0.25x for banked ore, so an army that never fights and never takes attrition is the most valuable thing you can own when the clock runs out. A better number, a worse opponent. Odyssey has no win condition, so the right target was never a maximum. It is what ARCHETYPES is trying to be by hand with four entries: a cast of distinct, legible opponents. `ailab archive` optimises for a filled grid instead. Three things differ from `evolve`, and each one closes a hole that run exposed: - THE ARCHIVE REPLACES THE POPULATION. A genome is binned by how it BEHAVES (aggression x army size, from the solo Odyssey bench) and only ever competes against the current occupant of its own cell. The doomstack turtle can w…09745ce
-
The first evolved candidate: 12 genomes x 6 generations, 3h21m
Claude +1: Claude Opus 5Unverified signatureChampion is generation 3's g3i0 -- later generations never beat it, which is itself the run's most useful result (see below). Recorded as a candidate file so it can be duelled and swept like any hand-written one; NOT promoted into engine/, and on the evidence so far it should not be. What it actually is, once the inert genes are stripped: max economy, uncapped army, never attack. Of the eleven dials it emits, three do anything -- neverInitiates, workerTargetMult, turretCountMult. attackTimeoutMult/ armyAttackSizeMult/garrisonMult are dead under neverInitiates (aiMilitary.js's readyToAttack gate), warFootingMult/Time are dead without a standingArmyCap, and matchBuffer/matchFloor are dead without matchEnemyForce. Junk DNA, exactly as the design doc's Sec 3.3 predicted, and carried rather than erased because the `|| 1` convention means an unread gene costs nothing. It found this because engine/victory.js's score-at-clock tiebreak weights combat units at 1.35x and banked ore at 0.25x, so…eddfd01 -
evolve: checkpoint the champion every generation, not only at the end
Claude +1: Claude Opus 5Unverified signatureA real run is long, and it gets LONGER as it succeeds: a population converging on `neverInitiates` stops resolving matches by elimination and starts running every one of them to the full clock, so generations slow down as the search works. Writing the champion and the log only on completion meant an interrupted run left nothing at all -- the difference between "still going" and "start over". Purely an output side effect, in the CLI's own onGeneration: it consumes no rng and changes no decision, so a checkpointed run breeds the identical champion. The final write goes through the same path, so an interrupted run and a completed one leave a file of exactly the same shape. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011KL6GbjkxUNWs3frZUYANKa6cc77c -
Evolve the AI: a genome, mutation, crossover, and a selection loop
Claude +1: Claude Opus 5Unverified signaturePhase 1 of docs/ai-evolution-design.md. Nothing under engine/ changes -- the whole point is that a candidate AI was already JSON, so the genotype lives in tools/ and the shipped simulation never learns any of this exists. tools/genome.js is the schema and the operators. GENOME_SCHEMA is one source of truth for what a legal gene is -- 28 genes over two chromosomes and six linkage groups -- and the operators are per gene KIND rather than one operator for everything, which is the decision that matters most here: ratios mutate multiplicatively (an additive step means something different at 0.2 than at 1.5, and 0 would be absorbing), headcounts additively so 0 stays reachable because 0 is a real allele, flags rarely because they are epistatic switches that decide whether other genes mean anything at all, and unitMix through sequence operators because it is a cyclic production cycle where order and multiplicity both carry meaning. Crossover cuts at MODULE boundaries, not per gene: the linka…9f53528 -
Phase 5 (replay + season): re-run any recorded match, and close a ladder
Claude +1: Claude Opus 4.8Unverified signaturedocs/competitions-and-elo.md Phase 5's remaining two bullets, which completes the plan — all six phases (0-5) have now landed, noted in a new closing section. REPLAY IS A RE-RUN, NOT A RECORDING. A stored history row already carries its world, its exact seed, its swapAsym half, its pinned difficulty and both entrants' strategies; the roster carries each entrant's archetype. That is the complete input to createSelfPlayState, so buildReplayConfig(row, ledger) rebuilds the match and startSpectatedMatch runs it through the spectator the previous stage built — same speed control, same Observer Mode, nothing captured, nothing stored. What gets rebuilt is the SEATING, not the labelling: a row is always reported A-relative but was played in one of the worker's two directions, so buildReplayConfig un-does flipRow's relabelling and restates the recorded outcome seat-relative, which is what lets spectatedMatchOutcome be compared to it directly. DETERMINISM HELD — BUT ONLY AFTER A REAL BUG, AND …090c049
-
Phase 3 (part 2): the in-game Tournament tab — round-robin, Swiss and knockout
Claude +1: Claude Opus 5Unverified signaturedocs/competitions-and-elo.md's Phase 3 wants real tournaments in the game: a format picker, a field builder, a budget estimate before you commit, round-by-round progress, live standings and a bracket view, with every pairing folding into the ladder. Part 1 landed pairing.js (the shared schedules); this stage wires all three formats into the Worker and the competition screen. Quick Duel, the roster and the standings screen are untouched in behaviour. - competitionWorker.js gains a SECOND job kind: `{ kind: "tournament", format, field, difficulty, worlds, seeds, seedBase, rounds? }` -> runTournamentJob(job, onProgress). A job with no `kind` is still the original single duel, dispatched to runCompetitionJob completely unchanged. The tournament's injected `runPair` is a thin wrapper around runCompetitionJob ITSELF, so a tournament pairing is byte-for-byte the same work a Quick Duel already does — side-swapped both directions, replicate-parity swapAsym, one pinned difficulty for …204faa9 -
Phase 3 (part 1): pairing.js — the shared pairing/scheduling core, plus a knockout bracket
Claude +1: Claude Opus 4.8Unverified signaturedocs/competitions-and-elo.md's Phase 3 needs round-robin, Swiss and a knockout bracket in the game, and its own brief says why the pairing logic must be shared rather than reimplemented: "the Swiss matcher's backtracking, its bye rule, and its already-played-pair avoidance are exactly the sort of code that must not be reimplemented". So this stage extracts that logic and completes it. UI and Worker wiring are the next stage on purpose -- pure logic only here. - pairing.js (new, root, `// @ts-check`, JSDoc-annotated, no DOM/clock/unseeded-pick reference anywhere): pairKey, MATCH_ATTEMPT_CAP, findMatching, greedyMatching, rankStandings, pairRound and buildSwissBracket moved verbatim out of tools/ailab.js, comments included -- they are the record of three real bugs (a bye counted as a win, a rematch a greedy walk could not avoid, standings ranked by total games instead of win rate) and are worth more than the code. The TIER 5 header's PAIRING RULE and BYES paragraphs moved with…3e24f9b -
Phase 2 (part 2): roster + persistent ladder wired into Quick Duel, archetype threaded end-to-end
Claude +1: Claude Sonnet 5Unverified signatureTurns Phase 1's one-off Quick Duel into the persistent competition mode docs/competitions-and-elo.md Phase 2 describes: Quick Duel / Roster / Standings, one coherent mode behind a small tab row, all three reading and writing the SAME competitionLedger.js ledger. THE KEY UX CHANGE: ad-hoc, free-typed entrants are retired. Each Quick Duel entrant is now either picked "From Roster" (a <select> of competitionLedger's current roster) or drafted "New Entrant" (name + strategy + archetype + faction) -- a new draft joins the roster, via addRosterEntry, the instant startDuel() actually commits to running (after buildJob's own validation passes, before the Worker spins up), never on a keystroke, so an abandoned draft never pollutes the roster. A finished duel's rows are folded into the ledger for the pinned difficulty bracket via recordCompetition alone -- no second, hand-rolled elo.js applySeries call in competition.js. The results view's old "Elo isn't saved" line is gone, replaced by "Elo up…628afc1 -
Elo: reject a same-name entrant/candidate pairing instead of silently corrupting its rating
Claude +1: Claude Sonnet 5Unverified signatureBlocker from Phase 1 review (docs/competitions-and-elo.md): elo.js's RatingsTable is a plain object keyed by entrant name, and nothing upstream of it guarded against two entrants/candidates sharing a name. When aName === bName, `ratings[aName]` and `ratings[bName]` in applyResult alias the SAME object -- the function computes A's post-match entry, writes it, then unconditionally overwrites that exact slot with B's post-match entry (whichever assignment runs second always wins) -- A's half silently vanishes and the survivor represents neither side. Reproduced live: the in-game Quick Duel screen with both entrants named "Same Name" ran to completion and showed TWO Elo cards, both reading the identical, corrupted "1200? (0)" -- no error, no warning. Three-layer fix, defense in depth: - elo.js: applyResult now throws a clear Error when aName === bName, before touching `ratings` at all -- the shared backstop every caller (present or future) gets for free, per D1's "one implementation" …87a9642 -
Phase 1 foundations: elo.js, tools/duelCore.js, and an Elo column in ailab's CLI
Claude +1: Claude Sonnet 5Unverified signaturedocs/competitions-and-elo.md's Phase 1 turns the tuning bench into the first slice of an in-game competition: a rating system (D7), one shared between the CLI and (in a later stage of this same phase) the game (D1), plus the fairness-critical duel primitive split out where a browser Worker can reach it next. UI and the Worker itself are out of scope for this stage on purpose -- foundations only. - elo.js (new, root, `// @ts-check`, JSDoc-annotated): INITIAL_RATING, expectedScore, kFactor, applyResult, applySeries -- plain Elo (D7): K=40 while provisional (<10 games, wins over the rating-based rule even at a seeded-high rating), then 20, then 10 above 2400. applyResult creates missing entrants at INITIAL_RATING/0 games rather than throwing, and derives both sides' deltas from ONE shared actual-minus-expected value so they're exact negatives of each other whenever both sides share a K-bucket (verified: two independently-rounded expectedScore(a,b)/expectedScore(b,a) calls are…9af0ddd -
Phase 0: split tools/selfplay.js into a browser-safe core + tools/selfplay-cli.js
Claude +1: Claude Sonnet 5Unverified signaturedocs/competitions-and-elo.md's Phase 0: tools/selfplay.js ended with a module-scope `process.argv[1]` guard, which throws ReferenceError the moment the file is imported anywhere without a `process` global (a browser main thread, or a Worker) — the blocker every later phase in that doc depends on being gone. - tools/selfplay.js now keeps ONLY the pure core: createSelfPlayState, tickSelfPlay, runSelfPlayMatch, fingerprint, and the DT constant they share. Zero `process`/`document` references anywhere in the file, not even in a comment. Function bodies are byte-for-byte unchanged from before the split. - tools/selfplay-cli.js is the new Node CLI entry point (parseArgs, runCmd, USAGE, main, and the process.argv[1]-guarded invocation line), importing the four core functions from "./selfplay.js". `node tools/selfplay-cli.js run ...` behaves identically to the old `node tools/selfplay.js run ...` — same flags, same output. - tools/ailab.js's import of createSelfPlayState/runSe…022fcd2 -
Bench: detectors must prove the state never resolved
Claude +1: Claude Opus 5Unverified signature§2.11 shipped with one guardrail row going the wrong way (supply-deadlock 1/44 -> 6/44) and deliberately left the detector alone, on the grounds that sharpening a metric you are being judged on is not the judged party's call. Taken up separately, the answer was bigger than that row. The pattern was in the detectors' own history. Sorted by the SHAPE of the predicate: the two written as a pure instantaneous fraction (supply-deadlock, production-stall) are exactly the two that have ever needed rescuing, while the three carrying a growth / non-resolution term (dev-flatline, hoarding, and hostile-but-idle since its entitlement gate) survived two separate scale-ups of the AI untouched. A busy AI is momentarily blocked, momentarily idle and momentarily rich all the time; only a stuck one is still in that state with nothing having moved. - supply-deadlock += supplyCapGrowthTail <= 0 (the ceiling never rose) - production-stall += armyGrowthTail <= 0 (the army never grew) - bot…f038c75
-
Tier 2d: make the AI bench measure what it claims to measure
Claude +1: Claude Opus 5Unverified signatureThe side-swap could not detect the thing it exists to detect. Its header says "a side-symmetry bug would show up as those two disagreeing", but duelSeed hashed the candidate names in ORDER while runSwappedDuel calls runDuel(a,b) then runDuel(b,a) — so the two halves differed in seat AND map, and any disagreement was confounded with ordinary seed variance. Sorting the pair into the hash makes it a genuine paired comparison, which is what swapAsym (the map-side control) already was. No result test needed re-baselining: they compare two runs of the same call, not frozen values. Swiss standings ranked raw win totals across unequal match counts. A bye is scorable-neutral since e9ad1d0, but its recipient plays one fewer pairing — 16 fewer chances to win under the CLI defaults — so sorting on totals ranked "everyone who avoided a bye, then everyone who didn't": a 2W-2L candidate at 50% finished below a 3W-3L candidate at 50% purely for having played more. That is the mirror image of the bug …c3a176e -
Tier 1, step 4c: the AI bench lies, and an owner-parametric leak (A9, A12)
Claude +1: Claude Opus 5Unverified signatureA9 — runDuel applied BOTH candidates' overrides into the same live STRATEGIES table, and applyOverrides merges rather than replaces. Two variants of the same dial under the same strategy key — which is the natural A/B tuning workflow — collapsed into one Frankenstein row belonging to neither candidate, played by BOTH seats, and reported a perfectly normal-looking winner that was pure seat/seed noise. This is the function every AI tuning decision runs through, and `search --tournament-against` scores every dial value through it, so a session could "promote" a change that was never actually measured. A collision is now refused up front with a message naming the shared key and suggesting distinct ones; round-robin and Swiss inherit the check across every pair before a long tournament starts rather than partway through. A12 — effectiveMix threads `owner` into prereqsMet but called plannedMix with none, and plannedMix called strategyFor(state)/difficultyFor(state), both of which default to…5853645
-
Fix two real bugs in Tier 5 Swiss tournament found by belated review
Claude +1: Claude Sonnet 5Unverified signatureA scripting accident crashed the original orchestration before Tier 5 got the same independent verify+review every other tier received, so it shipped self-graded. Dispatching two independent agents after the fact (a verifier and an adversarial reviewer) found two real problems the self-grading missed, plus one instance of an already-known bug class: 1. HIGH: a bye credited worlds.length x seeds x 2 (a maximum-margin sweep) as pure wins with zero losses -- reproduced live tying a candidate that structurally cannot fight with a genuine winner, and confirmed that credit exceeded the best real margin observed across the project's own strategy roster. Fixed: a bye now adds only to its own `byes` counter, never wins/losses. 2. MEDIUM: pairRound's own comment and CLI text claimed a repeat pairing only happens when every opponent has already been played. False -- fuzz-tested against a brute-force checker, the old greedy-no-backtracking walk produced an avoidable repea…e9ad1d0 -
Add a fair head-to-head tournament system on top of self-play
Claude +1: Claude Sonnet 5Unverified signatureTiers 2-5 of the AI championship roadmap, all in tools/ailab.js: - duel: candidate A vs candidate B, both driven by the real AI via Tier 1 self-play, resolved by engine/victory.js's own skirmish rule. Fairness is structural: pinnedDuelDials() reads difficulty once into one object both sides' configs spread from, so APM/micro/difficulty cannot diverge. - Side-swap (default) and never-blended difficulty brackets (runSwappedDuel/runDuelBrackets/runRoundRobinSwapped), closing the gap a single fixed-side, single-difficulty measurement can't rule out. - search --tournament-against: the existing dial-search scored by duel standing against a fixed baseline instead of solo score(). - swiss: Swiss-style pairing (closest-standing pairs, rotated byes) for candidate pools too large for round-robin. Independent adversarial review caught a real bug: duel always seated candidate A as "player" and B as "ai", so on a world with a map-baked asym block (oort, nimbus) the fixed side decided…07e72eb -
Make the AI controller owner-parametric: true two-sided self-play
Claude +1: Claude Sonnet 5Unverified signaturerunAI(state, dt, owner = "ai") and every AI phase module now resolve their controller, opponent, and fog grid from `owner` instead of hardcoding "ai"/ state.fogAI — 100% backward compatible (every pre-existing call site keeps the default and behaves byte-for-byte as before). A new, independently configured controller slot (state.playerAi, null by default) lets a second real AI drive the "player" seat in a skirmish, headless-only (tools/ selfplay.js) — nothing in setup.js/boot.js/the shipped game changed. Independent adversarial review (fairness lens + correctness lens) caught a real bug before this was accepted: Hard difficulty's economic edge (hardEdge) was seeded onto state.players.ai only, never a self-play "player" controller configured for Hard. Fixed via seedDifficultyEdge (engine/state.js), called for "player" once state.playerAi exists. engine/persist.js's save/load extension is purely additive (no SAVE_VERSION bump) — old saves round-trip unaffected. Co-Authored-By: Claude …916c3ad -
Add ailab leaderboard: Tier 0 of the AI championship roadmap
ClaudeUnverified signatureRanks N candidate strategies against the same fixed sparring bot, with difficulty/opponent/worlds/seeds held identical across every candidate so none gets an APM or micro edge — a proxy signal usable today, with no engine changes, ahead of true head-to-head self-play (docs §2.8, which needs engine/ai.js's controller to become owner-parametric). - tools/ailab.js: runLeaderboard + snapshotTables/restoreTables (clean per-candidate override isolation) + the `leaderboard` CLI command. - tools/candidates/: five runnable example candidates. - test/ailab.test.js: determinism, override isolation (including on throw), and ranking-correctness coverage. - docs/odyssey-ai-review.md + .claude/skills/ai-lab/SKILL.md: document the command and its "proxy, not self-play" caveat.d71f0e0
-
ailab: add a teching sparring bot and a real-APM flag
Claude +1: Claude Sonnet 5Unverified signatureCloses two bench blind spots (docs/improvement-proposals.md "Close the bench's blind spots: a teching sparring bot and real-APM runs"): 1. OPPONENTS.tech — a turtle economy that also climbs Barracks -> Foundry -> Arsenal via botBuild and holds a Lancer/Breacher/Dreadnought guard (cost-ascending, so trying the list in order is cheapest-affordable- first and never wedges on a unit it can't yet pay for), committing waves on the same six-idle trigger as `skirmisher`. Every prior sparring bot fielded only Skiffs, so none of this batch's counter- picking, turret-wall-reading, or army-composition changes to engine/aiMilitary.js et al were measurable by the bench — this makes "does the AI react to and survive a composition, not a blob" a runnable probe. The shared economy/defence prefix (worker ramp, Habitat, one Barracks, up to 4 turrets) is factored out of `turtle` into `botEconomy` so both bots share it byte-identically instead of duplicating it. 2. --a…dfc603e
-
Correct three bench detectors that the fixes turned into false positives
Claude +1: Claude Opus 5Unverified signatureScaling the AI up changed what its healthy behaviour looks like, and three of the five health checks kept measuring the old shape. A detector that fires on behaviour the design intends is worse than no detector, because the tuning loop optimises against it — so each is rewritten and pinned with a test: - production-stall now needs EVERY Barracks idle, and excludes strategies that deliberately cap their standing army. An "any Barracks idle while holding 400" test fired on 42 of 44 HEALTHY runs once surplus opened six of them, and idle Barracks are the literal point of Economic / Force Parity. - hoarding now needs a large FINAL bank with a frozen army, not a transient peak. A working economy peaks high and spends straight back down; the peak-based test scored it the same as the AI that banked 30,000 and stopped. - supply-deadlock now needs the AI to be blocked with no Habitat on the way. A busy AI lives close to its cap and is momentarily blocked all the ti…b63da6d -
Fix the five Odyssey AI defects the bench found, TDD
Claude +1: Claude Opus 5Unverified signatureEvery change below is red-first: the failing test states the contract, the engine change makes it pass. Full suite 1209 green, typecheck clean. engine/aiWorkers.js + engine/aiEconomy.js — the supply deadlock (review §2.2). The Habitat trigger fired at a flat `used >= cap - 2`, a margin sized for a 2-supply unit, while the Odyssey roster has 4- and 8-supply ones and pickNextUnitType retries the SAME mix entry until it succeeds. It is now sized from maxSupplyDemand(): the biggest supply cost the AI could actually try to pay. Clearing that surfaced two more freezes with the same signature, both fixed here: supply already under construction is now credited (so one Habitat per 10s no longer throttles a scaled-up line), and Habitats are placed at ANY of the AI's Command Centers — measured, a 70-building capital had no valid spot left while its own expansions had room to spare. engine/aiIndustry.js + engine/ai.js — the industry bootstrap reserve (§2.4). runAI runs production before industry…42d791d -
Add an AI bench for Odyssey, and a measured review of the opponent
Claude +1: Claude Opus 5Unverified signatureThe engine suite guards invariants (determinism, purity, "a skirmish resolves to a winner") and says nothing about AI QUALITY, which in a play-forever mode is a curve over 40+ minutes rather than an assertion. So several real defects were sitting in a fully green suite. tools/ailab.js is a headless bench: it runs the real sim (a 40-sim-minute world costs ~7s), drives the player side with scripted sparring bots, samples an AI-quality metric set, and prints a scoreboard plus a named-defect list. Subcommands: probe / sweep / compare / search / check. The key seam is that ARCHETYPES, STRATEGIES and DIFFICULTY_OPTIONS are plain exported tables read through defensive `|| 1` accessors, so a candidate AI is JSON injected via --overrides, not an engine patch — the search space is already a data document. Nothing under engine/ changed here. docs/odyssey-ai-review.md carries the review and the tuning loop, with a reproduction command per finding. A full-roster soak (11 worlds x 4 strategies, 4…953e69e
-
Fix the dev server's broken path-traversal guard
Claude +1: Claude Sonnet 5Unverified signaturefilePath.startsWith(ROOT) with no trailing separator let a sibling directory that merely shares ROOT as a string prefix (e.g. SpaceExploration-RTS-evil) sail through. Extracted the check into a pure, exported resolveSafePath(root, pathname): normalizes the joined path before comparing, and requires an exact match or a match followed by the platform path separator. server.listen() is now guarded to only bind when the file is run directly, so importing it for tests has no side effects. Dev-only tool (not shipped to players), but worth fixing correctly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dmxcvm178TEt2wVXrX5Cj1fae7184
-
Tier 5: release hygiene — docs, license, dev server, npm start
Claude +1: Claude Opus 4.8Unverified signatureTurn the repo into something a stranger can clone, run, and contribute to. - README: rewritten to lead with how to run it (npm start), fix the stale "no tech tree" claim (there's a Refinery doctrine system, a Foundry gate and Datacenter research), and document the whole Odyssey open-world layer, the two save channels, and the versioning scheme — none of which were mentioned. - tools/serve.js + `npm start`: a zero-dependency static server so the ES-module game runs with nothing but Node (no npx, no Python), serving .js as application/javascript (or the modules won't load) with a path-traversal guard. - LICENSE: MIT. - CONTRIBUTING.md: the load-bearing invariants (engine purity, determinism, no build step, versioned saves) with the guarding test for each, plus a release checklist. - CHANGELOG.md: the 1.0.0 entry. Full suite green (560 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AEQUVetLk31Jj7niDQAsXLd0e9298