An AI courtroom for challenging denial decisions.
Built for HackDuke, VerdictX helps people examine denial letters for loans, insurance, housing, and benefits. Specialist AI agents challenge the decision, a defender argues for the institution, and a judge evaluates the debate. When at least two challenges are conceded, the application generates an appeal letter for human review.
- Structured analysis: Extract denial details from pasted text.
- Parallel specialist review: Examine potential bias, precedent, personal circumstances, and legal arguments.
- Adversarial debate: Follow the defender’s responses and see which challenges are conceded or rebutted.
- Live courtroom interface: Display analysis and debate progress through server-sent events (SSE).
- Appeal generation: Copy the generated letter or save it as a PDF through the browser’s print dialog.
- Profiles and case history: Sign in with Auth0, provide context, and revisit MongoDB-backed case records through the hosted API.
- Optional outreach: Email appeals and courtroom PDF summaries through Resend, or initiate automated Twilio calls.
flowchart TD
A[Denial letter] --> B[Parser]
B --> C[Bias auditor]
B --> D[Precedent agent]
B --> E[Circumstance agent]
B --> F[Legal agent]
C --> G[Defender and rebuttals]
D --> G
E --> G
F --> G
G --> H[Judge assessment]
H --> I{At least two concessions?}
I -->|Yes| J[Generate appeal]
I -->|No| K[Show review outcome]
The pipeline supports eight IBM watsonx Orchestrate agents:
| Agent | Role |
|---|---|
| Parser | Convert the denial letter into structured data. |
| Bias auditor | Identify potential discrimination signals. |
| Precedent agent | Identify precedents for challenging the denial. |
| Circumstance agent | Develop arguments based on the applicant’s situation. |
| Legal agent | Identify potential legal issues. |
| Denial defender | Defend the decision and respond to challenges. |
| Override judge | Assess the arguments and rebuttals. |
| Appeal writer | Draft an appeal when the threshold is met. |
An “override” is an internal application outcome, not a reversal of an institution’s decision. The local backend counts actual CONCEDED verdicts from the defender. The hosted handler uses those verdicts too, with a fallback to the judge’s conceded-argument list when rebuttal data is absent.
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, Tailwind CSS |
| AI orchestration | IBM watsonx Orchestrate |
| Local API | Node.js, Express |
| Hosted API | Vercel serverless functions |
| Authentication | Auth0 |
| Persistence | MongoDB |
| Email and PDF attachments | Resend, PDFKit |
| Voice calls | Twilio |
| Alternative voice service | Python, FastAPI |
Use Node.js 20.19 or newer and npm. The backend uses the built-in fetch API.
git clone https://github.com/noteesh/HackDuke.git
cd HackDuke
npm install
npm --prefix backend install
npm --prefix frontend installcp backend/.env.example backend/.env
cp frontend/.env.example frontend/.envReplace the example values with your own configuration. Keep server credentials in backend/.env; only public frontend configuration belongs in VITE_ variables.
Backend variables
| Variable | Purpose |
|---|---|
IBM_KEY |
IBM API key for token exchange. |
SERVER_INSTANCE |
Orchestrate instance base URL; the client appends /v1/orchestrate/<agent-id>/chat/completions. |
PARSE_AGENT_ID |
Parser agent ID. |
BIAS_AGENT_ID |
Bias auditor agent ID. |
PRECEDENT_AGENT_ID |
Precedent agent ID. |
CIRCUMSTANCE_AGENT_ID |
Circumstance agent ID. |
LEGAL_AGENT_ID |
Legal agent ID. |
DEFENDER_AGENT_ID |
Denial defender agent ID. |
JUDGE_AGENT_ID |
Judge agent ID. |
APPEAL_AGENT_ID |
Appeal writer agent ID. |
MONGODB_URI |
Connection string for hosted profile and case endpoints. |
RESEND_API_KEY |
Optional email service key. |
MAIL_FROM |
Sender address for appeal emails. |
APP_NAME |
Optional email branding; set to VerdictX. |
TWILIO_ACCOUNT_SID |
Optional Twilio account ID. |
TWILIO_AUTH_TOKEN |
Optional Twilio credential. |
TWILIO_PHONE_NUMBER |
Twilio sender number. |
APP_URL |
Public application URL for hosted Twilio callbacks. |
Provision the agents in your IBM environment and set their IDs. The repository includes reference text in knowledgebase/, but no automated agent-provisioning workflow. Agent responses must match the JSON fields consumed by backend/index.js and api/analyze.js.
Frontend variables
VITE_AUTH0_DOMAIN=your-tenant.auth0.com
VITE_AUTH0_CLIENT_ID=your-public-client-id
VITE_AUTH0_CALLBACK_URL=http://localhost:5173Configure an Auth0 single-page application with http://localhost:5173 as an allowed callback URL, logout URL, and web origin. The frontend makes relative /api requests, which Vite proxies to http://localhost:3001. The example’s VITE_API_URL variable is not consumed by the current frontend.
From the repository root, start the backend:
cd backend
node index.jsIn a second terminal, starting from the repository root:
cd frontend
npm run devOpen http://localhost:5173. The API listens on http://localhost:3001.
Use these direct commands: the root npm run dev currently delegates to backend scripts that incorrectly reference nested backend/ and frontend/ directories.
- Sign in with your configured Auth0 application.
- Paste a denial letter or select a built-in example.
- Start the review and follow the arguments and rebuttals.
- Inspect the outcome. If two or more challenges are conceded, review the appeal and copy or print it.
Missing agent IDs may activate individual fallbacks or skip stages; they do not provide a complete offline AI demo.
The repository contains two API implementations with different capabilities:
| Capability | Local Express backend | Vercel API |
|---|---|---|
| Denial analysis | Supported | Supported |
| Debate | Up to three rebuttal rounds | One rebuttal round |
| Applicant profile in prompts | Not passed through | Supported |
| Profiles and case history | Routes not implemented | MongoDB-backed routes |
| Appeal email | Supported | Supported, with courtroom PDF generation |
| Voice calls | Not mounted in Express | Twilio routes included |
The local frontend still requests profiles and case history, so those requests can fail with the Express-only setup. Use the Vercel deployment for the included persistence and voice endpoints. The alternative Python voice service is separate and is not started by the commands above.
The root vercel.json builds frontend/, serves frontend/dist, and routes API requests to the functions in api/.
- Import the repository into Vercel with the repository root as the project directory.
- Add the server environment variables and public
VITE_AUTH0_*values to the project. The serverless handlers do not loadbackend/.env. - Set
VITE_AUTH0_CALLBACK_URLandAPP_URLto the deployed URL, and register that URL in Auth0. - Configure MongoDB connectivity. The API uses the
theoverridedatabase and itsprofilesandcasescollections. - Deploy and verify sign-in, analysis, and case persistence. Configure Resend and Twilio to enable outreach.
The analysis function requests a 300-second maximum duration in vercel.json; the deployment environment must support that duration.
| Method | Endpoint | Purpose |
|---|---|---|
POST |
/api/analyze |
Analyze { denialText, userProfile } and return SSE; the local backend uses only denialText. |
GET |
/api/profile?userId=... |
Load a profile. |
POST / PUT |
/api/profile |
Create or update a profile. |
GET |
/api/cases?userId=... |
List cases; add caseId to retrieve one case. |
POST |
/api/cases |
Save a completed review. |
POST |
/api/send-appeal |
Send an appeal email. |
POST |
/api/call/initiate |
Initiate a voice call. |
POST |
/api/call/webhook/start |
Return TwiML for the hosted call flow. |
See the implementation files for complete request fields. Availability depends on the runtime described above.
| Path | Contents |
|---|---|
frontend/src/ |
React UI, authentication, dashboard, and courtroom components. |
backend/index.js |
Local Express API and multi-round debate. |
backend/orchestrateClient.js |
IBM token exchange and agent invocation. |
backend/test-agents.js |
Manual checks against configured IBM agents. |
backend/main.py |
Alternative FastAPI voice service. |
api/ |
Vercel API handlers. |
api/utils/ |
Courtroom summary and PDF generation. |
knowledgebase/ |
Reference text for agent configuration. |
Some package names and internal identifiers retain the earlier name The Override.
Build the frontend from the repository root:
npm --prefix frontend run buildRun the manual agent checks after configuring IBM credentials:
cd backend
node test-agents.jsThe agent checks make real external requests. No automated test suite is configured in the package scripts.
VerdictX is a hackathon prototype. Generated arguments and citations require human verification. Agent concessions are simulated debate results, not admissions by the institution receiving an appeal.
Auth0 gates the frontend, but the current API handlers do not validate bearer tokens or enforce authenticated ownership of client-supplied userId values. Server-side authorization is needed before using real personal data or publicly exposing outreach endpoints.