Skip to content

About

Bit-exact Slay the Spire 2 combat simulator (Rust), RL environment, and a network + search combat solver

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

STS2 self-play harness

Claude plays Slay the Spire 2 (v0.111.0, A10) in the real game: Rust combat simulator + search for combat, run model and calculators for macro, an outer loop for skills and networks. Goal: win the run; tiebreak end HP. Plan: docs/plan.md.

game + mods/AgentBridge :15555  <-  agent daemon :15556 (python -m agent <cmd>)  <-  Claude
oracle/combat `serve --port N` (headless game, same protocol)  <-  STS2_BRIDGE=127.0.0.1:N (daemon N+1)

Setup

cargo test --workspace
uv venv .venv && uv pip install maturin numpy torch --python .venv/Scripts/python.exe
VIRTUAL_ENV=$PWD/.venv .venv/Scripts/maturin develop --release -m crates/sts2py/Cargo.toml --features obs_v4   # live net solver_r9_v4 (r9 on observation v4: 9 potions, death block; obs_v3 + solver_r9.pt to roll back)
export STS2_DEVICE=cuda
bash mods/AgentBridge/dev.sh       # .NET 9, Steam 2868840: build + install mod, relaunch (GUI=1 window)

Play

python -m agent s (daemon starts on first use), python -m agent a 1 ironclad 10 SEED (seeded run from the menu). Rules + skill loading CLAUDE.md; commands sts2-harness; bridge mods/AgentBridge/README.md. Human terminal: daemon with STS2_SKILL_GATE=off. agent/fight.py rebuilds the fight from visible state (hidden info = the simulator's own sample). Dashboard: python tools/dashboard/extract_assets.py (once per game update), then python tools/dashboard/serve.py -> http://localhost:8777.

Outer loop

python -m agent.improve review|lessons|gaps|corpus; python -m agent.hindsight <fight> --log; python -m agent.fidelity_sweep. Protocol: sts2-harness "Review loop". Records runs/<id>/events.jsonl, evals/.

Training and evaluation

  • Expert iteration: tools/collect.sh <rl/exit.py collect args> (--ckpt --fights --out [--cover --K --futures]), rl/exit.py train --init --data --out (policy + TD(0.8) value by default). Pools: tools/gen_curriculum.py, signal_pool.py, gen_train.py, round_pool.py. After a simulator change: tools/prune_divergent.py.
  • Pods: scripts/pod_round.sh (combat-loop round), pod_job.sh (uploaded job.sh), shared pod_setup.sh.
  • Benchmarks: tools/bench.py build|build-plans|relabel|score|play|screen, tools/nearmiss_bench.py build|eval, tools/bench_search.py, tools/exact_turn_check.py, tools/leaf_bench.py.
  • Headless baseline: tools/baseline.py (N OracleCombat serve games round-robin, one shared Engine, fixed search rounds, runmodel.BasePolicy macro, win = The Architect reached; evals/baseline/<tag>.jsonl).
  • Live networks: models/current.json. Expert re-enactment: tools/expert.py, skill expert-reenact.

Accuracy gate

bash tools/gate.sh passes unchanged for any simulator/search/env change: search + env checksums, oracle regression traces, RNG goldens, information contract, sync, look-ahead cache exactness. A deliberate behaviour change updates its checksum in the same commit.

Layout

path what
agent/ harness, bridge client, fight rebuild, engine, run model (runmodel, price, tracker), eval / routes / restcalc calculators, decision guards, skill gate, outer loop
mods/AgentBridge/ game mod (C#)
.claude/skills/ strategy book
rl/ network + outcome head, fastsearch, solver, exit, predictor
crates/ sts2sim simulator, sts2env batch env + search, sts2py bindings, sts2diff differential tester
oracle/ the game's combat code headless, regression traces, RNG goldens
tools/ gate, benches, pool generators, baseline arms + analysis, dashboard, expert pipeline
scripts/ pod scripts, skill_gate.py (hook), porting/ (rerun after a game update: gen_defs.py, gen_ids.py, gen_relics.py, flag_multiplayer_cards.py)
tests/ harness and dashboard tests (python tests/agent/run.py)
docs/ plan.md, simulator.md, solver.md, game-bugs.md, research/ (evidence.md, game_code.md)
data/, models/ catalogs, pools, bench/train sets, expert records; networks
runs/, evals/ run records; gaps, rule ledger (evals/rules/)

About

Bit-exact Slay the Spire 2 combat simulator (Rust), RL environment, and a network + search combat solver

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages