A local-first personal neural library — ingest raw files, retrieve by meaning, get source-grounded answers.
Cognix is a local-first personal knowledge system. It ingests raw files from an immutable vault, extracts and chunks text, builds a hybrid semantic index, and answers questions through a lightweight web UI. Answers are grounded in retrieved evidence with inline citations and a confidence score.
The stack is intentionally understandable: FastAPI backend, React + TypeScript frontend, SQLite for operational state, ChromaDB for vector search, and a retrieval pipeline you can follow line by line.
data/raw/, parses every file type, chunks text into 450-word overlapping windows, embeds each chunk, stores everything in SQLite + ChromaDBwiki/_intelligence/| Type | Extensions |
|---|---|
| Plain text / code | .txt .md .rst .py .js .ts .tsx .jsx .css .yml .yaml .toml |
| HTML | .html .htm (tags stripped) |
| JSON | Recursively flattened to key/value text |
| CSV | Column summary + row samples |
OCR via ocr_pdf() | |
| Images | .png .jpg .jpeg .webp .heic .tiff .bmp via OCR |
| Extensionless | Read as text if UTF-8/Latin-1 decodable |
Ingest skips node_modules, __pycache__, .git, dist, build, binary files, and minified assets automatically.
Configurable via COGNIX_LOCAL_EMBEDDING_BACKEND:
| Backend | Default | Notes |
|---|---|---|
hash | Yes | SHA-256 word hashing into 128-dim normalized vector — no GPU, no API key |
sentence-transformers | No | all-MiniLM-L6-v2, runs locally |
OpenAI text-embedding-3-small | No | Requires COGNIX_CLOUD_EMBEDDINGS_ENABLED=true + key |
Cognix routes synthesis calls through a provider cascade (skips any with blocked status):
| Provider | Default model | Status |
|---|---|---|
local | Deterministic extractive | Always available |
openai | gpt-4.1-mini | Requires API key |
anthropic | claude-3-5-sonnet-latest | Requires API key |
ollama | User-configured | Local inference |
Keys are read from environment variables first (OPENAI_API_KEY, ANTHROPIC_API_KEY), then from SQLite provider_settings.
| Style | Output |
|---|---|
memo | Full research memo with inline citations |
brief | 2-sentence summary |
deep | Extended analysis (uses same pipeline as memo in v1) |
scripts/start_cognix.sh
# Opens http://127.0.0.1:5173/backend/
app/
main.py FastAPI app + router mounts
db/schema.sql SQLite v1 schema
db/schema_v2.py V2 migration runner
services/
retrieval.py Hybrid retrieval pipeline
llm.py Answer synthesis + provider cascade
intelligence/ Gap, contradiction, staleness detectors
outputs.py Draft output management
compiler.py Source summary wiki generation
parsers.py File type parsers (v4)
chunking.py Sliding window chunker
embeddings.py Hash + sentence-transformers + OpenAI
providers.py Provider settings + test
config.py All COGNIX_* env vars
frontend/
src/
pages/
Ask.tsx Q&A interface
Ingest.tsx Ingest runner + file/job tables
Outputs.tsx Draft output management
Intelligence.tsx Findings, gaps, contradictions, concept graph
Health.tsx Health score + findings
Settings.tsx Profile, providers, background services
config/ Source, model, budget, priority YAML config
data/raw/ Immutable source vault
data/processed/ Extracted text cache
data/chroma/ ChromaDB vector store
wiki/
sources/ Per-file summaries (auto-generated)
outputs/analysis/ Saved Q&A drafts
_health/ Health reports
_intelligence/ Nightly briefings
concepts/ Compiled concept pages
Three services, all off by default and controllable from the Settings UI:
| Service | Default interval | What it does |
|---|---|---|
watcher | 20s | Polls data/raw/ for new files, auto-runs ingest |
scheduler | 300s | Periodic scheduled ingest |
intelligence | 86400s | Nightly gap/contradiction/staleness detection + briefing |