Agentic workflow that turns messy consumer complaint evidence into grounded, escalation-ready claim packages.
Hackathon: Protex Hack-2-Win 2026
Track: Track 2 – Agentic AI / AI Workflows
| Layer | Tech |
|---|---|
| Frontend / App | Next.js 16 App Router + TypeScript + Tailwind v4 |
| Backend | Server-side logic inside Next.js route handlers and server components |
| Database + Storage | Supabase (PostgreSQL + Storage) |
| AI Reasoning | Groq API (llama-3.3-70b-versatile) |
| OCR / Document Extraction | OCR.space |
| Deployment | Vercel |
- Intake – The consumer describes their complaint and uploads supporting evidence (emails, screenshots, receipts).
- Evidence Extraction – OCR and document parsing extract structured facts from uploaded files.
- Policy Retrieval – The pipeline retrieves relevant company policies and consumer regulations (DGCA rules, E-Commerce Rules 2020) grounded to the complaint.
- AI Analysis – Groq-powered reasoning evaluates the claim against retrieved policies, identifies violations, and scores claim strength.
- Output Generation – The system produces a case summary, drafted grievance emails, escalation notes, and an evidence checklist.
- Communication & Escalation – Built-in email drafting and escalation workflows with manual, assisted, and autopilot modes.
- The live pipeline uses Groq as the primary reasoning provider.
- OCR.space is used for uploaded image OCR and best-effort PDF extraction.
- Support Breadth: The platform applies a Hybrid Grounding Model.
- Merchant-grounded support: IndiGo and Flipkart have full policy coverage in the stable baseline.
- Generic fallback: For unsupported merchants, the pipeline relies on ingested regulations and generic escalation guidance.
- The app provides informational guidance, not legal advice.
Currently, the pipeline isolates policy grounding through deterministic keyword matching and merchant-name normalization.
Future Roadmap: In future versions, policy retrieval should migrate from keyword filtering to deep semantic embeddings stored in PostgreSQL using pgvector. A vector-based retriever would intelligently match conceptually identical grievances without requiring hardcoded keyword maps, dramatically improving retrieval accuracy on generalized merchant policies.
- Node.js 18+
- npm
- A Supabase project
- A Groq API key
- An OCR.space API key
npm install
npm run devOpen http://localhost:3000.
Create .env.local from the example:
Copy-Item .env.example .env.localThen fill in:
| Variable | Where to find it |
|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Supabase Dashboard > Project Settings > API > Project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Supabase Dashboard > Project Settings > API > anon/public key |
SUPABASE_SERVICE_ROLE_KEY |
Supabase Dashboard > Project Settings > API > service_role key |
GROQ_API_KEY |
Groq Console |
OCR_SPACE_API_KEY |
OCR.space |
- Create a Supabase project.
- Open the SQL Editor.
- Run
supabase/schema.sql. - Confirm the
evidencestorage bucket exists. - Confirm storage policies are present for the browser upload flow.
- Visit
/api/healthlocally and confirm Supabase is configured.
app/ # Next.js pages, layouts, route handlers
api/health/ # Health check endpoint
api/pipeline/run/ # Pipeline execution endpoint
api/case/delete/ # Secure claim deletion endpoint
case/[id]/ # Case workspace (resizable panels)
new/ # Intake workspace
profile/ # User profile management
lib/
document/ # OCR.space adapter
groq/ # Groq reasoning adapter
pipeline/ # Pipeline steps and orchestration
supabase/ # Supabase clients and helpers
types/ # Shared types
supabase/ # Database schema and migrations
data/
policies/raw/ # Policy and regulation corpus
- Resizable Workspace – Desktop case view uses
react-resizable-panelsfor adjustable panel sizing; mobile auto-stacks. - Communication Modes – Manual, assisted, and autopilot escalation workflows.
- User Profile – Editable name, email, and phone used as default variables in drafted complaint letters.
- Secure Claim Deletion – User-scoped deletion with ownership verification, confirmation step, cascading DB cleanup, and evidence storage pruning.
- Responsive Design – Premium dark editorial theme with mobile-optimized spacing and layout.
Full guide: DEPLOYMENT.md
Quick version:
- Push the repo to GitHub.
- Import it into Vercel.
- Add these environment variables before deploying:
| Variable | Required |
|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Yes |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Yes |
SUPABASE_SERVICE_ROLE_KEY |
Yes |
GROQ_API_KEY |
Yes |
OCR_SPACE_API_KEY |
Yes |
- Deploy.
- Verify with
/api/health.
- OCR.space free-tier constraints still apply.
- Uploaded image OCR is verified working.
- PDF extraction is best-effort and may be constrained by file size and free-tier limits.
- The product provides informational guidance, not legal advice.
- DEPLOYMENT.md – Deployment guide
- VALIDATION.md – Problem validation and track fit
Made with ❤️ by Team Yin & Yang for Protex Hack-2-Win 2026