feat(learning): חיווט אוטונומי לכפתורי מסלול-הסופי — סקריפט-תזמור אחד לכל שלב

הכפתורים "הרץ למידת-קול"/"הרץ אימות-הלכות" מעירים את הרמס, ובמקום שהסוכן
(DeepSeek) ירכיב כמה קריאות-כלי (שביר), הוא מריץ עכשיו פקודה דטרמיניסטית אחת.

חדש:
- scripts/final_learning_pipeline.py — (1) ingest_final_version עם נתיב-הסופי
  (מדלג אם הזוג כבר analyzed; --force לחידוש), (2) רישום לקורפוס-הסגנון
  (idempotent — סוגר את הפער שפאנל-הסגנון דרש corpus_id), (3) style_lesson_panel
  --apply. --dry-run להרצה בטוחה.
- scripts/final_halacha_pipeline.py — extract_internal_citations →
  corroboration.build_all → halacha_panel_approve --apply. --dry-run / --limit.

briefs הרמס (web/paperclip_client._curator_task_brief) פושטו לפקודה-אחת לכל
task — חסין מול הרצת-סוכן. תוקנו שני הפערים שזוהו: ingest דרש file_path,
ופאנל-הסגנון דרש style_corpus.

נלווה: תיקון help מיושן של halacha_panel_approve (--apply מחווט). SCRIPTS.md.

אומת: שני ה-pipelines רצו dry-run על בל"מ 8126-03-25 (skip-ingest, קורפוס,
פאנלים) בהצלחה. Invariants: INV-LRN1/LRN5/G10 (הפיך, שער-יו"ר ידני נשמר),
INV-DM7. G2 — תזמור של יכולות קיימות, לא מסלול-מקביל.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-08 10:21:39 +00:00
parent c028328175
commit 0f0656ecca
5 changed files with 257 additions and 32 deletions

View File

@@ -1056,27 +1056,25 @@ def _curator_task_brief(task: str, case_number: str, final_filename: str) -> tup
task='learning' — draft↔final voice distillation + the 2-judge style panel.
task='halacha' — extract the halachot CITED in the final + corroboration + the
3-judge halacha panel.
The curator (Hermes) has Bash + MCP tools, so it both calls MCP tools and runs the
local panel scripts. Panels write only reversible, CSV-backed proposals (INV-G10).
The curator (Hermes) runs ONE deterministic local pipeline script per task — the
script chains the MCP-tool calls + panels internally, so the agent only has to run a
single command (reliable). Panels write only reversible, CSV-backed proposals (INV-G10).
"""
if task == "halacha":
title = f"[ערר {case_number}] אימות-הלכות — פאנל 3-סוכנים"
description = (
f"אימות ההלכות שצוטטו בהחלטה הסופית של תיק {case_number} "
f"אימות ההלכות סביב ההחלטה הסופית של תיק {case_number} "
f"(`{final_filename}`).\n\n"
f"**שלב 1 — ציטוטים:** הרץ "
f"`mcp__legal-ai__extract_internal_citations(chair_name=\"דפנה תמיר\")` "
f"כדי למפות לאילו תקדימים ההחלטה מפנה.\n"
f"**שלב 2 — חילוץ הלכות:** לכל תקדים מצוטט שקיים בספרייה הרץ "
f"`mcp__legal-ai__precedent_extract_halachot(case_law_id=...)` (idempotent). "
f"תקדים מצוטט שחסר — `mcp__legal-ai__missing_precedent_create`.\n"
f"**שלב 3 — corroboration:** `mcp__legal-ai__corroboration_rebuild` לבניית "
f"אות-התיקוף (treatment) ומדיניות.\n"
f"**שלב 4 — פאנל-הלכות (אוטו-אישור + אסקלציה):** הרץ "
f"`cd ~/legal-ai/mcp-server && .venv/bin/python ../scripts/halacha_panel_approve.py --apply`. "
f"הסכמה 2/3+ → approved/rejected (הפיך, מגובה ל-CSV); פיצול → נשאר pending_review "
f"ליו\"ר. **אל תקבע סמכות binding/persuasive — היא נגזרת מ-precedent_level (INV-DM7).**\n"
f"**שלב 5:** כתוב comment בעברית עם סיכום (כמה אושרו/נדחו/הוסלמו), סגור issue (done)."
f"**הרץ פקודה אחת:**\n"
f"```\ncd /home/chaim/legal-ai/mcp-server && "
f".venv/bin/python ../scripts/final_halacha_pipeline.py --case {case_number}\n```\n"
f"הסקריפט מבצע דטרמיניסטית: (1) `extract_internal_citations` (גרף-ציטוטים), "
f"(2) `corroboration_rebuild` (אות-תיקוף + מדיניות), (3) פאנל-הלכות תלת-סוכני "
f"(Opus+DeepSeek+Gemini) `--apply` — הסכמה→approved/rejected (הפיך, מגובה ל-CSV), "
f"פיצול→pending_review ליו\"ר. סמכות binding/persuasive נגזרת מ-precedent_level "
f"(INV-DM7), לא נקבעת בפאנל.\n"
f"**לסיום:** כתוב comment בעברית עם סיכום הפלט (אושרו/נדחו/הוסלמו), סגור issue (done). "
f"תקדים מצוטט שחסר בספרייה — פתח `missing_precedent_create` והפנה ליו\"ר."
)
return title, description
@@ -1085,21 +1083,18 @@ def _curator_task_brief(task: str, case_number: str, final_filename: str) -> tup
description = (
f"דפנה סימנה את ההחלטה הסופית של תיק {case_number} כסופית.\n"
f"קובץ סופי: `{final_filename}`\n\n"
f"**שלב 1 — דיסטילציה (חובה, draft↔final):** הרץ "
f"`mcp__legal-ai__ingest_final_version(case_number=\"{case_number}\")`. "
f"הוא משווה את הטיוטה (snapshot מפנקס-ההתאמה) לסופי, מסווג כל שינוי "
f"style_method מול substance (INV-LRN5), ושומר את ההצעה ב-draft_final_pairs "
f"(status→analyzed). **אל תקבע לקח לבד — זו הצעה לאישור.**\n"
f"**שלב 2 — פאנל-סגנון דו-סוכני (DeepSeek+Gemini, אוטו-אישור + אסקלציה):** הרץ "
f"`cd ~/legal-ai/mcp-server && .venv/bin/python ../scripts/style_lesson_panel.py "
f"--case {case_number} --apply`. הסכמה 2/2 → נכתב כ-decision_lesson "
f"(source=panel:deepseek+gemini); פיצול → מוסלם ליו\"ר. רק לקחי style_method "
f"נשקלים (substance מדולג, INV-LRN5).\n"
f"**שלב 3 — הצעה:** מתוך לקחי-הסגנון שאושרו בפאנל, בחר 3-5 דפוסים שלא תועדו "
f"ב-skills/decision/SKILL.md / docs/legal-decision-lessons.md / "
f"daphna-voice-fingerprint.md (אל תציע מה שכבר שם). כתוב comment בעברית, ניטרלי, ממוספר.\n"
f"**שלב 4:** עדכן MEMORY.md, סגור issue (status=done). הטמעה ל-SKILL.md/lessons.md "
f"נשארת אישור-יו\"ר ידני (INV-G10)."
f"**הרץ פקודה אחת:**\n"
f"```\ncd /home/chaim/legal-ai/mcp-server && "
f".venv/bin/python ../scripts/final_learning_pipeline.py --case {case_number}\n```\n"
f"הסקריפט מבצע דטרמיניסטית: (1) `ingest_final_version` — דיסטילציית טיוטה↔סופי "
f"(Opus), מסווג style_method מול substance (INV-LRN5), שומר ב-draft_final_pairs "
f"(status→analyzed); (2) רישום לקורפוס-הסגנון (idempotent); (3) פאנל-סגנון דו-סוכני "
f"(DeepSeek+Gemini) `--apply` — הסכמה 2/2→decision_lesson "
f"(source=panel:deepseek+gemini), פיצול→ליו\"ר. substance מדולג.\n"
f"**לסיום:** מתוך לקחי-הסגנון שאושרו, בחר 3-5 דפוסים שלא תועדו ב-skills/decision/"
f"SKILL.md / docs/legal-decision-lessons.md / daphna-voice-fingerprint.md, כתוב "
f"comment בעברית ניטרלי וממוספר, עדכן MEMORY.md, וסגור issue (done). הטמעה "
f"ל-SKILL.md/lessons.md נשארת אישור-יו\"ר ידני (INV-G10)."
)
return title, description