DAEMON-KP
ARCHA Django architecture template for knowledge platforms — an end-to-end RAG pipeline from source ingestion to citation-grounded answers.
Private repository · Available on request
Why It Exists
Every knowledge product faces the same structural problem: getting from raw sources to answers a user can actually trust. The pipeline sounds simple — ingest, chunk, search, answer — but the failure modes compound: hallucinated citations, keyword-only search missing semantic intent, semantic search missing exact terms. DAEMON-KP is the architecture I designed to solve that, purpose-built for knowledge-heavy products where answer quality is the product.
Pipeline
Each stage is a typed Pydantic boundary — a chunk that doesn't meet quality criteria never reaches the search index. An answer that can't be grounded in retrieved context is flagged, not surfaced.
Core RAG flow (chunking → lexical search → AI answer) works out of the box.
Detailed Flow
Domain Map
Knowledge Core
Intelligence
Interaction
Pipeline
Foundation
Key Decisions
-
Hybrid Search (BM25 + vector similarity)
pg_search(BM25 ranking) +pgvector(semantic similarity), scores fused at query time with a 45/55 split. Handles both "what is X" and "find the document that mentions Y" — neither alone is sufficient. -
Citation-First Answers
Answers are generated only from retrieved chunks. Gemini receives chunk IDs directly and returns structured output with
source_idsalongside the answer text — no post-hoc attribution. If context doesn't support an answer, the system says so. -
PostgreSQL-Only (no separate vector DB)
pgvector+pg_searchinside the same PostgreSQL instance. No Pinecone, no Elasticsearch, no sync overhead. The search index is always consistent with the document store by construction. -
Built on DAEMON-ONE
DAEMON-KP is a domain-layer extension of DAEMON-ONE. 12 domains —
documents,chunks,search,answers,sources,topics,discussions,entities,ingestion,workspace,accounts,core— each following the same Vertical Slicing andinterface.pyboundary rules. Drop theknowledge/domain folder and the RAG system is gone cleanly.
Target Products
- Sports Science Platform · University Wiki · Research Explorer · Recipe Archive
- Any product where documents are the data model and answers need to cite their sources.
Related Writing
Built On DAEMON-KP
- → SportsIQ — Sports knowledge platform, in development
Status
Private repository. The pipeline evolves with SportsIQ as the proving ground. Available on request.