Expand description
semlith — a local semantic cache for AI agents.
Point it at files, get back a store that answers “what part of my corpus is relevant to this question?” in milliseconds, without shipping anything off the machine and without an agent burning tokens reading whole files.
Two pieces of state live side by side in the store directory:
- the vectors — a
turbovecTurboQuant index holding only quantized vectors keyed by chunk id. A store created by 0.7.0 keeps them as a directory of shards underindex/; every store written before it keeps the singleindex.tvit already has. Seeindex. store.db— SQLite holding the chunk text, its file, and its line span.
A search quantizes the query, gets ids back from the index, then resolves them to text with one SQLite lookup each.
Modules§
- chunk
- Turning a file on disk into embeddable chunks of text.
- embed
- Which embedding model a store uses, and how to load it.
- filter
- Narrowing a search to part of the corpus.
- fleet
- Several stores, one query.
- index
- The vector side of a store: read from disk only when something needs it, and in pieces small enough to put down again.
- lock
- One writer at a time per store.
- mcp
- A stdio MCP server, so an agent can query and maintain the store as tool calls.
- store
- SQLite side of the store: file bookkeeping and chunk payloads.
- watch
- Keep a store current while its corpus is being edited.
Structs§
- Hit
- Index
Progress - Where an index run has got to, handed to the callback with each file it starts embedding.
- Index
Report - Semlith
Functions§
- canonical
- default_
model - Default model: 384-dim, ~52 MB on disk. Measured against the previous default (BGE-small) on a 6260-chunk corpus it scored 16.00 code MRR@10 against 14.84, at a third of the download.
- default_
store_ dir - Default store location:
.semlithbeside whatever you are indexing. - human_
bytes - Byte counts sized to the unit that actually shows a digit — a small corpus reported as “0.0 MB” reads like a bug rather than a small corpus.
- model_
cache_ dir - Where ONNX model weights are cached. Shared across stores — the weights are large and identical for a given model.
- store_
dirs - The stores a command should use: the
--storeflags if any were given, else whateverSEMLITH_STOREnames, else.semlithin the current directory.