train-kit.git
the learning half of an ardegazu.ro bot — plain-JSON checkpoints a 40-line forward pass can replay, episode logs, DQN fit helpers, and the promotion gate that decides what ships.
Clone
git clone https://git.ardegazu.ro/train-kit.git
or browse the code right here, in the browser.
Use as a dependency
"ardegazu-train-kit": "git+https://git.ardegazu.ro/train-kit.git#v1.0.0"
What's inside
- MLP and tabular checkpoint shapes as plain JSON, with the tiny forward pass live bots run — no ML framework in the bot process
- append-only episode JSONL and the byte-offset reader that lets a trainer ingest every bot's transitions exactly once
- atomic checkpoint files with interval reloads — one trainer writes, every bot picks it up within a minute
- frozen-target DQN helpers and tabular Bellman updates; tfjs-node is an optional peer the trainer alone loads
- the promotion gate's file dance: a model ships only after it beats the stock baseline the bots were already playing
docs/NEW-BRAIN-PROMPT.md— the full recipe for teaching the bot fleet a new suite game
The loop
import { resolveModel, dqnTargets, fitNet, gatePromotion } from "ardegazu-train-kit";
const model = resolveModel(dir, game) ?? fresh();
// collect from an ardegazu-peer-kit gym vs the stock baseline …
const { xs, ys } = dqnTargets(model.net, replay, gamma);
model.net = await fitNet(model.net, xs, ys, { lr: 0.001, epochs: 2 });
// your eval decides `promoted` — the gate decides what the fleet plays
gatePromotion(dir, game, model, promoted);