How the AI plays
The AI is Instinct: one small transformer, trained by reinforcement learning, that makes every decision of a run. It plays the cards in a fight and picks the path, the card rewards and the shop purchases between fights, each in a single forward pass, with no search. It never sees information a human player could not.
How it was trained is on its own page. This page describes what runs at decision time, as deployed. The agent it replaced, a tree search for the fights plus a learned run policy, is documented in the V1 archive.
One network
Earlier versions of this project split the work: a Monte-Carlo tree search played each fight and a learned policy made the choices in between. Instinct replaces both. An Ironclad run at Ascension 10 has about 650 decisions, most of them card plays, and each one is the network's single answer to the state in front of it.
The difference in strength is large. On 4,000 held-out Ironclad runs at Ascension 10 the first Instinct net won 81.4%, and the search agent won 21.2% of the same seeds. Win rates for all six characters are in the main docs.
One reason is that a fight is no longer played for its own sake. A search over one combat optimises that combat. The network that picks the cards also carries the deck, the map and the boss ahead, and it was trained on the outcome of whole runs, so it spends HP and potions where the run can afford them. In an audit of potion use, Instinct drank potions the way winning human players at Ascension 10 do: seldom in ordinary fights, more in elites, most at bosses, and it rarely reached a boss with an empty belt. The earlier agents it was compared with drank in ordinary fights about three times as often and arrived at bosses empty in roughly four runs out of ten.
What it decides
- In a fight: every card play with its target, every potion, choices a card asks for (which card to discard, exhaust or upgrade) and when to end the turn. One action at a time; there are no whole-turn plans.
- On the map: which node to walk to next.
- After a fight: the card reward, including skipping it, relic choices and boss relics.
- In shops: what to buy and whether to remove a card.
- At rest sites: rest, smith or the other options, and which card to upgrade.
- In events and at the start of the run: every option, and every deck change the game asks for (remove, upgrade, transform, enchant).
- With a full potion belt: which potion to give up.
A few rare screens are not modelled as decisions yet and are handled by fixed rules in the simulator and the mod (drinking a potion outside combat, for example, is trained but switched off in the shipped hosts).
What it sees
The state is turned into a set of tokens, one per thing on the table. A card in hand is a token; so is an enemy, a relic, a power, a potion, each legal action and each option on a reward screen. A typical decision has a few dozen tokens. There is no fixed layout and no position encoding: a hand of ten cards is ten card tokens in no particular order.
| Group | When | Content |
|---|---|---|
| Combat | in a fight | the hand with each card's current cost and damage, the draw, discard and exhaust piles as unordered sets, player and enemy HP, block and powers, relics with their counters, potions |
| Intents | in a fight | each enemy's shown intent in full, plus a three-step forecast of its move pattern with how certain each step is |
| Tactical helpers | in a fight | per enemy, the most damage the current hand can deal this turn and whether that kills; the HP lost if the turn ended now |
| Run state | always | HP, gold, act and floor, floors to the boss, the kind of decision being asked |
| Boss | always | the current act's boss, and at Ascension 10 the second one |
| Deck summary | always | pooled views of the deck, the piles and the relics |
| Run body | between fights | the deck card by card, relics, potions, and what is on offer: reward cards, shop stock with prices, event options, rest-site options, boss relics |
| Map | on the map | the nodes reachable from here and a summary of the routes behind each next step |
Every card, relic, power, potion, monster and event id indexes one shared embedding table. Each id also carries a fixed row of facts taken from the game's own data: type, rarity, cost, base numbers, keywords, targeting and what an upgrade changes. A card the network has rarely met is therefore not a blank: it starts from what the card says.
Numbers (HP, block, damage, gold, counters) enter through a small network after a symmetric log transform, so 7 and 700 are both readable without hand-set scales.
The network
| Part | Specification |
|---|---|
| Id embedding | one table of 4,096 rows × 256, shared by every kind of game object |
| Input stems | embeddings for the token's group, type and slot; a small network for its numbers |
| Trunk | 4 transformer blocks, width 256, 4 attention heads, pre-norm with RMSNorm, SwiGLU feed-forward of width 704, no positional encoding |
| Policy heads | one for fights and one for everything else: each scores a legal option from that option's token, the state token and the kind of decision; a softmax over the options gives the probabilities |
| Size | 6.1 million parameters in training, including the critic; the shipped file holds the policy path only, about 21 MB in 32-bit floats |
The same trunk serves every decision type. A card play and a map choice differ only in which tokens are present and which head reads the result. One net plays Ironclad, Silent, Defect, Regent and Necrobinder on game build v0.111.0. The Fool, new in v0.113.0, has its own net of the same shape, because that build has a different content vocabulary.
Choosing
- Greedy. When it plays for real (in the published win rates, the mod and the workbench) the network takes its highest-probability option every time. Sampling exists only in training.
- Identical options are one choice. Two plain Strikes aimed at the same enemy are merged into a single option. An enchanted Strike, or a card whose damage has grown during the fight, stays separate.
- Forced moves are free. A step with one legal option gets no forward pass. That is about one combat step in six.
- Deterministic. The same state always produces the same move, so a run replays exactly from its seed.
Where it wins and loses
The first Instinct net (Ironclad only, 9 billion training decisions) on 2,000 development seeds at Ascension 10: 1,628 wins and 372 losses.
| Boss slot | Fights won | HP at entry | Potions at entry |
|---|---|---|---|
| Act 1 | 96.8–99.0% | 72–84% | 1.6–1.8 |
| Act 2 | 97.1–98.4% | 77–85% | 2.2–2.3 |
| Act 3, first boss | 97.3–97.7% | 96% | 2.8 |
| Act 3, second boss (Ascension 10) | 89.7–92.2% | 74–76% | 2.2–2.4 |
Of the 372 losses, 80 came in Act 1, 77 in Act 2 and 215 in Act 3, and 157 of those 215 were at the second of the two final bosses. That fight starts with whatever HP and potions the first one left, and it ends the run. Only 80 losses in all happened outside a boss fight.
Ranges are over the bosses that can appear in the slot.
Source: docs/experiments/2026-11-17-ironclad-e2e-campaign-report.md.
The shipped five-character net has not been broken down this way.
What the search still does
Instinct outputs a ranking of the options. It does not produce a line of play, a count of futures examined or, in the shipped nets, an estimate of the chance to win. The chance-node Monte-Carlo tree search from version 1 remains in the workbench and the mod for the jobs that need those:
- The search tree and the principal line for a combat position, with visit counts and values.
- Win estimates for a fight, and the percentages on cards when the search is the chosen advisor.
- Reviews: the live regret coach, the post-combat review and the run review re-search your decisions and list the costliest ones.
- SimLab: build any fight by hand and study it by search or by repeated playouts.
- Fallback: where Instinct cannot answer (a character and game build without a net, or a position it cannot encode) the advisor answers with the search and says so.
The search keeps the draw order hidden as well: draws and monster rolls are chance nodes. How it works, with its budgets and its learned playout nets, is in the V1 archive.
The numbers on screen
- Percentages next to Instinct's advice are the network's probabilities for each option: how strongly it prefers one move over the others. They are not chances of winning.
- "est. win" in the mod and win badges on cards in the workbench come from the search: of the simulations that started with this move, the fraction that reached a won fight. It is a fight-level number and not calibrated.
- The mod's evaluation bar shows the search's mean value for its recommended move.
Where it runs
| Host | How Instinct runs there |
|---|---|
| Simulator and evaluation | its own inference code in pure Rust (sts2-rs/crates/sts2-e2e) on the CPU, or the PyTorch model during training |
| Browser workbench | the same Rust crate compiled to WebAssembly with SIMD, in a Web Worker; the ~21 MB net is fetched when the brain is first chosen and cached |
| Spire Mentor mod | the mod reads the game and draws the HUD; a separate advisor process bundles the Rust engine and the nets, mirrors the live state into the engine and answers over a local socket |
The Rust tokenizer and network are checked against the Python training code on recorded runs: the tokens must match bit for bit, and on 23,132 recorded decisions of the shipped net the largest difference in any output was 1.3e-4, with no change of the chosen move. Inference speed is on the benchmarks page.