feat(mcp): FU-14 GAP-47 (חלק provenance) — draft_section מחזיר document_id+page+score

ה-provenance (document_id, page_number, score) כבר נשלף ב-search_similar אך
נזרק בבניית פלט draft_section. כעת מוחזר לכל קטע ב-case_documents/precedents,
כך שהכותב יכול לעקוב אחורה אל מסמך-המקור והעמוד ולצטטם, ולא לסמוך על תוכן
חסר-מקור. תוספתי בלבד — אין צרכן שמפרסר את מפתחות-הפלט, תואם-לאחור.

נותר ב-GAP-47: העברת הנחיות-יו"ר מ-analysis-and-research.md ל-DB
(get_chair_directions) — שינוי-מסלול גדול יותר, לפרוסה נפרדת.

Invariants: מקיים INV-TOOL4 (מקור-אמת נגיש) + G9 (provenance). לא נוגע ב-G2/G1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 15:58:39 +00:00
parent 4977ab8d9a
commit 40c1111e9b
3 changed files with 16 additions and 2 deletions

View File

@@ -199,6 +199,10 @@ async def draft_section(
case_number: מספר תיק הערר
section: סוג הסעיף (facts, appellant_claims, respondent_claims, legal_analysis, conclusion, ruling)
instructions: הנחיות נוספות לניסוח
כל קטע ב-case_documents/precedents מלווה ב-provenance: document_id, page
(מספר עמוד במסמך-המקור, אם קיים) ו-score — כדי שניתן יהיה לעקוב אחורה
אל המקור ולצטטו, ולא לסמוך על התוכן ללא מקור.
"""
case = await db.get_case_by_number(case_number)
if not case:
@@ -245,10 +249,16 @@ async def draft_section(
},
"section": section,
"instructions": instructions,
# GAP-47 (INV-TOOL4/G9): surface provenance — document_id + page —
# so the writer can cite chunks back to their source (already fetched
# by search_similar, was previously discarded).
"case_documents": [
{
"document": c["document_title"],
"document_id": str(c["document_id"]),
"page": c.get("page_number"),
"section_type": c["section_type"],
"score": round(c.get("score", 0.0), 4),
"content": c["content"],
}
for c in case_chunks
@@ -257,6 +267,9 @@ async def draft_section(
{
"case_number": c["case_number"],
"document": c["document_title"],
"document_id": str(c["document_id"]),
"page": c.get("page_number"),
"score": round(c.get("score", 0.0), 4),
"content": c["content"][:500],
}
for c in precedent_chunks[:3]