Merge pull request 'fix(writer): always feed canonical anti-patterns to the writer' (#340) from worktree-writer-anti-patterns into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m25s
G12 Leak-Guard / leak-guard (push) Successful in 5s
Lint — undefined names / undefined-names (push) Successful in 10s

This commit was merged in pull request #340.
This commit is contained in:
2026-06-28 21:24:57 +00:00

View File

@@ -983,6 +983,22 @@ async def _build_style_context(practice_area: str = "") -> str:
("anti_patterns", "אנטי-דפוסים (להימנע)"),
):
ov = await db.get_methodology_overrides(cat)
if cat == "anti_patterns":
# Anti-patterns are STRUCTURAL INVARIANTS of Dafna's style (no
# markdown headers, no bullet lists, no mid-paragraph mini-lists —
# she writes continuous legal narrative). They must reach the writer
# ALWAYS, from the SAME canonical list style_distance measures against
# (lessons.ANTI_PATTERNS) — otherwise the loop detects them but never
# corrects them, and drafts keep emitting them (the gap that left
# 8137 with 28 hits). Chair additions layer on top; they never
# remove the canonical ones.
from legal_mcp.services.lessons import ANTI_PATTERNS as _ANTI
learned.append(f"\n**{label} — כתוב נרטיב משפטי רציף; הימנע מ:**")
for ap in _ANTI:
learned.append(f"- {ap['note']}")
for k, v in (ov or {}).items():
learned.append(f"- (יו\"ר) {k}: {json.dumps(v, ensure_ascii=False)}")
continue
if ov:
learned.append(f"\n**{label} — ערכי היו\"ר (גוברים על ברירת-המחדל):**")
for k, v in ov.items():