From 7033d2d3ee439a9813eaade02a67a98ea4894d67 Mon Sep 17 00:00:00 2001 From: Chaim Date: Fri, 3 Apr 2026 16:12:09 +0000 Subject: [PATCH] Embed full style guide in block prompts for Dafna's voice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _build_style_context rewritten from 10-line summary to comprehensive style guide including: - Tone rules per appeal type (warm for licensing, cold for levy) - 15 mandatory expressions ("כידוע", "ברי כי", "אין בידנו לקבל") - Discussion structure rules (continuous prose, conclusion first) - Per-party phrasing templates (appellants, committee, permit applicants) - DB patterns grouped by type (phrases, transitions, openings, closings) This addresses the main quality gap: style rated 2/5 because the output was "dry and overly formal" vs Dafna's "direct and clear" voice. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/legal_mcp/services/block_writer.py | 67 +++++++++++++++++-- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/mcp-server/src/legal_mcp/services/block_writer.py b/mcp-server/src/legal_mcp/services/block_writer.py index 57d720a..896b2a8 100644 --- a/mcp-server/src/legal_mcp/services/block_writer.py +++ b/mcp-server/src/legal_mcp/services/block_writer.py @@ -568,12 +568,69 @@ async def _build_precedents_context(case_id: UUID, block_id: str) -> str: async def _build_style_context() -> str: - patterns = await db.get_style_patterns() - if not patterns: - return "(אין דפוסי סגנון)" + """Build comprehensive style guide from DB patterns + SKILL.md rules. + + Per Anthropic: explicit style instructions reduce generic output. + """ lines = [] - for p in patterns[:10]: - lines.append(f"- [{p['pattern_type']}] {p['pattern_text']}") + + # Core style rules (from SKILL.md analysis) + lines.append("""## כללי סגנון דפנה תמיר — חובה: + +### טון: +- ערר רישוי (1xxx): חם יחסית, עם אלמנטים אנושיים +- ערר השבחה (8xxx): קר, יבש, מקצועי +- גוף ראשון רבים: "אנו סבורים", "מצאנו כי", "לדעתנו" +- ישיר ובהיר — לא אקדמי ולא מסורבל + +### ביטויים ייחודיים (חובה להשתמש): +- "לפנינו..." (פתיחה) +- "כידוע..." (הצגת עקרון ידוע) +- "ברי כי..." / "ודוק..." (הדגשה) +- "אין בידנו לקבל" (דחיית טענה) +- "בטענה זו מצאנו טעם" (קבלת טענה) +- "יחד עם זאת" (מעבר לאיזון) +- "למעלה מן הצורך" / "נבקש שלא לצאת בחסר" (הרחבה) +- "הדברים מתחדדים שעה ש..." (חידוד) +- "מחד... מאידך... על כן..." (איזון לפני הכרעה) +- "לאור כל האמור לעיל" (סיכום) +- "ניתנה פה אחד היום" (סיום) + +### מבנה דיון: +- אסה רציפה ללא כותרות משנה (חריג: נושאים נפרדים לחלוטין) +- מסקנה בפתיחה, לא בסוף +- מעברים טקסטואליים, לא כותרות +- ניטרול טענות חלשות לפני ניתוח מעמיק +- ציטוטי פסיקה כבלוקים מוגדלים + +### טענות צדדים: +- עוררים: "העוררים טוענים כי...", "לטענתם...", "עוד ציינו כי..." +- ועדה: "הוועדה המקומית הציגה/הבהירה/הוסיפה כי..." +- מבקשי היתר: "מבקשי ההיתר דוחים מכל וכל...", "לטענתם...", "מבקשי ההיתר מציינים כי..." +""") + + # DB patterns (actual examples from Dafna's decisions) + patterns = await db.get_style_patterns() + if patterns: + lines.append("### דפוסים שחולצו מהחלטות קודמות:") + grouped: dict[str, list] = {} + for p in patterns: + grouped.setdefault(p["pattern_type"], []).append(p) + + type_names = { + "opening_formula": "פתיחה", + "transition": "מעברים", + "characteristic_phrase": "ביטויים אופייניים", + "closing_formula": "סיום", + "citation_style": "ציטוט", + } + for ptype in ["characteristic_phrase", "transition", "opening_formula", "closing_formula"]: + items = grouped.get(ptype, []) + if items: + lines.append(f"\n**{type_names.get(ptype, ptype)}:**") + for item in items[:8]: + lines.append(f"- {item['pattern_text']}") + return "\n".join(lines)