Your AI models can change. Your memory shouldn't.
Every six months the "best" model changes. GPT, Claude, Llama, Qwen, DeepSeek — the logo on the API key is not the asset. Your notes, docs, and decisions are. Most assistant stacks invert that. Your memory gets shipped
Every six months the "best" model changes. GPT, Claude, Llama, Qwen, DeepSeek — the logo on the API key is not the asset.
Your notes, docs, and decisions are.
Most assistant stacks invert that. Your memory gets shipped into whichever frontier model is fashionable this quarter. Switch vendors and you rebuild context from scratch. Cancel a subscription and the "assistant that knew you" forgets you existed.
That is the wrong dependency graph.
Local-first means the memory lives with you
A local-first assistant API keeps the canonical store on your machine (or your VPS):
- Notes and files stay in a local database you control
- Search works offline
- The model is a plugin, not the source of truth
- Sensitive content can stay redacted until you approve it
Models become interchangeable. Memory does not.
What that looks like in practice (Python + FastAPI)
Here is the shape I teach in Build a Local-First AI Assistant API:
- FastAPI service with clear settings and health checks
- Local memory store (SQLite) with sensitivity tags and file ingest (Markdown, text, PDF)
- Offline search — full-text (FTS5) plus local embeddings, hybrid ranking
-
/askagainst a local model (Ollama by default), with citations and streaming - Human-in-the-loop approval gate — policy decides content vs metadata vs nothing
- Provider plugins — local by default; optional cloud behind the same interface
- Strict mode — local data + local model only, tested to make zero outbound calls
- Ship it — tests, Docker, run as a background service
None of that requires renting your notes to a SaaS "second brain."
Strict / General / Full — modes, not vibes
Prompting "please don't send my data" is not a control plane.
Enforce modes in code:
| Mode | Data | Model |
|---|---|---|
| Strict | Local only | Local only |
| General | Controlled | Local or approved cloud |
| Full | Per policy | Best available provider |
If Strict can still phone home, it is not Strict.
Free outline vs full course
I published a public teaser outline (module titles only) so you can see the map before you buy:
- Repo: github.com/jamalfrnk/local-first-ai-assistant-api
- Outline: COURSE.md
- Full course (lessons + labs + starter code): Gumroad — $99
Related: if you also want the hosting side of "own your stack," see Own Your Web (VPS + Caddy + DNS migration) — free outline on GitHub.
Who this is for
Python developers who are comfortable with functions and classes, and who are tired of rebuilding context every time the model carousel spins.
Who this is not for
Anyone looking for a one-click ChatGPT wrapper with no local store and no approval gate.
Support: [email protected] · jjones.ai · malcolm.expert
Education product from Malcolm Frank / FranklySolutions LLC. Adapt everything to your own environment.
Want to promote these courses? Affiliates earn 15% → jjonesai.gumroad.com/affiliates
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.