lacspace-rag

Keyless local RAG in one CLI — index a folder, then ask grounded questions.

● Live · v0.1.0npmSource
terminal
npx lacspace-rag index ./docs && npx lacspace-rag ask "how do I deploy?"
What it does

Everything, in one command

lacspace-rag is a batteries-included retrieval-augmented-generation pipeline in a single zero-dependency command. `index` walks your text and code files, splits them into overlapping chunks, embeds each one and saves a plain-JSON index; `query` returns the top matching passages with scores and source paths; `ask` retrieves the best context, builds a grounded prompt and calls a chat model, printing the answer plus the sources it used. It defaults to a fully free, local Ollama setup so you can run RAG over private files with nothing leaving your machine — or point --provider/--base-url/--model at any OpenAI-compatible endpoint. It's the CLI companion to the @lacspace AI App Kit (embeddings/vector/rag/agent).

Runs locally, not as a hosted button

lacspace-rag talks to a local model server (Ollama by default) and reads your files, so it runs on your machine, not as a hosted button here. Install Ollama, then `ollama pull nomic-embed-text` and `ollama pull llama3.2` — that's the whole setup, no API key.

Features

What's inside

Index any folder

Recursively reads text + code files (skips node_modules/.git/binaries), chunks with overlap and embeds each one.

Free by default

Uses local Ollama out of the box — no API key, nothing leaves your machine. OpenAI-compatible too.

Grounded answers

`ask` retrieves the best passages, builds a grounded prompt and cites the source files in its answer.

Just the passages

`query` returns the top-k matching chunks with cosine scores and source paths — no model call needed.

Any provider

--provider / --base-url / --model / --embed-model point it at Ollama, OpenAI, or any compatible endpoint.

Zero dependencies

Self-contained CLI + library; the index is a plain JSON file you can inspect, move or commit.

How to use

Copy, paste, done

Real commands and snippets — from a one-liner to the typed library.

Index a docs folder (free, local)
terminal
npx lacspace-rag index ./docs

Chunks + embeds every file via Ollama and writes ./.lacspace-rag/index.json.

Ask a grounded question
terminal
npx lacspace-rag ask "how do refunds work?" -k 5

Retrieves the 5 best chunks, answers from them, and lists the sources.

Just retrieve passages
terminal
npx lacspace-rag query "rate limiting" --json

Prints the top matching chunks with scores + paths as JSON.

Use an OpenAI-compatible endpoint
terminal
npx lacspace-rag ask "summarise the API" \
  --provider openai --model gpt-4o-mini --api-key $OPENAI_API_KEY

Swap in any hosted model with one flag.

Use it as a library
typescript
import { chunkText, embed, search, buildPrompt } from "lacspace-rag";

The retrieval core is exported for your own scripts (inject fetch for tests).

Good for

What people build with it

Chat with your own docs, notes or a codebase — privately and for free

Add grounded Q&A to a project without a vector database or an API key

Prototype a RAG pipeline locally before wiring the @lacspace AI App Kit into an app

Search a large folder for the passages most relevant to a question

Start now

Run lacspace-rag today

Free, open-source, no API keys. It's a CLI and a typed library.

terminal
npx lacspace-rag index ./docs && npx lacspace-rag ask "how do I deploy?"