feat(halacha): NLI entailment validator via claude_session (#81.3) #54

Merged
chaim merged 1 commits from feat/halacha-nli-validator into main 2026-06-03 14:46:40 +00:00
Owner

#81.3 — ולידטור NLI (rule ⊨ quote)

ולידטור פוסט-חילוץ שמסמן הלכות שה-rule_statement שלהן אינו נובע (entailed) מה-supporting_quote — כלומר המחלץ הרחיב/הזה מעבר למקור.

  • מנוע: claude_session-as-judge (CLI מקומי, אפס עלות) לפי ההעדפה הקבועה של chaim — קריאת judge אחת מרוכזת לכל chunk, לא מודל NLI מתארח.
  • עוגנים טהורים ומבדקי-יחידה ב-halacha_quality: NLI_SYSTEM, build_nli_prompt, parse_nli_verdicts (fail-open — כל עמימות צורה/תווית → 'entailed').
  • halacha_extractor._nli_checkfail-open על כל שגיאה (למשל אין CLI בקונטיינר), כך ש-judge תקול לעולם לא חוסם הלכה אמיתית.
  • non-entailed (neutral/contradiction) → דגל nli_unsupported שחוסם auto-approve (→ pending_review) דרך שער ה-store הקיים.
  • config: HALACHA_NLI_ENABLED/MODEL/EFFORT (effort 'low').

אומת

  • מערך מלא 166 passed (10 חדשים: parser/prompt/fail-open/mapping).
  • smoke test חי מול ה-claude CLI האמיתי: זוג נתמך→entailed, זוג לא-נתמך→neutral (['entailed','neutral']).

גם

מתעד את #86 (preamble/רציו של נבו — תיקון strip ל-anti-contamination + gold-set benchmark) שנמצא היום.

🤖 Generated with Claude Code

## #81.3 — ולידטור NLI (rule ⊨ quote) ולידטור פוסט-חילוץ שמסמן הלכות שה-`rule_statement` שלהן **אינו נובע** (entailed) מה-`supporting_quote` — כלומר המחלץ הרחיב/הזה מעבר למקור. - **מנוע: claude_session-as-judge** (CLI מקומי, **אפס עלות**) לפי ההעדפה הקבועה של chaim — קריאת judge אחת מרוכזת לכל chunk, לא מודל NLI מתארח. - עוגנים **טהורים ומבדקי-יחידה** ב-`halacha_quality`: `NLI_SYSTEM`, `build_nli_prompt`, `parse_nli_verdicts` (**fail-open** — כל עמימות צורה/תווית → 'entailed'). - `halacha_extractor._nli_check` — **fail-open על כל שגיאה** (למשל אין CLI בקונטיינר), כך ש-judge תקול לעולם לא חוסם הלכה אמיתית. - non-entailed (neutral/contradiction) → דגל `nli_unsupported` שחוסם auto-approve (→ pending_review) דרך שער ה-store הקיים. - config: `HALACHA_NLI_ENABLED/MODEL/EFFORT` (effort 'low'). ## אומת - מערך מלא **166 passed** (10 חדשים: parser/prompt/fail-open/mapping). - **smoke test חי** מול ה-claude CLI האמיתי: זוג נתמך→`entailed`, זוג לא-נתמך→`neutral` (`['entailed','neutral']`). ## גם מתעד את **#86** (preamble/רציו של נבו — תיקון strip ל-anti-contamination + gold-set benchmark) שנמצא היום. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-03 14:46:34 +00:00
#81.3 — a post-extraction validator that flags halachot whose rule_statement is
NOT entailed by its supporting_quote (the model over-reaching beyond its source).

- Engine: claude_session-as-judge (local CLI, zero API cost) per chaim's standing
  preference — one batched judge call per chunk, NOT a hosted NLI model.
- Pure, unit-tested helpers in halacha_quality: NLI_SYSTEM, build_nli_prompt,
  parse_nli_verdicts (fails OPEN — any shape/label ambiguity → 'entailed').
- halacha_extractor._nli_check wraps the call; fails OPEN on any error (e.g. no
  CLI in the container) so a flaky judge never blocks a genuine halacha.
- Non-entailed (neutral/contradiction) → quality_flag 'nli_unsupported' which
  blocks auto-approve (routes to pending_review) via the existing store gate.
- config: HALACHA_NLI_ENABLED/MODEL/EFFORT (effort 'low' — entailment is simple).

Verified: suite 166 passed (10 new); LIVE smoke test against the real claude CLI
returned ['entailed','neutral'] for a supported vs unsupported rule.

Also commits TaskMaster #86 (Nevo preamble/ratio: anti-contamination strip fix +
gold-set benchmark) capturing today's strip_nevo_preamble findings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit 5efb8cf915 into main 2026-06-03 14:46:40 +00:00
chaim deleted branch feat/halacha-nli-validator 2026-06-03 14:46:40 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#54