ChessRTK is a reproducible, zero-dependency Java 17 toolkit for chess research: drive UCI engines, mine tactical puzzles, convert/inspect analysis dumps, and export ML-ready datasets for AI experiments and training (currently emitted as tensor files) without needing a GUI.
CLI command: crtk
Built for:
- chess researchers / dataset builders / engine experimenters
- high-throughput, scriptable pipelines (CLI-first)
Not a:
- playing app or chess GUI
Diagram source: assets/crtk-pipeline-overview.dot (render with dot -Tpng -Gdpi=160 -o assets/crtk-pipeline-overview.png assets/crtk-pipeline-overview.dot).
Mine puzzles from a PGN (via FEN seeds) and convert the results to CSV + PGN:
crtk pgn-to-fens --input games.pgn --output seeds.txt
crtk mine-puzzles --input seeds.txt --output dump/run.json --engine-instances 4 --max-duration 60s
crtk record-to-csv --input dump/run.puzzles.json --output dump/run.puzzles.csv
crtk record-to-pgn --input dump/run.puzzles.json --output dump/run.puzzles.pgnDiagram source: assets/crtk-mining-gates.dot (render with dot -Tpng -Gdpi=100 -o assets/crtk-mining-gates.png assets/crtk-mining-gates.dot).
Other common primitives:
- Mine random seeds:
crtk mine-puzzles --random-count 200 --output dump/random.json(or endless with--random-infinite) - Validate movegen:
crtk perft --depth 5 - Engine probing:
crtk analyze --fen "<FEN>" --max-duration 2s,crtk bestmove --fen "<FEN>" --max-duration 200,crtk threats --fen "<FEN>" --max-duration 2s - Position inspection:
crtk print --fen "<FEN>",crtk display --fen "<FEN>" --special-arrows,crtk render --fen "<FEN>" --output dump/pos.png - Dataset export:
crtk record-to-dataset --input dump/run.puzzles.json --output training/puzzles
Diagram source: assets/crtk-position-toolbox.dot (render with dot -Tpng -Gdpi=160 -o assets/crtk-position-toolbox.png assets/crtk-position-toolbox.dot).
Agent-friendly shortcuts:
moves-uci,moves-san,moves-bothbestmove-uci,bestmove-san,bestmove-botheval-static,perft-suite,records,puzzles-to-pgn,pgn-to-fens
- Start here:
wiki/README.md - Commands:
wiki/command-reference.md - Examples:
wiki/example-commands.md - Config:
wiki/configuration.md - Mining:
wiki/mining.md - Datasets:
wiki/datasets.md - Filter DSL:
wiki/filter-dsl.md - AI agents & automation:
wiki/ai-agents.md
Requirements:
- Java 17+ JDK (needs
javac) - A UCI engine on
PATH(e.g. Stockfish) or configured viaconfig/*.engine.toml
Build (no Maven/Gradle):
mkdir -p out
javac --release 17 -d out $(find src -name "*.java")Run:
java -cp out application.Main help
java -cp out application.Main <command> [options]Linux convenience installer (Debian/Ubuntu):
./install.sh
crtk helpMore: wiki/build-and-install.md
mine-puzzles: evaluate lots of seeds (random /.txt/.pgn) and emit puzzles + non-puzzles JSONrecord-to-plain,record-to-csv,record-to-pgn: convert.recordanalysis dumps to.plain, CSV, or PGNrecords: merge/filter/split record files (with optional puzzle/DSL filtering)puzzles-to-pgn: convert mixed puzzle/non-puzzle dumps to PGN gamesrecord-to-dataset,stack-to-dataset: export tensors for AI training (features(N, 781))gen-fens: generate large shards of random legal FENsprint: pretty-print a FEN as ASCII (includes tags)display: open a small GUI board view (overlays + optional ablation)render: save a board image to disk (PNG/JPG/BMP)gpu-info: show LC0 GPU backend availability and device info (CUDA/ROCm/oneAPI)analyze,bestmove,threats: engine probing and tactical checks on a FENmoves,moves-uci,moves-san,moves-both: list legal moves for a FENbestmove-uci,bestmove-san,bestmove-both: best move shortcuts with fixed output formattags: list tags for a FENstats,stats-tags: summarize dumps or tag distributionsperft,perft-suite: validate move generation (single position or suite)pgn-to-fens: extract FEN seeds from PGN fileseval,eval-static: evaluate a position with LC0 or classical heuristicsclean: remove/clean derived artifactsconfig: show/validate resolved configuration
- Configuration:
wiki/configuration.md - Mining pipeline:
wiki/mining.md - Filter DSL:
wiki/filter-dsl.md - Outputs & logs:
wiki/outputs-and-logs.md - More examples:
wiki/example-commands.md
If you use ChessRTK in research, consider citing the repository and pinning a commit hash/tag for reproducibility.
ChessRTK supports two different “LC0” paths:
- LC0 as a UCI engine for mining (usually needs
.pb.gzweights): seewiki/lc0.md - Built-in Java LC0 evaluator for
eval/display/ablation (usesmodels/lc0_744706.bin): seewiki/lc0.mdandmodels/README.md
This repo includes an optional CUDA JNI backend under native/cuda/.
To build and package a CUDA-enabled Linux x86_64 release artifact:
scripts/make_release_linux_cuda.sh --version v0.0.0To include models/ in the release bundle:
scripts/make_release_linux_cuda.sh --version v0.0.0 --include-modelsOutputs:
dist/crtk-<version>-linux-x86_64-cuda.tar.gzdist/SHA256SUMS
A short list of proposed future subcommands and contributor tooling lives in wiki/roadmap.md.
See LICENSE.txt.


