CloakClaw — Always-On Privacy Proxy
Prerequisites
CODEBLOCK0
Verify: cloakclaw --version should return 0.1.2 or higher.
How It Works
- 1. Detect: When user sends a document or sensitive text, auto-detect the document type
- Cloak: Run the cloaking engine (regex + local LLM) to replace sensitive entities with realistic fakes
- Send: Forward cloaked text to the cloud LLM for analysis
- Decloak: When response arrives, reverse all replacements to restore originals
- Deliver: Send the restored response to user with a privacy footer
Entity Types (24)
| Category | Types |
|---|
| Identity | People, Companies, Passports, Drivers License |
| Contact |
Emails, Phones, Addresses |
| Financial | Dollars, Percentages, Accounts, Banks, SSNs |
| Legal | Case Numbers, Jurisdictions |
| Tech | IP Addresses, MAC Addresses, Passwords/Secrets, API Keys, URLs |
| Other | Crypto Wallets, GPS Coordinates, VIN Numbers, Medical IDs, Dates |
Profiles (6)
- - general — all 24 types (default for unknown documents)
- legal — contracts, NDAs, filings (10 types)
- financial — bank statements, P&L, investor docs (11 types)
- email — correspondence (10 types)
- code — .env files, configs, infra docs (9 types)
- medical — HIPAA-adjacent records (11 types)
Auto-Detection Rules
Always cloak (document attached):
- - PDF, TXT, MD, CSV, JSON, YAML, code files → auto-detect profile from content
- Legal keywords (agreement, contract, whereas, hereby) →
legal profile - Financial keywords (revenue, P&L, balance sheet, quarterly) →
financial profile - Code files (.env, .yaml, .json with secrets) →
code profile - Default for unrecognized →
general profile
Always cloak (sensitive content in text):
- - Contains SSN patterns (###-##-####)
- Contains dollar amounts > $1,000
- Contains multiple proper names + company names
- Contains IP addresses, API keys, or passwords
- User explicitly says "cloak", "private", "redact", or "protect"
Skip cloaking:
- - Simple questions with no sensitive data
- User says "raw", "uncloak", "no cloak", or "cloakclaw off"
Execution Flow
Step 1: Cloak the document
CODEBLOCK1
Output JSON:
CODEBLOCK2
Or use the CLI directly:
CODEBLOCK3
Step 2: Send cloaked text to cloud LLM
Use the cloaked text as the document content. The user's question stays unchanged — only the document data is cloaked.
Step 3: Decloak the response
CODEBLOCK4
Or CLI:
CODEBLOCK5
Output: restored text with original entities.
Step 4: Deliver with privacy footer
Append to the response:
CODEBLOCK6
User Commands
- -
cloakclaw off — disable auto-cloaking for this session - INLINECODE7 — re-enable auto-cloaking
- INLINECODE8 — show current settings and recent sessions
- INLINECODE9 — show what was cloaked
Configuration
Config at ~/.cloakclaw/config.yaml:
CODEBLOCK7
Recommended Models by RAM
| RAM | Model | Quality |
|---|
| 8GB | qwen2.5:3b | Basic (regex does most work) |
| 16GB |
qwen2.5:7b | Good |
| 32GB+ | qwen2.5:32b | Very good |
| 64GB+ | qwen2.5:72b | Excellent |
Security
- - AES-256-GCM encrypted mapping database
- Optional password protection (
cloakclaw password set) - Auto-expiry: sessions purged after 7 days
- Zero telemetry, zero cloud dependency for cloaking
- All processing runs locally
⚠️ Disclaimer
CloakClaw is NOT HIPAA, GDPR, SOC 2, PCI-DSS, or CCPA compliant. It is a best-effort privacy tool. Users are responsible for reviewing cloaked output before sharing.
CloakClaw — 始终在线的隐私代理
前置条件
bash
必需
npm install -g cloakclaw
可选但推荐
brew install poppler # 更好的PDF文本提取
ollama pull qwen2.5:7b # AI驱动的姓名/公司检测
验证:cloakclaw --version 应返回 0.1.2 或更高版本。
工作原理
- 1. 检测:当用户发送文档或敏感文本时,自动检测文档类型
- 伪装:运行伪装引擎(正则表达式 + 本地LLM),将敏感实体替换为逼真的伪造数据
- 发送:将伪装后的文本发送至云端LLM进行分析
- 还原:收到响应后,反转所有替换操作,恢复原始内容
- 交付:将还原后的响应发送给用户,并附带隐私声明
实体类型(24种)
邮箱、电话、地址 |
| 财务信息 | 美元金额、百分比、账户、银行、社保号 |
| 法律信息 | 案号、司法管辖区 |
| 技术信息 | IP地址、MAC地址、密码/密钥、API密钥、URL |
| 其他 | 加密货币钱包、GPS坐标、车辆识别码、医疗ID、日期 |
配置文件(6种)
- - 通用 — 全部24种类型(未知文档默认)
- 法律 — 合同、保密协议、法律文件(10种类型)
- 财务 — 银行对账单、损益表、投资者文档(11种类型)
- 邮件 — 通信往来(10种类型)
- 代码 — .env文件、配置文件、基础设施文档(9种类型)
- 医疗 — HIPAA相关记录(11种类型)
自动检测规则
始终伪装(文档附件):
- - PDF、TXT、MD、CSV、JSON、YAML、代码文件 → 从内容自动检测配置文件
- 法律关键词(协议、合同、鉴于、特此) → 法律 配置文件
- 财务关键词(收入、损益表、资产负债表、季度) → 财务 配置文件
- 代码文件(.env、.yaml、.json含密钥) → 代码 配置文件
- 无法识别时默认 → 通用 配置文件
始终伪装(文本中的敏感内容):
- - 包含社保号模式(###-##-####)
- 包含超过1,000美元的金额
- 包含多个专有名词+公司名称
- 包含IP地址、API密钥或密码
- 用户明确说伪装、隐私、编辑或保护
跳过伪装:
- - 不含敏感数据的简单问题
- 用户说原始、取消伪装、不伪装或关闭CloakClaw
执行流程
步骤1:伪装文档
bash
node scripts/cloak.js --profile <通用|法律|财务|邮件|代码|医疗> --input /path/to/file
输出JSON:
json
{
sessionId: a5cc1496-15b9-4b43-8506-3ea75dfe1304,
cloaked: ...伪装后的文本...,
entityCount: 20,
profile: 法律
}
或直接使用CLI:
bash
cloakclaw cloak document.pdf --profile legal -o cloaked.txt
步骤2:将伪装文本发送至云端LLM
使用伪装后的文本作为文档内容。用户的问题保持不变——仅文档数据被伪装。
步骤3:还原响应
bash
node scripts/decloak.js --session --input /path/to/response.txt
或CLI:
bash
cloakclaw decloak -s -f response.txt
输出:恢复原始实体的文本。
步骤4:交付并附带隐私声明
在响应末尾追加:
🔒 CloakClaw:已保护{entityCount}个实体 | 配置文件:{profile} | 会话:{sessionId_short}
用户命令
- - cloakclaw off — 禁用当前会话的自动伪装
- cloakclaw on — 重新启用自动伪装
- cloakclaw status — 显示当前设置和最近会话
- cloakclaw diff — 显示被伪装的内容
配置
配置文件位于 ~/.cloakclaw/config.yaml:
yaml
ollama:
url: http://localhost:11434
model: qwen2.5:7b
按内存推荐模型
| 内存 | 模型 | 质量 |
|---|
| 8GB | qwen2.5:3b | 基础(正则表达式完成大部分工作) |
| 16GB |
qwen2.5:7b | 良好 |
| 32GB+ | qwen2.5:32b | 很好 |
| 64GB+ | qwen2.5:72b | 优秀 |
安全性
- - AES-256-GCM加密映射数据库
- 可选密码保护(cloakclaw password set)
- 自动过期:会话7天后清除
- 零遥测,伪装过程零云端依赖
- 所有处理均在本地运行
⚠️ 免责声明
CloakClaw不兼容HIPAA、GDPR、SOC 2、PCI-DSS或CCPA标准。它是一个尽力而为的隐私工具。用户在分享前有责任检查伪装后的输出内容。