tutor

package module
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 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

tutor

CI Release CodeQL Latest release Go version Coverage OpenSSF Best Practices OpenSSF Scorecard License

Code Smells Reliability Rating Security Rating Maintainability Rating Vulnerabilities

The AI side of the NovaTrail tutor: it reads the learner's work, handwriting or text, into an observation, reviews the working for the first mistake, assesses an essay against the module author's rubric, and words the hint for the rung of the hint ladder that the platform's program chose. It holds the platform's prompts, one per AI capability and each with its own eval set, the adapters to AI providers, the exact models admitted for each capability, and the one function that admits an AI route for the learner's age category before every request; it reports each call's usage, by which api counts the platform AI quotas, and its eval runner is a CLI on the same code. It is a library inside api: it decides no verdict, picks no lesson or task and stores nothing, and its requests carry no identifier of the learner or the account: on the own-key route only the key itself goes along, to its own provider, which ties each call to the key owner's account.

A component of NovaTrail, a universal open platform for adaptive learning, interactive lessons and AI tutoring. It belongs to stage 2, First slice with learners, with canvas, api, app, skill-map and infra; together with canvas it brings the stage's first code, which for tutor is the check board below.

Status

The MVP is the check board: you solve eleven fixed maths tasks by hand in the browser and press Check at any step, before you finish too. Five are solved in lines; the other six, tasks 6 to 11, in free form: on a number line, with a drawing, or with the working at the side. The Claude models you tick read the work, each at the effort you choose, and Claude Haiku 5.5 and Sonnet 5.5 without thinking if you like. Each gives only a verdict: correct, no mistakes so far, an error, which the model marks on the board in its own colour, or cannot read. You mark whether each was right. Each answer shows its time, when its first token came, its price and its tokens, thinking included; the summary shows, for each model at each effort, how often it was right and what an answer costs and takes. On 2026-10-23 Claude Opus 5.5 at high effort judged all five tasks the board then had right, at about a cent and five seconds a check (R20 in docs/decisions.md); GPT-6 Astra, which the board can also ask, is not used. The reading measurement of epic E2 asked one question: does the writing process, stroke order and erasures, help Claude judge a finished sheet? On 40 sheets, 39 of them drawn by code with the solution in lines from the top down, it did not show any help: Claude Opus 5.5 judged every sheet right from the picture alone (R27). Epic E4 (R28) came next and was done on 2026-10-29: solutions in free form, with a number line, a drawing or notes at the side, then reading the work into an observation with and without the key, hints, workbook cells and essays. It started with a pilot on this board, and spec recorded its conclusions in v0.3.2 (R49 in docs/decisions.md). Its extended measurement followed in the same epic (R50): more Claude configurations, hundreds of sheets, pages and essays that code draws, and ten sheets the author wrote messily; spec recorded what it showed in v0.3.3 (R51). The epic ended with the workbook reading under that tag's rule for a digit written mirrored: such a digit is not read as a digit, the box counts as ambiguous, and the learner writes it again. Start the board in a terminal of the devcontainer:

just board

It asks for the Anthropic and OpenAI keys for eval without showing them, so no key lands in the shell's history; Enter skips a model. When the terminal says the board is at http://127.0.0.1:8080, open that address, or the one the Ports tab of VS Code shows if it forwarded the port under another number. Until then the page only keeps loading: VS Code forwards the port, but nothing answers on it yet.

The measurement's sheets are written in the board's record mode, which asks no model and so needs no key:

just record

Pick a sheet of the plan, write what it shows with a pen or a mouse, press Done, check the markup the plan filled in and press Save. If the board grouped the strokes into lines wrongly, pick strokes on the sheet and move them to another line, or join two lines. The board checks the markup after every change, and its words show beside the fields. On a sheet with a planned erasure, the board takes the move of the eraser on the plan's line for it, and you check that too. The sheet is saved as a sample of spec's eval protocol, its history of writing — every stroke's points with their time and the pointer that wrote it, every erasure, Undo and Clear — in samples/sheets-v1, outside git, once spec's sample-check passes it. Undo and Clear are slips; Start over writes the sheet anew. A stroke in no line keeps the sheet from being saved until you move it to one or take it away. Your writer's code, which every sample of yours names, is made at random at the first save, in samples/writer-code. The sheets saved before as files of tutor-sample v0 are converted beside their directories by go run ./cmd/tutor-eval convert -from DIR, which leaves the old files as they are.

The three free-form sheets of epic E4 that you write yourself are made of parts: a number line, a drawing, notes at the side. just free-record starts the same mode on them and saves them in samples/free-v1. After Done the board frames each group of strokes as a part, in the order you wrote them. A drawing you drew on after a pause comes in two frames, so join them; to move strokes to another part, drag a rectangle around them to pick them.

The sheets you do not write, code draws: go run ./cmd/tutor-eval draw draws every sheet of the plan that has no file yet, saves it beside yours with the writer synthetic, and leaves yours as they are. With -png DIR it also saves, in DIR, the final picture of each sheet it draws and its frame before each erasure. For epic E4, code draws into synthetic/, out of git too. No handwriting is in it, so coding agents work with it and run the measurements on it themselves, and the board never writes there: your handwriting stays in samples/.

Once the sheets are written and split into a development and a test part (tutor-eval sheets, then tutor-eval split once), the measurement runs on a part:

just measure -part dev

The measurement of free writing of epic E4 runs the same way on the 40 sheets code draws, just free -part dev, in the judge's prompt for free writing; -part all runs every sheet of a plan without the split, as for your three sheets. Either run first says how many calls it makes and what they are expected to cost, and starts only when you type yes. It starts no call that could take it past its cap, $3 for the development part, $6 for the test and $2 for all the sheets, and logs every answer in runs beside the folder of the sheets, outside git. With -stub it asks no model: a stub answers by the markup, and the run needs no key. For the extended measurement, go run ./cmd/tutor-eval gen sheets|near makes a bank of tasks and a plan of their sheets with their truth by construction, as new files, and gen workbook|essays the pages of the workbook or the essays, and draw -shift leans the answer's digit of a near sheet as far as it says. run -kind essay -two assesses an essay in two calls, reading it and then assessing the text read. -readers names the Claude configurations a run asks: the three of E4 by default, and for the extended measurement four more, Opus 5.5 at medium, Sonnet 5.5 at low with thinking and without, and Haiku 5.5 at medium (R50). For it you write ten more sheets in free form, messily on purpose, with just messy-record: they go to samples/free-messy, out of git. go run ./cmd/tutor-eval report LOG then turns the log into the report, asking no model: whether the writing process helps each judge, by the criterion of section 3.1 of docs/architecture.md, and the other numbers, in Markdown and CSV beside the log.

The workbook of epic E4 is 20 pages of eval/workbook.json: ten items a page, each with its boxes, and in each box a value written by hand, plainly or with a digit leaning toward its pair, mirrored or crossed out and written again. Its pages are listed in docs/workbook.md. go run ./cmd/tutor-eval draw -workbook eval/workbook.json draws them as samples of spec's eval protocol into synthetic/workbook, which tutor-eval workbook and the runs read, and with -png synthetic/png/workbook it saves the crop of every filled box it draws, what a reading sees. The essays of epic E4 are 20 short essays in English with one rubric of six criteria, and whether each essay meets each criterion as planned: eval/essays.json, listed in docs/essays.md. go run ./cmd/tutor-eval draw -essays eval/essays.json draws them into synthetic/essays, and with -png synthetic/png/essays saves the crop of every page it draws.

api makes the library once, when it starts, with tutor.New: spec's admission table, the facts of its deployment, the least stage of admission its learners take, the platform's keys at the AI providers and the adapters of the providers it calls, claude.Dial of provider/claude and gpt.Dial of provider/gpt. The library builds no adapter in, so api's build carries the SDK of only the providers it takes (R90 in docs/decisions.md). Each call carries a tutor.Route — the AI route, the learner's age category and, on the own key, the key, which never prints — and ends in a tutor.Outcome with a record of usage for each call of a model; example_test.go shows it. Words asks the admitted model for the analysis of the steps and the tutor's question of a rung in one call, and without the work for the same rung put another way: the box of the first mistake, the trap and the question. Package words holds the checks api makes of the tutor's words beside the leak check: words.Hint, the form of a hint, and words.Feedback, the rule of feedback by a rubric, against the text read (R70 of spec). ReadSheet reads a handwriting sheet — the PNG of its crop and the open view of its task — by the admitted pair of readers, in parallel, and gives the observation of each, which module-kit joins into the verdict, or the outcome alone.

A model serves a capability only once tutor's rule of admission passes it on a runner's report (R80 in docs/decisions.md). The job of .github/workflows/eval.yml reads the platform's key for eval from Secret Manager of infra, in the GitHub environment eval; for now it is started by hand and only checks the way in, at no cost (R120 spec). For the first app the set is your own sheets: just admit-record opens the record mode on the 54 sheets of eval/author-sheets.json, into samples/author-v1, out of git. go run ./cmd/tutor-eval run -kind reading -reads plain -part recorded reads the sheets recorded so far as the platform does, every reader in every repeat, and go run ./cmd/tutor-eval admit REPORT says which stage the report admits its readers to, full or author, with the numbers it rests on.

The tutor's words have an eval set of their own, with points on the learner's sex and on safety (R85 in docs/decisions.md): the sheets with a mistake of eval/lines-gen-1.json, ten of them again with a note at the side that is no part of the solution and not for a child, and 330 cases of the words on them — a rung with the work, the rung put another way without it, and a sheet with a note — in eval/words-sheets.json and eval/words-cases.json, which go run ./cmd/tutor-eval gen words -seed 118 makes. draw draws the sheets into synthetic/words-v1, run -kind hint -part all -cases eval/words-cases.json asks the cases, and go run ./cmd/tutor-eval judge-words -log LOG has a judge model read every hint: whether it tells the learner's sex, keeps to the task, suits a child and takes the note up. The judge counts only once judge-words -controls eval/words-judge.json shows it passing all its control phrases; Sonnet 5.5 at low judges by default (R86). On your own sheets with a mistake, go run ./cmd/tutor-eval gen words-cases makes the cases of a written plan, and run -kind hint -part recorded -cases F -case-kinds rung asks those of the sheets recorded so far. go run ./cmd/tutor-eval admit-words -controls LOG HINT-LOG... applies the rule of admission of the words: the stage author, or every reason why not. Its first run, on 2026-11-08, did not admit Opus 5.5 at high (R86), and the words wait for task T127.

Canvas's sample page and tutor's runner must read the same files. just canvas-check downloads the synthetic samples of the release of canvas that the justfile pins, by its tag and the SHA-256 of the archive, into synthetic/, and runs tutor-eval canvas on them: each sample is held to spec's rules, read by the task it names, with the bank at the tag of tutor it names, and run on the stub, which asks no model, with the runner's report of the whole set. It fails on a sample the runner cannot read or refuses but as a child's, and just canvas-check-test makes sure it does; CI runs both.

How it works is section 3.3 of docs/architecture.md, and the plan of epic E4's measurements is its section 3.4; what the library is to be, call by call, is sections 3.5 to 3.10. The plan is RUN.md: epics E4 and E1, detailing, are done. Epic E3, deferred from 2026-10-25 to 2026-11-01, is done on 2026-11-08: it gave tutor its releases, moved it to spec's 0.6 line and on to spec v0.9.5, put the open views of the measurement's tasks into the releases, below, moved the runner, its report and the board's record mode to spec's eval protocol, and checks in CI that the runner reads canvas's synthetic samples. The library's code for the first app, epic E5, is done on 2026-11-09: its tasks T112 to T119 built what api needs for the first app — admission, the reading of a sheet by two readers, the checks of words and the call of words with its eval —, but T119 did not admit the words. Epic E6, deferred on 2026-11-09, is current again since 2026-11-11: T127 admitted the words, Opus 5.5 at high on version 3 of the hint's prompt, and T120 to T125 build the rest — the usage and prices of a call, the provider's refusals, the check of an own key, the reading of a workbook and of an essay, and the assessment by a rubric.

Releases

A release comes out by itself after each merge into main that changes what the module is built from: its Go code, the files that code embeds, go.mod, go.sum, the justfile, the license, the Dockerfile, the release workflow or the file of open views below (R62 in docs/decisions.md). Its number is the next patch of line 0.1, from v0.1.0. A release is the tag of the Go module, which api builds from, go get github.com/altnovatrail/tutor@v0.1.0, and its files: the source of that commit, tutor_<version>_source.tar.gz; from the first release after 2026-11-02, the open views of the measurement's tasks, tutor_<version>_open-tasks.json; and SHA256SUMS over them. The open views are what a learner sees of each of the 56 tasks of the measurements — its statement, its canvas and its answer slots, in spec's module format 0.2 up to v0.1.1 and 0.3 from the first release after task T30 of RUN.md — and none of its key, solution, traps or checks: until the modules repository has content, canvas's CI puts them into the build of its sample page, by the release's tag and the file's sum (R64). The file is eval/open-tasks.json, and just open-tasks writes it anew from the banks. Each file comes with its Sigstore bundle, <file>.sigstore.json. The releases are immutable, and gh release verify <tag> -R altnovatrail/tutor and gh release verify-asset <tag> <file> -R altnovatrail/tutor check a release and a file you downloaded. The Go command checks the module itself against the Go checksum database.

Documents

The documents are in Russian.

  • docs/architecture.md — the component: what it does and does not do, its data and links, and what is still to decide.
  • docs/decisions.md — the decision log: what was decided, why, and what was rejected.
  • RUN.md — the work plan, in epics.

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

License

Apache-2.0.

Documentation

Overview

Package tutor is the AI side of NovaTrail's tutor, a library that api calls in its own process. It reads the learner's work into an observation, reviews the working and words the tutor's replies, through the AI routes and models it admits, and reports each call's usage. It decides no verdict and stores nothing, and its requests carry no identifier of the learner or the account.

The AI providers are reached only through the port in package provider. The eval runner, cmd/tutor-eval, runs on the same code.

Example

api makes the library once, when it starts: spec's admission table, the facts of its deployment, the least stage of its learners, the platform's keys, which it reads from Secret Manager, and the adapters of the providers it calls — here Anthropic's alone, so that its build carries no other provider's SDK. Before an attempt it asks which models would read the learner's work, and whether any would.

package main

import (
	"fmt"
	"log"

	"github.com/altnovatrail/spec/types/admissionv0"

	"github.com/altnovatrail/tutor"
	"github.com/altnovatrail/tutor/admission"
	"github.com/altnovatrail/tutor/provider"
	"github.com/altnovatrail/tutor/provider/claude"
)

func main() {
	table, err := admission.Platform()
	if err != nil {
		log.Fatal(err)
	}
	facts, err := admission.ReadFacts(table, []byte("anthropic:\n  data_processing_agreement: [adult]\n  minimal_retention: [adult]\n"))
	if err != nil {
		log.Fatal(err)
	}
	lib, err := tutor.New(tutor.Config{Table: table, Facts: facts, Least: admission.StageAuthor,
		Keys:     map[admissionv0.Provider]string{"anthropic": "the platform's key"},
		Adapters: map[admissionv0.Provider]provider.Dial{"anthropic": claude.Dial}})
	if err != nil {
		log.Fatal(err)
	}
	route := tutor.Route{AI: admissionv0.AiRoutePlatformAi, Category: admissionv0.AgeCategoryAdult}
	entry, answer, err := lib.Choose(admissionv0.CapabilityHandwritingReading, route)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer.Admitted, entry.Stage, entry.Models[0].Name(), "+", entry.Models[1].Name())

	child := tutor.Route{AI: admissionv0.AiRoutePlatformAi, Category: admissionv0.AgeCategoryUnder13}
	_, answer, _ = lib.Choose(admissionv0.CapabilityHandwritingReading, child)
	fmt.Println(answer.Admitted, *answer.Reason, *answer.Fact)
}
Output:
true author claude-opus-5-5 high + claude-haiku-5-5 medium
false fact_missing data_processing_agreement

Index

Examples

Constants

View Source
const (
	LimitOwner   = provider.LimitOwner
	LimitTier    = provider.LimitTier
	LimitBalance = provider.LimitBalance
	LimitBilling = provider.LimitBilling
)

The reasons of a limit reached.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoxCrop added in v0.1.24

type BoxCrop struct {
	Item, Slot int
	Crop       []byte
}

BoxCrop is the crop of a filled box of a workbook page, as app sends it: the places of its item and of the box among the item's boxes, from 1, and the PNG of its strokes alone, without the box's frame and the print of its line (R53 spec, amendment of 2026-10-27).

type Call added in v0.1.24

type Call string

Call is a kind of call of the library: the reading of a sheet, of a workbook page and of an essay, the assessment of an essay by its rubric, and the call of the words. Each serves a capability with a prompt of its own, and an entry of the list admits it only when it measured that prompt (R70 spec).

const (
	CallSheet    Call = "sheet"
	CallWorkbook Call = "workbook"
	CallWords    Call = "words"
	CallEssay    Call = "essay"
	CallRubric   Call = "rubric"
)

The kinds of call of the library.

type CallPrice added in v0.1.24

type CallPrice struct {
	ExpectedUSD, WorstUSD float64
	Expected, Worst       bool
}

CallPrice is what a call of a capability is expected to cost and can cost at most, in US dollars, over every model of the entry the call asks — both readers of a pair — (architecture 3.7): api reserves the quota of platform AI by them before the call. The worst is the most input of the kind, each token at the higher of its price and that of a write to the cache, and its most output. Expected is false when a model of the entry has no expected tokens; Worst is false when the prices do not hold the worst, and api takes the value of its own config then.

type Config

type Config struct {
	Table    *admission.Table
	Facts    admission.Facts
	Least    admission.Stage
	Keys     map[admissionv0.Provider]string
	Adapters map[admissionv0.Provider]provider.Dial
}

Config is what api gives tutor when it starts (architecture 3.10): spec's admission table, the deployment's facts, the least stage of admission its learners take — admission.StageAuthor only where the author alone learns, as in the first app (R76 spec; R80) —, the platform's keys at the AI providers, which api reads from Secret Manager (architecture 1), and the adapters of the providers whose models the service calls, such as claude.Dial of package provider/claude. The library builds no adapter in, so that a service carries the SDKs of the adapters it gives alone (Д185 RUN.md spec; R90). A provider with no adapter here is no route at all, and one with no key no route of platform AI: Choose takes none of its models.

type CriterionMark added in v0.1.24

type CriterionMark struct {
	Evidence string
	Met      *bool
}

CriterionMark is the assessment of a criterion: what in the essay the model judged it by, and whether the essay meets it, nil when it has no assessment — a criterion the answer has no judgement of, or two (architecture 3.5).

type EssayRead added in v0.1.24

type EssayRead struct {
	Observation *observationv1.Observation
	Outcome     Outcome
}

EssayRead is what a reading of an essay gives: the observation of its answer slot bound to the sheet — the text as it is written, or unreadable when the essay as a whole cannot be read, which does not reach the assessment (R75 spec; R86 spec) — when Outcome is Answered, and otherwise none.

type EssayReading added in v0.1.24

type EssayReading struct {
	Route Route
	Task  *open.Task
	Crop  []byte
}

EssayReading is an essay to read (architecture 3.10, «чтение сочинения»), the first of the two calls of a task with a rubric (architecture 3.5; R75 spec): the PNG of the crop of the sheet, the open view of its task and the route. The model sees the crop alone, without the topic and the rubric.

type KeyCheck added in v0.1.24

type KeyCheck int

KeyCheck is how the check of an own key ended (R84 spec; architecture 3.7), as spec's contract names it (OwnKeyCheck): the provider took it; the key is wrong, revoked or expired; it is right and has no rights to a model it is needed for; the provider is closed to an own key at the profile, and no call went; or the provider did not answer, and the check says nothing of the key.

const (
	KeyAccepted KeyCheck = iota + 1
	KeyWrong
	KeyNoRights
	KeyProviderClosed
	KeyUnanswered
)

The ends of a check of a key.

func (KeyCheck) String added in v0.1.24

func (k KeyCheck) String() string

type Kind

type Kind int

Kind is how a call of the library ended (architecture 3.10): the models answered; AI failed; a provider refused for a limit, a balance or billing, whose reason Outcome.Limit names (architecture 3.7); the admission refused the call, before any model was asked (architecture 3.9); or the provider refused the own key, wrong or revoked (R84 spec). None but the first is the learner's mistake (R04 spec).

const (
	Answered Kind = iota + 1
	Failed
	LimitReached
	NotAdmitted
	KeyRefused
)

The kinds of outcome.

func (Kind) String

func (k Kind) String() string

type LimitReason

type LimitReason = provider.Limit

LimitReason is why a provider refused for a limit: one only the owner of the key can lift, each in its own way (architecture 3.7). It is the adapters' own, provider.Limit, so that a reason they tell is one the library gives.

type ModelPrice added in v0.1.24

type ModelPrice struct {
	Provider admissionv0.Provider
	Model    string
	Prices   provider.Prices
}

ModelPrice is a line of the table of prices: a model of the list of admitted models, by its provider and exact ID, with its prices and the day they were read.

type Outcome

type Outcome struct {
	Kind      Kind
	Limit     LimitReason
	Admission admission.Answer
	Usage     []Usage
	Err       error
}

Outcome is how a call of the library ended: its kind; the reason of a limit; the admission's answer, which on NotAdmitted refuses; and a record of usage for each call of a model that came back, in the order of the models, none on NotAdmitted. Err says what failed, for the logs: it carries no content and no key.

type OwnKey

type OwnKey struct {
	// contains filtered or unexported fields
}

OwnKey is the key of an account owner who learns, with its provider (R84 spec). It lives only in the memory of the request (privacy 5.2 spec): its fields are unexported, it prints as its provider alone with any verb, and as JSON it is nothing. The key itself stands behind a pointer, so that even an OwnKey printed field by field, as fmt prints an unexported field of another struct, shows an address rather than the key.

func NewOwnKey

func NewOwnKey(p admissionv0.Provider, key string) *OwnKey

NewOwnKey is the own key of a provider.

func (OwnKey) Format

func (k OwnKey) Format(f fmt.State, _ rune)

Format prints String with every verb, so that no verb reaches the fields.

func (OwnKey) GoString

func (k OwnKey) GoString() string

GoString is String, so that %#v prints no key either.

func (*OwnKey) Provider

func (k *OwnKey) Provider() admissionv0.Provider

Provider is the key's provider.

func (OwnKey) String

func (k OwnKey) String() string

String names the key by its provider, never the key itself.

type Route

type Route struct {
	AI       admissionv0.AiRoute
	Category admissionv0.AgeCategory
	Own      *OwnKey
}

Route is what every call of the library carries besides its work (architecture 3.10): the AI route, the learner's age category, and on the own key the key with its provider. It names no learner, no account and no adult (R15 spec; privacy 5.1 spec).

type RubricAssessed added in v0.1.24

type RubricAssessed struct {
	Criteria []CriterionMark
	Feedback string
	Outcome  Outcome
}

RubricAssessed is what an assessment by the rubric gives: a mark for each criterion, in the rubric's order, and one feedback, which api checks by the rule of the feedback (words.Feedback; R70 spec) before it reaches the learner. When the call failed, every criterion is without an assessment, and there is no feedback.

type RubricAssessment added in v0.1.24

type RubricAssessment struct {
	Route    Route
	Text     string
	Topic    string
	Criteria []string
	Style    string
	Language string
}

RubricAssessment is an essay to assess by the criteria of its task's rubric (architecture 3.10, «оценка по рубрике»), the second of the two calls of a task with a rubric (architecture 3.5; R75 spec): the text the reading of the essay wrote down, the statement of the task as its topic, the criteria of the rubric in their order, in the module's explanation language, the presentation style — only what of it changes the words (Д74 RUN.md spec) —, the language of the feedback by its tag, and the route. The model sees the text in the block <essay> and the topic and the criteria in the block of the task's data, and no picture.

type SheetRead added in v0.1.16

type SheetRead struct {
	Observations []*observationv1.Observation
	Outcome      Outcome
}

SheetRead is what a reading of a sheet gives: the observation of each reader, in the order of the pair, the strong reader first (R68 spec), when Outcome is Answered — module-kit joins them and gives the verdict (R86 spec) —, and otherwise none: tutor gives both or the outcome, never one.

type SheetReading added in v0.1.16

type SheetReading struct {
	Route Route
	Task  *open.Task
	Crop  []byte
}

SheetReading is a handwriting sheet to read (architecture 3.10, «чтение листа»): the PNG of the crop of its visible strokes, as app sends it (the contract between app and api, SheetWork), the open view of its task, and the route. The model sees the crop and the statement, never the key (R67 spec).

type Trap added in v0.1.18

type Trap struct {
	ID, Description string
}

Trap is a trap of a task that a model may name, by its ID, with its description from the catalogue of traps, which api takes through module-kit (R57 spec).

type Tutor

type Tutor struct {
	// contains filtered or unexported fields
}

Tutor is the library as api holds it: made once, at the start, and called by many requests at once. It keeps nothing of a call (R09 spec).

func New

func New(c Config) (*Tutor, error)

New makes the library of a config. It refuses a config with no table, a least stage that is neither of the two — an empty one is the stage full, the strict one —, and a key of a provider the config gives no adapter of, which would leave every model of the provider unchosen with no word of why.

func (*Tutor) AssessEssay added in v0.1.24

func (t *Tutor) AssessEssay(ctx context.Context, r RubricAssessment) RubricAssessed

AssessEssay assesses the text of an essay by the criteria of the rubric, by the one model admitted for the assessment by a rubric with the prompt of the assessment of a text (R70 spec; R97). The criteria go to the model by their numbers, from 1. Until an entry of the list measured the prompt, the assessment is NotAdmitted: its target comes from the measurement on the essays of volunteers (R71 spec; П-16). An answer off the schema fails the call; a criterion it judges twice, or not at all, is without an assessment, as is every criterion of a failed call.

func (*Tutor) CheckKey added in v0.1.24

func (t *Tutor) CheckKey(ctx context.Context, r Route) (KeyCheck, error)

CheckKey checks an own key when its owner connects it (R84 spec): api checks it through tutor and never calls a provider round it. The route is the own key's, with the profile's age category. The key is checked for every model the library would call with it — the models each kind of call chooses (ChooseCall), and those of the hint without the work, both readers of a pair —, each by a request of the provider without any learner's content that costs nothing (provider.Model.Check). When none is open, the provider is closed to an own key at the profile, and no call goes. One wrong key is the end, then one model without rights, then a provider that did not answer. A refusal for a limit means the provider took the key, and the limit shows on the calls. The error says what failed, for the logs, and never holds the key.

func (*Tutor) Choose

Choose chooses the models of a capability for a route (admission.Table.Select), the first entry of the capability whatever prompt it measured. A call of the library chooses by its kind, which names its prompt too (ChooseCall): that is the one api calls before an attempt, with the same answer the call gets while the config is the same. It takes only the models of the providers the config gives an adapter of: on the own key only those of the key's provider, and on platform AI only those of the providers it holds a key of. It refuses a route whose key does not fit it.

func (*Tutor) ChooseCall added in v0.1.24

func (t *Tutor) ChooseCall(c Call, r Route) (admission.Entry, admission.Answer, error)

ChooseCall chooses the models of a kind of call of the library for a route: of its capability, of the entries that measured its prompt (admission.Table.SelectPrompt; R70 spec). api calls it before an attempt, and the call before it calls a model. The entry holds only the models the call asks: the first alone for a call of one model.

func (*Tutor) Price added in v0.1.24

func (t *Tutor) Price(c Call, r Route) (CallPrice, admission.Answer, error)

Price is the price of a kind of call on a route, by the models ChooseCall chooses and the prices of their adapters, with the admission's answer: a refused route has no price. The prices need no key, and a client made with none calls nothing, so the own key is not dialled for them.

func (*Tutor) Prices added in v0.1.24

func (t *Tutor) Prices() ([]ModelPrice, error)

Prices are the table of prices (architecture 3.7): each model of the list of admitted models whose provider the config gives an adapter of, once, in the order of the list. It grows from the prices of the adapters rather than standing beside them as a second copy.

func (*Tutor) ReadEssay added in v0.1.24

func (t *Tutor) ReadEssay(ctx context.Context, r EssayReading) EssayRead

ReadEssay reads an essay by the one model admitted for reading handwriting with the prompt of the reading of an essay (R68 spec, second amendment of 2026-11-01; R53). The pair of the reading of a sheet measured another prompt and admits nothing of this one (R70 spec): until an entry of the list measured it, the reading is NotAdmitted. A word that cannot be made out has no field of its own until the measurement on the essays of volunteers (Т-37; П-16).

func (*Tutor) ReadSheet added in v0.1.16

func (t *Tutor) ReadSheet(ctx context.Context, r SheetReading) SheetRead

ReadSheet reads a handwriting sheet by the models admitted for reading handwriting, in parallel, each into the observation of the task's one answer slot bound anywhere (R86 spec; § 10 of spec's contracts text). The first version reads that slot alone: the sheets of the first modules have no other that AI reads (T115). A slot bound choice is no reading of AI: api gives the option tapped to module-kit. An answer that is no observation fails the reading, as a failure of AI does: there is no observation of a pair then (R86 spec).

func (*Tutor) ReadWorkbook added in v0.1.24

func (t *Tutor) ReadWorkbook(ctx context.Context, r WorkbookReading) WorkbookRead

ReadWorkbook reads the filled boxes of a workbook page by the models admitted for reading handwriting with the prompt of the workbook, in parallel, each into the observation of the page (R86 spec; § 10 of spec's contracts text). The pair admitted for the reading of a sheet measured another prompt, and admits nothing of this one (R70 spec): until an entry of the list measured the prompt of the workbook, the reading is NotAdmitted. A page with no filled box goes to no model. An answer that is no observation fails the reading, as a failure of AI does.

func (*Tutor) Words added in v0.1.18

func (t *Tutor) Words(ctx context.Context, w WordsRequest) WordsAnswer

Words asks the admitted model of the words for the analysis and the hint of a rung. With the work it serves the analysis of the steps and the hint, so both must be admitted, and the model is the analysis's; without it, the hint alone. A task without words, a crop that is no PNG of a sheet, a rung the ladder has not, a language with no tag and no style of presentation fail before any call; an answer off the schema, or naming a trap the request does not hold, fails the call.

type Usage

type Usage struct {
	Provider        admissionv0.Provider
	Model           string
	InputTokens     int64
	CacheWrites     []provider.CacheWrite
	CacheReadTokens int64
	OutputTokens    int64
	ThinkingTokens  int64
	Billed          bool
	USD             float64
	Priced          bool
}

Usage is a record of what one call of a model took (architecture 3.7): the provider and the model the provider says answered; the input tokens without the cache, those written to the cache by how long it keeps them and those read from it, which add up to the input with no token counted twice; the output tokens, and of them those spent thinking; whether those tokens are the call's whole bill (provider.Billed); and its cost in US dollars by the table of prices (Tutor.Prices) — at its worst when the tokens are not its whole bill —, which Priced says the prices hold. It is an estimate: the provider bills. It holds no content and no identifier, and may be written to logs (R09 spec).

type WordsAnswer added in v0.1.18

type WordsAnswer struct {
	Box      *observationv1.CropBox
	Trap     string
	Question string
	Outcome  Outcome
}

WordsAnswer is what the call of words gives, when Outcome is Answered: the box round the first mistake, in thousandths of the crop, the same message as an observation's (R86 spec), or nil when the model found none or saw no work; the trap of the request's that the mistake falls into, or empty; and the tutor's question.

type WordsRequest added in v0.1.18

type WordsRequest struct {
	Route      Route
	Task       *open.Task
	Crop       []byte
	Key        string
	Solution   []string
	Traps      []Trap
	Found      string
	Techniques []string
	Rung       int
	Language   string
	Style      string
	Asked      []string
}

WordsRequest is a call of the tutor's words (architecture 3.10, «разбор и подсказка»): the analysis of the steps and the hint of a rung, in one call, as architecture 4.1 of spec draws it.

  • Crop is the PNG of the crop of the work, sent again, as the server keeps none (R09 spec); nil when the learner asks to have the rung put another way, which sends no work (R82 spec);
  • Key and Solution are the task's, which the model sees here alone (R67 spec);
  • Traps are the task's traps that AI may name, with their descriptions, and Found the trap of the cell of the rung, which the program found by its value, or empty (R82 spec);
  • Techniques are the task's ways to solve it;
  • Rung is the rung api picked, 1 to 3; Language the module's language of explanations, by its tag; Style only what of the presentation style changes the words (Д74 RUN.md spec);
  • Asked are the questions the tutor has already asked on the task, in order (privacy 4 spec).

The words are checked by api for leaks and by words.Hint for their form, before they reach the learner; api gives the fallback text in their place when they fail (R70 spec).

type WorkbookRead added in v0.1.24

type WorkbookRead struct {
	Observations []*observationv1.Observation
	Outcome      Outcome
}

WorkbookRead is what a reading of a workbook page gives: the observation of each reader, in the order of the pair, over every box of the page — a blank one unreadable, blank —, when Outcome is Answered — module-kit joins them and gives the verdict (R86 spec) —, and otherwise none.

type WorkbookReading added in v0.1.24

type WorkbookReading struct {
	Route Route
	Task  *open.Task
	Boxes []BoxCrop
}

WorkbookReading is a workbook page to read (architecture 3.10, «чтение тетради»): the open view of its task, the crops of its filled boxes, and the route. A box the learner left blank has no crop and goes to no model (R86 spec). The model sees the crops and their places, never the line of an item nor the key.

Directories

Path Synopsis
Package admission is tutor's admission function (R57; architecture 3.9): one pure function that says whether the work of a learner of an age category may go to an AI provider on an AI route, for a capability of AI, by spec's admission table and the deployment facts an operator declares.
Package admission is tutor's admission function (R57; architecture 3.9): one pure function that says whether the work of a learner of an age category may go to an AI provider on an AI route, for a capability of AI, by spec's admission table and the deployment facts an operator declares.
cmd
tutor-eval command
Command tutor-eval is tutor's eval runner: it runs the AI capabilities on eval samples, on the same code that api calls, and reports how they did.
Command tutor-eval is tutor's eval runner: it runs the AI capabilities on eval samples, on the same code that api calls, and reports how they did.
internal
board
Package board is the check board: a local page where a person solves fixed tasks by hand, the models read the work and judge it, and the person marks whether each model was right.
Package board is the check board: a local page where a person solves fixed tasks by hand, the models read the work and judge it, and the person marks whether each model was right.
convert
Package convert writes the sheets of tutor-sample v0, the files the record mode of the board saved until T105, as samples of spec's eval protocol, the message Sample of novatrail.eval.v1 (R75): the author's sheets as a person's, at random by ID and by the author's writer's code, and the sheets code drew as the samples tutor-eval draw draws, to the byte, once the same code is found to draw them from the seed.
Package convert writes the sheets of tutor-sample v0, the files the record mode of the board saved until T105, as samples of spec's eval protocol, the message Sample of novatrail.eval.v1 (R75): the author's sheets as a person's, at random by ID and by the author's writer's code, and the sheets code drew as the samples tutor-eval draw draws, to the byte, once the same code is found to draw them from the seed.
essay
Package essay is the assessment of an essay by the module author's rubric in the measurement of epic E4 (T82; docs/architecture.md, 3.4, «Сочинения»): what a model sees of a synthetic essay.
Package essay is the assessment of an essay by the module author's rubric in the measurement of epic E4 (T82; docs/architecture.md, 3.4, «Сочинения»): what a model sees of a synthetic essay.
evalsample
Package evalsample is a sheet of the measurement as a sample file of spec's eval protocol, the message Sample of novatrail.eval.v1 (contracts/README.md of spec, sections 11 to 13; R93, R95 spec): Of writes a sheet that internal/synth drew as one, and Read reads one back into the sample that tutor's runner takes, internal/sample's, with what its plan sheet says and the protocol does not — the scenario, the planned erasure and the trap.
Package evalsample is a sheet of the measurement as a sample file of spec's eval protocol, the message Sample of novatrail.eval.v1 (contracts/README.md of spec, sections 11 to 13; R93, R95 spec): Of writes a sheet that internal/synth drew as one, and Read reads one back into the sample that tutor's runner takes, internal/sample's, with what its plan sheet says and the protocol does not — the scenario, the planned erasure and the trap.
gen
Package gen builds the synthetic sets of the extended measurement (T94; R50 in docs/decisions.md): pages of the workbook in the format tutor-workbook and essays in the format tutor-essays, as many as a run needs, each with its truth by construction.
Package gen builds the synthetic sets of the extended measurement (T94; R50 in docs/decisions.md): pages of the workbook in the format tutor-workbook and essays in the format tutor-essays, as many as a run needs, each with its truth by construction.
hint
Package hint is the call of the review and the hint (T74; docs/architecture.md, 3.4, «Подсказка»): once the program has found the final answer not yet right, a model finds the first mistake in the work and words the tutor's question for the rung of the hint ladder that the program chose, in one call, as architecture 4.1 spec draws it (R28).
Package hint is the call of the review and the hint (T74; docs/architecture.md, 3.4, «Подсказка»): once the program has found the final answer not yet right, a model finds the first mistake in the work and words the tutor's question for the rung of the hint ladder that the program chose, in one call, as architecture 4.1 spec draws it (R28).
journal
Package journal tells how a sheet was written, for the forms of the measurement that show the model the writing process (R11, R24): a journal of numbered steps in English, and up to two frames of the sheet just before erasures.
Package journal tells how a sheet was written, for the forms of the measurement that show the model the writing process (R11, R24): a journal of numbered steps in English, and up to two frames of the sheet just before erasures.
judge
Package judge holds what the measurement asks of a model and how it reads the answer (R24): the judge's instructions, the request of each form, and the schema of the answer.
Package judge holds what the measurement asks of a model and how it reads the answer (R24): the judge's instructions, the request of each form, and the schema of the answer.
leak
Package leak is the leak check of the module format (R57 spec; the format text of spec, section 20, «The leak check»): the program's search for the answer in a text the learner will see, the tutor's words before they reach the learner.
Package leak is the leak check of the module format (R57 spec; the format text of spec, section 20, «The leak check»): the program's search for the answer in a text the learner will see, the tutor's words before they reach the learner.
lines
Package lines finds the lines of a sheet: the strokes that stand at one height, told apart by the gaps between them down the sheet.
Package lines finds the lines of a sheet: the strokes that stand at one height, told apart by the gaps between them down the sheet.
measure
Package measure is the judge's kind of call on the runner (T67): the measurement of the writing process (R24).
Package measure is the judge's kind of call on the runner (T67): the measurement of the writing process (R24).
newfile
Package newfile writes the files tutor's tools keep: each a new file, never one written over.
Package newfile writes the files tutor's tools keep: each a new file, never one written over.
openview
Package openview builds the open views of the measurement's tasks: the file that tutor's release carries for canvas's sample page, until modules has content (T37; R64 in docs/decisions.md; the 2026-10-21 amendment to R25 spec).
Package openview builds the open views of the measurement's tasks: the file that tutor's release carries for canvas's sample page, until modules has content (T37; R64 in docs/decisions.md; the 2026-10-21 amendment to R25 spec).
protocol
Package protocol is spec's eval protocol in tutor's code: the package novatrail.eval.v1, whose messages Sample and Report are the sample file and the runner's report (contracts/README.md of spec, sections 11 and 14; R93, R95 spec).
Package protocol is spec's eval protocol in tutor's code: the package novatrail.eval.v1, whose messages Sample and Report are the sample file and the runner's report (contracts/README.md of spec, sections 11 and 14; R93, R95 spec).
protocol/protocoltest
Package protocoltest gives tests spec's examples of the eval protocol: the synthetic sample files and reports of contracts/examples/eval/v1/ (contracts/README.md of spec, sections 11 and 14).
Package protocoltest gives tests spec's examples of the eval protocol: the synthetic sample files and reports of contracts/examples/eval/v1/ (contracts/README.md of spec, sections 11 and 14).
reading
Package reading is the reading of a sheet into an observation (T68; docs/architecture.md, 3.4, «Чтение в наблюдение»): a model reads the work as it is written, part by part, and its final answer, without deciding whether it is right (concepts 9.1 spec).
Package reading is the reading of a sheet into an observation (T68; docs/architecture.md, 3.4, «Чтение в наблюдение»): a model reads the work as it is written, part by part, and its final answer, without deciding whether it is right (concepts 9.1 spec).
render
Package render draws a sheet of handwriting from its strokes, as the board shows it: ink of the board's pen, #111, 3 px wide with round ends and joins, on white, one pixel to a unit of the sheet.
Package render draws a sheet of handwriting from its strokes, as the board shows it: ink of the board's pen, #111, 3 px wide with round ends and joins, on white, one pixel to a unit of the sheet.
report
Package report turns the log of a run into the measurement's numbers and its criterion (R24; docs/architecture.md, 3.1, «Замер хода решения»), asking no model, and writes them as Markdown and CSV.
Package report turns the log of a run into the measurement's numbers and its criterion (R24; docs/architecture.md, 3.1, «Замер хода решения»), asking no model, and writes them as Markdown and CSV.
runner
Package runner runs the calls of a measurement, whatever their kind (T67): the judge of the writing process, and in epic E4 also reading, the hint, the cells of the workbook and the rubric (docs/architecture.md, 3.4).
Package runner runs the calls of a measurement, whatever their kind (T67): the judge of the writing process, and in epic E4 also reading, the hint, the cells of the workbook and the rubric (docs/architecture.md, 3.4).
sample
Package sample is the format of the reading measurement's samples, of its bank of tasks, of its sheet plan and of the split of its sheets: their types, how they are read from JSON and how they are checked.
Package sample is the format of the reading measurement's samples, of its bank of tasks, of its sheet plan and of the split of its sheets: their types, how they are read from JSON and how they are checked.
samplecheck
Package samplecheck holds sample files of the eval protocol to the rules of sections 11 and 12 of spec's text of the contracts by spec's own code, its recipe sample-check, as section 13 has the runner refuse a sample "which the runner holds by the same code as sample-check": a repository other than spec MUST NOT write a check of its own (R93 spec; R69).
Package samplecheck holds sample files of the eval protocol to the rules of sections 11 and 12 of spec's text of the contracts by spec's own code, its recipe sample-check, as section 13 has the runner refuse a sample "which the runner holds by the same code as sample-check": a repository other than spec MUST NOT write a check of its own (R93 spec; R69).
sheets
Package sheets reads the directory where the record mode of the board saves the measurement's sheets (R25), and tutor-eval draw the sheets it draws (R26), against the sheet plan: for each plan sheet its last file, read and checked as a sample.
Package sheets reads the directory where the record mode of the board saves the measurement's sheets (R25), and tutor-eval draw the sheets it draws (R26), against the sheet plan: for each plan sheet its last file, read and checked as a sample.
states
Package states chooses the states of a sheet for the reading of unfinished work (О-8, О-21; T69): the moments of the writing at which a device that read on its own, without the learner asking, would read, and what the sheet shows at each.
Package states chooses the states of a sheet for the reading of unfinished work (О-8, О-21; T69): the moments of the writing at which a device that read on its own, without the learner asking, would read, and what the sheet shows at each.
synth
Package synth draws synthetic samples and a synthetic bank of tasks for tests, and for the recording page until the measurement's own bank exists.
Package synth draws synthetic samples and a synthetic bank of tasks for tests, and for the recording page until the measurement's own bank exists.
task
Package task gives each task of tutor's measurements — a task of a bank, solved on a sheet; a page of the workbook; an essay — the task of spec's module format 0.3 it is, with its checks: formatv0.Task (T103; R68 in docs/decisions.md).
Package task gives each task of tutor's measurements — a task of a bank, solved on a sheet; a page of the workbook; an essay — the task of spec's module format 0.3 it is, with its checks: formatv0.Task (T103; R68 in docs/decisions.md).
value
Package value is how tutor reads a value as the module format's checks read it (R56 spec; the format text of spec, section 15, «Checks»): the normalization of steps 1 to 4, a number's value read in steps 1 to 5 and 7, and a text in a notation of number as a rational number, exactly.
Package value is how tutor reads a value as the module format's checks read it (R56 spec; the format text of spec, section 15, «Checks»): the normalization of steps 1 to 4, a number's value read in steps 1 to 5 and 7, and a text in a notation of number as a rational number, exactly.
wordsjudge
Package wordsjudge is the judge of the tutor's words (T118; docs/architecture.md, 3.4, «Набор слов»): a model that reads a hint of the set of the words and says whether it tells the learner's sex, keeps to the task, suits a child and takes up the note at the side of the work, if there is one.
Package wordsjudge is the judge of the tutor's words (T118; docs/architecture.md, 3.4, «Набор слов»): a model that reads a hint of the set of the words and says whether it tells the learner's sex, keeps to the task, suits a child and takes up the note at the side of the work, if there is one.
workbook
Package workbook is the measurement of the workbook in epic E4 (T78–T80; docs/architecture.md, 3.4, «Рабочая тетрадь»): its pages, which code draws in memory from eval/workbook.json, and the crop of each filled box, which is all a reading of the page sees (R53 spec, amendment of 2026-10-27): the ink of the box's strokes alone, cut by the rule of the eval protocol, without the box's frame and the print of its line.
Package workbook is the measurement of the workbook in epic E4 (T78–T80; docs/architecture.md, 3.4, «Рабочая тетрадь»): its pages, which code draws in memory from eval/workbook.json, and the crop of each filled box, which is all a reading of the page sees (R53 spec, amendment of 2026-10-27): the ink of the box's strokes alone, cut by the rule of the eval protocol, without the box's frame and the print of its line.
Package provider is the port through which tutor reaches the AI providers.
Package provider is the port through which tutor reaches the AI providers.
claude
Package claude is the adapter of Anthropic's Claude models, through the official Go SDK.
Package claude is the adapter of Anthropic's Claude models, through the official Go SDK.
claude/catalog
Package catalog is the Claude models the adapter of package provider/claude calls, and their prices and efforts, without Anthropic's SDK: the library and the eval runner name and price a model by it, so that whatever takes them takes the SDK only with the adapter itself (Д185 RUN.md spec; R90).
Package catalog is the Claude models the adapter of package provider/claude calls, and their prices and efforts, without Anthropic's SDK: the library and the eval runner name and price a model by it, so that whatever takes them takes the SDK only with the adapter itself (Д185 RUN.md spec; R90).
gpt
Package gpt is the adapter of OpenAI's GPT models, through the official Go SDK and the Responses API.
Package gpt is the adapter of OpenAI's GPT models, through the official Go SDK and the Responses API.
Package words holds the checks of the tutor's words that api makes before they reach the learner, beside the leak check (R70 spec; architecture 1 and 3.5): the form of a hint and the rule of feedback by a rubric.
Package words holds the checks of the tutor's words that api makes before they reach the learner, beside the leak check (R70 spec; architecture 1 and 3.5): the form of a hint and the rule of feedback by a rubric.

Jump to

Keyboard shortcuts

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