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:
$ 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 commandSteps 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
| Option | Meaning |
|---|---|
--manifest PATH | A manifest file, or a folder that holds .duckdb-vectors.yaml. Default: DUCKDB_VECTORS_MANIFEST, then a walk up from the current folder. |
--version | Print 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
| Code | Meaning |
|---|---|
| 0 | Done. |
| 1 | annotate --check found stale pages, or move-tags-to-* found a collision. |
| 2 | Invalid usage, manifest or settings, or a missing SDK; the message names the key, the file or the extra to install. |
| 3 | Batch 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.
--sourcesalso lists the indexed sources.reportstays 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.
| Option | Meaning |
|---|---|
--database, --embeddings | The database file and the embeddings model. |
--recursive / --no-recursive | Recurse into sub-folders. |
--tag-field | Tag 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-bm25 | Also match the tags in keyword search. |
--no-batch | Embed 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.
search
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.
| Option | Meaning |
|---|---|
--check | List the pages whose crc is missing or stale, with no model call. Exit 1 if there are any. |
--from-pack PACK | Apply the contexts of an earlier run, a contexts.json that may be gzipped, instead of calling the model. |
--dry-run | Write the contexts to contexts.json in the work folder only. |
--force | Ignore the page crc and write every page again. |
--no-batch | Send the requests online for one run. |
--write-to | sidematter (default) or frontmatter. |
--model, --workers, --max-document-chars | Override 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.
| Option | Meaning |
|---|---|
--split | dev, test (default) or all. |
--tags NAME=spec;spec | An extra tag set. Repeat for several. |
--free-tags | Add the tag sets T, H, P, TH and THNAME from the reserved keys. |
--placements | embedding, bm25 or both; default: all three. |
--index-dir | Keep one index per model and condition here, and reuse it by etag. |
--time-embedding | Record the uncached time to embed the texts of each condition. |
--strata, --top-k | Strata to score, and the values of k. |
--results PATH | Write the result file here. |
Which command replaces which?
| Former invocation | Command |
|---|---|
duckdb-vectors report | status |
make kb-context | annotate |
make kb-context KB_ARGS=--check | annotate --check |
make kb-sidematter | move-tags-to-sidematter |
make kb-sidematter KB_ARGS=--reverse | move-tags-to-frontmatter |
make kb-validation STEP=local | generate-questions --local N |
make kb-validation STEP=contextual | generate-questions --contextual N |
make kb-validation STEP=import | import-questions FILE |
make kb-validation STEP=split | split-questions |
make kb-validation STEP=pool | pool-passages |
make kb-validation STEP=judge | judge-passages |
make kb-validation STEP=audit | audit-judge |
make kb-validation STEP=kappa | score-audit |
make kb-evaluate | evaluate-retrieval |
make kb-batch STEP=submit|status|fetch | none: run the command that queued the requests again, and read status |
make kb-tags | none: page-level tag classification was removed |
See also
- Manifest reference: the keys that the commands read.
- Configuration reference: the
DUCKDB_VECTORS_*variables and the precedence. - Python API reference: the same operations from code.