Local CLI for taxonomy-based document classification, indexing, and semantic search using embeddings.
Install dependencies:
pnpm installConfigure .env:
RAG_CLI_DB=./rag.sqlite
RAG_CLI_CATEGORIES_DB=./rag-categories.sqlite
RAG_CLI_EMBEDDING_PROVIDER=llama.cpp
RAG_CLI_EMBEDDING_URL=http://localhost:8080/embedding
RAG_CLI_EMBEDDING_MODEL=granite-embedding-107m-multilingual
RAG_CLI_EMBEDDING_DIMENSIONS=384The embedding endpoint must accept POST /embedding.
categories.yml is the source of truth for categories.
pnpm run start categories sync assets/taxonomy/categories.ymlThis embeds every category and stores it in the categories database.
pnpm run start classify assets/docs/doc.txtThis compares the input with the already-synced categories database.
pnpm run start index assets/docs/doc.txt --metadata '{"fileName":"assets/docs/doc.txt"}'
pnpm run start index https://example.com/article --metadata '{"url":"https://example.com/article"}'This splits the document into chunks and stores each chunk in the documents database with:
- chunk embedding
- best matching category
- user metadata
- chunk metadata such as
chunkIndex,chunkCount,chunkStart, andchunkEnd
Example output:
{
"chunks": 3,
"ids": [1, 2, 3]
}pnpm run start search "Microsoft BASIC" --limit 5Search returns the best scoring indexed texts with category and metadata (KNN via sqlite-vec).
pnpm run start statsOr:
pnpm run start inspectThis prints a JSON summary of the documents and categories databases.
pnpm run start find --file machinelearning
pnpm run start find --text pipeline
pnpm run start find --category llmsYou can combine filters and control pagination with --limit and --offset.
Example:
version: 1
categories:
- id: software-architecture
path: "Tecnologia / Desenvolupament / Arquitectura"
description: "Notes sobre disseny de software."
examples:
- "Clean Architecture"
- "DDD"pnpm run build