fix(writer): always feed canonical anti-patterns to the writer #340

Merged
chaim merged 1 commits from worktree-writer-anti-patterns into main 2026-06-28 21:24:57 +00:00
Owner

הפער שנסגר

לולאת-הלמידה מדדה אנטי-דפוסים אך לא תיקנה אותם. style_distance מזהה כותרות-markdown / תבליטים / מיני-רשימות (מ-lessons.ANTI_PATTERNS), אבל הכותב קיבל הנחיית-הימנעות רק אם קיים override של היו"ר ב-appeal_type_rules — ואין כזה. לכן ענף ה-if ov: ב-_build_style_context לא הזריק דבר, הכותב מעולם לא הונחה להימנע, והטיוטות המשיכו לייצר אותם (8137: 28 — הגרוע, החדש; אנטי-הדפוסים עלו, לא ירדו).

התיקון

אנטי-דפוסים הם אינווריאנטים מבניים של קול דפנה (נרטיב רציף — בלי markdown/תבליטים), לא העדפות הניתנות-לעקיפה. לכן מזריקים את ה-ANTI_PATTERNS הקנוניים תמיד, מאותה רשימה ש-style_distance מודד לפיה (מקור-אמת יחיד), עם תוספות-יו"ר על-גביהם. זה סוגר את פער ה-measure-but-don't-correct: הטיוטה הבאה אמורה להראות ירידה ב-markdown/תבליטים, ומסלול A (style_distance_history) יאשר.

Invariants

  • G1 — תיקון במקור (הכותב), לא stripper בדיעבד.
  • G2 — רשימת אנטי-דפוסים קנונית אחת משותפת לזיהוי ולהנחיה — אין רשימה מקבילה.
  • INV-LRN4 — סוגר את חצי-המשוב של לולאת draft↔final.

py_compile נקי.

🤖 Generated with Claude Code

## הפער שנסגר לולאת-הלמידה **מדדה אנטי-דפוסים אך לא תיקנה אותם.** `style_distance` מזהה כותרות-markdown / תבליטים / מיני-רשימות (מ-`lessons.ANTI_PATTERNS`), אבל הכותב קיבל הנחיית-הימנעות **רק אם קיים override** של היו"ר ב-`appeal_type_rules` — ואין כזה. לכן ענף ה-`if ov:` ב-`_build_style_context` לא הזריק דבר, הכותב מעולם לא הונחה להימנע, והטיוטות המשיכו לייצר אותם (8137: 28 — הגרוע, החדש; אנטי-הדפוסים *עלו*, לא ירדו). ## התיקון אנטי-דפוסים הם **אינווריאנטים מבניים** של קול דפנה (נרטיב רציף — בלי markdown/תבליטים), לא העדפות הניתנות-לעקיפה. לכן מזריקים את ה-`ANTI_PATTERNS` הקנוניים **תמיד**, מאותה רשימה ש-style_distance מודד לפיה (מקור-אמת יחיד), עם תוספות-יו"ר על-גביהם. זה סוגר את פער ה-measure-but-don't-correct: הטיוטה הבאה אמורה להראות ירידה ב-markdown/תבליטים, ומסלול A (`style_distance_history`) יאשר. ## Invariants - **G1** — תיקון במקור (הכותב), לא stripper בדיעבד. - **G2** — רשימת אנטי-דפוסים קנונית אחת משותפת לזיהוי ולהנחיה — אין רשימה מקבילה. - **INV-LRN4** — סוגר את חצי-המשוב של לולאת draft↔final. py_compile נקי. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-28 21:24:50 +00:00
fix(writer): always feed canonical anti-patterns to the writer
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 3s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
d7201736f2
The learning loop measured anti-patterns but never corrected them. style_distance
detects markdown headers / bullet lists / mid-paragraph mini-lists (from the
canonical lessons.ANTI_PATTERNS), but the writer only received anti-pattern
guidance if a chair `anti_patterns` override existed in appeal_type_rules — and
none does. So _build_style_context's `if ov:` branch injected nothing, the writer
was never told to avoid them, and drafts kept emitting them (8137: 28 hits, the
worst, newest — anti-patterns were trending UP, not down).

Anti-patterns are structural invariants of Dafna's voice (continuous legal
narrative — no markdown, no bullets), not overridable preferences. So inject the
canonical ANTI_PATTERNS notes ALWAYS, from the same list style_distance measures
against (single source of truth), with any chair additions layered on top. This
closes the measure-but-don't-correct gap: the next draft should show the markdown/
bullet anti-patterns drop, and Path A (style_distance_history) will confirm it.

Invariants: G1 (correct at source — the writer, not a post-hoc stripper), G2
(one canonical anti-pattern list shared by detection and instruction — no parallel
list), INV-LRN4 (closes the feedback half of the draft↔final loop).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit 6427911baf into main 2026-06-28 21:24:57 +00:00
chaim deleted branch worktree-writer-anti-patterns 2026-06-28 21:24:57 +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#340