sim

command module
v0.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

sim

CI CodeQL Go version Coverage OpenSSF Scorecard License

Code Smells Reliability Rating Security Rating Maintainability Rating Vulnerabilities

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 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.16.3, learner-model at the commit of the candidate theta, a063835, 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). The current epic, E5, has 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 commit until its release (R46); the engine's second round is the epic after it, E6 (R44).

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.

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:

  1. 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.

  2. 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.

  3. 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. 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).

  4. The confirmation. The candidate chosen and the base run once more, on the held-out learners of the choice: just decisive engine runs/base-held-out.jsonl held-out-engine-1, and the same with CANDIDATE_ENGINE. The judgement file then names them under "confirm": {"base": …, "candidate": …}.

  5. 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.

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, its table of debt and the epic archives stay in Russian.

  • docs/architecture.md — the component: what it does and does not do, its data and links, what was decided, and what the code builds.
  • docs/decisions.md — the decision log: what was decided, why, and what was rejected.
  • docs/sources.md — the records of external facts the documents rest on: each source, the date it was read and its quote.
  • docs/measurements.md — the results of measurements: the times of the gate and of decisive runs.
  • RUN.md — the work plan, in epics; DEBT.md — its table of technical debt.

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.16.3: clone this repository with git clone --recurse-submodules.

License

Apache-2.0.

Documentation

Overview

Command sim is NovaTrail's learner simulator: virtual learners of different populations answer tasks through learner-model and engine, and the numbers they give hold every change to either before it is merged (docs/architecture.md). It is a tool of CI, not a library: the parts of the bench live in internal/ packages (R10 in docs/decisions.md), and a caller that builds sim with go.work runs it as `go run github.com/altnovatrail/sim <command>`.

Its commands run cells of learners into a file of results, compare two such files by learner (R24) and judge candidates by a criterion (R25); the rest come with the tasks of epic E2 in RUN.md.

Directories

Path Synopsis
internal
bench
Package bench runs cells of virtual learners into a file of results, one line a learner, and reads two such files in pairs by learner (docs/architecture.md, section 3.6; R24 in docs/decisions.md).
Package bench runs cells of virtual learners into a file of results, one line a learner, and reads two such files in pairs by learner (docs/architecture.md, section 3.6; R24 in docs/decisions.md).
criterion
Package criterion judges candidates against the base by the criterion of the model, of the engine, or of a pair of both: the constraints, the score as the share of the path from the base to the ceiling, "better", the choice, the confirmation on held-out learners and the way out (docs/architecture.md, section 3.6; R25 in docs/decisions.md).
Package criterion judges candidates against the base by the criterion of the model, of the engine, or of a pair of both: the constraints, the score as the share of the path from the base to the ceiling, "better", the choice, the confirmation on held-out learners and the way out (docs/architecture.md, section 3.6; R25 in docs/decisions.md).
gate
Package gate holds the gate of the bench: the gate file, which names what the gate's numbers were recorded on — the commits of the libraries, the pinned packages, the versions the workspace chose and the go lines — and the bands; the gate's cells and numbers; the checks of a run against the file; and the recording of the bands anew (docs/architecture.md, sections 3.7 and 3.9; R26 in docs/decisions.md).
Package gate holds the gate of the bench: the gate file, which names what the gate's numbers were recorded on — the commits of the libraries, the pinned packages, the versions the workspace chose and the go lines — and the bands; the gate's cells and numbers; the checks of a run against the file; and the recording of the bands anew (docs/architecture.md, sections 3.7 and 3.9; R26 in docs/decisions.md).
invariant
Package invariant checks the invariants of the bench on every learner's run, with a tolerance of zero: one breach on one learner makes the run red (docs/architecture.md, section 3.5; R04; R17 in docs/decisions.md).
Package invariant checks the invariants of the bench on every learner's run, with a tolerance of zero: one breach on one learner makes the run red (docs/architecture.md, section 3.5; R04; R17 in docs/decisions.md).
learner
Package learner is the virtual learner of the bench: its truth, which the bench knows and the learner model estimates from its attempts, and its calendar (docs/architecture.md, section 3.1; R03).
Package learner is the virtual learner of the bench: its truth, which the bench knows and the learner model estimates from its attempts, and its calendar (docs/architecture.md, section 3.1; R03).
measure
Package measure reads the measures of the bench off the runs of virtual learners, by the truth the bench knows and what the learner model and the engine gave (docs/architecture.md, section 3.5; R04; R22 in docs/decisions.md).
Package measure reads the measures of the bench off the runs of virtual learners, by the truth the bench knows and what the learner model and the engine gave (docs/architecture.md, section 3.5; R04; R22 in docs/decisions.md).
pack
Package pack reads published packages of modules as the bench needs them: the server part, server.json, by the types of spec's canonical view and without module-kit, checked through the chain of digests from a pinned module index (docs/architecture.md, sections 1, 3.3 and 3.9; R62, R72, R77 spec; the text of the format, sections 25 and 26).
Package pack reads published packages of modules as the bench needs them: the server part, server.json, by the types of spec's canonical view and without module-kit, checked through the chain of digests from a pinned module index (docs/architecture.md, sections 1, 3.3 and 3.9; R62, R72, R77 spec; the text of the format, sections 25 and 26).
population
Package population names the populations of virtual learners: each changes one assumption of the base population, on the graphs it says, and runs to its limit (docs/architecture.md, section 3.2; R03; R18 in docs/decisions.md).
Package population names the populations of virtual learners: each changes one assumption of the base population, on the graphs it says, and runs to its limit (docs/architecture.md, section 3.2; R03; R18 in docs/decisions.md).
published
Package published holds the published packages of modules the bench is pinned to, as their release has them, and reads them through the chain of digests (docs/architecture.md, sections 3.3 and 3.9; R14 in docs/decisions.md).
Package published holds the published packages of modules the bench is pinned to, as their release has them, and reads them through the chain of digests (docs/architecture.md, sections 3.3 and 3.9; R14 in docs/decisions.md).
run
Package run runs a virtual learner through learner-model and engine, as the platform runs a learner through them: at each time its calendar gives, the bench builds the engine's input as api would — the model's reading, the pool and the lessons the learner's age category suits, the runs of lessons, the attempts closed by "Done", the last closed attempt and the summary of what was handed out —, takes the engine's choice, has the learner answer by its truth, and gives the model the evidence (docs/architecture.md, sections 1 and 3; architecture 3.8 spec; R104, R107 spec; R16 in docs/decisions.md).
Package run runs a virtual learner through learner-model and engine, as the platform runs a learner through them: at each time its calendar gives, the bench builds the engine's input as api would — the model's reading, the pool and the lessons the learner's age category suits, the runs of lessons, the attempts closed by "Done", the last closed attempt and the summary of what was handed out —, takes the engine's choice, has the learner answer by its truth, and gives the model the evidence (docs/architecture.md, sections 1 and 3; architecture 3.8 spec; R104, R107 spec; R16 in docs/decisions.md).
seed
Package seed gives the bench its numbers: every draw of sim comes from a place of randomness of the module format, a seed and names, by the platform's one generator (docs/architecture.md, sections 3.4 and 3.8; R27, R59 spec; the text of the format, section 22).
Package seed gives the bench its numbers: every draw of sim comes from a place of randomness of the module format, a seed and names, by the platform's one generator (docs/architecture.md, sections 3.4 and 3.8; R27, R59 spec; the text of the format, section 22).
synthetic
Package synthetic builds the bench's own synthetic packages: canonical views in the shape of the three modules of the first slice, for the code and the tests of the bench and not to judge candidates by (docs/architecture.md, section 3.3; R03; R19 in docs/decisions.md).
Package synthetic builds the bench's own synthetic packages: canonical views in the shape of the three modules of the first slice, for the code and the tests of the bench and not to judge candidates by (docs/architecture.md, section 3.3; R03; R19 in docs/decisions.md).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL