feat(x11): treatment-aware citation authority wired into research agents (#154) #319

Merged
chaim merged 1 commits from worktree-x11-treatment-wiring into main 2026-06-20 16:04:37 +00:00
Owner

הבעיה

גרף-הציטוטים הזין רק דירוג (in-degree גולמי), וה-טיפול (followed/distinguished) של כל ציטוט מעולם לא סווג — אז תקדים שאוּבחן N פעמים קיבל אותו בוסט-סמכות כמו שאומץ N פעמים (הפרת INV-COR2), והאות לא הגיע לנימוק של הסוכן. ה-PR מחבר את כל המסלול (ראה #154).

4 השלבים

  • שלב 1scripts/classify_citation_treatments.py: מסווג את ה-treatment של כל קצה מקושר מתוך ה-match_context (corroboration.classify_treatment, Opus 4.8 @ xhigh, מקומי), ממלא precedent_internal_citations.treatment. אידמפוטנטי.
  • שלב 2db.refresh_verified_layer: סופר רק טיפול לא-שלילי ל-verified/cite_count (INV-COR2/COR4). לא-מסווג נספר כנייטרלי-חיובי → הסיגנל מתדרדר-בחן לפני הסיווג.
  • שלב 3db.citation_authority(ids): פירוק per-תקדים {total, positive, negative, unclassified, by_treatment}. נחשף כ-cited_by ב-search_precedent_library וב-precedent_library_get, ו-treatment לכל ציטוט-נכנס.
  • שלב 4 — prompts (legal-researcher/analyst/writer): לשקלל ולטעון סמכות ("הלכה שאומצה ב-N החלטות ועדת-ערר"), לדגל אובחן/בוטל, ולא להמציא מספר (INV-AH; ה-writer read-only מהמנתח).

אימות

  • ast.parse נקי ל-5 המודולים; smoke של הסקריפט (3 קצוות → 2 followed, 1 mentioned).
  • db.citation_authority(שפר) ו-get_precedent.cited_by עובדים (12 ציטוטים).

תפעולי (אחרי merge+deploy)

  1. הרצת הסיווג על 379 הקצוות (--apply). 2. build_verified_layer.py. 3. sync_agents_across_companies.py --apply (prompts). auto-approval נשאר כבוי — שער-דפנה נשמר (INV-G10).

Invariants

G2 (מסווג אחד + שאילתת-סמכות אחת, בשימוש-חוזר) · INV-COR2/COR3/COR4 · INV-G10 (ללא אוטו-אישור) · INV-AH (ללא מספרים-מומצאים). ללא שינוי-סכמה.

🤖 Generated with Claude Code

## הבעיה גרף-הציטוטים הזין רק **דירוג** (in-degree גולמי), וה-**טיפול** (followed/distinguished) של כל ציטוט מעולם לא סווג — אז תקדים שאוּבחן N פעמים קיבל אותו בוסט-סמכות כמו שאומץ N פעמים (הפרת INV-COR2), והאות לא הגיע ל**נימוק** של הסוכן. ה-PR מחבר את כל המסלול (ראה #154). ## 4 השלבים - **שלב 1** — `scripts/classify_citation_treatments.py`: מסווג את ה-`treatment` של כל קצה מקושר מתוך ה-`match_context` (`corroboration.classify_treatment`, Opus 4.8 @ xhigh, מקומי), ממלא `precedent_internal_citations.treatment`. אידמפוטנטי. - **שלב 2** — `db.refresh_verified_layer`: סופר רק טיפול **לא-שלילי** ל-`verified`/`cite_count` (INV-COR2/COR4). לא-מסווג נספר כנייטרלי-חיובי → הסיגנל מתדרדר-בחן לפני הסיווג. - **שלב 3** — `db.citation_authority(ids)`: פירוק per-תקדים `{total, positive, negative, unclassified, by_treatment}`. נחשף כ-`cited_by` ב-`search_precedent_library` וב-`precedent_library_get`, ו-`treatment` לכל ציטוט-נכנס. - **שלב 4** — prompts (`legal-researcher`/`analyst`/`writer`): לשקלל ו**לטעון** סמכות ("הלכה שאומצה ב-N החלטות ועדת-ערר"), לדגל אובחן/בוטל, ולא להמציא מספר (INV-AH; ה-writer read-only מהמנתח). ## אימות - `ast.parse` נקי ל-5 המודולים; smoke של הסקריפט (3 קצוות → 2 followed, 1 mentioned). - `db.citation_authority(שפר)` ו-`get_precedent.cited_by` עובדים (12 ציטוטים). ## תפעולי (אחרי merge+deploy) 1. הרצת הסיווג על 379 הקצוות (`--apply`). 2. `build_verified_layer.py`. 3. `sync_agents_across_companies.py --apply` (prompts). auto-approval **נשאר כבוי** — שער-דפנה נשמר (INV-G10). ## Invariants G2 (מסווג אחד + שאילתת-סמכות אחת, בשימוש-חוזר) · INV-COR2/COR3/COR4 · INV-G10 (ללא אוטו-אישור) · INV-AH (ללא מספרים-מומצאים). ללא שינוי-סכמה. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-20 16:04:30 +00:00
feat(x11): treatment-aware citation authority wired into research agents (#154)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
ccc5a73bc8
The internal citation graph fed only RANKING (raw in-degree), and the per-citation
TREATMENT was never classified — so a precedent distinguished N times got the same
authority boost as one followed N times (INV-COR2 violation), and the signal never
reached the agents' reasoning. Wires the full path:

Phase 1 — scripts/classify_citation_treatments.py: classify each linked edge's
  treatment (followed/distinguished/…) from its match_context via
  corroboration.classify_treatment (Opus 4.8 @ xhigh, local), filling
  precedent_internal_citations.treatment. Idempotent.
Phase 2 — db.refresh_verified_layer: count only NON-negative treatments toward
  verified/cite_count (INV-COR2/COR4). Unclassified counts as neutral-positive so
  the signal degrades gracefully before classification runs.
Phase 3 — db.citation_authority(ids): per-precedent {total, positive, negative,
  unclassified, by_treatment}. Surfaced as `cited_by` in search_precedent_library
  hits and precedent_library_get, and `treatment` per incoming citation.
Phase 4 — legal-researcher/analyst/writer prompts: weigh & ARGUE authority
  ("הלכה שאומצה ב-N החלטות ועדת-ערר"), flag distinguished/overruled, never invent
  the count (INV-AH; writer is read-only of the analyst).

Auto-approval stays kill-switched off (chair gate preserved, INV-G10). No schema
change (treatment column already existed). Operational: run the classifier +
refresh_verified_layer over the 379 edges, then sync agents across companies.

Invariants: G2 (one classifier + one authority query, reused), INV-COR2/COR3/COR4
(negative never corroborates; point-specific; ≥N), INV-G10 (no auto-approval),
INV-AH (no invented numbers).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit 4f45fa416b into main 2026-06-20 16:04:37 +00:00
chaim deleted branch worktree-x11-treatment-wiring 2026-06-20 16:04:37 +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#319