Logo vun Privacy Routing

Privacy Routing

Communautéit
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

Iwwersiicht

Editeurfedec65
Repositorybettercallclaude
Skill-Nummprivacy-routing
Stären
46
Forks
10
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzAGPL-3.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum fedec65 op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Privacy Routing an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/fedec65/bettercallclaude/tree/main/bettercallclaude/skills/privacy-routing
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Privacy Routing an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Privacy Routing automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Privacy Routing net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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

Firwat Privacy Routing op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Privacy Routing besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Privacy Routing an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/fedec65/bettercallclaude/tree/main/bettercallclaude/skills/privacy-routing an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Privacy Routing benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Privacy Routing benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Privacy Routing domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Privacy Routing gratis?

Jo. De Skill gëtt vum fedec65 ënner der Lizenz AGPL-3.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇