sim


The NovaTrail learner simulator: thousands of virtual learners of different populations answer tasks through learner-model and engine, so that a change to either is measured before it is merged. It holds the criterion a new rule is chosen by, written down before the first candidate runs, and the tolerance bands that CI holds every change to; it measures the algorithms and never changes them. It reads the module packages as pinned data, through spec's types and without module-kit, and holds no data of live learners.
A component of NovaTrail, a universal open platform for adaptive learning, interactive lessons and AI tutoring. It belongs to stage 1, Format and core, with spec, modules, module-kit, learner-model and engine; it comes together with learner-model and engine, since the simulator needs both the model and the rule of choice.
Status
Detailing is done, and so is the code epic, E2 (RUN.md). The first epic decided what the component's card left open: the virtual learners, the criteria with their bands, and how the CI of learner-model, engine and modules takes the gate. spec took its recommendation on that last point and closed its open question with it (R103 spec). E2 built the simulator on the first versions of learner-model, engine and modules. The decisive runs of the base and of the ceiling of the engine fixed the paths the criteria score by, and the first tag, v0.1.0, came out on 2026-11-09: it is the gate the CI of those three repositories takes. Its own CI is .github's shared checks, with the same bits held on every build, the gate on amd64 and arm64, CodeQL for Go and the coverage in Codecov. The simulator runs: sim run, sim merge, sim compare, sim judge, sim evaluate, sim paths and sim gate; docs/architecture.md, section 3, is what it is built of. The simulator is pinned to the packages learners get, modules v0.2.5 with both maths at 0.3.0, with checks of time and leading questions, and every module in format 0.4, on spec v0.18.4, learner-model v0.1.8, the release of the candidate theta, and engine v0.1.6; the gate takes 250 learners a cell, and a decisive run 2,000 and at most an hour, keeping its file of results in runs/, which git ignores (R31, R33 in docs/decisions.md). E3 judged the first candidates of both libraries, and both judgements ended in an exit, so the base stays (R36, R37; docs/plan/E3.md). E4 kept the simulator up with the libraries: spec v0.15.0 and engine v0.1.6 with the sizes of runs after its faster choice, the check kind time and the leading question of format 0.4 on learner-model v0.1.5 (R41), and the pin of modules that has them, with the paths read anew (R42). The base then moved to learner-model v0.1.6, whose faster readout gives the same bits, with the paths read anew (R43). E5 raised the sizes of runs by a measurement on it — the gate from 150 learners to 250, a decisive run from 1,500 to 2,000, from the tag after v0.1.9 — and judged the second round of the model's candidates on them: theta, where the level of a module forgets after a pause, was chosen and confirmed, and the base stands on its release, v0.1.8 (R46). It then taught the run to call the engine at the end of each task segment of a lesson, as api will, and wrote down the criterion of the judgement of consolidation in a lesson before its candidate; the tag v0.1.15 has both (R48, R49). E5 is done (docs/plan/E5.md). E7 moved the simulator to spec v0.17.3 with the same bits and held each judgement's confirmation to its own held-out set (R50–R52); its judgement of consolidation in a lesson, engine-lesson-1, ended in an exit, and the base stays (R53). E7 is done (docs/plan/E7.md). E9 took up the fairness of the learner model by the grade: virtual learners of the same skill and different grades should come to the same estimate and the same kind of task. Its criterion is an evaluation of the base for spec's DPIA and a constraint of the criteria of the model and of the engine (R54): its populations, measure and numbers were written down before its first run (R55), and the populations, the measure, the evaluation and the constraint are built (R56, R57). The evaluation of the base, evaluations/fairness-1/, found that it does not hold the criterion: learners of grades 1 and 5 get the tasks of grade 3, but by the 50th answer only 0.81 and 0.55 of them come to its estimate, against the bound 0.90 (R58). E9 is done (docs/plan/E9.md). There are no judgement rounds by plan: sim stays the gate in the CI of learner-model and engine, and judges a candidate only when a library brings it with a reason of its own (R59). The one judgement laid out, epic E10 of RUN.md, is that of the round of learner-model aimed at the fairness by the grade, which learner-model took up as its epic E8: its criterion is written down before the first candidate — the model's criterion as it is, with the target that alone decides: the gain over the base, pooled over grades 1 and 5, in the share of learners who come to the estimate of grade 3 by the 50th answer; the bound 0.90 is reported, not required (R65), and sim judge reads that target (R66) —, sim judges the candidates on their commits, and the base moves to the release of the chosen one, or the exit is recorded (R64). The judgement is deferred: the exploration of learner-model found no candidate, and by the author's decision sim runs no long fitting of constants while there are fewer than 100 children; its criterion and held-out set wait for it (R69). Before it, sim moved to spec v0.18.3 with the same bits, and the gopls plugin now loads by the devcontainer (R60); its plan took spec's layout, run/, and is in English (R61). E11, the move, is done (docs/plan/E11.md), and so is E12, which moved CI to .github v0.1.24, with the image of its toolchain stage from the cache of GitHub Actions (R62, R63; docs/plan/E12.md). Outside the epics, CI runs the gate as jobs (R67), on .github v0.1.31, and sim stands on spec v0.18.4, whose devcontainer has the stage toolchain-core, which the release builds (R68, R70).
Gate
just gate builds the simulator on the commits of the libraries that gate.json names, through a go.work it writes in a temporary folder, runs the gate and holds its numbers to their bands; just gate exact holds them to the recorded numbers to the last bit, as this repository's CI does on amd64 and arm64, and just gate record "<reason>" records the bands anew. A caller puts its own code in place of a library with GATE_LEARNER_MODEL or GATE_ENGINE: a folder, or a commit by its full SHA.
The same gate runs as jobs (R67 in docs/decisions.md): just gate-part <k> <n> <folder> runs part k of n of the learners, as one job of n, into the folder, and just gate-check <bands|exact> <folder> holds the build and the merged parts as just gate does, refusing a part missing, repeated or of another run. The jobs of one gate run on one kind of machine, since each splits its part by its processors. .github/workflows/gate.yml is that, four jobs and the check, and this repository's CI calls it on amd64 and arm64. A caller calls it by the SHA of a tag of sim:
gate:
name: Gate
uses: altnovatrail/sim/.github/workflows/gate.yml@<SHA of the tag> # <tag>
with:
name: amd64
sim-tag: <tag>
sim-commit: <SHA of the tag>
library: GATE_ENGINE
It checks out sim at sim-commit, which sim-tag must be on, and the caller's own commit in place of the library library names, and holds the numbers to their bands; the check is "Gate / amd64".
Gate in the CI of modules
The CI of modules judges content, not a library, so its gate holds invariants and thresholds rather than bands, and runs only where what the simulator reads of a package changed (docs/architecture.md, section 3.9). Its job checks out sim by the tag and the SHA of its commit and runs, from the root of that checkout:
just gate modules (-index <module-index.json> | -first) [-published <folder>]... [-all] <package folder>...
-index is module-index.json of the newest release of modules, which release-verify has accepted; -first says there is no release yet, and every package is new. Give exactly one of the two.
- Each
-published is a published package of that index as a folder, with its inventory.json and server.json: the packages of every version of the modules, withdrawn ones too, as the CI of modules already unpacks them for module-kit diff. sim finds each by the digest of its inventory.json and checks it by the chain of digests from the index.
- Each
<package folder> is a package that module-kit build wrote for the pull request. Give every module the pull request builds, not only the changed ones: a cell on two modules runs on both of them.
-all runs every package: give it when the pull request moves the tag of sim.
- Relative paths are taken from the folder
just was called in.
The recipe first asks sim gate changed what each package is, and prints a line a package:
| State |
Meaning |
Runs |
new |
the module has no published version that is not withdrawn |
yes |
changed |
what the simulator reads differs from the newest published version that is not withdrawn |
yes |
same |
what the simulator reads is the same: only texts for the learner, or the version, changed |
with -all, or when a cell of the gate runs it with a changed module: A-linked runs on both maths, so a change to either brings the other along, and its line names the module that brought it |
transition |
the newest published version is of another version of the module format |
never |
What the simulator reads is what it translates the server part into: the bands and the audience of the manifest, the graph and its tiers, the tasks, the lessons and the instances of templates, and none of the texts for the learner. If nothing runs, the recipe says so and exits with 0 before it fetches anything. Otherwise it builds the simulator on both libraries at the commits that gate.json names, runs the gate's populations on the graphs of the packages that run, and checks the numbers against the thresholds:
E2: the share of learners stuck, and of the choices of nothing while the pool has a task to give, on every cell. Each is at most its largest value in gate.json plus one percentage point.
E1 on G0 and G2-half. The share of items with P* below 0.50 is at most its largest value in gate.json plus one point. The share in the corridor is at least its smallest value less one point.
M4 on G0: at most 20 % false "mastered".
E5 on E-base: no task with a rubric given again.
The recipe exits with 0 when the gate is green, 1 when it is red or refuses its input, and 2 on a call it does not know. It writes a table of every number against its threshold to stdout, for the job's summary. Run it in the toolchain stage of sim's devcontainer at the same tag, as this repository's job "Gate" does: docker build --target toolchain - < .devcontainer/Dockerfile, then docker run with both the checkout of sim and the package folders mounted, so that every path the recipe is given is inside the container.
Judging a candidate
A candidate of learner-model or engine is judged by a criterion on decisive runs of 2,000 learners a cell (docs/architecture.md, sections 3.6 and 3.8; R34 in docs/decisions.md). From the root of this repository:
-
The base. just decisive engine runs/base.jsonl builds the simulator on the libraries go.mod names and runs the base on the working learners. Its file is the one paths.json names: sha256sum runs/base.jsonl gives its base. A file kept in runs/ from an earlier run needs no run again.
-
The candidate. CANDIDATE_ENGINE=<full SHA> just decisive engine runs/engine-a.jsonl builds the simulator on that commit, through the same workspace as the gate, with the other library at the commit of gate.json. The SHA may be the head of a pull request that is on no branch. A folder works in place of the SHA, if it has nothing uncommitted. CANDIDATE_LEARNER_MODEL names a candidate of learner-model, and both together with CANDIDATE_PAIR=yes a pair. A relative folder is of the caller's folder. The recipe holds the build to gate.json before it runs, and the file names both libraries by commit.
-
The judgement. A judgement file names the criterion — model, engine or pair — the base's file and each candidate's, with its name, its group and what makes it simple:
{
"criterion": "engine",
"base": "runs/base.jsonl",
"candidates": [
{"name": "A", "file": "runs/engine-a.jsonl", "group": "<group>", "constants": 1}
]
}
sim judge <judgement file> writes the report: the constraints, the score and the choice. Every criterion holds the constraint fair of fairness by the grade: on D-grade1 and D-grade5 each number of M11 against grade 3 no worse than the base's, so both runs need the cells of the populations D-, which just decisive and just rough run; the report names the cell and the number where it does not hold (R55, R57). It refuses runs that are not of the judgement: a base on other libraries than those the paths were read on, or than the embedded gate.json names, and a candidate of one library on another commit of the other (R40).
A candidate may name "equal_on": the graphs, as the IDs of their modules joined by +, on which it gives the base's runs. On each cell of them every learner's sums must be the base's, or the candidate fails the constraint neutral. The judgement of consolidation in a lesson names ["novatrail/grade-3-math", "novatrail/english-essays"] (R49). Beside each candidate the report writes the note of consolidation in a lesson, E6, on the cells where a run consolidated; it decides nothing.
-
The confirmation. The candidate chosen and the base run once more, on the held-out learners of the choice, its judgement's own — held-out-engine-lesson-1 for engine-lesson-1, held-out-model-fair-1 for model-fair-1, held-out-engine-1 for engine-2 (docs/architecture.md, section 3.8): just decisive engine runs/base-held-out.jsonl held-out-engine-lesson-1, and the same with CANDIDATE_ENGINE. The judgement file then names them under "confirm": {"base": …, "candidate": …}, and names its judgement, as its folder: "judgement": "engine-lesson-1"; a file in a folder of judgements/ that names another judgement is refused. sim judge takes the confirmation only on the set that internal/seed/sets.go records for that judgement, and refuses a set kept for another round or variant, or one another judgement has looked at (R52).
-
The bands. A candidate confirmed goes into gate.json and go.mod, and just gate record "<reason>" records the bands anew in a pull request to this repository.
A rough look goes the same way, on fewer learners a cell, before a candidate is ready for its decisive run: just rough engine runs/base-300.jsonl for the base and CANDIDATE_ENGINE=<full SHA> just rough engine runs/engine-a-300.jsonl for the candidate — 300 learners a cell unless a third argument names from 1 to 1,999, and only the working learners, since a look at held-out learners leaves them held out no longer. A judgement file of the two, without a confirmation, gives a report named a rough look, whose outcome decides nothing (R49).
The judgement of the round of fairness, model-fair-1, goes by the target its criterion wrote down before its first candidate (docs/architecture.md, section 3.6; R65, R66 in docs/decisions.md). Its file names the judgement and the target, and its candidates name no group or goal:
{
"judgement": "model-fair-1",
"criterion": "model",
"target": "M11.same",
"base": "../../runs/base.jsonl",
"candidates": [
{"name": "A", "file": "../../runs/model-fair-1-a.jsonl", "constants": 1}
]
}
The target is the candidate's M11.same less the base's, on D-grade1 and D-grade5 pooled, with its interval: it alone decides "better" and the choice, and the model's score stands in the report as a reference. The report writes M11 of the base and of the candidate on both grades, and, for the confirmation on held-out-model-fair-1, whether the chosen one holds the bounds of R55; they decide nothing here. sim judge refuses model-fair-1 without the target, and any other judgement with one. A rough look of the round, as learner-model's exploration runs it, uses the same file without a confirmation.
The evaluation of fairness by the grade reads the decisive run of the base, whose cells of the populations D-grade1, D-grade3 and D-grade5 the engine's ceiling does not run (docs/architecture.md, section 3.6; R55, R56 in docs/decisions.md). An evaluation file in its folder, evaluations/fairness-<n>/evaluation.json, names the evaluation, the run relative to the file, its SHA-256 and the date:
{"evaluation": "fairness-1", "run": "../../runs/base.jsonl", "sha256": "<sha256sum of the run>", "date": "YYYY-MM-DD"}
sim evaluate evaluations/fairness-1/evaluation.json > evaluations/fairness-1/report.md writes the report: each grade against grade 3, whether the base holds the bounds of R55, and the paragraph for spec's DPIA. It refuses a run of another SHA-256, a rough look, held-out learners, a run that did not record the invariants, and a run on other libraries than the gate file names. The report names the version of sim from its build, so the run and the report are made from a clean clone at a tag, as fairness-1 was at v0.1.19 (R58). A judgement reads those cells by the constraint of fairness alone.
Taking a release
A release comes out by itself once CI passes on main and something the gate is built from has changed: the next patch of the line 0.1, from v0.1.0. Releases are immutable, and the tags v* are under a ruleset, so a tag stays on its commit for good.
A caller of the gate takes sim from git, not as a file:
- write both the tag and the SHA of its commit in its workflow: the tag for the reader, and the SHA for what holds the content, as actions are pinned;
- check out sim at that SHA, then run
just gate or just gate modules from it, in the toolchain stage of its devcontainer (see Gate).
A release's one file is sim-<version>.tar.gz, the archive of what builds the simulator and runs the gate, signed without a key. just -f spec/justfile release-verify sim <tag> <file> checks it, and gh release verify <tag> -R altnovatrail/sim checks the release.
Documents
The documents under docs/ are in English, for the Claude Code session that reads them; the decision log was translated by the tasks T52 and T53 (docs/plan/E5.md). The work plan is in English; the description of its epic, its table 1, the bodies of its tasks and the archives of its epics are in Russian (R61 in docs/decisions.md).
The working rules, for people and coding agents alike, are in CLAUDE.md and AGENTS.md. The platform's shared vocabulary, formats, contracts and decisions are in spec, checked out here as a git submodule at v0.18.6: clone this repository with git clone --recurse-submodules.
License
Apache-2.0.