Home Quick Start Examples Downloads Resources Revision History FAQs

Overview of CQLi

CQLi is a fast, versatile, programmable commandline tool used to query and manipulate chess games, studies, or puzzles stored in PGN files.

CQLi employs the powerful yet accessible chess query language to identify matching games and positions with laser-like precision while supporting arbitrarily complex query criteria. Matched positions can be commented, tags may be added/removed/updated, and matching games can be split across multiple output files.

It may be employed for a variety of tasks including simple comment removal or tag population, searching for games containing comments or tags that match a regular expression, finding games or studies possessing thematic move sequences and complex positional patterns, and everything in between.

Its ability to explore positions resulting from moves not actually played allows it to be used to generate and solve different types of chess puzzles and find positions where e.g. checkmate was missed. Reverse move generation and unreachable position detection can be employed in retrograde themes such as retractor problems. The ability to interact with external programs using a language-agnostic extensibility mechanism provides limitless flexibility.

CQLi supports popular variants such as Chess 960, Crazyhouse, and Horde and supports querying the unique aspects of those variants. Native 64-bit binaries are available for Windows, macOS, and Linux.

A comprehensive PDF Reference Manual is provided which includes detailed examples of all the functionality supported by CQLi.

See Quick Start and Examples for more information.

The current version of CQLi is 1.0.6 which may be downloaded here.


CQLi can be used to optimally solve chess mazes:

Rook Maze in 17
Rook Maze in 17, J. Coakley, 2006
Knight Maze in 29
Knight Maze in 29, J. Coakley, 2020

See "Expository Examples" ⇒ "Generating and Solving Chess Problems" ⇒ "Chess Mazes" in the PDF Reference Manual for the query used to solve these mazes.


CQLi can find unreachable positions in puzzles/compositions:

Knight Maze in 29
John Selman, 1-2/1-2, 1941
Unreachable position (click for details) All of Black's missing pieces were captured
by White Pawns currently on the board but
missing trapped c8 Bishop could not have
been captured by one of these Pawns

CQLi is credited with discovering unreachable starting positions in dozens of compositions in the HHdbVII endgame study database. See "Imaginary Position Exploration" ⇒ "The legalposition and reachableposition Filters" in the PDF Reference Manual for more information.