# tophant-clawvault-mask-project

Adopt this skill: https://proskills.md/skills/other/tophant-ai-clawvault-skills-tophant-clawvault-mask-project

Page: https://proskills.md/skills/other/tophant-ai-clawvault-skills-tophant-clawvault-mask-project
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/tophant-clawvault-mask-project/SKILL.md
size: 3451
upstream: https://github.com/tophant-ai/clawvault/blob/main/skills/tophant-clawvault-mask-project/SKILL.md

````text
---
name: tophant-clawvault-mask-project
version: 0.1.0
description: Mask sensitive company-project document content before analysis
homepage: https://github.com/tophant-ai/ClawVault
user-invocable: true
disable-model-invocation: false
---

# ClawVault Project Document Masking

Use this skill when a user asks to analyze a local company or project document only after ClawVault checks and desensitizes it.

## Example User Request

```text
Please analyze project.txt. It is a company project document, so use @clawvault to check and mask it first.
```

## Required Safety Flow

When the user requests ClawVault masking before analysis:

1. Do not directly read the original file for analysis.
2. Run this skill first against the user-specified file.
3. Analyze only the returned `sanitized_content` or the file written by `--output`.
4. Do not quote, summarize, or expose original sensitive values.
5. Do not restore numbered placeholders such as `[mask_1]` to original values.

This skill masks sensitive business values with numbered non-reversible placeholders such as `[mask_1]`, `[mask_2]`, and `[mask_3]`. It does not create a reversible mapping.

## Commands

### /tophant-clawvault-mask-project generate-policy

Generate the default company-project masking policy.

```bash
/tophant-clawvault-mask-project generate-policy
/tophant-clawvault-mask-project generate-policy --save-policy /tmp/clawvault-policy.json
```

### /tophant-clawvault-mask-project mask-file

Mask a local document and return JSON containing sanitized content.

```bash
/tophant-clawvault-mask-project mask-file project.txt
/tophant-clawvault-mask-project mask-file project.txt --output project.masked.txt
/tophant-clawvault-mask-project mask-file project.txt --policy /tmp/clawvault-policy.json
/tophant-clawvault-mask-project mask-file project.txt --save-policy /tmp/clawvault-policy.json
```

## What Gets Masked

The default policy targets:

- Company names with common Chinese or English organization suffixes.
- Project amount values, especially after labels such as `Project Amount`, `Contract Amount`, `Budget`, `项目金额`, `合同金额`, or `预算`.
- Contextual person names after labels such as `Project Manager`, `Contact`, `Owner`, `负责人`, `联系人`, or `项目经理`.

For label-introduced values, the label is preserved and only the sensitive value is masked.

```text
Project Amount: USD 300,000
```

becomes:

```text
Project Amount: [mask_1]
```

Chinese project-document values are also supported. For example:

```text
客户公司：上海示例科技有限公司
项目金额：人民币三百万元
项目经理：张伟
联系人：李娜
```

becomes:

```text
客户公司：[mask_1]
项目金额：[mask_2]
项目经理：[mask_3]
联系人：[mask_4]
```

## No-Match Warning

If no sensitive content is matched, the skill returns the original content as `sanitized_content`, sets `detections` to `0`, and includes this warning:

```text
No matching sensitive content was found. This does not guarantee the document is safe; it only means the current policy did not match.
```

## Privacy Rules

- Reads only the user-specified input file.
- Never modifies the original file.
- Writes only optional sanitized output files or optional saved policy JSON files.
- Does not request network access.
- Does not start or require the ClawVault proxy or dashboard.
- Does not access credentials.
- Does not output original matched values.
````

## File: README.md
upstream: https://github.com/tophant-ai/clawvault/blob/main/README.md

````text
<div align="center">
  <img src="./doc/images/logo1.png" alt="ClawVault Logo" width="200"/>
  <p><strong>OpenClaw Security Vault — Atomic "claw" control: every AI reach, within your sight.</strong></p>
  <p>
    <a href="https://github.com/tophant-ai/ClawVault/blob/master/LICENSE">
      <img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License"/>
    </a>
    <a href="https://www.python.org/downloads/">
      <img src="https://img.shields.io/badge/python-3.10+-blue.svg" alt="Python 3.10+"/>
    </a>
    <a href="https://github.com/tophant-ai/ClawVault/stargazers">
      <img src="https://img.shields.io/github/stars/tophant-ai/ClawVault?style=social" alt="Stars"/>
    </a>
  </p>
</div>

**[English](./README.md)** | **[中文](./README.zh-CN.md)**

<div align="center">
  <img src="./doc/images/cartoon_en.png" alt="ClawVault Cartoon" width="800"/>
</div>

## 🎯 ClawVault is for you if

- ✅ You’re concerned about leaking personal private data when interacting with AI agents
- ✅ You want to prevent AI agents from accessing API keys, private files, and credentials
- ✅ You need to stop AI agents from mishandling sensitive or confidential files
- ✅ You want to keep logs of how AI interacts with your private data
- ✅ You need to detect AI injection attacks and dangerous commands

Activate your personal AI Vault:
- 1️⃣ Load private files
- 2️⃣ Set up and customize your secure storage
- 3️⃣ Create remote management skills

https://github.com/user-attachments/assets/2098b271-f844-4db5-b44a-f836e36d314c

### Effect

<div align="center">

| Interception | Interception Record |
|:-------------------:|:----------------:|
| <img src="doc/images/block-tui.png" width="400"> | <img src="doc/images/block-web.png" width="400"> |

</div>

https://github.com/user-attachments/assets/d580cfa1-8410-4095-90cb-3d693413a24e

### Core Capabilities

#### 1. Visual Monitoring
Users can configure their own "vault" and lock in Agents, Skills, credentials, and files they care about.  
When someone touches these assets, the "Security Lobster" will notify you via IM: who touched what in your vault yesterday.

**Technical Implementation**:
- Event collection based on API gateway and file-side monitoring (invocation records, file access, change tracking)
- Supports periodic change notifications and real-time alerts

#### 2. Atomic Control

Fine-grained control at the Agent level, using composable "atomic capabilities" as the smallest unit:
- Agent interaction and invocation policies
- Model routing, whitelists, and quota control
- Security detection (sensitive info recognition, credential detection, prompt injection protection, etc.)
- File access permission constraints

Users can combine these atomic capabilities like "building blocks" to create reusable policy configurations.

#### 3. Generative Capabilities
Each "storage chamber" in the vault includes built-in basic security scenarios and allows users to add detection scenarios and Skills via natural language by mobilizing atomic capabilities.

**Example**:  
Tell the system via chat interface:
```
For customer service Agent, if a user uploads a PDF containing 'contract',
it must first go through sensitive information desensitization,
and only GPT-4o-mini is allowed, with a single call limit of 2000 tokens.
```
The system will automatically generate and execute the corresponding policy rules.

---

## ✨ Features

- **🔍 Sensitive Data Detection** — API keys, passwords, PII, credit cards, and 15+ pattern types
- **🛡️ Prompt Injection Defense** — Block role hijacking, instruction override, data exfiltration
- **⚠️ Dangerous Command Guard** — Intercept `rm -rf`, `curl|bash`, privilege escalation
- **🔄 Auto-Sanitization** — Replace secrets with placeholders, restore on response
- **💰 Token Budget Control** — Daily/monthly limits with cost alerts
- **📊 Real-time Dashboard** — Web UI with Audit Log, Protection Monitor, per-agent config, and quick tests
- **🤖 Agent Integrations** — OpenClaw session/runtime protection and Claude Code prompt/tool hooks

ClawVault combines a **transparent proxy gateway**, local agent hooks, and dashboard monitoring to protect AI provider traffic, OpenClaw sessions, and Claude Code prompt/tool activity.

## 🚀 Quick Start

https://github.com/user-attachments/assets/1f424172-8833-4ccc-b0d2-abf67c1758dd

### Option 1: Install as OpenClaw Skill (Recommended)

```bash
# Install the dedicated installer from ClawHub
openclaw skills install tophant-clawvault-installer --version=0.2.9 --force

# Or install via clawhub CLI
clawhub install tophant-clawvault-installer --version 0.2.9
```

**ClawHub:** https://clawhub.ai/Martin2877/tophant-clawvault-installer

The installer skill provides AI-guided installation and management:
- `/tophant-clawvault-installer install --mode quick` - Quick setup
- `/tophant-clawvault-installer health` - Check status
- `/tophant-clawvault-installer generate-rule "Block AWS credentials"` - Create security rules
- `/tophant-clawvault-installer test --category all` - Run detection tests

See [skills/tophant-clawvault-installer/](skills/tophant-clawvault-installer/) for skill documentation.

Operational commands after installation are provided by [skills/tophant-clawvault-operator/](skills/tophant-clawvault-operator/).

### Option 2: Install as Python Package

```bash
# Install
pip install -e .

# Start (proxy + dashboard)
clawvault start

# Scan text
clawvault scan "password=[PASSWORD_EXAMPLE] key=[SYNTHETIC_API_KEY]"

# Interactive demo
clawvault demo
```

## 🚀 Deploy to Server

```bash
# One command: pack, upload, install
./scripts/deploy.sh <server-ip> root

# On server: setup integration + start
./scripts/setup.sh
./scripts/start.sh
```

## 📜 Scripts

| Script | Usage |
|--------|-------|
| `scripts/deploy.sh <ip> [user]` | Deploy to cloud server |
| `scripts/start.sh` | Start ClawVault (add `--with-openclaw` to also start OpenClaw) |
| `scripts/stop.sh` | Stop all services |
| `scripts/test.sh` | Run CLI + API tests |
| `scripts/setup.sh` | Setup OpenClaw proxy integration |
| `scripts/setup-claude-code.sh` | Setup Claude Code prompt and tool hooks (dry-run by default) |
| `scripts/uninstall.sh` | Uninstall and restore original state |

## 🏗️ Architecture

```
    OpenClaw
       │
       ▼
┌─────────────────────────────────┐
│    ClawVault (Security Vault)   │
├─────────────────────────────────┤
│ Gateway Module                  │
│  • Transparent Proxy  :8765     │
│  • Traffic Interception         │
├─────────────────────────────────┤
│ Detection Engine                │
│  • Sensitive data               │
│  • Injection patterns           │
│  • Dangerous commands           │
├─────────────────────────────────┤
│ Guard / Sanitizer               │
│  • Allow / Block / Sanitize     │
├─────────────────────────────────┤
│ Audit + Monitor                 │
│  • SQLite storage               │
│  • Token budget tracking        │
├─────────────────────────────────┤
│ Dashboard                       │
│  • Web UI :8766                 │
│  • Agent config & tests         │
└─────────────────────────────────┘
```

## ⚙️ Configuration

```yaml
# ~/.ClawVault/config.yaml
proxy:
  port: 8765
  intercept_hosts: ["api.openai.com", "api.anthropic.com"]

guard:
  mode: "interactive"  # interactive | strict | permissive

monitor:
  daily_token_budget: 50000
```

### OpenClaw OpenAI-Compatible Adapter

For OpenClaw deployments, prefer the direct OpenAI-compatible adapter over a transparent proxy when you want `@clawvault sanitize` prompts to continue to the model after local sanitization.

OpenClaw provider configuration:

```text
base_url = http://127.0.0.1:8766/v1
```

Keep the existing OpenClaw model and provider API key unchanged. Configure ClawVault to forward adapter traffic to the real upstream provider:

```yaml
# ~/.ClawVault/config.yaml
provider_adapter:
  enabled: true
  upstream_base_url: https://api.example.com/v1
  request_timeout_seconds: 60.0
```

Do not set `provider_adapter.up
````
