← 返回
沟通协作 中文

Openclaw Pii Anonymizer

Privacy pipeline for OpenClaw - Hybrid regex + Qwen2.5 LLM to scrub PII (names/emails/SSNs/phones/wallets/IPs/paths) before external AI processing. Script wo...
OpenClaw隐私管道:混合正则与Qwen2.5 LLM,在外部AI处理前擦除姓名、邮箱、社保号、电话、钱包、IP及路径等PII数据。
solmas
沟通协作 clawhub v2.0.0 2 版本 99883.7 Key: 无需
★ 0
Stars
📥 859
下载
💾 17
安装
2
版本
#latest

概述

OpenClaw PII Anonymizer v2.0

Status: ⚠️ Partially Working

  • ✅ Script works perfectly (manual invocation)
  • ❌ Auto-hook interception needs debugging

Hybrid regex + Qwen2.5:3b LLM to scrub PII before external AI calls.

Quick Start

# 1. Install Ollama model
ollama pull qwen2.5:3b

# 2. Test the script
cd ~/.openclaw/workspace/skills/openclaw-pii-anonymizer
bash privacy-anonymize-v2.sh "My name is John Doe, SSN 123-45-6789"
# Output: My name is [NAME], SSN [SSN]

What It Does

Replaces PII with tokens:

  • Names → [NAME]
  • SSNs → [SSN]
  • Emails → [EMAIL]
  • Phones → [PHONE]
  • Wallets → [WALLET]
  • IPs → [IP]
  • Paths → [PATH]

Two-layer approach:

  1. Regex (fast, <1ms) - Structured PII (SSN, email, phone, etc.)
  2. Qwen2.5:3b (2-3s) - Contextual names (zero hallucination)

Usage

Manual (Working Now)

# In scripts/workflows
ANONYMIZED=$(bash privacy-anonymize-v2.sh "$USER_INPUT")
echo "$ANONYMIZED" | external-api-call

Automatic Hook (TODO)

Hook installed at ~/.openclaw/workspace/hooks/pii-shield/ but doesn't fire on messages yet. Debugging needed.

Requirements

  • Ollama running at http://localhost:11434
  • Model: qwen2.5:3b (1.9GB) - Better instruction-following than phi3:mini
  • RAM: 16GB recommended (6GB minimum but tight)
  • Dependencies: bash, curl, jq, sed

Why Qwen2.5:3b?

Tested alternatives:

  • phi3:mini - Hallucinates extra content, too chatty
  • qwen2.5:3b - Zero hallucination, task-focused, smaller (1.9GB vs 2.2GB)
  • Alternative: llama3.2:3b (similar performance)

Performance

  • Regex layer: <1ms
  • LLM layer: 2-3s (only runs if names detected)
  • Optimization: Skips LLM for short messages or already-anonymized text

Known Issues

  1. Hook system - message:preprocessed event doesn't fire (needs investigation)
  2. Auto-interception - Messages not automatically scrubbed yet
  3. Re-contextualization - Not implemented (responses stay anonymized)

For Production

Consider NemoClaw for production deployments:

  • Built-in PII handling at architecture level
  • Enterprise-grade from Nvidia
  • No hook debugging needed

This skill: Development/testing, manual workflows

NemoClaw: Production with real customer PII

Testing

# Test 1: Structured PII
bash privacy-anonymize-v2.sh "SSN 123-45-6789, email test@example.com"
# Expected: SSN [SSN], email [EMAIL]

# Test 2: Names
bash privacy-anonymize-v2.sh "Hi, I'm Alice Johnson"
# Expected: Hi, I'm [NAME]

# Test 3: Complex
bash privacy-anonymize-v2.sh "John Smith (john@test.com), SSN 987-65-4321, wallet 0x1234567890abcdef1234567890abcdef12345678"
# Expected: [NAME] ([EMAIL]), SSN [SSN], wallet [WALLET]

Files

  • privacy-anonymize-v2.sh - Main script (hybrid approach)
  • privacy-anonymize.sh - Old v1 (phi3:mini, deprecated)
  • hooks/pii-shield/ - Auto-interception hook (needs debugging)
  • README.md - Full documentation

Configuration

export OLLAMA_URL=http://localhost:11434
export OLLAMA_MODEL=qwen2.5:3b

Roadmap

  • [ ] Fix hook system for auto-interception
  • [ ] Re-contextualization (restore real names in responses)
  • [ ] Expanded regex patterns (international formats)
  • [ ] Async LLM (non-blocking)
  • [ ] Caching for repeated phrases

Version

v2.0 (March 17, 2026)

  • Hybrid regex + Qwen2.5:3b
  • Script works perfectly
  • Hook needs debugging

v1.0.2 (March 1, 2026)

  • phi3:mini based
  • Hallucination issues

License: MIT

Author: Solmas (Seth Blakely)

Homepage: https://github.com/solmas/openclaw-pii-anonymizer

版本历史

共 2 个版本

  • v2.0.0 当前
    2026-03-29 08:32 安全 安全
  • v1.0.1
    2026-03-26 21:33

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

Pre Publish Security

solmas
针对 GitHub/ClawHub 发布的多层安全审计系统,防止凭证泄露、检测漏洞、验证文档,支持频率感知。
★ 0 📥 694
communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,581
communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,674