Preface¶
Before handing logs, ticket screenshots, or conversation context over to Large Language Models (LLMs), phone numbers, ID numbers, bank card details, and text within screenshots often lack time for manual masking. Uploading sensitive content to third-party desensitization services, however, conflicts with compliance requirements and internal network boundaries. The following introduces a community Skill on SkillHub: the “Deep Learning-based Local Image and Text Desensitization Tool”. It utilizes Python scripts to identify and mask sensitive information locally. It can be mounted into the skills directory of Agents like Cursor or Codex using standard Skill installation methods, allowing the Agent to invoke it according to the guidelines in SKILL.md.
What is this¶
One-sentence positioning: A local desensitization capability package designed for Agents, covering text, JSON, and images (including OCR and regional blurring). All processing is completed within the runtime environment, and SkillHub marks it as requires_api_key=false.
Maintenance & Source: Published by the community publisher user_cf24022c, coordinates @user_cf24022c/image-text-desensitization, categorized under it-ops-security. The current SkillHub version is 1.0.0. The skill.json inside the package describes the capability as an “Intelligent Automatic Desensitization Tool.” The main entry point is smart_desensitize_skill.py, accompanied by standard and high-performance image desensitization modules (deep_desensitize_skill.py, fast_deep_desensitize_skill.py).
Core Features¶
The following capabilities are derived from the installed Skill package’s SKILL.md, skill.json, and SOP.md:
- Text Desensitization: Uses regex to identify phone numbers, ID cards, bank cards, emails, etc.;
SOP.mdalso lists desensitization examples for names, addresses, QQ numbers, WeChat IDs, license plate numbers, and other types. - JSON Desensitization: Automatically processes data based on field names and content;
skill.jsonconfigures common sensitive field names (such aspassword,token,phone,id_card, etc.). - Image Desensitization: Supports base64 input; can enable deep learning mode, including OCR text detection blurring and face detection blurring (defined in
skill.jsonunderimage_desensitize.features). - Performance Strategies: The image side offers two modes:
standard(DeepLearningDesensitizer) andfast(FastDeepLearningDesensitizer);SmartDesensitizercan switch between them viause_deep_learningandhigh_performanceparameters. - Agent-side Integration: Upon first import, it can automatically create
./基础设定/DESENSITIZE_RULES.mdand update desensitization rules in./MEMORY.md; it can be skipped if the user explicitly requests “no desensitization” (seeSKILL.md,SOP.md).
Installation & Activation¶
Via SkillHub CLI (Recommended)¶
First, confirm that skillhub is installed on your local machine (refer to the SkillHub Installation Guide for installation methods). When installing the Skill, you must use --dir to point to the current Agent’s skills directory; otherwise, if installed to the default ./skills/, it might not be recognized.
skillhub install image-text-desensitization --namespace user_cf24022c --dir <Your Agent skills directory>
Common directories (excerpted from SkillHub installation documentation):
- Cursor:
~/.cursor/skills/ - Codex:
~/.codex/skills/or.agents/skills/under the project - Claude Code:
~/.claude/skills/
You can also send the following prompt to your Agent to let it fetch the same coordinates according to the official installation documentation:
Please install `@user_cf24022c/image-text-desensitization` based on https://skillhub.cn/install/skillhub.md.
Python Dependencies¶
SKILL.md states that text and JSON desensitization primarily rely on the Python 3.6+ standard library; for image OCR, easyocr is recommended, and opencv-python-headless is optional for face-related capabilities. skill.json lists opencv-python, Pillow, and numpy as required dependencies for image-related tasks. OCR supports optional easyocr or paddleocr, with OCR languages including ch_sim and en. Simply install the corresponding packages based on whether you enable the image deep learning mode.
Typical Usage¶
After installation, invoke the main class within the Skill directory or in an environment where the path has been added to PYTHONPATH (examples below are from SKILL.md and skill.json).
Text:
from smart_desensitize_skill import SmartDesensitizer
desensitizer = SmartDesensitizer()
result = desensitizer.desensitize_text("手机号:13812345678")
# Sample Output: 手机号:138****5678
JSON:
data = {"name": "张三", "phone": "13812345678"}
result = desensitizer.desensitize_json(data)
Image (base64):
result = desensitizer.desensitize_image_base64(image_base64)
Enabling Image Deep Learning / High-Performance Mode (skill.json):
desensitizer = SmartDesensitizer(use_deep_learning=True)
# Or
desensitizer = SmartDesensitizer(use_deep_learning=True, high_performance=True)
The integration workflow in SOP.md is: User Content enters Agent → Determine if desensitization is needed → Execute desensitization → (For images) optionally delete the original image and retain only the desensitized result → Proceed with subsequent tasks.
Use Cases & Notes¶
Target Audience
- Developers or Ops personnel who need to perform a round of local PII processing on text, structured fields, or screenshots before handing them over to models.
- Agent environments using the OpenClaw system or those with
MEMORY.mdand tool directory conventions, desiring inheritable and self-checkable initialization for desensitization rules.
Limitations & Notes
- The package’s
INSTALL.mdmentions verification viapython test_full.py, but the current Skill package file list does not include this script; rely on imports and unit tests in your environment. - Both
SKILL.mdandSOP.mdstate: The original image may be automatically deleted after image desensitization is complete. If archival is required, please retain a separate copy in your workflow. - OCR and OpenCV dependencies are not small in size and computing power. It is advisable to use the
high_performancemode for large images (seeskill.jsonforfastconfiguration). - The SkillHub page introduction is brief; specific behavior is subject to the
SKILL.md,SOP.md, andskill.jsoninside the package. If the version number in the header of the package’sSKILL.md(3.0.0) is inconsistent with the 1.0.0 displayed on SkillHub, the store coordinate version shall prevail.
Conclusion¶
The “Deep Learning-based Local Image and Text Desensitization Tool” packages text, JSON, and image desensitization scripts along with Agent integration instructions into an installable Skill. It is suitable for adding a layer of local masking to conversations and automation tasks without uploading sensitive data. Official page and installation coordinates:
- SkillHub: https://www.skillhub.cn/skills/user_cf24022c/image-text-desensitization
- API Entry: https://api.skillhub.cn/user_cf24022c/image-text-desensitization