Self-hosted chess tutor
Chess Tutor
A chess tutor where the engine establishes every fact, lessons are pitched to how players at your rating really play, and a local model only puts the engine’s facts into words.
what it does
The engine decides every fact
Moves, evaluations and tactics come from Stockfish and python-chess.
Graded without a model
Every answer is a square, a move or a count, checked exactly.
Pitched to how people at your rating play
Maia2 predicts the moves a player at your level picks; Stockfish says which of them hold.
The model only phrases engine facts
A sentence that names anything the engine did not establish is dropped. Token containment only; facts still have to carry their relations.
the engine’s facts
- Stockfish
- 5…Nxd5 costs about 8% of expected score, under the inaccuracy line. White’s point now is Nxf7 or d4, not the model’s O-O.
- Maia2 + Stockfish, a student at 1100
- Few players at this level survive the line. After the book move 5…Na5, most do.

The problem
I asked a capable local model three questions about a well-known opening position. It got all three wrong, including a capture of a pawn that was no longer there and the opponent’s threat given as the position’s tactic, and it sounded sure each time. A beginner cannot catch that.
How it fits together
- Phones and browsers, over a tailnet to Python app, a local service: “a move or an answer”
- Python app, a local service to Stockfish + python-chess: “position”
- Python app, a local service to Maia2: “position + rating”
- Stockfish + python-chess to Local model via llama.cpp: “facts only”
- Local model via llama.cpp to Names only engine facts?: “a sentence”
- Names only engine facts? to Commentary on the board: “yes”
- Python app, a local service to Glicko + FSRS: “exact grade”
- Glicko + FSRS to Postgres: “rating, schedule”
What I built
Stockfish and python-chess produce the facts: legal moves, evaluations, what a move leaves hanging, and which of the tutor’s chess concepts a position shows. I build questions from templates over those facts, and every answer a student gives is a square, a move or a count, so grading is exact and needs no model. A test makes sure no question gives away its own answer.
I gave the language model one job: turning the engine’s findings into a sentence of commentary while you watch a game. It runs locally through llama.cpp, so no hosted model API is involved.
I measure difficulty against the student. Maia2 predicts which moves a player at a given rating will actually choose, Stockfish decides which of those hold, and together they estimate whether you survive the position a move creates. An engine calls some moves playable that an 1100 player loses almost every time.
A Glicko rating over puzzles sets the level, and FSRS spaced repetition schedules concepts rather than positions, so a weakness comes back in a new position instead of one you have memorised. Puzzles come from the Lichess corpus. Each student’s history lives in Postgres. I run the app as a service on my own machine, reached from phones over a private tailnet, with a server-held clock for games between two phones.
How it turned out
Running and in use, with a puzzle ladder, coached games against Maia, historical chapters and two-phone play. Aggregate Watch drop-rate and student learning-outcome measurements are not yet collected.
- 710 → 2.1 ms
- to find puzzles near a rating, after cutting the Lichess corpus from 3.6 million puzzles to 242,537 in 64 MB.
Written about it
- Measure the student, not the moveAn engine says a move is fine. A 1100 player will still lose. A metric for that, and the checks that caught its instruments measuring themselves.12 min read
- The model never sees the boardIn my chess tutor, engines own every fact and a model only words them. A checker stops invented squares; only the facts can stop false relations.14 min read
- Gates that must be able to failA gate is only as good as its evidence. Five in my coding loop read a proxy, two of them one the loop wrote itself. Breaking the work on purpose shows which.15 min read
Built with
- Python
- Stockfish
- python-chess
- Maia2
- llama.cpp
- PostgreSQL
- FSRS