I published the Chess Mod this weekend, and it plays chess against you while your Claude Code session keeps running. It is a game, so it is easy to dismiss, but the way it gets Claude’s moves is the same mechanism any Mod has for asking the model something, and it is the only one that hands back the real token usage. So the board doubles as a meter.
// Detect dark theme var iframe = document.getElementById('tweet-2103887582002045065-146'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2103887582002045065&theme=dark" }
Install it and open the board
One command, and then a session with function hooks on:
npx claude-code-templates@latest --mod games/chess CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude It lands in .claude/skills/chess/, which Claude Code auto-loads as chess@skills-dir in a trusted project. Mods are early access: you need Claude Code 2.1.259 or newer, and the $ API can still move between releases. If /chess never shows up in the typeahead, the module did not load.
/chess opens the board, /chess black starts a game as Black, /chess stop closes the pane. Closing does not end the game, it just hides it. You move by clicking a piece and then a square (the picked square turns yellow, legal destinations go blue, captures go red) or by typing SAN or UCI in the field under the board: e4, Nf3, O-O, e2e4, e8=N. The full rules are enforced, including castling, en passant, promotion, the fifty-move rule, threefold repetition and insufficient material.
Where the pane draws depends on your layout. In the fullscreen renderer (/tui fullscreen, or CLAUDE_CODE_NO_FLICKER=1) the engine docks it beside the transcript, floor to ceiling, the same way /diff docks. On the classic renderer it sits above the prompt. Fullscreen wants a terminal at least 110 columns wide.
How Claude moves, and what the tokens mean
Claude’s move comes from $.model.fork: one completion over your session's own transcript, on your session's model, with tools denied. The prompt carries the position as FEN, the moves so far, and Claude's legal moves in SAN, and asks for one of them. Two things make that interesting. First, the fork shares the main thread's prompt cache. Second, it is the one model call a Mod can make that returns the API's own usage, so the numbers in the pane are reported, not estimated.
That is why a move in a fresh session reads around 48k tokens and nearly all of it is cache r. The fork re-reads your system prompt, your tools and your conversation out of the cache. in is the few hundred uncached tokens of the chess prompt itself, out is the handful Claude replies with, w is what got newly written to the cache. The headline number is the sum of all four, and cache reads bill at a fraction of normal input, so the headline is not a bill. The useful part is watching it grow as your session grows.
- A move that needed a retry, because Claude named something illegal, makes two calls and both land on that move.
- Nothing is written to your transcript. The fork’s prompt and reply stay out of the session’s JSONL.
- Before the session’s first turn there is no transcript to fork, so that move goes through
$.model.completeonfallbackModel(haikuby default) and costs a few hundred tokens instead. - If a call fails, or Claude still names no legal move after a retry, the pane plays a random legal move and says why, so the game never hangs on “Claude is thinking”.
Jev can play the other side
// Detect dark theme var iframe = document.getElementById('tweet-2103996879071752557-610'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2103996879071752557&theme=dark" }
Put a Jev key in the plugin’s options and Jev plays instead of Claude:
{ "pluginConfigs": { "chess@skills-dir": { "options": { "typesafeApiKey": "<your key>" } } } } Jev is TypeSafe’s System One decision model. It does not generate text. You hand it state and typed questions, and it returns calibrated answers: noul for a three-valued yes / no / unknown, choice for one option out of a set, score for a number. That constraint is the whole point here, because a chess move is a choice whose options are exactly the legal moves, each with a short description like "knight g1-f3, takes pawn, check". Jev cannot name an illegal move. Claude can, and sometimes does, which is what the retry path is for.
// Detect dark theme var iframe = document.getElementById('tweet-2101485309095514241-219'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2101485309095514241&theme=dark" }
The other difference is where the tokens go. Jev’s move is one HTTP request, not a fork: it reads none of your transcript and spends none of your Claude tokens. typesafeApiKey goes to TypeSafe's own API (POST api.typesafe.ai/v1/systemone, model jev-latest), gatewayApiKey goes to the Vercel AI Gateway (POST ai-gateway.vercel.sh/v4/ai/evaluation-model, model typesafe-ai/jev). With both set, TypeSafe wins, and provider forces one or keeps Claude. The pane shows whatever usage the response reports, and says "not reported" rather than guessing when it reports none. A failed request, or no answer inside timeoutMs (15 seconds), plays a random legal move.
One thing to be explicit about: with a Jev key set, the position and the move list are sent to that backend on every move of Jev’s. Nothing else from your session goes with them.
The options worth changing
Options are declared in the plugin manifest and set in /config, in user settings (~/.claude/settings.json) or in managed settings, under the plugin's full id. Project settings are not read for this. A value marked sensitive, like either API key, goes to the platform's secure credential store rather than into settings.json. With --plugin-dir the id is plain chess.
-
pieces:lettersinstead of the defaultunicode, if the glyphs are indistinguishable in your terminal font. -
board: the pane swaps the Unicode convention on dark themes. A Mod cannot see what an auto theme resolved to, so if your terminal is light under auto, setlighthere. -
columns: width asked for the docked pane, 30 to 100, default 40. -
fallbackModel: the model for that first pre-transcript move, defaulthaiku. -
timeoutMs: how long to wait for Jev, default 15000.
Is it worth installing? As a game, that is your call on a Saturday. As a way to see what a forked completion actually costs in a session you have been growing all day, it is the cheapest instrumentation I know of, and it never touches your files, your git state or your transcript.
Where the Mods live
- The Mod’s page, with the full document and the install command: Chess on aitmpl.com
- Jev Model Router, which takes the same Jev options and routes your real turns
- The rest of the catalog: aitmpl.com
You can follow me on my social media:
- Twitter (English): https://x.com/dani_avila7
- LinkedIn (Spanish): https://www.linkedin.com/in/daniel-avila-arias/
- Youtube (Spanish): https://www.youtube.com/@daniiielsan
- Instagram (Spanish): https://www.instagram.com/danielsan_avila/



