Jonas Lange
← All cases
Case 1

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.

company brain · demo · example data
local · qwen2.5:7b · bge-m3 · pgvector · 0 egress
🧠 Company Brain · Beta (local)

Answers only from our own knowledge, with a source. Runs locally on this Mac (Qwen + pgvector), nothing in the cloud.

KnowledgePeopleDecisionsMeetingsHonesty

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.

→ one table data_beta_docs · Postgres 17 + pgvector 0.8.5 · text, 1024-dim vector, metadata (kind, link, date)

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.

30nights without a gap
429pages written · 1 to 35 per night
17night notes · five sentences each
03:30due time · a daemon checks every 300 s · missed nights catch up at next start
Night run writes pages via gbrain put, embeddings by bge-m3last run · 9 pages · stamp written
  1. 1 · Daily statedeterministic, no model: agent status, open Slack points, tasks, data-room visitors, plan and priorities, files changed in 26 h
  2. 2 · Memoriesevery memory file changed in the last 24 h → page memory/<name>
  3. 3 · Documentsevery Markdown changed in the last 26 h (under 120 KB) → page cockpit/<path>
  4. 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. 5 · Stampnachtlauf_<date>.done with the list of pages, so a night never runs twice
$ waiting · next check in 300 s
30 stamp files, all ok: true labels show the nights with a documented page count
Search the second brain cockpit style · hybrid search · [score] slug -- excerpt
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.

One machine · all local · no egress at query time
fill
5 sourcesread-only connectors
→
split1024 chars · overlap 200
→
bge-m3Ollama · 1024 dim
→
Postgres 17pgvector 0.8.5 · one table
ask
questionFastAPI · localhost:8000
→
bge-m3same model as fill
→
pgvectortop_k 8 · cutoff 0.4
→
bge-reranker-basecross-encoder · 8 → 3 · filler filter
→
qwen2.5:7bOllama · core facts + strict prompt
→
answer + sourceslabel · meta · score · excerpt
2nd brain
cockpit 03:30Python stdlib · launchd
→
gbrainBun · Markdown repo
→
Postgres DB gbrainown database · bge-m3
·
night noteclaude -p · the one cloud call
Outside traffic: read-only fetch from the five sources at ingest, one download of the reranker weights. LlamaIndex glues the pipeline. Code: about 1,150 lines of Python.
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.

← All cases

CV · Jonas LangeDownload

Your browser cannot show the PDF here. Download the CV.

Press Esc or click outside to return to the page