DEV Community

Cover image for How I Built a Legal Intake and Triage App with Claude Code and Momen Backend
Aoxuan Guo for Momen

Posted on

How I Built a Legal Intake and Triage App with Claude Code and Momen Backend

This showcase was built as a workshop demo for the Cambridge Hack the Law hackathon. Aequitas is a legal-aid intake copilot: describe what happened in plain language, attach a notice, screenshot, PDF, or short video, and the system reads everything together, gauges urgency, surfaces missing facts, and suggests next steps or referrals.

The backend is configured visually in Momen. Claude Code built the frontend through Momen BaaS and deployed it to Vercel. The backend is intentionally small — which makes it a clear example of how visual backend setup connects to a coding-agent frontend.

Live demo: hack-the-law-multimodel-intake.vercel.app

Narrative and Evidence In, Structured Triage Out

Legal-aid intake is multimodal by nature. A tenant's story, an eviction summons photo, a court date buried in a PDF — intake staff need all of it at once. Prototyping that flow in a notebook is straightforward; shipping it as a shareable app usually means wiring file storage, API routes, model calls, and a database yourself.

Aequitas follows a single pipeline:

  • Free-text narrative plus optional contact fields
  • Multimodal attachments (image, document, or video)
  • Async AI triage returning structured JSON
  • Persisted intake and assessment records
  • Referral suggestions filtered from a reference org directory

Claude Code handles the intake form and result layout quickly. The backend — media columns, structured-output agent, async orchestration, reference tables — is where Momen earns its place. Everything configured in the editor becomes GraphQL. Claude Code reads the schema via MCP instead of inventing endpoints. See Why Backend Structure Always Matters (Even If You Don't Write Code) for why that structure matters even when you never touch server code.

What the System Does

App features

  • Public intake form with optional account sign-in on the deployed demo
  • Free-text narrative with optional name and email
  • Multimodal attachments: photo/screenshot (IMAGE), document/PDF (FILE), short video (VIDEO)
  • Async AI triage — structured assessment with issue category, summary, jurisdiction, parties, and key dates
  • Urgency classification (critical | high | medium | low) with reason and deadline
  • Missing-facts checklist and recommended next steps (markdown bullets from the agent)
  • Referral category assignment for routing to legal-aid org types
  • Confidence score on each assessment
  • No payments or external APIs beyond Momen's built-in AI and file storage

Data model

The backend uses five business and reference tables, modeled in the Momen database editor:

The intakeassessment relation is one-to-one with a unique constraint on intake_id. Assessment columns mirror the agent's JSON schema directly — issue_category, issue_summary, document_type, jurisdiction, parties, key_dates, urgency_level, urgency_reason, deadline, missing_facts, recommended_steps, referral_category, and confidence. The frontend queries relational data instead of parsing raw LLM text.

Reference tables give the agent and the UI a consistent urgency taxonomy and referral routing vocabulary. That "structure first" approach — define rubrics visually, let AI align to them — is the same pattern described in Getting Started with Agentic Workflows in AI Applications.

AI

One multimodal AI agent configured as a civil legal-aid intake specialist:

  • Inputs: narrative (TEXT), document_image (IMAGE), document_file (FILE), document_video (VIDEO)
  • Role: analyze narrative and supporting documents to triage legal issues, classify them, assess urgency, and identify missing information for human review
  • Structured output (required): issue_category, issue_summary, parties, urgency_level (exactly one of critical | high | medium | low), urgency_reason, deadline, missing_facts, recommended_steps, referral_category, confidence (0.0–1.0)
  • Optional output: document_type, jurisdiction, key_dates

Non-streaming structured response. The frontend waits for complete JSON, then renders the triage card. All four input types can be passed in a single agent call — no separate OCR or transcription pipeline.

Backend logic

One async Actionflow — triage_intake:

  • Receive narrative, attachment IDs, and optional contact fields
  • Insert intake row (status pending)
  • Start AI conversation with the triage agent, passing narrative and all attached media
  • Insert assessment row — map agent JSON fields into typed columns linked to the intake
  • Update intake.status to triaged
  • Return intake_id

The flow runs async because multimodal model inference exceeds sync Actionflow timeouts.

Frontend invocation pattern:

  1. Presigned upload for each attachment type (imagePresignedUrl, filePresignedUrl, videoPresignedUrl) → HTTP PUT binary → collect asset IDs. See File Management and the momen-baas-skill for the two-step binary workflow.
  2. fz_create_action_flow_task with triage_intake arguments
  3. WebSocket subscription fz_listen_action_flow_result until status is COMPLETED
  4. GraphQL query intake_by_pk with nested assessment, then filter referral rows by category and jurisdiction

Integration — Momen BaaS to Claude Code frontend

Backend (Momen editor)

  1. Create intake, assessment, and reference tables with relations
  2. Seed urgency_level, referral_category, and referral rows
  3. Configure the multimodal triage agent with structured output schema
  4. Build the triage_intake Actionflow

Frontend (Claude Code + BaaS)

  1. Install momen-baas-skill
  2. Enable Momen MCP — Claude Code introspects agent inputs, Actionflow names, and output schemas
  3. Generate:

    • Intake form UI with multi-type file pickers
    • Binary upload helpers (presigned URL protocol per attachment type)
    • Async triage_intake invocation + WebSocket subscription
    • Triage result view (urgency badge, missing facts, recommended steps)
    • Referral list filtered from the referral table by assessment category
  4. Deploy to hack-the-law-multimodel-intake.vercel.app

The BaaS integration guide covers MCP setup for Claude Code and the recommended loop: visual backend → configure agent → re-read schema after sync. What is MCP and How It Transforms AI Integrations explains why MCP-backed schema reading beats prompt-only integration — Claude Code generates filter syntax, mutation names, and subscription patterns against the introspected schema without manual API documentation.

For broader context on the BaaS pattern with coding agents, Vibe coding best practices and the best BaaS options for 2025 and How to Get Started with Claude Code for Developers cover the toolchain this project sits in.

Design

  • Backend: headless — no Momen canvas UI
  • Frontend (Claude Code): three-step hero (Describe → AI triages → Get matched referrals), intake form, async processing state, structured triage card, referral suggestions
  • Permissions: open anonymous access for the demo; production would use role-based permissions

Technical highlights

  • Small but complete backend: two core business tables, three reference tables, one agent, one Actionflow
  • Multimodal in one agent call: narrative plus up to three attachment types — no separate OCR pipeline
  • Structured output → typed columns: assessment fields map 1:1 from agent JSON to Postgres
  • Async by default for AI: task + subscription pattern, not polling
  • Referral routing without custom code: org directory is plain table data the frontend filters after triage
  • Visual logic collocated with Postgres: orchestration runs server-side in Actionflow, not at a distant Edge layer — the same advantage Stop Rolling the Dice: How to Build a Predictable AI Backend That Won't Break Your Lovable App describes for AI frontends that need a reliable backend

How Long It Takes and What It Costs

Momen Pro required for multimodal AI agents. Claude Code on an existing subscription. Vercel free tier for the demo. Each triage run consumes AI points for the multimodal model call.

Try It Live

Demo: hack-the-law-multimodel-intake.vercel.app

  • Describe a legal situation in the narrative field
  • Optionally attach a notice photo, document, or short video
  • Submit for triage and wait for the structured assessment
  • Review urgency, missing facts, recommended steps, and referral suggestions

To rebuild a similar backend, create a Momen project, configure the data model and agent visually, install momen-baas-skill, and prompt Claude Code to build the frontend against your project schema.

Closing Thoughts

Aequitas is a workshop showcase, not a production legal-aid deployment — but it demonstrates a pattern that repeats across intake and triage scenarios. A visual Momen data model, reference rubrics, one structured-output agent, and one async Actionflow handle the backend. Claude Code handles the UI. No custom server routes, no separate object storage, no Edge Function glue.

If you are exploring Momen as a BaaS for multimodal AI workflows, this is a direct path from editor config to live deploy. Start with the BaaS docs, configure a structured-output agent in the editor, and let Claude Code read the schema through MCP.

Top comments (0)