Personal Wiki — Architecture

Local AI knowledge base · Ollama + Qdrant + FastAPI

Chat Flow Ingestion Flow Metadata / Async
Client Layer
Web Browser
Chat · Manage · Browse
localhost:8000 · /manage · /browse
CLI
make ingest · lint-wiki
Ingestion & wiki lint commands
API Layer
FastAPI Server
create_app() · Middleware · SSE · Security
Auth · Rate Limit · Path Validation · Prompt Injection Guard
Application Services
ChatEngine
RAG · Retrieval
build_rag_prompt() · wiki retrieval · SSE
Source Routes
CRUD · Catalog
GET/POST/PUT/DELETE /api/sources
Wiki Routes
Pages · Browse
GET /api/wiki/pages · markdown render
Ingestion Pipeline
Extract → Write → Index
PDF · URL · Code · Markdown adapters
Service Providers
LLM Provider
gemma4:e2b · async
Entity extraction · Chat · Wiki gen
VectorStore
Semantic search
Qdrant client · nomic-embed · dedup
Source Registry
SHA256 · Change detect
state/registry.yaml · skip unchanged
Wiki Filesystem
entities / concepts
LLM-maintained markdown wiki
Indexer
Async Qdrant index
Chunk-level dedup · embeddings
External Services & Storage
Ollama
gemma4:e2b · nomic-embed
Local LLM runtime · embeddings + generation
Qdrant
Vector DB · Docker
Semantic index · port 6333 · snapshots
Disk (wiki/)
Markdown files
wiki/entities/ · wiki/concepts/ · wiki/generated/
Source Files
PDFs · URLs · Code
sources/ · immutable inputs
Data Flow Summary
Chat Flow
Browser → FastAPI → ChatEngine → VectorStore (retrieve) → LLM (generate) → SSE stream back
Ingestion Flow
Sources → Docling/Adapters → LLM Extract → Wiki Pages → Indexer → Qdrant · SHA256 registry
Wiki Structure
wiki/entities/ — people, orgs, tech
wiki/concepts/ — theories, patterns
wiki/generated/ — raw summaries