How swethaallada/kavach works
Kavach is a citizen-safety service that analyzes suspicious messages and screenshots through one shared decision engine, returning a localized verdict with citations and scam-only guidance. The web UI and WhatsApp adapter are documented entry points; the backend also supports pattern submissions and an anonymized trends view. The graph preserves the documented classifier stages and major product branches. Some internal links rely on README statements or SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: classifier.py Classifier · webhook.py WhatsApp adapter · HomePage.jsx Analysis page · App.jsx Web app
Components 24
Web experience
- Web app
frontend/src/App.jsx - Analysis page
frontend/src/pages/HomePage.jsx - Text and image input
frontend/src/components/AnalyzePanel.jsx - Verdict display
frontend/src/components/VerdictCard.jsx - Trends dashboard
frontend/src/components/TrendsDashboard.jsx - Language context
frontend/src/lib/LangContext.js
Channel and API
- Analyze endpoint
backend/routes/analyze.py - Image endpoint
backend/routes/image.py - WhatsApp adapter
backend/routes/webhook.py - Pattern intake API
backend/routes/patterns.py - Trends API
backend/routes/trends.py
Decision engine
- Classifier
backend/services/classifier.py - Rules classifier
backend/services/rules.py - LLM analysis
backend/services/llm.py - Pattern retrieval
backend/services/rag.py - Image extraction
backend/services/vision.py - Guided report
backend/services/report.py - Response locales
backend/core/locales_loader.py
Knowledge and signals
- Crowd pattern store
backend/services/pattern_store.py - Telemetry and audit store
backend/services/store.py
Other components
- Citizen
- Twilio
- Supabase
- xAI Grok
Connections 26
- Citizen → Web app: uses
README.md - Web app → Analysis page: routes to
frontend/src/App.jsx - Analysis page → Text and image input: renders
frontend/src/pages/HomePage.jsx - Text and image input → Analyze endpoint: submits text
README.md - Text and image input → Image endpoint: submits image
README.md - Analysis page → Verdict display: renders verdict
frontend/src/pages/HomePage.jsx - Language context → Analysis page: supplies language
frontend/src/pages/HomePage.jsx - Analyze endpoint → Classifier: calls analyze
README.md - Image endpoint → Image extraction: extracts text
backend/routes/image.py - Image endpoint → Classifier: analyzes text
backend/routes/image.py - Twilio → WhatsApp adapter: sends message
README.md - WhatsApp adapter → Classifier: calls analyze
README.md - WhatsApp adapter → Image extraction: extracts image text
backend/routes/webhook.py - WhatsApp adapter → Response locales: formats reply
- Pattern intake API → Crowd pattern store: reads and writes
backend/routes/patterns.py - Classifier → Rules classifier: classifies first
backend/services/classifier.py - Classifier → LLM analysis: requests analysis
backend/services/classifier.py - LLM analysis → xAI Grok: calls model
README.md - Classifier → Pattern retrieval: retrieves citations
backend/services/classifier.py - Classifier → Guided report: builds guidance
backend/services/classifier.py - Classifier → Response locales: localizes response
backend/services/classifier.py - Classifier → Telemetry and audit store: logs audit
backend/services/classifier.py - Telemetry and audit store → Supabase: writes telemetry
README.md - Web app → Trends dashboard: routes to trends
frontend/src/App.jsx - Trends dashboard → Trends API: requests trends
README.md - Trends API → Supabase: reads aggregate
README.md