Intake: bulk upload + auto-classification + assign-or-create flow
Adds an /intake triage queue for bulk-uploaded contracts. Each upload is
classified by an LLM and routed to an existing project (counterparty
match) or a new one with a single click.
Schema:
- documents.intake_role / intake_status / intake_counterparty /
intake_parent_counterparty / intake_lifecycle_hint / intake_confidence /
intake_analyzed_at.
Backend:
- New lib/intakeAnalysis.ts: maybeAnalyzeIntake() runs one LLM call that
determines role (buyer/seller/mutual), status (draft/execution/unknown),
counterparty, parent entity, lifecycle position (original/amendment/
renewal/addendum/sow/order_form/etc.), and self-reported confidence.
- Hooked into POST /single-documents and POST /projects/:id/documents,
fire-and-forget alongside contract-fact extraction.
- GET /single-documents/intake returns pending docs + the user's projects
for client-side counterparty matching.
- POST /single-documents/:id/assign accepts {project_id} OR
{new_project: {name, template, counterparty, parent_counterparty}}.
Frontend:
- New /intake route with bulk upload button (multi-file).
- Per-doc row shows role + status + lifecycle pills, counterparty +
parent + confidence, fuzzy-matched existing project suggestions
(single click to assign), and a "Create new project" button that
preselects the right template based on detected role.
- AppSidebar gains Intake entry above Projects.
- Polls every 4s while any doc is mid-analysis.
| Repository | Custos/legalos |
|---|---|
| Author | Custos <jfeinblum@gmail.com> |
| Authored | |
| Parents | 59760a0d |
| Stats | 8 files changed , +716 |
| Part of | Intake - bulk-upload triage queue with auto-classify and assign |
Capture this commit into my fork
Download a Markdown prompt that tells Claude how to port this
exact commit into your working tree. Run it via
claude -p < capture-commit-32b1f25b.md
from inside the repo you want the change in.