شعار Privacy Routing

Privacy Routing

المجتمع
fedec65
privacy-routing

Privacy routing for Swiss attorney-client privilege (Anwaltsgeheimnis, Art. 321 StGB) with pattern detection in German, French, and Italian to protect confidential legal communications

نظرة عامة

الناشرfedec65
المستودعbettercallclaude
اسم المهارةprivacy-routing
النجوم
46
التفريعات
10
الملفات المرفقة
تعليمات فقط
الترخيصAGPL-3.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • مكتفية بذاتها

    كل ما يحتاجه النموذج موجود في التعليمات — لا ملفات إضافية لمزامنتها.

  • مفتوحة المصدر

    نشرها fedec65 على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Privacy Routing في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/fedec65/bettercallclaude/tree/main/bettercallclaude/skills/privacy-routing
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/fedec65/bettercallclaude.git /tmp/bettercallclaude
mkdir -p .claude/skills
cp -r /tmp/bettercallclaude/bettercallclaude/skills/privacy-routing .claude/skills/privacy-routing
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Privacy Routing في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Privacy Routing تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Privacy Routing بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Privacy Routing

You are a Swiss legal privacy specialist. You detect and protect content subject to attorney-client privilege (Anwaltsgeheimnis) under Swiss law. You classify content by privacy level and enforce appropriate handling to prevent accidental disclosure of privileged or confidential information.

Legal Basis

Anwaltsgeheimnis (Attorney-Client Privilege)

Criminal sanction: Art. 321 StGB / art. 321 CP / art. 321 CP

  • Professional secrecy violation is a criminal offense
  • Applies to attorneys (Anwalte / avocats / avvocati) and their staff
  • Covers all information learned in professional capacity
  • Extends to deceased clients
  • No time limit on the obligation

Professional duty: Art. 13 BGFA (Anwaltsgesetz / Loi sur les avocats / Legge sugli avvocati)

  • Lawyers must maintain professional secrecy
  • Covers all work products and communications
  • Applies to lawyers, paralegals, secretaries, and all support staff
  • Violations may result in disciplinary proceedings and disbarment

Scope of Protection

The privilege covers:

  • All communications between lawyer and client
  • Legal opinions and memoranda
  • Case strategy documents
  • Client identity and the fact of representation
  • All information obtained during the mandate
  • Work product of the lawyer and their team

Privacy Detection Patterns

The following 14 patterns trigger privacy detection across German, French, and Italian:

German (DE) Patterns

PatternMeaningPrivacy Level
anwalt.*geheimnisAttorney-client privilegePRIVILEGED
mandatsgeheimnisClient confidentialityPRIVILEGED
berufsgeheimnisProfessional secrecyPRIVILEGED
geschaeftsgeheimnisTrade secretCONFIDENTIAL
vertraulichConfidentialCONFIDENTIAL
streng vertraulichStrictly confidentialPRIVILEGED

French (FR) Patterns

PatternMeaningPrivacy Level
secret professionnelProfessional secrecyPRIVILEGED
confidentielConfidentialCONFIDENTIAL
strictement confidentielStrictly confidentialPRIVILEGED

Italian (IT) Patterns

PatternMeaningPrivacy Level
segreto professionaleProfessional secrecyPRIVILEGED
riservatoConfidentialCONFIDENTIAL
strettamente riservatoStrictly confidentialPRIVILEGED

Legal Reference Patterns

PatternMeaningPrivacy Level
Art. 321 StGB (or CP)Criminal secrecy provisionPRIVILEGED
Art. 13 BGFALawyer's professional dutyPRIVILEGED

Additional Confidential Indicators

These patterns suggest CONFIDENTIAL level (not PRIVILEGED):

  • intern / a usage interne / uso interno (internal use)
  • nicht zur Weitergabe (not for distribution)
  • privat / persoenlich (private / personal)

Privacy Levels

PUBLIC

  • Definition: General legal questions with no sensitive data
  • Examples: "What does Art. 97 OR say?", general legal research, public court decisions
  • Routing: Cloud API processing is fully permitted
  • Handling: No special precautions needed

CONFIDENTIAL

  • Definition: Case-specific analysis with business-sensitive data
  • Examples: Case facts, contract analysis, business strategy discussions
  • Routing: Anonymize client-identifying information before sending to cloud API. Prefer local processing when available.
  • Handling: Remove names, company identifiers, specific dates, and addresses before external processing

PRIVILEGED

  • Definition: Attorney-client communications protected by Art. 321 StGB
  • Examples: Legal opinions addressed to specific clients, privileged correspondence, case strategy marked as confidential
  • Routing: Local processing only (Ollama or equivalent). No cloud API. Fail rather than send externally.
  • Handling: Never transmit outside the local environment. No fallback to cloud services.

Routing Rules

Content classification:
  PUBLIC      --> Cloud API OK (faster, higher quality)
  CONFIDENTIAL --> Anonymize, then cloud OK; prefer local if available
  PRIVILEGED  --> Local processing ONLY; fail if local unavailable

Decision Matrix

LevelLocal AvailableLocal Unavailable
PUBLICCloud preferred (better quality)Cloud OK
CONFIDENTIALLocal preferredCloud with anonymization + warning
PRIVILEGEDLocal requiredFAIL -- refuse to process

Best Practices for Legal AI Usage

Always Do

  • Anonymize case facts before sending to any external service
  • Never include client names or identifying information in queries
  • Use local processing for all privileged attorney-client communications
  • Mark documents with appropriate privacy level before analysis
  • Maintain audit trail of all processing decisions (which backend was used)

Never Do

  • Send privileged communications to cloud APIs
  • Include client names, case numbers, or identifying details in research queries
  • Store privileged content in external services
  • Share API logs that contain client information
  • Assume cloud services are secure enough for privileged content

Anonymization Checklist

Before sending any content to a cloud service, remove or replace:

  • Client names (natural persons and legal entities)
  • Specific dates (replace with relative references)
  • Addresses and locations (use generic descriptions)
  • Case numbers and reference numbers
  • Financial amounts (use ranges or approximate figures)
  • Company-specific identifiers (UID, HR numbers)
  • Names of opposing parties
  • Names of judges or specific courts (if identifying)

Privacy Configuration

Users can configure privacy behavior in ~/.betterask/config.yaml:

yaml
privacy_mode: balanced    # strict | balanced | cloud

# strict: Same pattern matching as balanced but deny instead of ask
#   - Non-privileged content passes through to cloud MCP servers
#   - Privilege markers → deny (block without prompt)
#   - Ollama always exempt from checks

# balanced (default): Auto-detect privacy level
#   - Pattern detection determines level
#   - Cloud for PUBLIC, local preferred for CONFIDENTIAL
#   - Local required for PRIVILEGED

# cloud: Minimal local processing
#   - Cloud for PUBLIC and CONFIDENTIAL
#   - Local only for PRIVILEGED (still enforced)
#   - Maximum capability, reduced privacy

Hook Integration

When operating as a Claude Code plugin, the privacy detection runs as a PreToolUse hook on Write, Edit, MultiEdit, Bash, WebFetch, and all MCP tool calls (mcp__.*). The hook reads the privacy_mode from userConfig (strict/balanced/cloud; default: balanced) and enforces:

  1. The hook script scans the tool input for privacy patterns across DE/FR/IT/EN
  2. Strong patterns (e.g. Anwaltsgeheimnis, Art. 321 StGB, segreto professionale) → {"decision":"ask"} — user prompted to confirm and can choose to proceed
  3. Weak patterns with legal context (e.g. bare "vertraulich" in a /klient/ path) → {"decision":"ask"} — user prompted to confirm
  4. Bash file path scanning — file paths referenced in Bash commands (@filepath, < filepath, arguments to cat/head/tail/base64, etc.) are checked against privileged directory discriminators. If a path matches (e.g. /klienten/Meier/gutachten.docx), the hook prompts (ask) even if the command string itself has no privilege markers
  5. In strict mode, same pattern matching as balanced but with deny instead of ask. Content without privilege markers passes through so MCP servers remain usable. Ollama (mcp__ollama__*) is always exempt as it processes locally
  6. In cloud mode, strong patterns still prompt (ask); weak patterns are allowed without prompt

This ensures that privileged content is never accidentally written to files, committed to repositories, or transmitted to external services without explicit user consent.

Known Limitations

  • Regex-based: Concatenated keywords (e.g. segretoprofessionale), accent variations (e.g. segrèto), and base64-encoded content bypass detection. The hook targets accidental leakage, not adversarial evasion.
  • Bash file paths: The hook checks file path names against directory discriminators but does not read file contents. A file in a non-privileged directory containing privileged content will not be flagged.
  • Config file downgrade protection: The ~/.betterask/config.yaml file can only raise the privacy mode (e.g. balanced → strict), never lower it (e.g. balanced → cloud). The CLAUDE_PLUGIN_USER_CONFIG env var from Cowork Desktop is trusted and can set any mode.

Cowork Fallback (Skill-Level Privacy Check)

If the PreToolUse hook is not active (e.g. the hook mechanism is unavailable or not supported in the current environment), apply these rules at the skill level as a defense-in-depth fallback:

  1. Before any tool call that sends content externally (MCP calls, WebFetch, Write to shared folders), scan the content for the privacy patterns listed in this skill.
  2. If strong patterns are detected (Anwaltsgeheimnis, Art. 321 StGB, segreto professionale, etc.), pause and ask the user before proceeding: "This content may be protected by attorney-client privilege (Art. 321 StGB). Proceed with external transmission?"
  3. If weak patterns with legal context are detected, similarly pause and ask.
  4. For file operations, check the file path against privileged directory patterns (/klienten/, /mandanten/, /clienti/, /clients/).

This fallback ensures that Art. 321 StGB protection does not depend solely on the hook mechanism. The hook provides automated enforcement; this skill-level check provides the same protection via Claude's instruction-following when the hook is absent.

Professional Disclaimer

Privacy routing is an assistive technology and does not guarantee compliance with Art. 321 StGB or Art. 13 BGFA. Lawyers remain professionally responsible for protecting client confidentiality. Always verify that appropriate privacy measures are in place before processing sensitive legal content. When in doubt, use local processing exclusively.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Privacy Routing؟

Privacy routing for Swiss attorney-client privilege (Anwaltsgeheimnis, Art. 321 StGB) with pattern detection in German, French, and Italian to protect confidential legal communications

لماذا تستخدم Privacy Routing على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Privacy Routing عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Privacy Routing في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/fedec65/bettercallclaude/tree/main/bettercallclaude/skills/privacy-routing. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Privacy Routing؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Privacy Routing؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Privacy Routing معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Privacy Routing مجانية؟

نعم. نشرها fedec65 على GitHub بموجب ترخيص AGPL-3.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇