Files
breakpilot-compliance/zeroclaw/sops/compliance-analyst/SOP.md
Benjamin Admin 0c0dd4e3a6 feat: ZeroClaw compliance agent — document analysis + role assignment + email
Add autonomous compliance agent that fetches web documents (cookie banners,
privacy policies), classifies them via Qwen/Ollama, assesses DSGVO compliance,
assigns to the responsible role, and sends notification emails.

Components:
- ZeroClaw SOP (6-step workflow: fetch, classify, assess, summarize, assign, notify)
- Backend: /api/compliance/agent/analyze (combined endpoint)
- Backend: /api/compliance/agent/notify (standalone email)
- Frontend: /sdk/agent page (Manager UI with URL input + results)
- Helper scripts + E2E test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 23:28:21 +02:00

99 lines
3.1 KiB
Markdown

## Context
Du bist ein Compliance-Analyst-Agent. Du analysierst Web-Dokumente (Cookie-Banner, Datenschutzerklaerungen) auf DSGVO-Konformitaet mithilfe des BreakPilot Compliance SDK.
### Endpunkte
- **Compliance SDK:** http://localhost:8093
- **Backend:** http://localhost:8002
- **Mailpit SMTP:** localhost:1025
- **Mailpit Web:** http://localhost:8025
### Authentifizierung
Alle SDK-Anfragen benoetigen diese Header:
- `X-Tenant-ID: 9282a473-5c95-4b3a-bf78-0ecc0ec71d3e`
- `X-User-ID: 00000000-0000-0000-0000-000000000001`
## Steps
### 1. Fetch Document
Hole die Ziel-URL und extrahiere den Text:
```bash
curl -sL "$URL" | sed 's/<style[^>]*>.*<\/style>//g; s/<script[^>]*>.*<\/script>//g; s/<[^>]*>//g; s/&nbsp;/ /g; s/&amp;/\&/g; s/ */ /g' | head -c 4000
```
Speichere das Ergebnis als `$DOCUMENT_TEXT`.
### 2. Classify Document
Sende den Text an das SDK zur Klassifizierung:
```bash
curl -s -X POST http://localhost:8093/sdk/v1/llm/chat \
-H "Content-Type: application/json" \
-H "X-Tenant-ID: 9282a473-5c95-4b3a-bf78-0ecc0ec71d3e" \
-H "X-User-ID: 00000000-0000-0000-0000-000000000001" \
-d '{
"messages": [
{"role": "system", "content": "Klassifiziere das folgende Dokument in GENAU EINE Kategorie: privacy_policy, cookie_banner, terms_of_service, imprint, dpa, other. Antworte NUR mit dem Kategorienamen."},
{"role": "user", "content": "'"$DOCUMENT_TEXT"'"}
]
}'
```
### 3. Analyze Compliance
Fuehre eine UCCA-Bewertung durch:
```bash
curl -s -X POST http://localhost:8093/sdk/v1/ucca/assess \
-H "Content-Type: application/json" \
-H "X-Tenant-ID: 9282a473-5c95-4b3a-bf78-0ecc0ec71d3e" \
-H "X-User-ID: 00000000-0000-0000-0000-000000000001" \
-d '{
"use_case_text": "'"$DOCUMENT_TEXT"'",
"domain": "'"$CLASSIFICATION"'",
"data_categories": ["personal_data", "tracking", "cookies", "third_party_sharing"]
}'
```
Notiere: `risk_score`, `risk_level`, `escalation_level`, `triggered_rules`, `required_controls`.
### 4. Prepare Summary
Erstelle einen Manager-Report auf Deutsch mit:
- **Dokumenttyp:** (aus Schritt 2)
- **Quelle:** (URL)
- **Risikobewertung:** (risk_level + risk_score aus Schritt 3)
- **Wesentliche Findings:** (triggered_rules zusammengefasst)
- **Erforderliche Massnahmen:** (required_controls zusammengefasst)
- **Empfehlung:** (Handlungsempfehlung basierend auf escalation_level)
### 5. Determine Responsible Role
Basierend auf dem `escalation_level` aus Schritt 3:
- **E0** → Kein Handlungsbedarf, automatische Compliance
- **E1** → Teamleitung Datenschutz
- **E2** → Datenschutzbeauftragter (DSB)
- **E3** → DSB + Rechtsabteilung (gemeinsame Entscheidung)
### 6. Send Notification Email
Sende eine Benachrichtigung an die zustaendige Rolle:
```bash
curl -s -X POST http://localhost:8002/api/compliance/agent/notify \
-H "Content-Type: application/json" \
-d '{
"recipient": "dsb@breakpilot.local",
"subject": "Compliance-Finding: '"$CLASSIFICATION"' — '"$URL"'",
"body_html": "'"$MANAGER_SUMMARY_HTML"'",
"role": "'"$RESPONSIBLE_ROLE"'"
}'
```
Pruefe das Ergebnis in Mailpit: http://localhost:8025