Context
Spiritual teaching communities study Hawkins' books line by line — a paraphrased quote is a wrong quote. Off-the-shelf RAG (chunk + embed + top-k) fails here: semantic search returns "close enough" passages, which is exactly what users cannot accept. Numen was built as a real product: tiered subscriptions, quotas and payments, not a demo.
Architecture
Channel layer (WhatsApp via Evolution API)
- Text and voice both ways: Whisper transcription in, ElevenLabs synthesis out.
- Message debouncing: rapid consecutive messages are accumulated in Postgres and merged before processing — the bot answers the person, not each fragment.
- Guardrails node on the response path.
Product layer
- Subscription tiers (free / basic / standard / premium) with per-tier quotas, daily resets, limit notifications and in-chat payment links.
- Per-tier assistant sub-workflows: the premium path gets the deeper pipeline.
Retrieval engine (the core)
- Query classifier routes each question to a specialized handler (simple / complex / meditation / practice) with its own prompt and model.
- Multi-query expansion: a dispatcher LLM splits complex questions into sub-queries processed in parallel.
- Hybrid retrieval: exact-term SQL + semantic (pgvector) in one query — exact match wins where wording matters, semantic covers concepts.
- Two-stage reranking with a decision layer that arbitrates between rankers, producing an evidence pack for the answering agent.
- Gap detector: identifies when retrieved evidence doesn't cover the question and proposes what's missing instead of hallucinating.
Self-learning loop (the 50% → 90%)
- Every answered query passes a "should learn?" gate; learned patterns are embedded and stored, and a strategic layer adjusts retrieval behavior over time.
- Every interaction is logged for offline review — accuracy was measured and iterated, not assumed.
Conversation layer
- 9+ specialized agents: intent router, RAG formulator, RAG executor, appointment manager, insistence manager, re-introduction manager, conversational rhythm, message analyzer, FAQ agent.
- Memory: Redis for live conversation context, Postgres for durable history.
Cost-aware multi-model routing
- Cheap fast models (Gemini flash-lite, GPT mini/nano tiers) for classification, routing and formatting; stronger models only where answer quality pays for them.
Results
| Metric | Value |
|---|---|
| Answer accuracy (internal eval) | ~50% → ~90% |
| Corpus | 6-7 books, ~2,000 pages, metadata-enriched by chapter/topic |
| Orchestration | ~200 nodes, 3 workflows, 9+ agents |
| Modalities | Text + voice (STT/TTS), monetized tiers |
| Volume | ~70 messages/month, private user group |
Stack
n8n · Supabase (Postgres + pgvector) · Redis · Evolution API (WhatsApp) · OpenAI (Whisper, GPT mini/nano) · Gemini (flash-lite) · ElevenLabs · reranker API