Company Brain: a private knowledge system on open models
Company knowledge sat across Notion, Drive, Slack, meeting transcripts and the fundraising database, and none of it was allowed to pass through an outside vendor. I built a retrieval system that answers with the source line, runs entirely on one machine with open models, and refuses when the answer is not in the knowledge base. Next to it, a personal second brain that my cockpit feeds every night.
Example data. All names and figures in this demo are illustrative.
Answers only from our own knowledge, with a source. Runs locally on this Mac (Qwen + pgvector), nothing in the cloud.
Connectors
Every source is read, split, embedded and written into one local table. Sources are never written to. Click a connector to see what it delivers and how it is taken apart.
Re-ingest safe: each connector deletes its own rows first, then writes fresh.
Nightly run · the personal second brain
A second, separate system: gbrain (open source, MIT) with its own database, fed every night by my cockpit. The Company Brain above is the team's knowledge base. The two share the Postgres server and Ollama on the Mac, nothing else.
- 1 · Daily statedeterministic, no model: agent status, open Slack points, tasks, data-room visitors, plan and priorities, files changed in 26 h
- 2 · Memoriesevery memory file changed in the last 24 h → page memory/<name>
- 3 · Documentsevery Markdown changed in the last 26 h (under 120 KB) → page cockpit/<path>
- 4 · Night notefive sentences: what mattered, what is open, what comes first tomorrow. The one step that calls a cloud model (claude -p), the rest is local
- 5 · Stampnachtlauf_<date>.done with the list of pages, so a night never runs twice
$ waiting · next check in 300 s
Night note: today the focus was the Fund A brief … (five sentences, demo)
What runs on it
The brain is the base layer. Skills, agents and whole workflows sit on top of it. Built items first, extensions marked as possible next. Click a tile for the details.
Architecture & security
Everything on one machine. At query time nothing leaves it.
Decisions that held
- Safeguard scan, green. No hard-coded secrets (everything in .env, gitignored), no external calls beyond local models, local DB and read-only readers.
- Data policy in three classes. Every class of data is sorted into eligible now, eligible once permissions and login are in place, or never. Sensitive classes such as payroll never enter the index.
- Tunnel rejected. Cloudflare Tunnel and ngrok terminate TLS at the provider, who would see company data in clear text. Path instead: overlay VPN, later reverse proxy with own SSO.
- Reranker due diligence to file level. Weights from a Beijing lab, so checked on disk: safetensors only (no pickle), standard xlm-roberta, trust_remote_code never set, cache content-addressed and pinned to one commit. Verdict: no critical risk. A local open-weight model is static math.
- Open-weight only. Hosted model APIs stay out of the brain for data sovereignty. Model swappable via LLM_MODEL.
- Honesty is a prompt and a reranker, not a threshold. Off-topic “capital of France” scored cosine 0.528, a real internal question 0.513. The cutoff alone lets it through; the strict prompt plus the reranker refuse. See the Ask tab.
- Sovereignty is the argument. Self-hosting is chosen for control over the data, not for price.
Model size is the weakest lever for faithful RAG
Hallucination rate on grounded answers, Vectara faithfulness benchmark (May 2026), lower is better. Basis for the model and hardware pick.
Realistic target: a ~30B mixture-of-experts model (about 3B active parameters) on a dedicated office machine, chosen by a test on our own DE/EN questions. 70B is nice to have.