Skip to content

Mentar

CI License: AGPL v3 Python 3.11+ Status: research preview

OSS-first AI tutor for children that supplements — never replaces — school education.

Local LLM hosting. Curriculum-templated by country and year level. Built-in kid safety from day one.

▶️ Want to run it? See docs/RUNNING.md — a 6-step quick start for Windows, macOS (incl. MacBook Pro M1 16 GB) and Linux — plus, at the end, the advanced path for using it from a tablet. There are also experimental single-file builds on the latest release — Windows x64, macOS Apple Silicon and Linux x64 (no Intel Mac build). Download one file, no Python install; they are unsigned, so your OS will warn you, and the language model is still downloaded on first run. RUNNING.md explains the trade-off before you pick.

⚠️ Research preview — supervised pilot only. Mentar is pre-1.0 and not ready for unsupervised use with real children (known safety gaps: no emergency-services signposting, handoff wording not yet professionally reviewed, no PIN gate). Use only with a parent/carer present. See SECURITY.md before running it with a child.


What it looks like

Two real sessions, recorded end-to-end against a locally-run model — same tutor, same safety model, pitched at the year being taught:

Year 5 Science Year 12 Maths Methods
Year 5 science: adaptations, then a Year-5-pitched explanation Year 12: combining quadratic expressions, with the computed working
Multiple-choice question, then an explanation built on a different example (a bird's feathers) so the answer on screen is never given away. Senior register — "terms with the exact same variable and exponent" — and the worked example ends in the computed answer, not a guess.

Nothing in those recordings is staged: the questions come from the generators, the marking from the deterministic verifier, the working from the engine. Only the prose is the model's. Regenerate them yourself with python3 scripts/record_demo.py (see the script's header).

First run starts small. Only the pilot and practice packs are on out of the box, so a fresh install would open on simple arithmetic — not the Year 12 algebra above. Setup now asks for your child's country and year up front and turns those packs on (157 are shipped, nothing to download) — see Setting it up below. You can change the answer at any time in ⚙️ Settings → Curriculum packs.

A Year 10 two-stage probability question — the child taps Show me how, and after the model's spoken-style explanation, a deterministic worked-example card lays out the branch tree (computed by the engine, not the model — it is always correct):

Ask for help Get the working
Asking for help on a Year 10 probability question Computed worked example with probability tree

The same tutor scales down to a Year 2 counting question, answers wrong answers with a gentle pointer back to the working rather than a red X, and tracks mastery on the curriculum's prerequisite graph:

Simple end of the range Wrong answer → gentle retry Progress map
Year 2 counting money Gentle retry Mastery map

Setting it up

Two questions, then a lesson. Mentar will not let a child start until a model actually answers, so the first screen is the one that connects it — and the second asks which year your child is in, so the tutor opens on the right material instead of the starter packs.

First run: Mentar redirects to setup, connects to a local model, asks which year the child is in, and opens on that year's subjects

  1. Point Mentar at a model. Anything you open before this redirects here. Option A is a model already running on the machine (Ollama, llama serve); Option B is one served elsewhere on your network; Option C is a cloud account, behind a written warning and a parent consent step.
  2. Press Save & Connect. It probes the backend there and then — no restart — and tells you what went wrong if it can't reach it, rather than failing later mid-lesson.
  3. Say which year your child is in. Picking Australia + Year 5 turns on that year's English, Maths and Science. Skippable, re-runnable, and changeable afterwards in Settings.
  4. Start. The subject cards are the child's home screen from then on.

Recorded against the real app; only the model's prose would differ on your machine. Full instructions, including installing a model from scratch and the tablet setup, are in docs/RUNNING.md.


What it is

Mentar is an open-source tutoring framework that lets parents run an AI tutor on their own hardware, with no data leaving the device and no per-seat API fees.

How it teaches — questions first, not lessons. Mentar is not a classroom-style course that lectures and then quizzes. Every session leads with real, checkable questions; teaching happens in response to the child's answers — explanations, worked examples and step-by-step method cards appear when a child is stuck or asks, and an adaptive model (BKT) decides what to ask next from what they have actually demonstrated. Test-to-learn, not lecture-to-test.

The core is three components:

  • Template engine — Markdown curriculum files per country + year/grade level, used as learning guidelines. Community-extensible.
  • Dialogue framework — Scaffolds tutoring conversations within the bounds of the active curriculum template.
  • Safety layer — Content guardrails and age-mode logic baked in, not bolted on. This is the non-negotiable bar the project must clear to justify existing.

How this is built — an honesty note

Mentar is, candidly, AI-built software. The great majority of the code, tests, and docs in this repo are written by AI agents working under a human maintainer's direction, decisions, and review — not hand-written by a person. In that sense it is close to "vibe coding," even though it follows deliberate engineering discipline: spec-first design, test-driven development (1240+ tests gating changes), design docs before code, versioned prompts, and code review. Those principles raise the quality bar — but they don't change that underlying fact, and we'd rather be upfront about it.

What this means for you:

  • The human makes the decisions (scope, safety thresholds, model choices, architecture); the AI executes and advises. Changes are test-gated and reviewed — but the author is AI.
  • It has not had a professional, independent audit. The child-safety code and spec are AI-authored and reviewed by AI plus the maintainer — not by a qualified safeguarding, security, or child-development professional. As an unfunded OSS project, Mentar cannot commission that review; it is actively sought pro-bono (there is a ready-to-hand SAFEGUARDING_REVIEW_PACKET.md for any professional willing to contribute) and gates unsupervised mode specifically — see docs/SAFETY.md §3.5.1.
  • Treat the project accordingly: carefully built and openly documented, but not yet independently verified. Read the code, run the tests, and do not put it in front of a real child outside a supervised pilot until the open safety items are closed.

Why local-first

Two reasons:

  1. Privacy — children's data never leaves the device (unless a parent explicitly opts in to a cloud LLM backend — off by default, consent-gated, see docs/SAFETY.md §4.5). No operator collects it. This is also a major compliance advantage (see compliance/).
  2. Cost — no per-seat API fees. A parent with a capable laptop or homelab machine pays nothing to run inference.

A paid hosted-inference tier (for non-technical parents) is a planned future bridge, but it carries its own heavier compliance obligations. The OSS local edition stays deliberately data-light by design.


Architecture

The codebase uses a Python src-layout (src/mentar/); specs and the safety spec live under docs/ (not in a top-level safety/). See docs/ARCHITECTURE.md for the authoritative layout.

mentar/
├── curriculum/              # Markdown curriculum templates (concept graphs)
│   ├── _template.md         # Authoring format for new curricula
│   ├── itembank/            # Frozen authored items (jsonl) for the pilot graph
│   ├── packs.json           # Pack registry (key → template dir + display name)
│   ├── visual_scaffolds/    # Per-topic visual-hint bundle (maths/english/science)
│   └── templates/
│       ├── AU_ACARA/        # Australian Curriculum v9 — maths Y1–12, English Y1–12,
│       │                    #   science Y1–10, plus senior splits (biology/chemistry/
│       │                    #   physics/earth-env, literature, maths methods/specialist/
│       │                    #   general/essential)
│       ├── IN_GENERIC/      # India board-agnostic — maths/English Classes 2–12,
│       │                    #   science 2–10, senior bio/chem/physics C11–12
│       ├── SG_GENERIC/      # Singapore board-agnostic — maths/English Primary 2 –
│       │                    #   Secondary 4, science P2–Sec 2, senior bio/chem/physics Sec 3–4
│       ├── US_GENERIC/      # US board-agnostic — maths/English Grades 2–12, science 2–8,
│       │                    #   then sequenced Biology G9, Chemistry G10, Physics G11
│       ├── _pilot/          # Phase-0 fractions/arithmetic/science pilot graph
│       └── practice/        # Country-agnostic evergreen practice content
├── prompts/                 # Versioned prompt templates + prompts/README.md registry (W6.2)
├── config/                  # Inference config example + the vetted model roster
├── scripts/                 # bootstrap, binary build, item-bank build, backend check, ZIM fetch,
│   │                        #   release_gate.sh (the full pre-push verification) + git-hooks/
├── src/mentar/              # Python package (src-layout)
│   ├── engine/              # Concept graph (KST), BKT mastery, fringe, probe classifier,
│   │                        #   item generators (see "How curriculum content is made" below)
│   ├── dialogue/            # Turn-loop controller (session state machine)
│   ├── safety/              # Safety-layer implementation (escalation, output guard, filters)
│   ├── grounding/           # ZIM reader + resolver + data-wrapper (retrieval grounding)
│   ├── inference/           # LLM abstraction layer (swappable backends)
│   ├── eval/                # Deterministic verifiers + model-eval harness
│   ├── db/                  # Local SQLite store (schema + access + adapter)
│   ├── tools/               # Template validator, doc-path checker, etc.
│   ├── cli/                 # Command-line entry points
│   └── web/                 # `mentar serve`'s Flask app (learner + parent views)
├── tests/                   # Mirrors the src/ layout
├── docs/                    # SPEC, PHASE0(+_STATUS), SAFETY, SESSION_FSM, ARCHITECTURE,
│                            #   TESTS, CONTENT_LICENSES, PILOT_CONSENT, design/, research/
├── compliance/              # Compliance coverage-status map (points back to docs/)
├── packaging/               # PyInstaller spec + entry point for the single-file binary
├── eval/                    # Eval harness configs; datasets/outputs are gitignored.
│                            #   eval/niah/ holds the needle-in-a-haystack retrieval configs —
│                            #   run-only: `needlehaystack` is installed on demand, not vendored
├── graphify-out/            # Generated knowledge-graph report (build output, not source)
└── .github/workflows/       # CI + the manual binary build

How curriculum content is actually made (read this before assuming what a ZIM download unlocks)

Every question a child sees today is hand-authored — a parametric formula (maths: e.g. random addition within a range) or a curated fact table (English/science: e.g. a synonym-pair list), written directly in Python and self-validated against hundreds of random draws before shipping. Grounding (the ZIM/retrieval machinery below) is wired to exactly one pack — the original 8-node Phase-0 fractions pilot. All of AU_ACARA / IN_GENERIC / SG_GENERIC / US_GENERIC / practice (every year, every subject) works today with zero ZIM download — there is no correlation between grade level and grounding need in the current build. Grounding, where it exists, only adds a quoted reference passage to an explanation — it never generates a question or decides correctness; that's always the deterministic verifier, never the LLM.

This is a deliberate, proven design for the content it covers (see docs/EXPLAIN_METHOD_AUDIT.md — a node-by-node audit, last run in full on 2026-08-11 when the curriculum was 319 nodes; it has not yet been re-run over the growth to today's 934), but it doesn't scale to broader/deeper subject coverage by itself — a hybrid direction (keep hand-authoring where it fits; add a retrieve→extract→verify→freeze pipeline sourced from real ZIM content for subjects that need it) has been ratified but not yet built — see docs/design/hybrid_content_architecture.md for the reasoning, including a live test showing why an ungrounded LLM can't just be asked for facts directly (a small model got a chemistry equation's final answer right while its shown reasoning was fabricated nonsense).

Licence note if you ever wire in Khan Academy ZIM content: Khan Academy is CC BY-NC-SA — fine for this local/personal edition, but the NC (non-commercial) clause blocks any paid or hosted tier built on it. See docs/CONTENT_LICENSES.md §3 for the full breakdown before building anything on top of it.

Codebase map: a Graphify-generated knowledge graph of the code's architecture lives in docs/CODEBASE_GRAPH.md — contributor material, kept out of this page so the README stays about the product.


Curriculum templates

Templates are simple Markdown files that define what topics a child at a given country + year level should be learning. They are guidelines, not scripts — the dialogue framework uses them to keep sessions on-topic and age-appropriate.

Shipping today (157 templates, 934 nodes). Read the counts, not the year ranges — a year listed below may hold as few as 3–7 topics, and an honest per-year gap report (currently: ZERO AU gaps) against the real strand structure is generated by python3 -m mentar.tools.audit_curriculum_coverage (reference: docs/design/curriculum_reference_au.json). Depth build-out is in progress, senior maths first:

Pack Coverage Alignment
AU_ACARA/ Maths Y1–10 (6–10 topics/yr, every reference strand covered) + senior courses: all four courses Y11–12: Essential (14 each), General (12 each), Methods (13–14 incl. the absorbed algebra nodes), Specialist (10 each) — all eight course-years COMPLETE vs the reference · English Y1–10 (5–8 topics/yr, every reference strand covered) + senior courses: Essential English, English (7–8 incl. absorbed nodes), Literature Y11–12 — all COMPLETE vs the reference · Science Y1–10 (4–8 topics/yr, every reference strand covered) · Physics (6–7), Chemistry (6–7), Biology (6 each) + Earth & Environmental Science (5+4) Y11–12 — every senior science subject-year COMPLETE vs the reference ACARA v9 (CC BY 4.0) for F–10; senior courses: none claimed
IN_GENERIC/ Maths + English Classes 2–12 · Science 2–10 · Physics/Chemistry/Biology 11–12 (now incl. the shared senior-science depth topics) None claimed — NCERT/CBSE/ICSE licences don't permit it
SG_GENERIC/ Maths + English Primary 2 – Secondary 4 · Science P2 – Sec 2 · Physics/Chemistry/Biology Sec 3–4 None claimed — Singapore MOE material is all-rights-reserved
US_GENERIC/ Maths + English Grades 2–12 · Science 2–8 · then sequenced: Biology G9, Chemistry G10, Physics G11 None claimed — Common Core's licence carries a purpose clause + trademark
_pilot/, practice/ Fractions pilot; country-agnostic practice n/a

Senior science is split into separate subjects because that is what a senior student actually enrols in — three in parallel (AU/IN/SG) or one per year in sequence (US). Junior years stay one combined "Science", because there they genuinely are combined.

The *_GENERIC packs deliberately claim no syllabus alignment — the level names are display labels, not assertions about what a country teaches in that year. Licence reasoning per pack: docs/CONTENT_LICENSES.md §2b.

Anyone can add a new country or year-level template. See curriculum/_template.md for the format.


Safety

Kid-safe content blocks and age-appropriate responses are non-negotiable and built in from the start. See docs/SAFETY.md for the full 6-layer spec (implementation lives in src/mentar/safety/).

Key commitments:

  • No dark patterns, no compulsive gamification mechanics (legal line under EU AI Act Article 5)
  • No emotion recognition or mood inference
  • Under-13: parent-mediated mode (parent in the loop, child never alone with AI)
  • 13+: more independent with parental oversight available
  • Hard block: model must never produce sexual content involving minors

Compliance

The OSS local edition is data-light by design, which removes most direct developer exposure under COPPA, GDPR-K, and similar frameworks. However, obligations are real and documented.

See compliance/README.md for coverage status — what's mapped, what's incomplete, and where contributors can help.


LLMs

Mentar is designed to work with smaller OSS models suited to educational dialogue. Low hallucination is critical for a children's tutor. The inference layer is abstracted so users can swap models.

Current evaluation status: see docs/llm-compatibility.md.

Hardware requirements: see docs/hardware-requirements.md.


Documentation

Full index: docs/index.md. Highlights:


Contributing

  • Add or improve a curriculum template under curriculum/templates/ (see curriculum/_template.md for the format)
  • Improve the safety spec in docs/SAFETY.md
  • Fill compliance gaps flagged in compliance/README.md
  • Test and document model compatibility in docs/llm-compatibility.md

Status

Phase 0 pilot underway (single-family, supervised): the end-to-end dialogue loop, local model evaluation + pick (gemma2:9b), safety pipeline, and learner data model are built and green, and the stack is now being exercised end-to-end on real family hardware (a base-M1 MacBook). That shakedown is doing its job: it surfaced — and fixed — a setup bug that halved the generation budget, a reasoning-model failure mode Ollama's think:false cannot switch off, and timeout/stop-button guarantees that only held on fast hardware. The 4 GB tier has its first full eval datapoint (qwen3.5:4b — viable, not the recommended minimum; docs/MODEL.md stays canonical for model choices).

What actually ships today (2026-08-26): 934 concept nodes across 157 curriculum templates — Australia (ACARA-aligned: maths Y1–12, English Y1–12, science Y1–10, with the senior years split into biology/chemistry/physics/earth-env, literature, and the four maths courses) plus three board-agnostic packs that claim no syllabus alignment (IN_GENERIC Classes 2–12, SG_GENERIC Primary 2–Secondary 4, US_GENERIC Grades 2–12 — each carrying senior biology/chemistry/physics; see the Curriculum templates table above for the exact per-subject ranges), a fractions pilot pack, and country-agnostic practice packs. Every question is generated by hand-authored Python (parametric formula or curated fact table) and scored by a deterministic verifier — the model explains, it never decides whether an answer is right.

Known limits, stated plainly: grounding (the ZIM retrieval layer) is wired to the fractions pilot pack only, not to any of the breadth above; the ratified hybrid content architecture that closes that gap is designed but not built (docs/design/hybrid_content_architecture.md). Unsupervised/independent mode (a child using it with no trusted adult present) stays out of bounds on the current safety implementation — its safety case needs two things this unfunded OSS project cannot commission (professionally-validated handoff wording + emergency-services signposting for the parent-is-the-harm case), and they are sought pro-bono, not funded. The supervised pilot is not blocked by that: its safety rests on a trusted adult being present. See docs/SAFETY.md §3.5.1 for the honest position.

Live status tracker: docs/PHASE0_STATUS.md.


License

AGPL-3.0-only (LICENSE). Free to use — including commercially — provided any version you distribute or run as a network service keeps its source open under the same terms. The network clause is deliberate child-safety policy, not ideology: nobody should be able to offer children a modified Mentar whose safety changes can't be inspected. Commercial licences outside the AGPL's terms are available from the maintainer; contributions go through a CLA so that stays possible. Full reasoning, stated honestly: LICENSING.md. Curriculum content licences are tracked separately in docs/CONTENT_LICENSES.md.


Author's Funny Thoughts

Plot twist: this is secretly an LLM training pipeline. The child is the model, the ZIMs are the corpus, the curriculum is the training schedule, BKT is the eval harness, and bedtime is the compute budget. An LLM built the training rig for a smaller, cuter model. Inception, but with more juice boxes.

About

OSS-first, local-first AI tutor for children — supplements school, never replaces it. No cloud, no accounts, no child data leaving the device.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages