- Auth + Entitlement
- Supabase JWT → uid.
- RevenueCat: if starter and
usage_today
≥ 10 → 429.
- Retrieve profile summary
- Redis hit → use immediately.
- Miss → query Supabase documentation via pgvector.
- Similarity filter
- sql
select *, 1 - (embedding <=> :ctx_emb) as score where score > 0.78 order by score desc limit 15;
- sql
- Live Q&A sweep
- StackOverflow top 5 (votes ≥ 5, last 2 yrs).
- GitHub issues closed < 90 d with
bug
label.
- Compose prompt
- LangChain PromptTemplate
{profile_summary} ### Additional context {so_snippets} {gh_snippets} ### User request {user_context} **Return**: 1. Installation 2. Example code 3. Common pitfalls 4. Citations
- LangChain PromptTemplate
- LLM answer
- Model =
MODEL_ANSWER
(DeepSeek). - Stream tokens to client.
- Compute token diff (
raw_docs_size
-answer_tokens
).
- Model =