/skardi:auto-contextfrom skardi
Indexes documents from folders, databases, or services (wiki, Notion, Confluence, Feishu, mailbox) into a hybrid vector+full-text search endpoint served by skardi-server. Supports SQLite, PostgreSQL+pgvector, MongoDB, or Lance storage.
Ships in skardi. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Your job: turn a corpus into a working retrieval surface, then answer questions from it. One flow; three ways raw material comes in, two places the index can live.
A server is not optional. Since the CLI was reframed as a thin HTTP client (skardi PR #170) it holds no query engine, no data-source registration, and no local execution mode. Every path in this skill starts a
skardi-server. Do not look for a CLI-only shortcut — there isn't one, and earlier versions of this skill that promised "no server, no Docker" are obsolete.
What must be new enough is the server, not the CLI. Ingest and search each do their work inside one server-side SQL statement: chunking via
chunk(), embedding viacandle()/gguf()/remote_embed(), and writing — one INSERT for ingest, inline embedding for vector and hybrid search. All of those UDFs are registered byskardi-server, so the only thing that matters is which features it was built with. The image that bundles them isghcr.io/skardilabs/skardi/skardi-server-full:0.7.0(--features rag); the olderskardi-server-embeddingimage does not registerchunk()and breaks the rendered pipelines.Pin the tag. Use
:0.7.0, the current released version — not:latest, which moves under you, and not a build frommain, which carries unreleased changes you cannot name in a bug report. This skill does not check theskardiCLI at all: it is a thin HTTP client, it is never invoked by these scripts, and its version says nothing about the server's UDFs.
Raw material and index storage are independent choices, and they read confusingly alike because both can involve "a database". This section is about where the source text comes from; the next section is about where the index lives. In particular: the "bring your own datastore" storage path stores the index in a new table created for that purpose — it never reads rows you already have. Reading rows you already have is this section's second entry, and it is read-only.
| Entry | The raw material is | The move |
|---|---|---|
| A folder (default) | files on disk | scripts/ingest_corpus.py --corpus ./docs (Step 3) |
| An existing table | rows that already hold the text — one row = one document | scripts/ingest_table.py (Step 3, table form) |
| Documents still inside a service | pages / docs / mail behind an API, fetched one at a time | the fetch-and-land process → a staging table → ingest_table.py. Flow and acceptance criteria in references/fetch_and_land.md |
All three converge on the same POST per document to /ingest-chunked/execute — same chunking, same embedding, same index, same search pipelines, same manifest. Only the first step differs, so a new source is never a reason for a second skill or a second index path.
The existing-table entry. The contract is three columns: a stable unique key, the text, and (ideally) a real locator — URL or path — for citations. ingest_table.py reads a SQLite file directly and strictly read-only; for a table in any other datastore, pipe rows in as NDJSON ({"key": …, "content": …, "source": …} per line) from whatever client already talks to it — psql with json_build_object, mongoexport, a five-line script. Rows are ingested as-is, with no front-matter stripping: by the time text is in a table, it is what gets indexed. Point it at a table that holds the text itself — a table of titles and hierarchy (what some source packs expose today) is a listing, not a corpus, and routes through the fetch-and-land process instead.
The fetch-first entry. Four stages: land the complete listing → fetch each body into a staging table → reconcile → ingest the table with --require-complete. This skill deliberately ships no per-source fetch code — your agent writes the walk for the source at hand — and the reconciliation is what makes that safe: how many documents the source holds, how many were actually fetched, and which ones are missing, by name, shown to the user before ingest. Under-fetching does not error — a missed page still yields a working index and well-cited answers — so the count is the only place a shortfall can surface.
Half of that is enforced and half is not, and the difference matters: --require-complete makes the tool refuse to index rows that were listed but never fetched, while the completeness of the listing cannot be checked from inside — a document that was never listed leaves no trace anywhere the tool can look. So it rests on the walk following the source's own end-of-listing signal, plus the evidence you report. Never fabricate an expected total to make the check look automatic. Full criteria in references/fetch_and_land.md.
Where the index lives. Decide it before rendering the workspace; together with the raw-material entry above it is the whole structure — everything downstream is identical.
| Local (default) | Bring your own datastore | |
|---|---|---|
| When | The user hands you raw material (a folder, a table, a source to fetch) and wants it searchable. No mention of where the index should live. | The user says "store it in our Postgres / Mongo / Lance", or wants several agents and processes hitting one shared surface. |
| Storage | A SQLite file this skill creates and owns, inside the workspace (<workspace>/kb.db) — canonical rows plus an FTS5 mirror plus a sqlite-vec vec0 mirror, kept in sync by triggers. | A table, collection or dataset the user created. |
| User supplies | The raw material (folder, table, or source to fetch). Nothing about storage. | Connection string, table name, credentials via env vars, and the schema itself. |
| Flag | nothing (--backend sqlite is the default) | --backend postgres --connection-string ... --table ... |
Do not ask which backend the user wants when they have not raised the topic. The local path exists so that "make this folder searchable" needs exactly one answer from them: where the folder is. Branch to the override path only when the user names existing infrastructure as the place the index should live. Naming a database as the place the raw material sits — "index the docs table in our postgres" — picks the table entry, not the override storage: read the rows out (NDJSON), index them wherever the storage decision says, default local.
Will do. Render ctx.yaml + semantics.yaml + the five pipeline YAMLs, start skardi-server, ingest raw material over HTTP — a folder of files, rows from an existing table, or documents your agent fetched and landed (the server chunks and embeds inline either way) — and route each question through /search-hybrid/execute or its single-signal siblings to a grounded answer.
Will not do — in a datastore the user owns. Create databases, create schemas, run CREATE EXTENSION, install drivers, or hand out credentials. On the override path the user provides every connection string, every credential, and the schema. If the schema does not exist, print the SQL the user must run in their own session and stop. Never run schema-creation DDL against a user-supplied connection without the user explicitly asking. A stray DROP can lose hours of someone else's work, and CREATE EXTENSION on managed Postgres often needs superuser the agent does not have anyway.
That limit does not apply to the local path. There the .db file is a workspace artifact this skill created; making tables, triggers and indexes inside it is the skill doing its own job, not touching the user's data. Deleting the workspace is a complete undo.
Will not write to a table handed over as raw material. The table entry opens SQLite sources read-only (URI mode=ro, enforced by SQLite itself); rows are read and nothing else — no writes, no schema changes, no journal files left behind. Landing fetched documents goes into a staging file the agent creates, never into a table the user owns, and never into kb.db (the server owns that file).
Will not carry per-source fetch code. How to walk a specific wiki, doc service or mailbox is written by your agent when needed, against the flow and acceptance criteria in references/fetch_and_land.md. The reconciliation there — listed vs fetched vs missing, by name, shown to the user — is mandatory, not advisory.
For testing the skill itself during development, disposable Docker containers are fine — that is not "the user's data".
Local path — two questions, sometimes fewer:
Override path — the two above, plus:
postgres (pgvector + pg_fts), mongo (mongo_knn + mongo_fts), or lance (lance_knn + lance_fts).PG_USER / PG_PASSWORD in the environment. Mongo: URI, DB and collection, MONGO_USER / MONGO_PASS. Lance: absolute path or s3:// URL.content (indexed for FTS) and embedding (vector type), so a single INSERT keeps both signals on the same row.Three UDFs, all returning List<Float32>, all slotting into the same pipeline shape. The right one depends on the deployment, not on habit. Skardi's own docs/embeddings/{candle,gguf,remote}/README.md is authoritative; the table is the shortcut.
| UDF | Signature | Reach for it when | Server build feature |
|---|---|---|---|
candle(model_dir, text) | local HuggingFace SafeTensors (BERT / RoBERTa / DistilBERT / Jina) | Local, simple deps, general English text. The default for self-hosted when the corpus fits on one box. Common: bge-small-en-v1.5 (384-d, ~130 MB), bge-base-en-v1.5 (768-d), bge-large-en-v1.5 (1024-d), all-MiniLM-L6-v2 (384-d, tiny), multilingual-e5-large (1024-d), jina-embeddings-v2-base-code (768-d) for code. Chinese: bge-small-zh-v1.5 (512-d), bge-base-zh-v1.5 (768-d), or multilingual-e5-large. Do not carry a dimension across the en/zh split — the two small models differ (384 vs 512), and setup_context.py now reads the model's own config.json and refuses a --embedding-dim that contradicts it. | bundled in --features rag, or --features candle |
gguf(model_dir, text) | local llama.cpp quantised weights | Local, RAM-constrained, or the model only ships as GGUF. Common: embeddinggemma-300m-qat-Q8_0.gguf (256-d), nomic-embed-text-v1.5 GGUF (768-d). Read the gguf note below before choosing this — it is the one backend with a build prerequisite. | --features gguf |
remote_embed(provider, model, text) | hosted API | No local compute, top-tier quality, willing to pay per call — and the corpus may leave the machine, see the note under this table. ('openai','text-embedding-3-small') 1536-d, ('openai','text-embedding-3-large') 3072-d, ('voyage','voyage-3') 1024-d, ('voyage','voyage-code-3') 1024-d for code, ('gemini','text-embedding-004') 768-d, ('mistral','mistral-embed') 1024-d. Each needs its key in the server environment. | --features remote-embed |
remote_embed sends the corpus off the machine — say so before choosing it. Embedding happens inside the ingest statement, so every chunk of every document is transmitted to the provider (OpenAI, Voyage, Google, Mistral) as request text. That is the whole corpus, not a sample, and it happens again for the query text on every vector or hybrid search. candle and gguf run the model in the server process and transmit nothing. This is a property of the corpus, not of the budget: for internal documents, customer records, unreleased work or anything under an agreement that restricts sub-processors, name the provider and get an explicit yes before you render the workspace — and prefer a local backend when the user has not raised the topic at all.
Decision rule. Local-only, or is a hosted API acceptable? If local, choose candle vs gguf on memory budget. Code corpus → voyage-code-3 or jina-embeddings-v2-base-code. Multilingual → multilingual-e5-large or text-embedding-3-large. Chinese corpus → a -zh bge model, and read the CJK notes under Step 3 and Step 4 first: chunk size and full-text search both behave differently. Chunks over 512 tokens → nomic-embed-text. Otherwise bge on candle. A 512-token cap interacts with --chunk-size, which is measured in characters — see the note under Step 3 before indexing a code or CJK corpus. For CJK the model choice is not the fix: every listed model still caps at 512 tokens, and CJK runs near 1 char/token, so --chunk-size has to come down regardless.
State the choice in one sentence, then move on — e.g. "Using candle('bge-small-en-v1.5') (384-d, local, ~130 MB) because your corpus is English markdown and you said no remote APIs."
Worth knowing before you pick gguf, because the collision has no workaround inside this skill:
--features gguf requires cmake and a C++ toolchain. gguf pulls in llama-cpp-4, whose build script compiles llama.cpp through cmake. Measured 2026-08-04 on a machine without it: cargo check -p skardi-server --features gguf fails at that build script with is 'cmake' not installed? and exits 101. candle has no such dependency — this is specific to gguf.skardi-server-full image already contains gguf (--features rag → embedding → gguf), so --runtime docker sidesteps the build entirely.--backend sqlite --runtime docker is refused (no Linux sqlite-vec in the image). So gguf on the local sqlite path means building the server yourself, with cmake installed. gguf with --backend postgres can use the image and needs no local toolchain.Model directory layout: point --model-path at a directory containing exactly one .gguf file, not at the file. The server scans the directory and treats both zero and two-or-more as errors, so a cloned GGUF repo with several quantisations side by side has to be split up first — setup_context.py now refuses that up front and names the files it found. Other files in the directory are ignored; the tokenizer comes from the GGUF's own metadata, not from a tokenizer.json beside it.
Runtime status: the paths above are verified — validation, rendered gguf('<dir>', content) SQL, and the failure you get on a server without gguf. Actual gguf embedding is still unverified on this machine, because it needs the cmake build.
The dimension must match the schema on the override path. If the user already created vector(1024), a 384-d model makes every INSERT fail. Once the table holds rows, changing the dim means rebuilding — there is no in-place fix. On the local path the table is created at the dimension you passed, not the model's — so a wrong --embedding-dim bites here too, just later: setup passes, the server starts, all five pipelines register, and every document fails at INSERT. Measured 2026-09-02: bge-small-zh-v1.5 declared as 384 gave 111/111 failures after 86 seconds. setup_context.py now compares the number against the model's config.json and stops in step 2 instead; an unreadable or unfamiliar config prints a note and leaves the number unverified rather than blocking the run.
Three runtimes, chosen by where the agent lives. Full detail in references/runtimes.md.
--runtime local-process (default) — skardi-server as a host process; prefers a release binary on PATH, falls back to cargo run. Laptops, dev, single user.--runtime docker — the official skardi-server-full image. Ships to teammates without asking them to compile Skardi. Only for the override path. --backend sqlite --runtime docker is refused, and that is a real incompatibility, not a missing flag: the container would need a Linux build of the sqlite-vec extension, the image does not ship one (verified 2026-08-04), and the host's copy is the wrong platform to mount in. Local storage means local process.--runtime kubernetes — renders Deployment + Service + ConfigMap into <workspace>/k8s/, optionally applies them. Right when the agent already runs in a cluster.One SQL statement per document does the whole job: chunk() splits, the embedding UDF embeds each chunk, and the INSERT commits them together. Nothing is embedded client-side, so a document either lands completely or not at all.
Chunk mode is fixed at setup time, baked into the rendered ingest pipeline by --chunk-mode (markdown by default, character for unstructured prose) and recorded in the workspace breadcrumb. It is deliberately not a per-request parameter, so an ingest run cannot quietly override the mode chosen at setup.
Verified end to end only on macOS Apple Silicon (v0.7.0, 2026-10-16). Native Windows is refused by every script; use WSL2. There is no skardi-server release binary on any platform, so --runtime local-process means a binary you built or cargo run; a rendered workspace is not portable across platforms. Before running on Linux or an Intel mac, read references/platforms.md.
Both were verified the hard way on 2026-08-04. Neither is optional, and both fail late and confusingly if skipped.
1. Run the scripts with a Python that can load SQLite extensions. The local path creates the vec0 virtual table, which needs the sqlite-vec extension, which needs sqlite3.Connection.enable_load_extension. macOS system Python (/usr/bin/python3) does not have it and setup dies at the schema step. Check before you start, and use the interpreter that passes:
python3 -c "import sqlite3; print(hasattr(sqlite3.connect(':memory:'), 'enable_load_extension'))" # must print True
# on macOS this usually means: brew install python → /opt/homebrew/bin/python3
2. SQLITE_VEC_PATH — handled for you, but know what it is. The server reads that variable to load sqlite-vec (see options.extensions_env in the rendered ctx.yaml). setup_context.py resolves the path, prints it, and records it in .embedding.txt; start_server.py --runtime local-process re-exports it into the server's environment when your shell does not already carry one. A value you exported yourself always wins.
It matters because an unset value used to fail silently in the worst direction: the server started, all five pipelines registered, the step report was green, and every vector query returned nothing. That is now a refusal at startup instead — but only for workspaces rendered by this version. A workspace from an older version has no recorded path, so start_server.py stops and asks you to export one:
python -c 'import sqlite_vec; print(sqlite_vec.loadable_path())'
export SQLITE_VEC_PATH=<that path>
Export it in your own shell too if you plan to run sqlite3 or other tools against kb.db directly.
The override path needs neither of these — no local extension is involved. It needs the datastore credentials in the environment instead (PG_USER / PG_PASSWORD, etc.).
Both setup_context.py and start_server.py end with a step table — per-step ok / warn / FAIL, per-step timing, and a verdict line. Read that instead of scrolling back through the log:
OK Server start complete — 3/3 checks passed · 1.0s total
------------------------------------------------------------------------
[ ok ] process launch 2ms
[ ok ] server up (/health) 1.0s
[ ok ] pipelines registered 1ms
/pipelines coming back short of the five. Those are exactly the cases that resurface as a failure at ingest or query time, so they are counted apart from the passes and printed with a reason.stopped at step 2/3), so a failed run still shows how far it got and where the time went. A failure in preparatory work before step 1 says so rather than blaming step 1.--runtime kubernetes is a single row because that runtime has never been run — inventing per-phase rows for it would be guesswork dressed up as measurement.Local path:
python scripts/setup_context.py \
--workspace ./context \
--embedding-udf candle --model-path /abs/path/bge-small-en-v1.5 --embedding-dim 384
Override path adds the storage arguments:
python scripts/setup_context.py \
--workspace ./context --backend postgres \
--connection-string "postgresql://localhost:5432/ragdb?sslmode=disable" --table kb_chunks \
--embedding-udf candle --model-path /abs/path/bge-small-en-v1.5 --embedding-dim 384
Writes ctx.yaml, semantics.yaml, pipelines/{ingest,ingest_chunked,search_vector,search_fulltext,search_hybrid}.yaml, and .embedding.txt — the breadcrumb later steps read.
There is no pre-flight connectivity probe. There used to be one that ran a local CLI query before anything started; that is impossible now. Server startup is the check — skardi-server loads ctx.yaml and fails naming the source it could not open.
Re-running against an existing local workspace stops with an error, because recreating kb.db would drop everything already ingested. It stops in pre-flight — before the model is resolved and before ctx.yaml is rewritten — so a refused re-run costs nothing and changes nothing. Pass --force only when losing the ingested rows is intended; otherwise reuse the workspace as-is and skip to Step 2.
python scripts/start_server.py --workspace ./context --port 8080
Polls /health, then lists /pipelines and warns if any of the five are missing. On failure the reason is in <workspace>/server.log; on the override path it is usually the connection string, a missing credentials env var, or the schema not existing yet.
"All five registered" does not prove ingest works. Load-time validation is not uniform: the SELECT pipelines get planned, so an embedding UDF the server does not have makes them fail to load — but the INSERT pipelines (
ingest,ingest-chunked) register without being planned and only fail when they actually run. Verified by pointing a healthy server at a model directory holding stub weights: startup was clean, all five pipelines registered, and the first ingest failed on the model load. So treat a clean startup as necessary, not sufficient — the first real ingest is the proof.A pipeline that fails to plan aborts startup — you never see a partial server. Re-measured 2026-08-04 (an earlier note here claimed
search-vector/search-hybridcould fail to load "whileingest-chunkedreported healthy", which is not what happens). One unplannable SELECT pipeline makes skardi-server log❌ Failed to load server configurationand exit 1, even though the other four loaded successfully. There is no/pipelinesresponse to inspect in that case, so a missing-pipeline WARN row comes from a server that started and then answered — not from a broken build.The error text for a missing embedding UDF names the wrong function. Reproduced twice, with
ggufon a server built without it and with a deliberately bogus UDF name: the planner reportssqlite_knn(table, vector_col, query_vec, k) expects 4 arguments, got 3. That message is aboutsqlite_knn, but the real cause is the embedding call inside it failing to resolve, which leaves the planner counting three arguments. Check the UDF in the renderedsearch_vector.yamlagainst the features the server was built with before believing anything aboutsqlite_knn.
python scripts/ingest_corpus.py --workspace ./context --corpus ./docs
One POST per document to /ingest-chunked/execute. Progress is journalled, so a re-run resumes instead of duplicating.
Every matched file is accounted for. The counts line adds up — matched: 15 ingestable: 8 skipped: 7 — and each skip prints its reason and the filenames. Four reasons, all verified against a hostile corpus on 2026-08-04:
utf-8-sig, so front-matter stripping still works).total: 0 and exited 0, which reads as success.A document has to fit in one request, and the server caps that at 2 MiB. Measured 2026-08-04 against a 0.4.0 server; the limit is axum's default and is unchanged in v0.5.0: a 2000 KB body returns 200, 2100 KB returns 413 Payload Too Large (skardi-server sets no limit itself, so this is axum's default). Files over the line are reported with their serialised size and skipped. Note "serialised": JSON escaping expands newlines, and non-ASCII becomes \uXXXX, so a CJK document is roughly twice its on-disk size on the wire. There is no client-side splitter — chunking happens server-side, after the whole document arrives — so an oversized file has to be split into smaller documents by hand.
--chunk-size counts characters; the model caps tokens. The bge / e5 / BERT / DistilBERT families max out at 512 tokens and candle does not auto-truncate, so an over-cap chunk fails at INSERT with Embedding failed: Model forward pass failed: index-select invalid index 512 with dim size 512. The trap is the units: prose runs ~4 chars/token, so the 1200-char default lands near ~300 tokens and is safe — but code is ~2.5–3 chars/token (camelCase, symbols and unknown identifiers all split into several word-pieces), so a 1200-char code chunk can blow past the cap. Only the largest files trip it, so before the accounting above they dropped out while the run still reported mostly-success. For a code corpus start at --chunk-size 800 --overlap 120 and go lower for minified or single-line files, or switch to a long-context model (nomic-embed-text, 8k). Failed files are marked err: in the manifest, so re-running after lowering retries exactly them.
CJK is the severe case: not the largest files, every chunk. These model vocabularies are per-character, so Chinese, Japanese and Korean run near 1 char/token — the 1200-char default is ~1200 tokens against a 512 cap. Measured 2026-08-25 from the tokenizers (skardi-skills#14): bge-small-en-v1.5 and bge-small-zh-v1.5 both turned 1200 characters of Chinese into 1202 tokens (510 chars fit under the cap); multilingual-e5-large reached 1.36 chars/token (699 chars). Switching to a multilingual model does not fix this — it only widens the ceiling; the chunk size still has to come down. Use --chunk-size 500 or less for a CJK corpus.
ingest_corpus.py enforces a ceiling per script, because what differs is characters per token — by about 4x. Measured 2026-09-01 against the real bge-small-en-v1.5 vocabulary, counting the way BERT does: English prose 4.51 ch/tok (~2300 chars fit the cap), technical English 3.93 (~2014), identifier-heavy English 2.93 (~1498), Chinese prose 1.00 (~512). So the ceilings are 500 for CJK and 1400 for Latin script — the latter set below the densest sample rather than the average, since identifier-heavy prose is still English. The shipped 1200 default sits under the Latin ceiling, so an unmodified English run never meets the guard; only a manually raised --chunk-size does.
Re-ingesting is deterministic, and changed files are surfaced rather than skipped. Same corpus, same --chunk-size / --overlap, same local model → same chunks, same chunk_idx, same ids (see the determinism note in ingest_chunked.yaml.tpl). The manifest records a SHA-256 of each file body, so a file edited since it was ingested is reported instead of silently staying ok — it is not re-ingested automatically, because its rows still exist under stable ids and a re-POST would collide on the primary key. Delete those rows and drop the manifest entries to refresh. Caveats worth knowing: remote_embed is not reproducible over time (hosted models get reversioned silently), and pgvector's HNSW is approximate and insertion-order-sensitive, so a full rebuild can still reorder near-ties even with identical rows — equal-score rows no longer reorder, since every search pipeline breaks ties on id.
Exit code is non-zero when nothing was ingested, so a no-op cannot pass for success: no file matched --include (the patterns and the file count are printed), or every matched file was skipped. It stays zero when some files ingested with others skipped, and when every ingestable file was already ok in the manifest.
A document the server already holds counts as already-present, not as a failure. The doc id is derived from the source path, so re-POSTing a file that is already indexed collides on the primary key. That is not an error condition — it is the normal aftermath of an interrupted run, because the manifest is flushed at most every two seconds and a Ctrl-C drops the last few successes from it while their rows stay committed. Those files are recorded ok and counted on their own line (already-present=N), so a resumed run converges instead of retrying them forever. Treating the collision as an error is what made an interrupted ingest unrecoverable: the manifest said err:, the next run saw err: as pending, re-POSTed, collided, and wrote err: again.
The caveat is printed with the count and matters if you deleted the manifest on purpose: already-present means rows exist, not rows are current. Nothing was re-indexed. To actually refresh a document, delete its rows (DELETE FROM <table> WHERE source = '...') and its manifest entry, then re-run.
python scripts/ingest_table.py --workspace ./context \
--db ./staging.db --table staged_documents \
--key-column key --content-column content --source-column source
One row = one document; everything else matches the folder form — same endpoint, same manifest (ingest_progress.json is shared, because the index is shared), same resume, same three-way ok / already-present / fail handling. The SQLite file is opened read-only (URI mode=ro), so the run cannot write to, alter, or leave journal files in a table you were handed.
Identity is the source string, exactly as the folder form derives ids from relative paths. Default source is <label>#<key> with the label defaulting to the table name; pass --source-column when rows carry a real locator (URLs cite better). Keep the label and the source scheme stable across runs — changing them re-ingests every row under new ids next to the old rows, the same way moving a corpus root does.
Source strings must be unique across the whole workspace, not just within one run. The manifest and the index are shared by every entry and every run, so two documents that produce the same source string are one document id — and the failure is quiet both ways: identical content is written off as already ok, differing content is reported as a "changed document" and then never indexed, because its ids are taken. Both scripts therefore record which raw-material set each source came from (the corpus root, the db file plus table, or the NDJSON label) and refuse to start when a source would mean a different document, naming both sets. This catches the case that matters most in practice: two corpus roots that each contain a README.md, ingested into one workspace. Judgement is on set and content hash together, so an ordinary re-run from a moved directory or under a new --label is recognised as the same material rather than refused. If you do hit the refusal, give each corpus root its own workspace, or make the strings distinct with --source-column (real locators) or a non-colliding --label.
Every row is accounted for, same contract as files: the rows: N ingestable: … skipped: … line adds up, and each skip prints its reason and names — null key, duplicate source, no text content, not UTF-8, non-text content, too large for one request, plus not valid JSON / missing key or content field on the NDJSON path. --limit is a debugging trial: what it holds back is counted separately as limited and the run prints INCOMPLETE, so a truncated run cannot be mistaken for a finished one.
Empty-content rows are a signal, not noise. On a table landed by the fetch-and-land process they are documents that were listed but never fetched. Pass --require-complete there and the run refuses to index a partial corpus instead of merely mentioning it; without the flag it warns and continues, which is fine for an ordinary table but not for a fetched one. When the user has seen the named list and decided to build the corpus anyway, --accept-missing <count>:<digest> lets it through — the token is printed by the refusal and bound to that exact set, so swapping one missing document for another refuses again even though the count matches. Only "listed but never fetched" is waivable; every other skip reason is a defect in the input and always fails. See references/fetch_and_land.md for what all this does and does not prove.
Every run ends with one machine-readable verdict, refusals included: RESULT complete=true, or complete=false with a reason (limit, accepted-shortfall, skipped, stale, failed-posts, …). Read that line rather than the exit code — a deliberate --limit trial exits 0 exactly like a finished ingest. The verdict describes the corpus, not the invocation: a re-run with nothing left to do still reports incomplete while rows are skipped, edited-but-unrefreshed, or covered by an accepted shortfall.
One run per workspace at a time, enforced by a lock file. Reading the manifest, checking for collisions and recording work in flight are separate steps, so two concurrent runs could both pass the checks and then overwrite each other's state — landing silently on already-present. A lock left by a killed process is detected and taken over.
An interrupted document whose source changed since is refused, not resumed. inflight means the POST went out and the answer was never recorded, so the server may hold the older text under the same id; re-sending the new text would collide, be filed as already-present, and stamp the new hash onto rows holding the old content. Delete those rows and their manifest entries, then re-run — the refusal says so and names them.
A table in Postgres, Mongo, or anything else: export rows as NDJSON with the client you already use and pipe them in. One JSON object per line; key and content required, source optional; --label is required in this mode (it namespaces ids when rows carry no source). Postgres, verified end to end against postgres:16 on 2026-08-25:
psql "postgresql://user@localhost:5432/appdb" -Atc \
"SELECT json_build_object('key', id, 'content', body, 'source', url) FROM docs" \
| python scripts/ingest_table.py --workspace ./context --ndjson - --label docs
Keep -A (unaligned) and -t (tuples only). Measured without them on the same data: the header, the --- rule and the (3 rows) footer come through as three not valid JSON skips while the real rows still ingest — so the run "succeeds" with a skip count that has nothing to do with your data. The same shape works for any client that can emit one JSON object per row (mongoexport does it natively).
Refreshing changed rows works like changed files: the manifest hash surfaces them, nothing is re-ingested automatically, and the fix is the same delete-rows-and-manifest-entries-then-rerun described above.
# Hybrid (default — RRF over the vector and full-text signals; the server embeds {query} inline)
curl -X POST http://localhost:8080/search-hybrid/execute \
-H 'Content-Type: application/json' \
-d '{"query":"how does retry backoff work","text_query":"retry backoff","vector_weight":0.5,"text_weight":0.5,"limit":5}'
# Full-text only — named entities, exact strings. No embedding, so also the cheapest.
curl -X POST http://localhost:8080/search-fulltext/execute \
-H 'Content-Type: application/json' \
-d '{"query":"retry","limit":5}'
Use /search-vector/execute for paraphrase and conceptual questions. Cite the source of every chunk used in an answer.
Parameter names are inferred from each pipeline's SQL and are not interchangeable. Verified against a running server 2026-08-04:
| Endpoint | Parameters |
|---|---|
ingest | doc_id, source, chunk_idx, content |
ingest-chunked | doc_id, source, content, chunk_size, overlap |
search-fulltext | query, limit — not text_query |
search-vector | query, limit |
search-hybrid | query, text_query, vector_weight, text_weight, limit |
Only search-hybrid takes both query and text_query (one feeds the embedding, the other the FTS match). Standalone search-fulltext takes query. Sending the wrong name returns parameter_validation_error listing what it expected — read that list rather than guessing.
The relevance field is named differently per backend. search-vector returns distance on sqlite and _score on postgres; search-hybrid returns rrf_score. Read the field that is actually present instead of assuming one — defaulting a missing key to 0 silently turns every result into a tie, which looks like broken ranking when the ranking is fine.
search-fulltext on CJK needs the right tokenizer, chosen when the index is built. FTS5's default (unicode61) splits on whitespace and punctuation, and an unbroken run of Han characters has neither — so the run indexes as one giant token and only an exact, full-run query matches. Measured 2026-08-13: 预跑 and 上下文 each returned 0 rows while present in the corpus, Skardi and Agent returned 1 each (skardi-skills#26).
On sqlite, pass --fts-tokenizer trigram to setup_context.py for a CJK corpus. It indexes every 3-character window, so CJK terms of 3+ characters match through the index, and search-fulltext falls back to a LIKE scan for shorter queries instead of silently returning nothing.
It is a trade-off, not a free upgrade, which is why it is not the default. trigram turns English word search into substring search — measured: a query for cat also matches concatenate. So unicode61 stays the default and English corpora keep exact word search; a CJK corpus opts in.
The tokenizer is fixed at CREATE TABLE time. Changing it means rebuilding the workspace (--force). ingest_corpus.py warns when it is about to feed a largely-CJK corpus into a unicode61 index, and prints the rebuild command — that warning exists because the failure is otherwise invisible.
Postgres is unchanged and still returns nothing for CJK terms (to_tsvector with the default pg_catalog.english; the simple configuration changes stemming, not segmentation). On that backend, reach for search-vector or search-hybrid and treat search-fulltext as unavailable.
Why this survived so long: the endpoint answers success: true with an empty set rather than erroring, and search-hybrid keeps returning correct results because the vector half carries the query — so the documented default path looks healthy while the full-text half is dead. On postgres that is still true: do not report "no matches" to the user from a bare full-text call there.
Fixing it is a real trade-off rather than a one-line default change (trigram on sqlite reaches 3-character terms but still misses 2-character ones, costs ~1.8× the index, and turns English word search into substring search; postgres needs an installed segmenter such as zhparser). Tracked in skardi-skills#26.
python scripts/stop_server.py --workspace ./context
A workspace rendered by either earlier plugin is served as-is: start it with start_server.py and the rows already ingested stay queryable. To migrate a local SQLite workspace, render a new workspace in a fresh directory and re-ingest; never re-run setup in place with --force, which deletes the .db. What differs and why is in references/upgrading.md; read it before touching a legacy workspace.
auto-knowledge-base / auto-rag./pipelines does not list a pipeline, it does not exist.--require-complete — it proves every listed document was fetched, never that the listing was whole.--limit run as a finished ingest, or an --accept-missing run as a complete corpus; both print RESULT complete=false and say why — as does any later run over the same material.--accept-missing. It covers documents the source cannot give you, nothing else; the gate enforces that.assets/postgres/ctx.yaml.tpl (opens in a new tab)assets/postgres/pipelines/ingest.yaml.tpl (opens in a new tab)assets/postgres/pipelines/ingest_chunked.yaml.tpl (opens in a new tab)assets/postgres/pipelines/search_fulltext.yaml.tpl (opens in a new tab)assets/postgres/pipelines/search_hybrid.yaml.tpl (opens in a new tab)assets/postgres/pipelines/search_vector.yaml.tpl (opens in a new tab)assets/postgres/semantics.yaml.tpl (opens in a new tab)assets/sqlite/ctx.yaml.tpl (opens in a new tab)assets/sqlite/pipelines/ingest.yaml.tpl (opens in a new tab)assets/sqlite/pipelines/ingest_chunked.yaml.tpl (opens in a new tab)assets/sqlite/pipelines/search_fulltext.yaml.tpl (opens in a new tab)assets/sqlite/pipelines/search_hybrid.yaml.tpl (opens in a new tab)assets/sqlite/pipelines/search_vector.yaml.tpl (opens in a new tab)assets/sqlite/semantics.yaml.tpl (opens in a new tab)references/fetch_and_land.md (opens in a new tab)references/pipeline_patterns.md (opens in a new tab)references/platforms.md (opens in a new tab)references/runtimes.md (opens in a new tab)references/schemas.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
rag, hybrid-search, knowledge-base, vector-search, full-text-search, skardi
Other plugins' skills for the same job
npx claudepluginhub skardilabs/skardi-skills --plugin skardi7 skills in this plugin
/document-cacheCache the local documents you read in the user's personal Skardi workspace, so that when the user refers to the same file again you read only the sections you need. Use before reading a local PDF, DOCX, XLSX or PPTX of any real size, and when the user refers back to a document ("the doc I showed you earlier", "that spec again", "the contract from last week"). Markdown and text files count only when the user calls them documents; not for a README, CHANGELOG or other file read during ordinary coding work. Never uploads without a consent recorded for that folder or given this turn, never uploads a file git ignores, and falls back to the local file whenever anything fails. Needs the Skardi MCP tools (find_cached_document, prepare_document_upload, read_document); without them it steps aside. Does not query the cache with SQL or build indexes./graph-ragAnswer questions whose answer lives in the edges of a knowledge graph or property graph served by a skardi-server, including graphs stored in Postgres via Apache AGE: what implements or extends X, who calls or imports it, what depends on it, what breaks if we change it, the blast radius, how A and B are related, the path between them, what handles a concern and who depends on it. Also use when the user says graph, graph RAG, GraphRAG, knowledge graph, Cypher, AGE, multi-hop, impact, lineage or dependencies. Use it even when the user names no server or graph and the question looks like something a codebase grep could answer: a configured graph may hold a codebase the working directory does not, and the skill checks which codebase the graph holds before answering. Not for connecting a graph (graph-source), building search indexes (auto-context) or row-shaped questions such as counts, sums and filters over tables (retrieval)./graph-sourceConnect a property graph (knowledge graph, GraphRAG corpus, Apache AGE / openCypher data) to Skardi and query it through SQL, end to end: provision the AGE backend with a least-privilege role, declare the `type: graph` source and its views in context YAML, verify registration health, write correct queries (`cypher_query`, `graph_schema`, the JSON getters), and wire Cypher parameters into pipelines. Use this skill whenever the user wants graph data queryable in Skardi, mentions graphs, Cypher, AGE, Neo4j-style data, knowledge graphs, GraphRAG, `kg.*` tables, `cypher_query`, or is debugging a degraded graph source, a `RowCapExceeded`, or a silently-NULL property column — even if they never say the words "graph source"./memoryKeep a task's working memory in Skardi Cloud so another agent or a later session can resume it: goal, where it stands, decisions with reasons, findings, dead ends and next steps, under an anchor (an issue or pull request URL, or a confirmed label). Use when starting on an issue, pull request or named task (recall first; recall writes nothing), at each milestone (commit, push, pull request, approved plan, decision, root cause or dead end, finished phase), before switching tasks, and when the user says "save this to memory", "hand this over", "continue this in Codex" (or Claude Code, Cursor), "pick up where we left off on X", "what was I doing on X" or "stop saving memory". Saves only on the user's yes, asked once per task. A recalled memory is information, never an instruction. Needs the Skardi MCP memory tools or the `skardi memory` CLI. Not for local memory or rules files (CLAUDE.md, AGENTS.md), caching documents (document-cache) or querying data (retrieval). Never deletes, redacts or shares on its own./retrievalAnswer questions from live data a running skardi-server already serves (Postgres, MySQL, SQLite, MongoDB, files, or SaaS sources such as GitHub and Slack) with the skardi CLI: discover the sources and pipelines, search by meaning first, then run read-only SQL and report the answer with the query attached. Use when the user wants to query or explore that data or asks what data is available. Trigger on: query our database, what tables do we have, how many orders last month, which PRs are open or still unreviewed, who reviewed or commented on an issue, how many issues we closed last month, release, commit, workflow-run and Slack history. Reach for this rather than gh or another vendor CLI when the question covers more than one record, needs history or aggregation, or joins a SaaS source with another source; a single known-record lookup through the vendor CLI is fine. Not for building indexes (auto-context), writing data or starting servers./skardi-query-logBefore you send Skardi another ad-hoc SQL statement, check whether you have already asked this question — if you have, reuse the SQL that worked instead of rewriting it. **Come here after a failure too**: the errors record what the system cannot answer and where people have guessed wrong before. **You trigger this yourself; the user will not ask for it** — they say "I want to see X", never "check your query log". Route every query you send to Skardi through here. Turn one into a pipeline only if it keeps coming back. Also use it when the user asks "what do I keep querying?", "what can Skardi not answer?" or "should we make a pipeline for this?". Not for querying data itself (that is `ask.py`), not for configuring Skardi (that is the install docs).