Code Intelligence · Mind RAG
Search by meaning, not by string match.
Semantic code search. Returns citations with file position and confidence scores. We use it ourselves — to navigate KB Labs and give AI agents context without hallucinations.
Indexing
Incremental by content-hash.
Terminal
$ kb mind index ✓ Index updated in 22s (incremental) Files discovered: 1 840 · processed: 68 · skipped: 1 772 Chunks stored: 9 440 · updated: 480 · rate: 7.06/file Cleanup deleted files: 3 · deleted chunks: 22
Source filesAll .ts, .tsx, .js, .jsx files in tracked packages
Index backendQdrant vector store (local or remote)
Embedding modelConfigured via adapter — openai, cohere, or custom
Re-index triggerAutomatic on kb-dev start or manual via pnpm kb mind reindex
Search modeSemantic (dense), keyword (sparse), or hybrid
Source verification
Not in the index — it'll say so honestly.
Every answer is tied to real chunks from the index with exact file and line numbers. The system cannot cite a source that isn't in the codebase.
If nothing is found — returns completeness: "minimal" and an explicit message. If found but uncertain — LOW_CONFIDENCE warning with a percentage. Low confidence results are not cached.
json
$ kb mind search --text "как работает pipeline релиза" --agent // i18n-ignore
{
"chunks": [
{
"path": "plugins/release/manager-core/src/pipeline.ts",
"span": { "startLine": 1, "endLine": 12 },
"score": 0.94,
"text": "Flow: plan → snapshot → checks → build → verify..."
},
{
"path": "plugins/release/manager-cli/src/cli/commands/run.ts",
"span": { "startLine": 180, "endLine": 210 },
"score": 0.87,
"text": "const result = await runReleasePipeline({..."
}
],
"contextText": "Release pipeline состоит из 8 последовательных шагов...", // i18n-ignore
"meta": { "schemaVersion": "agent-response-v1", "timingMs": 14200 }
}Commands
For humans and agents.
pnpm kb mind search --text "how does X work"Semantic search across the full codebase.pnpm kb mind search --text "RoutingBackend" --agentAgent-mode output: JSON lines with sources and confidence.pnpm kb mind reindexForce full re-index of the codebase into the vector store.pnpm kb mind reindex --affectedRe-index only files changed since last index run.pnpm kb mind statusShow index health: total chunks, last indexed, backend status.pnpm kb mind configShow active embedding model and vector store connection.AI agents
First-class tool for agent workflows.
--agent returns structured JSON with schemaVersion: "agent-response-v1". Agents get exact citations with file position — no guessing context.
Three modes: instant — fast, auto — balanced, thinking — reasoning chain before the answer.
InputNatural language query or structured JSON prompt
RetrievalTop-K semantic search with confidence threshold
Context windowSources injected into LLM context automatically
OutputStructured answer with file citations
AuditEvery search logged with query, sources, and latency
ModelConfigured via Gateway — swap without code changes
Install
Semantic search. Honest answers.
kb marketplace install @kb-labs/mind-entry