How it works

How the coach explains a move without making it up

Most AI chess chatbots guess. Ours is handed verified facts first and is checked against the board afterwards. Here is the whole pipeline, with a real example.

Last updated

touch_appSolve it, then ask the coach why it works: this is the same lesson as the example below.

Step 1: Stockfish analyses the position, in your browser

When you ask the coach about a position, the first thing that runs is Stockfish, the strongest open-source chess engine, compiled to WebAssembly and running on your own device. It searches the position and returns the best line and an evaluation. No position is sent anywhere for this step.

Step 2: chess.js turns it into a fact sheet

Engines speak in numbers and move lists, and language models are poor at reading a board. So before any AI is involved, the chess.js rules library writes down what is objectively true in plain sentences:

  • every piece and its square, the material count and whose move it is;
  • which pieces defend and attack each piece, and which pieces are loose;
  • verified line-ups (two pieces on the same diagonal, file or rank with nothing between them);
  • every legal move, and whether the reply to the engine's move is forced;
  • the engine's best line, its evaluation in words, and the tactical theme of the best move.

Step 3: the AI may only explain those facts

The fact sheet goes to the language model with strict rules: use only the moves, pieces and squares in the facts; never claim a pin, a diagonal or a defender unless it is listed; never call a move forced unless it is the only legal one; describe the evaluation with the exact words given. Its job is to explain the idea, not to calculate.

Step 4: some claims are checked against the board

Rules alone are not enough, so parts of the reply are checked before you see it. A sentence that says a piece protects or attacks something it doesn't, puts a piece on the wrong square, or claims a pin the position doesn't have is removed. Other claims, such as whether a king is in check or how many pieces a side has, are not checked yet: we found the AI sometimes gets these wrong, and a stricter checker is being built. Until it ships, treat the explanation as built from Stockfish analysis, not verified by it.

A real example, side by side

1 · Position + engine

2 · Fact sheet (chess.js + Stockfish)

Side to move: White.
White: king g1, queen d1, pawn f2, pawn g2, pawn h2.
Black: king g8, rook a8, pawn g7, pawn h7.
Material: White 12, Black 7 (White up 5).
Loose/under-defended pieces: none.
Defenders and attackers (verified):
Black rook a8: defended by nothing; attacked by nothing.
White queen d1: defended by nothing; attacked by nothing.
Line-ups (verified geometry): Black rook a8 and Black king g8 are on the 8th rank (nothing between them); White queen d1 and White king g1 are on the 1st rank (nothing between them).
White's legal moves (27): pawn f2: f3, f4; pawn g2: g3, g4; pawn h2: h3, h4; queen d1: Qc2, Qb3+, Qa4, Qd2, Qd3, Qd4, Qd5+, Qd6, Qd7, Qd8+, Qe2, Qf3, Qg4, Qh5, Qe1, Qf1, Qc1, Qb1, Qa1; king g1: Kh1, Kf1.
Engine best line: 1.Qd5+ Kf8 2.Qxa8+ Kf7 3.h4 g6 — winning (+10.4) for White.
Best move theme: double attack.
After Qd5+, the opponent has 2 legal replies (the reply is NOT forced; the line shows the best one).

3 · What the coach said

The move Qd5+ checks the black king and at the same time attacks the rook on a8, so Black must deal with the check while the rook stays under fire. After the king moves, White can capture the undefended rook with Qxa8+, winning material and keeping a huge advantage. A good way to spot this pattern is to look for squares where the queen can give check and, from that same square, also hit a poorly defended piece—especially a rook or queen—so the opponent can’t parry both threats at once.
Lesson "Queen Fork". A real reply from the live coach, cached on 2026-11-06 and checked by hand against the board. The arrow is the engine's best move, Qd5+.

When the AI is unavailable

If the AI service is down, rate-limited or not configured, the coach falls back to a template explanation built only from the fact sheet: the best move, the evaluation in words, the theme, and what the move attacks. Less friendly, but never wrong, and lessons keep working.

What it can't do (yet)

The board check catches some concrete false claims (see step 4), but not all of them, and not vague ones. A reply can still explain an idea clumsily or give a weak reason for a correct move. That is why the engine's move is always shown next to the explanation, and why the coach names its source on every reply: the move is checked fact, the words are a coach's attempt to explain it.