feat(X11): citation-corroboration Phase 1 — the signal (no approval change) #27

Merged
chaim merged 7 commits from feat/x11-corroboration-phase1 into main 2026-05-31 19:18:49 +00:00
2 changed files with 34 additions and 0 deletions
Showing only changes of commit 5abfbd2746 - Show all commits

View File

@@ -922,6 +922,18 @@ async def list_chair_feedback(
return await workflow.list_chair_feedback(case_number, category, unresolved_only) return await workflow.list_chair_feedback(case_number, category, unresolved_only)
@mcp.tool()
async def halacha_corroboration(halacha_id: str) -> dict:
"""החזר את ה-corroboration של הלכה: הציטוטים שמתקפים אותה, הטיפול, וסיכום (X11, read-only)."""
from uuid import UUID
from legal_mcp.services import corroboration as cor, db
links = await db.list_corroboration_for_halacha(UUID(halacha_id))
agg = cor.aggregate(
[{"source_id": (l["citing_case_law_id"] or l["citing_decision_id"] or ""), "treatment": l["treatment"]} for l in links]
)
return {"halacha_id": halacha_id, "summary": agg, "citations": links}
def main(): def main():
mcp.run(transport="stdio") mcp.run(transport="stdio")

View File

@@ -3439,6 +3439,28 @@ async def store_corroboration(
) )
async def list_corroboration_for_halacha(halacha_id: UUID) -> list[dict]:
"""Return all corroboration rows for one halacha, ordered by match_score DESC."""
pool = await get_pool()
rows = await pool.fetch(
"SELECT treatment, match_score, match_context, citing_case_law_id::text, "
" citing_decision_id::text, created_at "
"FROM halacha_citation_corroboration WHERE halacha_id = $1 "
"ORDER BY match_score DESC", halacha_id,
)
return [
{
"treatment": r["treatment"],
"match_score": float(r["match_score"]) if r["match_score"] is not None else None,
"match_context": r["match_context"],
"citing_case_law_id": r["citing_case_law_id"],
"citing_decision_id": r["citing_decision_id"],
"created_at": r["created_at"].isoformat() if r["created_at"] else None,
}
for r in rows
]
async def search_precedent_library_semantic( async def search_precedent_library_semantic(
query_embedding: list[float], query_embedding: list[float],
practice_area: str = "", practice_area: str = "",