b0bcdbeeef04c64b7c5e170f7c0427bcabb111cd
Root cause: the upload form "מראה המקום" field is stored only as case_number; citation_formatted was left empty and filled ONLY by the async metadata extraction, which runs in the local drainer (not the container) because it was lumped with halacha extraction. Result: the chair saw an empty מראה-מקום during the window and re-typed it by hand. Fix (hybrid — Option C): - Seed: _create_external_record / create_external_case_law store the chair's typed citation as citation_formatted at INSERT, so the field is never blank. A cited_only→external promotion preserves an existing non-empty value (prior edit). - Enrich: ingest_precedent runs metadata extraction INLINE in-container (gemini_session is direct REST, no local CLI) with force_citation=True, upgrading the seed to the canonical derived citation (parties + reporter + date) before the chair opens the page. Best-effort: on no key / API failure the seed remains and the queued metadata drain stays as the fallback. Halacha extraction is untouched (stays local — claude_session). - apply_to_record / extract_and_apply gain force_citation: re-assemble even when citation_formatted is non-empty, writing only when assembly SUCCEEDS (seed preserved on abstention). The drainer keeps the default (False) so a chair's manual edit in /precedents/[id] is never clobbered. Ops: GOOGLE_GEMINI_API_KEY added to the legal-ai Coolify app (runtime) — the SoT value from Infisical nautilus:/external-apis/gemini, validated against the API. Invariants: G2 (one citation-resolution + one metadata-extraction path, reused — no parallel logic), INV-ID2/X1§3 (citation_formatted stays a derived field; the seed is provisional and upgraded), INV-G10 (chair edits preserved). No schema change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
docs(principles): move research into docs/precedent-corpus-redesign/ (README + research-full) (#153)
Merge pull request 'feat(corpus): עיצוב-מחדש קורפוס-הפסיקה — ביטול תור-ההלכות, שכבת-מאומת-מאזכורים, דירוג-בזמן-אחזור (#153)' (#315) from worktree-canonical-synthesis into main
feat(corpus): corpus redesign — eliminate halacha queue, verified-by-citation layer, rank-at-retrieval (#153)
Description
AI Legal Decision Drafting System — MCP server, web upload, RAG search
Languages
Python
65.8%
TypeScript
32.2%
JavaScript
1%
Shell
0.7%
CSS
0.2%