Skip to content

Knowledge: knowledge/openingName, the opening of a line of moves (draft-1) - #35

Merged
cjus merged 1 commit into
mainfrom
claude/opening-name
Nov 18, 2026
Merged

cjus merged 1 commit into
mainfrom
claude/opening-name

Conversation

@cjus

@cjus cjus commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What

A proposed addition to the draft knowledge domain, behind a new capability switch, openingNames: knowledge/openingName.

  • Params: fen, where the line starts (four to six fields; the counters are ignored), and moves, the line's moves from it in UCI (at most MAX_LINE_MOVES = 1,024; an empty list names fen itself).
  • Answer: position, the position the line ends at, as knowledge/analyses identifies one. With it come eco, opening and ply for the last named position along the line: the end if a listed line ends there, or else the position before it, back to fen, as lichess.org names a game's opening. The three are there together or not at all.
  • Positions are matched by identity, not by move order, so a transposition is named too (D35 by 1. d4 Nf6 2. c4 e6 3. Nc3 d5).
  • An illegal position, or a move that isn't legal where it's played, is -32602.

The node answers from a list it holds itself, such as Lichess's chess-openings (CC0), not from imports. So it needs no import and no other switch.

Why

cjus/chessgui#755 (merged as cjus/chessgui#757) names openings in Solrac's Opening Explorer from the online service's answers. Solrac learns names only for the positions it looks up, so it shows no name after a skipped position, a jump, a panel opened late, or offline. Carlos asked for the follow-up: chessdb names any line from the list, through CNP. The node walks the whole line itself, so nothing gets skipped.

The answer depends on the whole line, not only where it ends. A client applies it only to the line it asked about; comparing position isn't enough. The spec and cnp's module docs say so.

Changed together (rule 1)

  • spec/knowledge.md: the capability, a "Naming openings" section with knowledge/openingName and its examples, the -32602 row, and "Changes".
  • cnp::knowledge: Capabilities::opening_names, MAX_LINE_MOVES, OpeningNameParams (with validate), OpeningNameResult (with name()), NameOpening.
  • Tests: the spec's new examples checked against the types, the switch (older nodes lack it), the params' shapes, and an answer leaving out what it hasn't got.
  • conformance/knowledge/opening-names.jsonl (requires knowledge.openingNames): C70 at 3... a6 with ply 6 through 4. Ba4 Nf6, the D35 transposition, the start with no name, an illegal move, a bad FEN. Its names are checked against Lichess's list as chessdb copies it.

All optional: a node that doesn't offer openingNames is unchanged. Adding a field to Capabilities means a program that builds one by naming every field adds opening_names when it next moves its pin.

Next

chessdb implements it (a table keyed by position, built from the list by its explorer-index tool), then Solrac's explorer asks chessdb for the name.

Checks

cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test, RUSTDOCFLAGS=-D\ warnings cargo doc --workspace --no-deps and cargo deny check pass locally on this commit.

🤖 Generated with Claude Code

…ft-1)

A node that offers openingNames names the last named position along a line
(fen + UCI moves) from a list it holds itself, such as Lichess's chess-openings
(CC0): position, and eco, opening and ply together or not at all. It needs no
import. For cjus/chessgui#755's follow-up: names offline, for any position,
with none skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjus
cjus merged commit c7fcb16 into main Nov 18, 2026
1 check passed
@cjus
cjus deleted the claude/opening-name branch November 18, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant