knightly-review
Your nightly chess reps, made from your own games. knightly-review pulls your Lichess/Chess.com games, finds your mistakes with an engine, and turns the ones costing you the most wins into interactive Anki cards: openings, tactics and endgames.
Install
You need Anki 25.07 or newer on a computer (Windows, macOS or Linux). Older versions run Python 3.9, which the add-on no longer supports. Cards are made on the computer, and reach AnkiDroid, AnkiMobile and AnkiWeb through normal Anki sync.
-
Install the add-on. The easy way: in Anki, Tools → Add-ons → Get Add-ons…, paste the code 208769069 (the AnkiWeb page) and press OK. Or download knightly_review.ankiaddon from the latest release and double-click it, or use Tools → Add-ons → Install from file…. Then restart Anki (it only loads an add-on's code at startup, so an update needs a restart too). A sample deck, knightly-sample.apkg, is on the release page if you want to see the cards first.
-
A welcome window opens. Enter your Lichess and/or Chess.com username.
-
Check that Stockfish was found (it's required). If it isn't installed, its window offers two ways to get it:
| Your system |
Install it yourself |
Or let the add-on do it |
| Windows 10/11 |
winget install --id Stockfish.Stockfish -e (the add-on can run it for you) |
Download Stockfish for me |
| macOS |
brew install stockfish if you use Homebrew (the add-on can run it for you) |
Download Stockfish for me |
| Arch, Manjaro, EndeavourOS |
yay -S stockfish or paru -S stockfish (it's in the AUR, not the official repos; the add-on only shows this if yay or paru is installed) |
Download Stockfish for me |
| Debian, Ubuntu, Mint |
sudo apt install stockfish |
Download Stockfish for me |
| Fedora |
sudo dnf install stockfish |
Download Stockfish for me |
| openSUSE |
sudo zypper install stockfish |
Download Stockfish for me |
| Anything else (NixOS, Void, Alpine, RHEL…) |
your package manager, if it has Stockfish |
Download Stockfish for me |
Download Stockfish for me fetches the official build from the Stockfish GitHub releases, checks it, and keeps it inside the add-on's folder. No admin rights needed.
Stockfish does the analysis. Every position of your games is first searched until the grades it implies stop changing, and the ones that look like mistakes are then searched to the depth in the same box as its threads and hash size, with every legal move scored. A higher depth judges more accurately and takes longer. Stockfish is the only supported engine.
-
Save. The first update fetches your recent games and analyses them in the background (a few minutes; Anki stays usable). New cards appear in the Knightly Review deck.
After that, updates run when Anki starts and every few hours while it's open. Tools → Knightly Review → Update now runs one right away. Lichess: logging in (optional, in Settings) makes downloads faster; your password stays on lichess.org. Chess.com refreshes its game lists only a few times a day, so new Chess.com games can take a few hours to show up.
What it looks like
The card shows your game up to the mistake and asks for a better move. Right-click and drag on the board to draw your own arrows while you think; the card draws its own arrows too (the best move in green, your rejected move in red).


Get stuck and the hint button helps. Play the wrong move and the card shows the best one:
| Hint |
A wrong move |
 |
 |
Play the right moves and the puzzle is solved:

The back lists the alternatives, each graded with its line, with arrows for your move and the best one:

Where a line ends, the card says why (a decided game, a draw, a mate Stockfish sees, or several equally good moves). A position that came up by another move order is not written twice: the card continues from the line already written, so every path reaches the end of the puzzle. When the opponent could have played several good moves, the card shows the one it showed you least before (at random among equals).
| Card settings (⚙ on any card) |
On a phone |
 |
 |
In Anki's own windows
| Settings |
Finding or installing Stockfish |
Update progress |
 |
 |
 |
These pictures come from real Anki and the sample games in card/dev/samples.pgn. They are regenerated by node card/e2e/screenshots.mjs --anki (see card/e2e/README.md); without --anki the card pictures come from a headless browser instead.
Move grades (NAGs)
Every move on the back of a card has a grade, the standard chess annotation symbol (a NAG). The grade is how much win rate the move loses against the engine's best move. "Win rate" is the engine's expected score: wins plus half the draws, from its win/draw/loss estimate.
| Grade |
Name |
Meaning |
!! |
brilliant |
the only good move, and it sacrifices material |
□ |
only move |
the only good move, and not a sacrifice |
!? |
interesting |
a good move that gives up material, while another move is good too |
! |
good |
any other good move: within Good move (3 % by default) of the best |
?! |
inaccuracy |
not a good move; loses 5–10 % (the inaccuracy setting is where it starts) |
? |
mistake |
loses 10–20 % |
?? |
blunder |
loses more than 20 % |
- By default,
!!, □, ! and !? are accepted as answers; ?!, ? and ?? fail the puzzle. A move that loses a little more than a good move (between Good move and inaccuracy: 3–5 % by default) gets no mark: normal play, never a puzzle of its own, and not accepted by default (the card says something better was available; turn on acceptNeutral to accept it). Change which ones count with acceptNags (card/README.md).
- When the best move mates by force, a good move is one that keeps a forced mate, however long. A move that gives the mate up is
?! at best, even if the engine still calls the position won. Turn on strictMate to accept only the fastest mate.
- A sacrifice is a move that, once the captures after it are over, leaves at least 2 points of material (pawn 1, knight and bishop 3, rook 5, queen 9) below what you have now and below the move that keeps the most. A small built-in search counts it (captures and promotions only; checks that may follow are not followed), not Stockfish.
- The numbers beside moves (
+2.4, #3) are the engine's eval from White's point of view; #3 is mate in 3.
Settings
There are two places for settings. Tools → Knightly Review → Settings… controls how cards are made, and is saved in Anki's add-on config. ⚙ on a card controls how a card behaves while you review.
Settings window (making the cards)
| Setting |
Default |
What it does |
| Lichess / Chess.com |
empty |
Whose games to fetch. Either can be empty. Logging in to Lichess (optional) makes downloads faster. |
| Look back |
90 days |
How far back to fetch games. All time fetches everything; raising it later downloads the older games on the next update. |
| Stockfish: depth |
13 |
The depth of the full search that confirms a puzzle (every legal move scored). Higher is more accurate and slower. |
| Stockfish: threads, hash |
half the cores, 64 MB |
CPU threads and RAM for the engine. |
| Deck |
Knightly Review |
Where the new cards go. |
| New cards per update |
10 |
An update stops after this many new cards (between two notes, so it may go a little over). A mistake from a game can make several notes; if the limit stops one halfway, the next update finishes it. |
| Analysis per update |
10 min |
…or after this much engine time (0 = until the cards are found). The next update carries on from there. |
| After the update |
stop |
Keep analysing keeps analysing, ply by ply, in the background, so the next update adds puzzles right away. Keep adding cards goes on with no per-update limit. Both run the engine at full load (heat, fan, battery). |
| Opponents' mistakes |
off |
Also make cards from your opponents' mistakes, played from their side. |
| Update when Anki starts / every |
on / 6 h |
Automatic updates while Anki is open. |
| Good move: within |
3 % |
A move this close to the best (in win rate) counts as a correct answer. |
Not in the window, but in the add-on's config (Tools → Add-ons → Knightly Review → Config): time_classes (which time controls to fetch), rated_only, min_loss (the floor, default 3 %) and mad_k, which set how far above its game phase's usual loss a move must be to become a puzzle, and min_games with small_base (how many annotated games come first, and what to do while there are fewer). See addon/knightly_review/config.md for every key.
How puzzles are made: one way, ply by ply. For ply 0, 1, 2, … (half-moves played), your positions first and then, with Opponents' mistakes, your opponents' (each position once, however many games reached it). Every position was annotated before that, game by game (newest first, both sides' moves): searched with its two best lines until the grades they imply stop changing (from depth 6 on, the same answer at two depths in a row), the move played valued by its line or, when it isn't one of the two, by the position it leads to. Where a move you played looks like it loses more than half of its threshold, the position is searched in full, to Stockfish depth with one line per legal move so every move has an exact score from the same search, biggest losses first; it becomes a puzzle if the move loses more than its threshold and is not a good move. The threshold is the median loss of its game phase plus mad_k median absolute deviations, never under min_loss; mate positions are judged among themselves. No puzzles are made until min_games of your games are annotated completely. The next ply starts when none is left.
- A card is one move and the reply to it. A note has at most two cards: find the best move at a position (the opponent's reply is shown), and punish the mistake (the best move that is not good; the position after it, where you find the punishing move). A mistake from your games makes one such note for its own position and one for every later position of its solution tree where you must find a move, made from the end of the line towards the start (so new cards come due that way). A position that is a card already is never made again, whatever game or line reached it. The note's tags describe the first card only. A punishment card is left out when the game is already decided there.
- Stats from your games, like an opening explorer, on the back of each card (the position of the card you are reviewing): in how many of your games the position came up, how they ended (White / draw / Black, as on Lichess) and, for each move played from it (the six most played, the rest together), how many games it was played in and the same bar. Moves the analysis graded carry their mark (
!, ??…) and a green or red accent. Shown only for positions that came up in at least two different games, and refreshed on every update as games are added.
- Similar positions (same side to move, at most 2 squares different) don't get a note of their own. The first puzzle's note gets a comment for each correct answer instead, e.g. "g6 would also be a good move if the white bishop on c4 was on b5" or "Nf6 would still be a bad move if …".
Card settings (⚙ on a card)
These change how a card plays, per device or, with Save for all devices, for every device that syncs. The main ones:
| Setting |
Default |
What it does |
intro |
lastMove |
Animate the opponent's last move, or replay the whole game (fullGame). |
afterAnswer |
flip |
After the puzzle: show the back, stay on the front, or flip and then grade by itself (grade: Good if solved, Hard with hints, Again if failed). |
hints |
on |
The Hint button: a text hint if the card has one, then the piece to move. |
acceptNeutral |
off |
Also accept normal moves: no mark, between a good move and an inaccuracy. |
guessOnlyGameMove |
off |
On guess-the-move cards (another player's games), only the move they played counts. |
timed, timeLimit, timeAffects |
off, 30 s, nothing |
A clock while you think. Out of time can do nothing, fail the card, or grade a slow solve lower. |
showEval |
on |
The eval bar and numbers. |
All of them are listed in card/README.md.
Tags
Every note is tagged so you can search the browser or build filtered decks, for example tag:knightly::phase::endgame or tag:knightly::severity::blunder. Updates replace a note's knightly:: tags and keep your own.
| Tag |
Meaning |
knightly |
every note made by the add-on |
knightly::phase::opening / middlegame / endgame |
the game phase of the mistake |
knightly::site::lichess / chesscom |
where the game was played |
knightly::color::white / black |
the side you played |
knightly::time::blitz, rapid, … |
the time control |
knightly::result::win / draw / loss |
how the game ended for you |
knightly::rated / knightly::casual |
rated or casual |
knightly::opening::<family> |
the opening, e.g. sicilian-defense |
knightly::severity::blunder / mistake / inaccuracy |
the grade of the move you played: ??, ? or ?! |
knightly::motif::<motif> |
a tactical motif of the best move, e.g. fork, pin, back-rank-mate, mate-in-2 |
knightly::opponent |
the card comes from an opponent's mistake |
Each note also has one key tag that lets the next update find it again: knightly::puzzle::<ply>-<position hash>. Leave it alone, or the next update makes the note again. Notes made by earlier versions (one per game, opening or motif) are not touched or deleted; their positions are not offered again.
How it works
core/ Python package `knightly`: fetch games, analyse, pick mistakes, write notes (no Anki imports)
addon/ the Anki add-on: settings, scheduling, writing notes; bundles core/ and python-chess
card/ the interactive card (TypeScript), built into one media file
- Games come from the Lichess API (incremental, one request at a time) and the Chess.com archive API (each finished month downloaded once; the current month re-checked with ETags).
- Stockfish analyses in two steps, always with win/draw/loss output (
UCI_ShowWDL): every position of your games with its two best lines (MultiPV = 2), the search streamed and stopped once the grades it implies stop changing (or at a forced mate, or 4 million nodes), then a full search of the suspects to a fixed depth with one line per legal move (MultiPV = every move: with one line Stockfish prunes the moves it thinks are worse and only bounds their scores). "Win rate" everywhere means the engine's expected score: wins + draws / 2. Evals are cached in a SQLite file, shared by threads and processes.
- A move becomes a puzzle when it loses more than its threshold against the best move: the usual loss of its game phase (median plus
mad_k median absolute deviations, across the moves played there by you and your opponents, at or above the floor), never less than min_loss (3 %). There is no ceiling. The engine's WDL treats a position about 2 pawns up or down as already decided, so mistakes there barely register: puzzles come from the moments where the result was still in play. Positions are taken ply by ply, the biggest mistakes first. The full search grades every candidate move (!!, □, !?, !, ?!, ?, ??; see card/README.md) and gives the accepted alternatives on the back of the card.
- One note per position where you must find a move (at most two cards: the move, and punishing the mistake). Notes are tagged by phase, site, colour, time control, result, opening and how bad the mistake was (
knightly::…). Optionally (off by default), your opponents' mistakes become cards too, played from their side.
- The analysis follows the good moves of both sides, branch by branch, until the game is decided, drawn, a mate is in sight or the good moves stop being clearly better than the rest; every position of yours on the way where the choice matters becomes a note of its own. There is no engine on the card.
The add-on bundles only pure-Python code (python-chess and the core), so one file installs on every OS. Heavier work planned for later (personal engines that need ML libraries) will run in a separate helper process with its own Python, not inside Anki.
See card/README.md for the card and its PGN format, addon/README.md for building the add-on, and core/README.md for the command line.
Build from source
You need Python 3.11+ and Node.js 24+.
git clone https://github.com/NeTiFeSi/knightly-review.git && cd knightly-review
(cd card && npm ci && npm run build) # the card bundle and templates
python3 addon/build.py # addon/dist/knightly_review.ankiaddon
Command-line use, tests and the development setup are in CONTRIBUTING.md; changes are listed in CHANGELOG.md.
Known limitations
- Needs Anki 25.07 or newer on a computer. Cards are made on the computer only.
- The author develops and tests on Linux. The core's unit tests also run on Windows and macOS in CI, but the add-on's windows have not been tried by the author there. Please report problems.
- Tested on AnkiDroid 2.25. AnkiMobile and AnkiWeb get the cards through sync and have not been tested by the author.
- Only Stockfish is supported as an engine.
- Annotating a position takes under a tenth of a second on average (a whole game, a few seconds), but the full search of a suspect position does not: on a 10-thread desktop about 4 s at depth 13, about 20 s at depth 16 and about 27 s at depth 18 (the hardest positions take over a minute), and fewer threads are slower still. A note needs a number of those searches (its solution tree), so a middlegame puzzle takes a while to make. Updates carry on where the last one stopped, and every search is cached.
- New Chess.com games can take a few hours to appear, because Chess.com refreshes its game lists only a few times a day.
- Deleting a puzzle card does not remove the puzzle: it is made again at the next update. Suspend a card you don't want to see instead.
Licence
GNU Affero General Public License v3 or later (see LICENSE). The motif tagger in core/knightly/cook.py and cookutil.py is ported from lichess-puzzler (AGPL-3.0). Third-party code, data and artwork, and how the ported files differ from upstream, are listed in THIRD_PARTY_NOTICES.md.