Skip to content

CLI ​

The duckdb-vectors command covers the whole life of a knowledge base with one flat list of commands, each doing one thing. Run duckdb-vectors --help to list them, duckdb-vectors <command> --help for the options of one command, and duckdb-vectors --version for the tag-derived package version.

Overview ​

The commands read the optional manifest .duckdb-vectors.yaml of the knowledge base, and honor the precedence flag > DUCKDB_VECTORS_* variable > manifest > default. Without a manifest, they behave as if every key had its default:

shell
$ cd my-kb && duckdb-vectors init           # writes .duckdb-vectors.yaml
$ duckdb-vectors annotate                   # contexts of every section and PDF page
$ duckdb-vectors index                      # pages, database, embeddings and tags come from the manifest
$ duckdb-vectors search "how do retries work?"
$ duckdb-vectors status                     # where the knowledge base stands, and the next command

Steps are never chained, so the cost of model calls stays explicit. A command that lacks an input, such as questions or a split, fails with the command that produces it.

Global options ​

OptionMeaning
--manifest PATHA manifest file, or a folder that holds .duckdb-vectors.yaml. Default: DUCKDB_VECTORS_MANIFEST, then a walk up from the current folder.
--versionPrint the version and exit.

Most commands also take --database (the DuckDB file), --embeddings (the model, such as local:minishlab/potion-multilingual-128M) and --output (json by default, or yaml). Every command writes its report on stdout and its progress and hints on stderr. The old spellings --db and --backend stay one release as hidden, deprecated aliases.

Exit codes ​

CodeMeaning
0Done.
1annotate --check found stale pages, or move-tags-to-* found a collision.
2Invalid usage, manifest or settings, or a missing SDK; the message names the key, the file or the extra to install.
3Batch jobs are pending: run the same command again later.

Commands ​

init ​

duckdb-vectors init [FOLDER] writes a commented manifest in FOLDER (default: the current folder). It refuses to overwrite one without --force. The file has the schema modeline, pages: ., recursive: true, database: vectors.duckdb, work: .duckdb-vectors, the default local: model, tags.fields filled with the reserved keys found in existing sidematter files, a commented annotation block with the attributes of each provider, and a commented batch block. It runs no model, downloads nothing and prints a hint to add .duckdb-vectors/ to .gitignore.

config ​

duckdb-vectors config prints the resolved settings, the origin of each value (flag, environment, manifest or default) and the provider attributes that are active. --schema prints the JSON Schema of the manifest.

status ​

duckdb-vectors status is to a knowledge base what git status is to a repository. It reports:

  • the manifest in use;
  • the pages, with those whose annotation is missing or stale;
  • the database: path, embeddings model, dimensions, chunks, tag fields and the pages not yet indexed;
  • the questions and their split, the batch jobs and the latest retrieval results;
  • the next command to run. --sources also lists the indexed sources. report stays one release as a hidden, deprecated alias.

index ​

duckdb-vectors index [FOLDER] chunks every Markdown and PDF file of the pages, embeds the chunks and writes them to the database. FOLDER is optional when the manifest names pages. It embeds only what changed since the last run, and never indexes the manifest, the work folder or the database file.

OptionMeaning
--database, --embeddingsThe database file and the embeddings model.
--recursive / --no-recursiveRecurse into sub-folders.
--tag-fieldTag to embed with each chunk, as label: $.path, read from the front matter or the sidematter file. Repeat for several tags.
--tag-bm25 / --no-tag-bm25Also match the tags in keyword search.
--no-batchEmbed online for one run, even with a batch section.

With a batch section and a bedrock: embeddings model, index exits with status 3 while batch jobs run.

duckdb-vectors search QUERY runs the hybrid search and prints the ranked hits. Options: --database, --embeddings, --top-k (default 20) and --output.

tags ​

duckdb-vectors tags measures which front matter tags help search and which only add noise. For each tag it reports the coverage, the cardinality, the entropy, the documents per value and the embedding separation, with an effective or decorative verdict. With --queries FILE, the verdict also checks that queries use the values of the tag. Tags come from --tag-field or tags.fields.

mcp ​

duckdb-vectors mcp serves retrieval as an MCP server over stdio; see the MCP reference. With --manifest, the server takes its database, embeddings model and tags from the manifest. With --index FOLDER, it indexes that folder into the database before serving, so a client can launch a self-contained server. Indexing is incremental, and the database file is locked only for the brief lookup and writes. Options: --database, --embeddings, --index, --recursive.

annotate ​

duckdb-vectors annotate writes the context of every section of each Markdown page and of every page of each PDF file, in one run. It needs annotation.model; see the generation procedure.

OptionMeaning
--checkList the pages whose crc is missing or stale, with no model call. Exit 1 if there are any.
--from-pack PACKApply the contexts of an earlier run, a contexts.json that may be gzipped, instead of calling the model.
--dry-runWrite the contexts to contexts.json in the work folder only.
--forceIgnore the page crc and write every page again.
--no-batchSend the requests online for one run.
--write-tosidematter (default) or frontmatter.
--model, --workers, --max-document-charsOverride the annotation keys.

move-tags-to-sidematter ​

duckdb-vectors move-tags-to-sidematter moves the generated keys (retrieval, sections, crc) from the front matter of each page into its sidematter file. --dry-run writes nothing. A collision leaves that page unchanged and exits with status 1.

move-tags-to-frontmatter ​

duckdb-vectors move-tags-to-frontmatter moves the same keys back from the sidematter file of each page into its front matter, with the same options and exit codes.

generate-questions ​

duckdb-vectors generate-questions writes test questions with reference answers, from single passages (--local N) and from near-identical passages of different pages (--contextual N). Other options: --min-words (shortest passage, default 60), --per-chunk, --seed, --embeddings (the model that mines near-identical passages). It needs annotation.model.

import-questions ​

duckdb-vectors import-questions FILE adds real questions, one per line.

split-questions ​

duckdb-vectors split-questions freezes a dev/test split by page, with a digest. Options: --dev-share (default 0.3), --seed, and --force, which voids earlier test results.

pool-passages ​

duckdb-vectors pool-passages collects the top passages of several search systems for every question. Options: --system (an embeddings model, repeat for several; default: the manifest's, else two local models), --tag-field, --depth (default 20).

judge-passages ​

duckdb-vectors judge-passages has the generation model grade every pooled passage 0, 1 or 2. Options: --workers, --no-batch. It exits with status 3 while batch jobs run.

audit-judge ​

duckdb-vectors audit-judge writes a blind sheet of graded passages for a person to grade, and a key file with the grades of the judge. Options: --size (default 200), --seed, --sheet.

score-audit ​

duckdb-vectors score-audit measures the agreement of the person with the judge, as Cohen's kappa. Option: --sheet.

evaluate-retrieval ​

duckdb-vectors evaluate-retrieval scores retrieval with and without the tags of the manifest, on the judged questions, and writes the results to results/ in the work folder. When the knowledge base is in a git work tree, it records the git state.

OptionMeaning
--splitdev, test (default) or all.
--tags NAME=spec;specAn extra tag set. Repeat for several.
--free-tagsAdd the tag sets T, H, P, TH and THNAME from the reserved keys.
--placementsembedding, bm25 or both; default: all three.
--index-dirKeep one index per model and condition here, and reuse it by etag.
--time-embeddingRecord the uncached time to embed the texts of each condition.
--strata, --top-kStrata to score, and the values of k.
--results PATHWrite the result file here.

Which command replaces which? ​

Former invocationCommand
duckdb-vectors reportstatus
make kb-contextannotate
make kb-context KB_ARGS=--checkannotate --check
make kb-sidemattermove-tags-to-sidematter
make kb-sidematter KB_ARGS=--reversemove-tags-to-frontmatter
make kb-validation STEP=localgenerate-questions --local N
make kb-validation STEP=contextualgenerate-questions --contextual N
make kb-validation STEP=importimport-questions FILE
make kb-validation STEP=splitsplit-questions
make kb-validation STEP=poolpool-passages
make kb-validation STEP=judgejudge-passages
make kb-validation STEP=auditaudit-judge
make kb-validation STEP=kappascore-audit
make kb-evaluateevaluate-retrieval
make kb-batch STEP=submit|status|fetchnone: run the command that queued the requests again, and read status
make kb-tagsnone: page-level tag classification was removed

See also ​