Library: search, lists, collections

search — Search positions

Search positions in the database using combinable criteria.

./blunderdb search --db <path> [options]

Main options:

  • --db — Database (required).

  • --format — Output format: table, json or xgid (default: table).

  • --limit — Maximum number of results (0 = unlimited).

  • --offset — Skip the first n results before starting to count; together with --limit, this is pagination.

  • --export — Export results to a new database.

  • --query-help — Shows the list of tokens --query understands, and stops there. No database is opened: --db is unnecessary.

Available filters:

  • --decision — Decision type: checker or cube.

  • --dice — Dice roll. 5,3 matches positions where both dice match (any order). 5 matches positions where a 5 appears on either die (the second die value is ignored). Implies --decision checker when no --decision value is given.

  • --pip-min / --pip-max — Pip count difference range.

  • --winrate-min / --winrate-max — Win rate range (%).

  • --cube — Cube value.

  • --score1 / --score2 — Player scores.

  • --match-length — Match length.

  • --error-min — Threshold on what a mistake in the position costs: the gap between the best move and the second-best one, or the largest of the three cube errors. In equity points — --error-min 0.1 keeps positions where a mistake costs at least a tenth of a point. It says nothing about what was actually played there.

  • --move-error-min / --move-error-max — Threshold on the error of the move actually played by player 1. In thousandths of equity (millipoints): --move-error-min 50, i.e. a twentieth of a point. This is the E token of the search grammar, written as is.

  • --has-analysis — Only positions with analysis.

  • --off1-min / --off2-min — Minimum checkers off (player 1/2).

  • --match-ids — Filter by match IDs (comma-separated).

  • --tournament-ids — Filter by tournament IDs (comma-separated).

  • --position-ids — Filter by position IDs: range 2,7 (positions 2 to 7) or explicit semicolon-separated list 5;10;15.

  • --individual — Only positions imported on their own, that is, the ones you added yourself and not the ones a match import brought in.

  • --flagged — Only the positions flagged for study in the originating software (eXtreme Gammon flags). Not retroactive: matches already imported must be imported again to yield their flags.

  • --has-comment — Only the positions carrying a comment. The origin makes no difference: a note typed by hand and a comment brought in by a match import both count. Match or tournament comments are not consulted.

  • --no-comment — Only the positions without a comment. Mutually exclusive with --has-comment.

  • --comment-origin <o1,o2> — Only positions carrying a comment from these origins: user, xg, gnubg, bgf, unknown (co:).

  • --comment-author <name> — Only positions carrying a comment attributed to this name (full name, case ignored).

  • --phase <p1,p2> — Only positions in these game phases: opening, middlegame, race, bearoff (ph:).

  • --game-type <t1,t2> — Only positions of these game plans: race, bearin, crunch, backgame, acepoint, blitz, primevprime, mutualholding, holding, contact (gt:). Phase and plan are labels derived from the board, which blunderdb repair recomputes; an unknown value makes the command fail.

Corpus filters apply to the match where the position was encountered; each one is equivalent to a token of the query language (Search Filters):

  • --player <nom> — Matches in which this player played, on either side; case is ignored and * stands for any sequence of characters (pl"…"). With --seat-only, only the decisions made by this player (pl!"…").

  • --opponent <nom> — With --player, matches against this opponent; alone, a name on either side (op"…").

  • --tournament-name <nom> — Matches from tournaments of this name (tn"…").

  • --round <r1,r2> — Matches from these rounds (rd:).

  • --match-lengths <expr> — The match length: 7, 5,9, >5, <9 (ml). Not to be confused with --match-length, which goes with the position’s score.

  • --away <expr> — The points the player still needs, whatever the match length: 4, 2,5, >3, <5 (aw). Crawford and post-Crawford count as 1; money play never matches.

  • --opponent-away <expr> — The points the opponent still needs, in the same forms (AW).

  • --crawford <state> — game: the Crawford game (cr); post: the games after it (pcr).

  • --margin <expr> — The margin, in millipoints, between the best choice and the next one in the stored analysis: <20 (close decision), >100 (obvious), 20,60 (mg). A position without analysis or with a single candidate never matches.

  • --match-date <expr> — The match date: 2024, 2024-01..2024-12, >2024-06, <2024-06 (md); this is not the analysis date.

  • --pr <expr> — The PR of the match for the player who made the decision: >8, <5, 4,9 (pr).

  • --analysis <v1,v2> — Engines and depths of the recorded analysis: xg, gnubg, bgblitz, hedgehog, gammonnet, 3ply, 3ply+, book, rollout (ad:).

  • --cube-response <type> — A single type of cube decision: double (Double / No Double) or takepass (Take / Pass).

Warning

--error-min and --move-error-min do not measure the same thing and do not take the same unit: the factor is a thousand. The first is given in equity points (0.1), the other two in thousandths (100) — one point is worth 1000 thousandths. It is --move-error-min that answers “where did I go wrong”; --error-min answers “which positions were tricky”.

What search prints:

--format table (the default) gives one row per position: the identifier, the score, the cube value, the decision type, the dice, the best decision and its equity; these last two columns stay empty for a position without analysis. Then come Error, the equity lost by the decision played, on the position’s scale (points in money play, normalised equity at a match score): no analysis without analysis, - when the decision played is not among those analysed; Date, the day of the oldest match that reaches the position, otherwise the day it entered the database; Collections, the collections that contain it; Decks, the study decks (Anki) that hold a card of the position.

Found 5 position(s)

ID  Score  Cube  Type  Dice  Best Move  Equity  Error  Date        Collections  Decks
--  -----  ----  ----  ----  ---------  ------  -----  ----        -----------  -----
2   7-7    0     cube        No Double  -0.005  0.000  2023-11-26
4   7-7    0     cube        No Double  -0.027  0.000  2023-11-26
6   7-7    0     cube        No Double  -0.161  0.000  2023-11-26  Videau       Videau
8   7-7    0     cube        No Double  0.256   0.071  2023-11-26  Videau
10  7-7    0     cube        No Double  -0.234  0.000  2023-11-26

--format json gives an array of the same positions. The fields are id, xgid, score, cube, decision_type (checker or cube) and dice, always present; best_move and equity appear only if the position carries an analysis that fills them in. The list fields follow: analysed, played_error (null without analysis, or when the decision played is not among those analysed), date, collections and decks (the names, an empty list if none). The Found n position(s) line goes to the error output: standard output carries only the JSON.

[
  {
    "id": 5266,
    "score": [
      5,
      4
    ],
    "cube": 1,
    "decision_type": "checker",
    "dice": [
      4,
      3
    ],
    "best_move": "10/3",
    "equity": 0.565,
    "analysed": true,
    "played_error": 0.042,
    "date": "2023-11-26",
    "collections": [
      "Ouvertures"
    ],
    "decks": []
  }
]

--format xgid prints one XGID per line, prefixed with XGID=, and nothing else on standard output. The XGID recorded with the analysis is preferred, because it carries the match length of the source; failing that, it is regenerated from the board. The same XGID appears in the xgid field of the JSON.

The query language:

The flags above cover only some of the filters. --query gives access to the application’s query language — the one used by the command bar — and therefore to every filter that is not drawn on the board: move pattern, comment text, date added, equity, excluded dice, zones and blots.

The grammar is written in only one place, Search Filters. Its table gives every token, its form, and the search flag it corresponds to when one exists. This page does not repeat it.

./blunderdb search --db base.db --query 's p>30 E>50'
./blunderdb search --db base.db --query 's m"13/11" t"blunder" pl"Alice" T>2026/01/01'

Ranking a position’s neighbours goes through the same grammar: --query 's like42', alone or followed by other tokens to narrow the ranked set.

--query-help recalls the list without opening a database:

$ ./blunderdb search --query-help
blunderdb search --query — the interface's query language

A query is the same text the application's command bar takes:
  s cube p>30 E>50        cube decisions, 30+ pips behind, 50+ millipoints of error
  s m"13/11" T>2026/01/01 played 13/11, imported this year

Flags (no value):
  cube score   match the cube / the score of the position on the board
  d            match the decision type (checker or cube)
  …

Ranges — each takes x>n, x<n or xa,b (lower-case: you; upper-case: the opponent):
  p P          pip count difference / absolute pip count
  …
  E            error of the played move, in millipoints
  T            creation date, T>2026/01/01

Values:
  t"tag"       comment text (";" separates alternatives)
  …

--query replaces the filter flags rather than adding to them: combining them is refused, naming the offending flag. The flags that say where to search and how to display — --db, --format, --limit, --offset, --export — remain valid.

A token nothing recognises fails the command rather than narrowing the search in silence. Two limits follow from having no board on the command line: the checker pattern cannot be typed, and the five tokens that read the board — cube, score, d, D/D1 and x — compare here against an empty board. A search that needs one of them is written entirely in flags, since --query does not combine with them — for example, cube decisions at least 30 pips behind and wrong by at least 50 millipoints:

./blunderdb search --db base.db --decision cube --pip-min 30 --move-error-min 50

Examples:

./blunderdb search --db base.db --decision cube
./blunderdb search --db base.db --individual
./blunderdb search --db base.db --error-min 0.1
./blunderdb search --db base.db --tournament-ids 1 --export cubes.db

# 6-5 dans les deux ordres, puis un 6 sur l'un des deux dés
./blunderdb search --db base.db --dice 6,5
./blunderdb search --db base.db --dice 6

# Pagination
./blunderdb search --db base.db --format json --limit 10 --offset 20

list — List contents

Display database contents.

./blunderdb list --db <path> --type <type> [--limit <n>] [--offset <n>]

Types:

  • matches — Lists the imported matches, with their result: final score and winner, or unfinished when no player reached the match length.

  • tournaments — List of tournaments: name, date, venue, origin when known and number of matches.

  • positions — Lists the positions (10 by default; --offset <n> skips the first n). Each position carries the error of the decision played (or no analysis), its date and its collections and its study decks (a Decks: line, absent when there are none), like the output of search. Only the window shown is read, whatever the size of the database. With --format csv it becomes a tabular export: one row per position, with its XGID, phase, score, cube, pips and the derived analysis columns.

  • imports — The recorded imports, most recent first: id, date, format, source, matches imported / skipped / enriched, unreadable files and new positions. With --batch <id>, shows the full report of one import: flagged positions, positions with no analysis, the PR over that batch and its five worst decisions (see The import report).

  • stats — Performance statistics report: PR / Snowie ER / MWC (overall, checker, cube), rolling PR over the last N decisions, top blunders, breakdown by cube action and error magnitude histogram.

  • players — Comparison table, one row per player in the database: matches, wins/losses, counted decisions, overall / checker / cube PR, Snowie ER, errors, blunders and luck. This is the command-line counterpart of the Stats panel’s Players tab.

  • moves — Tabular export of the recorded moves, one per row, with the match they belong to repeated on every row: identifiers, date, players, length, move number and type, position, dice, played move, cube action, luck. --format csv required.

  • analyses — Tabular export of the stored analyses, one per row: engine, depth, best move and its equity, played move’s error, best cube action and its error, the six win rates. --format csv required.

  • tags — The database’s tag vocabulary: every #word written in a comment, with the number of positions carrying it, most used first. On a database with no tag at all, shows the recommended vocabulary rather than an empty list (see Tags). Accepts --format json and --format csv.

  • study — By game plan, the distinct positions reviewed in the Anki decks over the last --days days (default: 30) and the PR of the matches played before and since, each with its number of decisions; a PR based on fewer than ten decisions is shown as “—”. Three numbers side by side, not an effect: nothing accounts for opponents, format or dice. Accepts --format json and --format csv.

Tabular exports

Three types — positions, moves and analyses — export to CSV for a notebook, a spreadsheet or a script:

./blunderdb list --db base.db --type positions --format csv > positions.csv
./blunderdb list --db base.db --type moves     --format csv > moves.csv
./blunderdb list --db base.db --type analyses  --format csv > analyses.csv

--limit applies only if you pass it. Its default (10) exists so that a list printed to a terminal does not scroll the whole database past you; an export goes to a file read by a program, and silently truncating it at ten rows would be a trap nobody notices until the figures are wrong.

The columns are a contract. A notebook or a script written against these names must keep working: columns are added at the end, never renamed and never reordered. Every equity is in integer millipoints, because that is how they are stored and because a float in a CSV invites a locale to reformat it.

Parquet is not offered, and that is measured rather than dogmatic: a columnar library weighs several megabytes in a binary whose size is a tracked concern, while everything this export is for reads CSV in one line (pd.read_csv, polars.read_csv, read.csv, a spreadsheet). Parquet earns its keep on tens of millions of rows; a ten-year-old backgammon library holds a hundred thousand. If one day the difference is measurable on a real database, that measurement is what should reopen this.

An example Jupyter notebook comes with these exports (notebooks/blunderdb-analyse.ipynb in the repository): PR over time, the distribution of error magnitudes, the ten worst decisions with their XGID. It uses nothing but those three CSV files, and it is executed every night in continuous integration — a notebook nobody runs is a notebook that has stopped working without anybody noticing.

Options (stats type only):

  • --metric — Displayed metric: pr or mwc (default: pr).

  • --player — Restrict to the given player.

  • --tournament — Restrict to one or more tournament IDs (comma-separated).

  • --from — Start date (YYYY-MM-DD).

  • --to — End date (YYYY-MM-DD).

  • --decision-type — Decision type: all, checker or cube (default: all).

  • --top-blunders — Number of worst errors listed (default: 10).

  • --engine / --min-depth — Only counts decisions analysed by this engine (exact name, as recorded) or at this depth at least (in plies); also accepted by the players type.

  • --format — Output format: text or json (default: text).

Options (type matches only):

  • --query — Keeps only the matches where a player, the event, the venue, the round, the tournament or the date contains this text (case-insensitive).

  • --ids — Keep only these match identifiers, separated by commas (those printed by stats matches).

  • --sort — Order: date (default, most recent first), date_asc, length_asc, length_desc, player1, player1_desc, player2, player2_desc, tournament, tournament_desc, opponent, or by PR: pr1 / pr1_desc (player 1), pr2 / pr2_desc (player 2), pr_main / pr_main_desc (the main player, whichever seat he played, aliases included) and pr_opponent / pr_opponent_desc (his opponent). A match without that PR — no counted decision, or a match the main player did not play — comes last in both directions.

Filtering and sorting are done by the database, as in the Matches panel; the reported total is that of the retained matches. The server offers them on /v1/matches.list (text and sort fields) and /v1/matches.count.

Options (imports type only):

  • --batch — A batch id: shows its full report instead of the list.

  • --queue — With --batch: the batch’s study queue rather than its report — the positions worth a second look, in the order to walk them (see The study queue). The decisions that cost something first, then the positions flagged in the source tool, then the close cube decisions; a position appears only once.

  • --format — Output format: text or json (default: text).

The measured half of the report is recomputed on every call: a batch whose positions have since been analysed returns today’s figures, not those of the day it was imported.

Options (players type only):

  • --from / --to — Date bounds (YYYY-MM-DD), for instance the days of a competition.

  • --tournament — Restrict to one or more tournament IDs.

  • --format — Output format: text, json or csv (default: text).

--player and --decision-type do not apply to this type: the table covers every player and already splits checker and cube into separate columns.

Note

A dash “—” (an empty field in CSV) marks a value that was never measured, not to be confused with zero. That is the case for luck on any match imported before schema version 2.15.0, as well as for the formats that do not carry it (BGF, Jellyfish .mat): re-import the source files to obtain it. The luck_rolls column says how many rolls the average covers.

Each type prints one block per item, preceded by the total found. The final line says which window is shown, truncated by --limit (whose default value is 10 for positions) and shifted by --offset:

Found 3859 position(s):

ID: 1
  Score: 7-7
  Player on roll: 0
  Decision: Checker play

ID: 2
  Score: 7-7
  Player on roll: 0
  Decision: Cube action

…

(Showing 1-10 of 3859 positions, use --offset and --limit to see more)

Examples:

# Les imports enregistrés, puis le compte rendu de l'un d'eux
./blunderdb list --db base.db --type imports
./blunderdb list --db base.db --type imports --batch 3

./blunderdb list --db base.db --type stats
./blunderdb list --db base.db --type stats --metric mwc --player "Alice"
./blunderdb list --db base.db --type stats --decision-type checker --from 2026-01-01
./blunderdb list --db base.db --type stats --format json

# Un tableau par joueur, borné aux dates d'une compétition
./blunderdb list --db base.db --type players --from 2026-03-01 --to 2026-03-08
./blunderdb list --db base.db --type players --format csv

./blunderdb list --db base.db --type matches
./blunderdb list --db base.db --type positions --limit 20

collection — Manage collections

Manages collections, those sets of positions picked by hand in the GUI’s Collections panel. Each subcommand takes --db; list and show accept --format text (default), json or csv, like list.

./blunderdb collection <subcommand> [options]

Subcommands:

  • list — List of collections: id, name, number of positions, description.

  • show --id <id> — Positions of a collection: id, index (the 1-based number shown in the GUI’s status bar), score, decision type and XGID.

  • create --name <name> [--description <text>] [--query <query>] — Creates an empty collection or, with --query, a living collection from the start. A query containing a token that no rule recognises is refused before anything is written.

  • filter --id <id> --query <query> — Makes a collection living: its content becomes the result of a search, re-evaluated every time it is opened. The query is written in the application’s own search grammar (see Search Filters). --clear turns it back into a hand-made list, keeping the positions it already held.

  • freeze --id <id> — Freezes a living collection: the positions its query selects now become its content, and the query is cleared. Refused on a collection that is not living.

  • evaluate --id <id> [--limit <n>] [--format text|json] — Reads the position identifiers of a collection, replaying the query of a living collection now. The response is bounded by a declared ceiling of 5,000 positions (--limit lowers it) and always gives the actual number of positions and the truncated flag: never a silent truncation. In text mode, the identifiers go to standard output and the count to standard error.

  • pile [--position-id <id> | --xgid <XGID>] — Puts a position on the Pile (the “come back to this” collection), or takes it off when it is there; a position given by XGID that is not in the database is first written to it, as a position brought in on its own. Without a position, prints the Pile.

  • rename --id <id> --name <name> [--description <text>] — Renames a collection (the description is kept if not given).

  • delete --id <id> [--confirm] — Deletes a collection; its positions remain in the database.

  • export --id <id[,id…]> --out <file.db> [--analysis=false] [--comments=false] [--matches=false] [--transcriptions=false] [--aliases=false] [--watermark <text>] [--watermark-note <text>] [--password <password>] — Exports one or more collections to a new database file, through the same exporter as the graphical interface’s export window and as export --type database: the file also carries the matches in which the positions were played, with their transcriptions and the aliases of their players and events (see the export command for the watermark and the password).

  • suggest [--player <nom>] [--match <ids>] [--tournament <ids>] [--from <date>] [--to <date>] [--decision-type all|checker|cube] [--size <n>] [--collection <nom>] [--deck <nom>] [--format text|json] — Suggests reference positions among the errors of the filter: those whose lesson covers the most recoverable MWC of their neighbouring errors, with no near-duplicate and no position already handled (see positions de référence). --size defaults to 20, 50 at most. Nothing is written without --collection, which files the suggested positions in a new collection, or --deck, which turns them into an Anki deck. Each line gives the family, the score of a cube reference, the errors and matches it summarises, the MWC covered and its reason (which gives the figure counted when the lesson counts for half); --format json returns the same components.

The XGID shown by show is the one saved with the position’s analysis when it exists (BGF and XGP imports); otherwise it is generated from the board exactly as Copy position does in the GUI — the match length is then the larger of the two remaining scores, since a saved position does not retain the real one.

Examples:

./blunderdb collection list --db base.db

# Found 2 collection(s):
#
# ID  Name              Positions  Description
# --  ----              ---------  -----------
# 1   Ouvertures blitz  0          À revoir
# 2   Videaux ratés     0

A database with no collection answers No collections found in database and still exits with code 0.

./blunderdb collection show --db base.db --id 3 --format csv

./blunderdb collection create --db base.db --name "Ouvertures blitz"
./blunderdb collection rename --db base.db --id 3 --name "Ouvertures"
./blunderdb collection delete --db base.db --id 3 --confirm

# Exporter deux collections, marquées de leur origine
./blunderdb collection export --db base.db --id 3,4 --out ouvertures.db \
    --watermark "Cours de Jean Dupont - 12 mars 2026"

# Dix positions de référence d'Alice sur un tournoi, gardées en collection
./blunderdb collection suggest --db base.db --player "Alice" --tournament 4 \
    --size 10 --collection "Références : open de mars"

comment — The comments of a position

A position carries as many comments as you like, each attributed to its author (free text). A comment received in a watermarked export also carries its issuer’s signature: list shows it in the Signed by column — name, fingerprint, and (unverified) if it no longer matches what was signed —, and the provenance in the Origin column (empty for a comment written in blunderDB).

./blunderdb comment <sous-commande> --db <chemin> [options]

Subcommands:

  • add --position N --text T [--author A] — Adds a comment to position N, attributed to A (without --author, it has no author).

  • list [--position N] [--author A] — Lists the comments of a position, or of the whole database, optionally those of a single author.

Common options: --db (required); list accepts --format (text or json).

Examples:

./blunderdb comment add --db base.db --position 412 --text "Videau trop tôt" --author Alice
./blunderdb comment list --db base.db --position 412
./blunderdb comment list --db base.db --author Alice --format json

elsewhere — Elsewhere: a position in other databases

Looks up a position, by its Zobrist hash, in other database files passed to the same command, and returns for each what it knows about it: its analysis, its comments, the matches where the position was played (players, length, date, move played and its cost), and its closest positions (same ranking as the search like token, in rolls).

The cost of a move played elsewhere is judged with the error and blunder thresholds of the --db database, never with those of the database read: error, blunder, good, or unscored without analysis. An analysis made at a match score with a match equity table other than the current table of --db is flagged; its match costs are shown but not judged (other-met), as everywhere else in blunderDB. The other files are opened read-only: nothing is written to them, and a database in a read-only folder (network share, USB key, mount) is read as it stands, without creating a file beside it. A file that cannot be read (missing, of an earlier or later version, not a blunderDB database) is reported on a Not read: line under its name (error field in JSON) and skipped: the other files answer, and the command exits with a non-zero code only if none could be read. A file of an earlier version is refused (opening it once in blunderDB upgrades it), and so is a file of a later version (update blunderDB). Past 50 matches where the position was played, only the 50 latest imported are read: the output says so, with the total (matchesTotal and playsTruncated in JSON).

./blunderdb elsewhere --db <chemin> --other <fichier> [--other <fichier>...] (--position N | --xgid X | --zobrist H | --match N | --tournament N | --collection N | --lesson N) [options]

Options:

  • --db (required) — The database that judges: its thresholds and its equity table.

  • --other (required, repeatable) — A database file to search.

  • --position N — The position, by its identifier in --db.

  • --xgid X — The position, by its XGID.

  • --zobrist H — The position, by its hash (decimal); its neighbours are then searched only in the databases that hold it.

  • --match N, --tournament N, --collection N, --lesson N — Instead of a position, a match, a tournament, a collection or a lesson of --db: the command says whether each other base holds it, under the key where a copy would merge it (the match’s fingerprint, even imported from another format; the name otherwise), with its identifier there and what it holds (games, matches, positions or steps).

  • --neighbours N — Number of neighbours per database (default: 5, 0: none, at most 50).

  • --max-distance D — Discards neighbours more than D rolls away (0: two rolls, the most that is served; beyond that, refused).

  • --format — text (default) or json.

The daemon serves the same lookups across tenants: across.positionElsewhere and across.objectElsewhere (see Headless mode (server)).

Examples:

./blunderdb elsewhere --db moi.db --other club.db --position 412
./blunderdb elsewhere --db moi.db --other club.db --tournament 3
./blunderdb elsewhere --db moi.db --other a.db --other b.db --xgid "XGID=-b----E-C---eE---c-e----B-:0:0:1:52:0:0:0:0:10"
./blunderdb elsewhere --db moi.db --other club.db --zobrist 1234567890 --format json

trash — The trash

What was deleted, and what it takes to put it back. A delete is still a delete: a JSON snapshot of what disappears is written first, and nothing else in the database knows that table exists — no search filter, no statistic, no retention rule.

./blunderdb trash <sous-commande> --db <chemin> [options]

Subcommands:

  • list — What is in the trash, most recently deleted first.

  • restore --id N — Puts entry N back and removes it from the trash.

  • discard --id N — Drops entry N now, without restoring it.

  • empty [--older-than D] — Empties the trash, or only what is older than D days.

  • delete --kind K --id N — Deletes an object through the trash, so the gesture can be undone. K is position, collection, comment or match.

Common options: --db (required), --kind, --limit (default 50), --format (text or json). For list, --kind narrows the listing to one kind of object: position, collection, comment, match or anki_card.

Note

blunderdb delete still deletes with no net: a script that deletes a position expects it gone, and quietly leaving a snapshot behind would grow a file nobody asked to grow. trash delete is the one that keeps the undo.

Restoring a position goes back through the Zobrist deduplication: it never creates a duplicate. A restored position takes back its old number; if the same position has been saved in the meantime, that one is kept, and it receives what it lacks. A restored match also takes back its original number, with its games, its moves, its analyses and its positions; it is refused if another match holds that number or if a match with the same file fingerprint has been imported in the meantime. What a successful restore could not put back — a Direction slot taken or gone, a deleted tournament — is reported by a warning.

Anything older than thirty days is dropped by blunderdb vacuum — never on opening a database.

Examples:

# Supprimer une position en gardant l'annulation
./blunderdb trash delete --db base.db --kind position --id 412

# Voir la corbeille, puis remettre une entrée
./blunderdb trash list --db base.db
./blunderdb trash restore --db base.db --id 3

# Ne garder que ce qui a moins de trente jours
./blunderdb trash empty --db base.db --older-than 30