Built from scratch in under 24 hours.
A source-grounded legal research assistant for personal-injury attorneys. Every claim is linked to a real public statute — no fabricated citations, no model-memory shortcuts.
For a short cheat sheet on adapters, extraction/retrieval/reasoning/verification, and the agent layer, see Architecture Q&A below (after the kickoff checklist).
Phased prep plan with technology guide: docs/plan.md.
Phase-1 MVP plan (CA Vehicle Code Harvester, query → UI): docs/phase1_plan.md. That doc describes the statute tables, hybrid retrieval, and /statutes API to build next; not all of it is implemented in the repo yet.
The repo is past blank scaffolding in a few areas, but most pipeline modules are still stubs.
- FastAPI app (backend/main.py): CORS for
http://localhost:3000,init_dbon startup,/healthz. - Status + ingest API (backend/api/):
GET /status— document counts + sample URLs from thedocumentstable.POST /ingest/search— Claudeweb_search_20250305discovers URLs, thenhttpxfetches and persists rows (deduped by URL).POST /ingest/url— direct URL fetch + persist.
- Persistence (backend/config.py, backend/db.py, backend/models.py): SQLite via SQLAlchemy;
documentstable only (nostatutes/ Phase-1 statute schema in code yet). - Ingestion (backend/ingestion/):
WebAdapter+ingest_searchpipeline written end-to-end for web search → fetch →Documentrows;base.pyprotocol;canlii/pdfadapters are still one-line stubs. - Extraction types (backend/extraction/schemas.py): full Pydantic models for Variant A (PI case comparator) —
PICaseFields, damages, liability,SourceSupport.extract.py/prompts.pyare not wired to production extraction yet. - Smoke check (backend/smoke_check.py):
python -m backend.smoke_checkverifies deps +ANTHROPIC_API_KEY. - Frontend (frontend/): Next.js 15 + React 19 + Tailwind; three-column shell matching the baseline layout. Components still return
null— no live API wiring.
- Statute Harvester (Phase 1 per brief):
Statute/StatuteFactormodels, Chroma + FTS5 hybrid retrieval,GET /statutes/{id},POST /statutes/search,GET /factors— specified in docs/phase1_plan.md; not present inbackend/yet (e.g.routes_statutes.py,retrieval/*implementations). - Parsing, chunking, case-law extraction runtime, retrieval indexes, reasoning, verification — baseline modules exist as placeholder files.
- Agent layer — openclaw/tools.json / openclaw/agent_prompt.md not filled for statute tools.
.env.example ANTHROPIC_API_KEY, DATABASE_URL, VECTOR_INDEX_PATH
requirements.txt fastapi, anthropic, chromadb, sqlalchemy, httpx, ...
package.json npm scripts that delegate to frontend/
backend/ Python package — FastAPI app
main.py app entry, routers: status + ingest
config.py / db.py runtime config + SQLAlchemy session
models.py documents table (statute tables = planned in phase1_plan)
ingestion/ pipeline + adapters (web implemented; canlii/pdf stub)
parsing/ stubs
extraction/ schemas.py (PI case Pydantic); extract/prompts stub
retrieval/ stubs (Chroma + hybrid planned)
reasoning/ stubs
verification/ stubs
api/ routes_ingest, routes_status (+ routes_search/answer/verify stub)
smoke_check.py
openclaw/ agent_prompt.md, tools.json — agent layer (minimal / empty)
frontend/ Next.js app: app/, components/ (UI placeholders)
data/ raw/, processed/, exports/, index/ (.gitkeep)
docs/ plan.md, phase1_plan.md, architecture.md, demo_script.md, ...
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -r requirements.txt
cp .env.example .env # then fill in ANTHROPIC_API_KEY (needed for /ingest/search)Frontend (optional):
npm install --prefix frontend
npm run dev # from repo root: runs Next dev server (see package.json)uvicorn backend.main:app --reloadUse /docs for interactive OpenAPI. Smallest working loop today: POST /ingest/url or /ingest/search → rows in SQLite + GET /status.
Next milestones (aligned with docs/phase1_plan.md)
- Data: CA Vehicle Code ingest (e.g. leginfo) →
statutes+statute_factors(or equivalent) with realofficial_urlper row. - Retrieval: implement Chroma + SQLite FTS5 + RRF hybrid search;
python -m backend.retrieval.build(or equivalent) after ingest. - API: statute lookup + search + factor listing; extend
/statusfor statute counts and eval metadata. - UI: wire
SearchPanel/ResultsPanel/SourceViewer/DatasetStatusto those endpoints. - Agent layer: tools pointing at the statute API for demos.
The checklist in docs/plan.md remains the broader baseline; docs/phase1_plan.md narrows Phase 1 to California-only query → result → UI on statutes.
- Every claim traces back to a public URL + paragraph snippet
- Unsupported claims get marked, not hidden
- No legal advice; this is a research prototype
Research prototype. Not legal advice. Results limited to indexed public sources.