feat(learning): feed corpus-measured ratios to the writer (P2 #7, structural half) #345

Merged
chaim merged 1 commits from worktree-corpus-ratios-writer into main 2026-06-28 22:11:13 +00:00
Owner

הפער שנסגר

יחסי-הזהב נמדדו מהקורפוס (measure_corpus_ratios) אך מעולם לא הגיעו לכותב — הוא השתמש רק ב-STRUCTURE_GUIDANCE הקשיח. המבנה-היעד היה קפוא, והטיוטות סטו (למשל בלוק-דיון 10% מול יעד 40-47%) ללא סיגנל-תיקון.

התיקון

_structure_guidance_with_corpus(outcome, practice_area) מצרף עכשיו את היחסים המדודים-מהקורפוס ל-structure_guidance בשני אתרי-הכותב (write_block + get_block_context) דרך helper יחיד (G2). מכיוון ש-measure_corpus_ratios קורא מ-style_corpus — שגדל בכל סופי (ראה #343) — המבנה-היעד של הכותב משקף את ההתפלגות האמיתית הנוכחית של דפנה ומשתפר ככל שהקורפוס גדל. דטרמיניסטי (ללא LLM); best-effort.

הסתייגות (היקף #7)

זהו החצי המבני של חידוש-פרופיל-הקול. החצי הנותר — חידוש פרוזת ה-voice-fingerprint ע"י LLM מהקורפוס (מגודר-יו"ר) — הוא יוזמה גדולה ונפרדת, נדחתה במכוון ולא נדחפה בחיפזון בסוף סשן-מרתון.

Invariants

  • G1 — הכותב מקבל יעד-מדוד חי, לא קבוע קפוא.
  • G2 — builder יחיד לשני האתרים; שימוש-חוזר ב-measure_corpus_ratios.
  • INV-LRN4 — הקורפוס שהלולאה מגדילה מזין את המבנה-יעד.

py_compile נקי.

🤖 Generated with Claude Code

## הפער שנסגר יחסי-הזהב נמדדו מהקורפוס (`measure_corpus_ratios`) אך **מעולם לא הגיעו לכותב** — הוא השתמש רק ב-`STRUCTURE_GUIDANCE` הקשיח. המבנה-היעד היה קפוא, והטיוטות סטו (למשל בלוק-דיון 10% מול יעד 40-47%) ללא סיגנל-תיקון. ## התיקון `_structure_guidance_with_corpus(outcome, practice_area)` מצרף עכשיו את **היחסים המדודים-מהקורפוס** ל-structure_guidance בשני אתרי-הכותב (write_block + get_block_context) דרך helper יחיד (G2). מכיוון ש-`measure_corpus_ratios` קורא מ-`style_corpus` — שגדל בכל סופי (ראה #343) — המבנה-היעד של הכותב משקף את ההתפלגות **האמיתית הנוכחית** של דפנה ומשתפר ככל שהקורפוס גדל. דטרמיניסטי (ללא LLM); best-effort. ## הסתייגות (היקף #7) זהו ה**חצי המבני** של חידוש-פרופיל-הקול. החצי הנותר — חידוש **פרוזת** ה-voice-fingerprint ע"י LLM מהקורפוס (מגודר-יו"ר) — הוא יוזמה גדולה ונפרדת, נדחתה במכוון ולא נדחפה בחיפזון בסוף סשן-מרתון. ## Invariants - **G1** — הכותב מקבל יעד-מדוד חי, לא קבוע קפוא. - **G2** — builder יחיד לשני האתרים; שימוש-חוזר ב-measure_corpus_ratios. - **INV-LRN4** — הקורפוס שהלולאה מגדילה מזין את המבנה-יעד. py_compile נקי. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-28 22:11:05 +00:00
feat(learning): feed corpus-measured section ratios to the writer (P2 #7, structural half)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 3s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
638dbf9b9f
Golden ratios were measured from the corpus (style_distance.measure_corpus_ratios)
but never reached the writer — it used only the hardcoded STRUCTURE_GUIDANCE text.
So the structural target was frozen, and drafts kept deviating (e.g. discussion
block 10% vs a 40-47% target) with no corrective signal.

_structure_guidance_with_corpus(outcome, practice_area) now appends the
corpus-measured section ratios for the block's outcome to the structure guidance,
at both writer entry points (write_block + get_block_context) via one shared helper
(G2). Because measure_corpus_ratios reads style_corpus — which grows with every
enrolled final (see exemplar-growth, #343) — the writer's structural target now
reflects Dafna's ACTUAL current distribution and improves as the corpus grows.
Deterministic (no LLM); best-effort.

This is the STRUCTURAL half of the voice-profile-refresh (#7). The remaining half —
LLM-regenerating the abstract voice-fingerprint PROSE from the corpus (chair-gated)
— is a distinct larger initiative, deliberately deferred rather than rushed.

Invariants: G1 (the writer gets the live measured target, not a frozen constant),
G2 (one structure-guidance builder shared by both entry points; reuses the existing
measure_corpus_ratios — no parallel measurement), INV-LRN4 (the corpus the loop
grows now feeds the writer's structural target).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit 9455da7567 into main 2026-06-28 22:11:13 +00:00
chaim deleted branch worktree-corpus-ratios-writer 2026-06-28 22:11:13 +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#345