Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Pyveil?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hyeonsangjeon-pyveil)
---
name: pyveil
description: Local PII and secret redaction for Claude Code, Codex, and GitHub Copilot CLI using pyveil hooks, MCP stdio proxy, and CLI redaction.
---
# pyveil Agent Skill
Use `pyveil` to redact PII and block credentials locally before prompts, tool
arguments, tool outputs, MCP payloads, logs, or traces cross trust boundaries.
## Prerequisites
Always provide an HMAC redaction secret via `PYVEIL_SECRET` (or a private,
untracked key file). pyveil intentionally fails closed when no secret is set.
```bash
export PYVEIL_SECRET="$(python3 -c 'import secrets; print(secrets.token_hex(32))')"
```
Never hardcode an operational secret in hook configs, `config.toml`,
`settings.json`, `hooks.json`, or source code.
## When to Use Each Command
### 1. Wrap a stdio MCP Server (`pyveil proxy`)
Place `pyveil proxy` in front of any stdio MCP server so `tools/call` arguments
are checked and tool results / MCP resources are masked before entering model
context:
```bash
python3 -m pyveil proxy -- <mcp-server-command> [args...]
```
With optional Korean PII detection and raw-free JSONL audit logging:
```bash
python3 -m pyveil proxy --rulepack kr --audit-log pyveil-audit.jsonl -- <mcp-server-command> [args...]
```
### 2. Guard Coding-Agent Tool Calls (`pyveil hook`)
Wire `PreToolUse` and `PostToolUse` hooks for Claude Code, Codex, or GitHub
Copilot CLI:
```bash
# PreToolUse (default --mode block denies credentials and sensitive secret paths)
python3 -m pyveil hook pre-tool-use --client auto
# PostToolUse (always non-blocking; masks tool outputs and emits safe context)
python3 -m pyveil hook post-tool-use --client auto
```
Supported `--client` values: `auto`, `claude-code`, `copilot-cli`, `codex`.
Supported `--mode` values for `pre-tool-use`: `block` (default), `redact`, `audit`.
Ready-to-use templates live in this repository:
- Claude Code: `hooks/claude-code/settings.json`
- GitHub Copilot CLI: `hooks/copilot-cli/hooks.json`
- Codex: `hooks/codex/config.toml`
### 3. Redact Files or Piped Payloads (`pyveil redact` / `pyveil scan`)
Redact plain text or structure-preserving JSON locally before sharing logs,
fixtures, or tool responses with an LLM:
```bash
# Plain text
python3 -m pyveil redact notes.txt
# Structured JSON (preserves keys/arrays while masking values)
python3 -m pyveil redact payload.json --format json
# Findings-only metadata scan (never prints raw values)
python3 -m pyveil scan payload.json
```
## Optional Flags
- `--rulepack kr`: enable opt-in Korean PII detection (RRN, BRN, Korean bank
account patterns) alongside built-in global PII and credential detectors.
- `--audit-log <path>`: write structured metadata-only JSONL audit records
(`event`, `channel`, `action`, `finding_count`, `entity_counts`, `rule_ids`,
`latency_ms`, `scope`) without raw sensitive values or file paths.
- `--scope <name>`: isolate HMAC placeholder digests per session, run, or
tenant so placeholders cannot be linked across contexts.
## Security Rules and Honest Boundaries
- **Never log or echo raw sensitive values**: do not paste raw secrets,
credentials, PII, or `.env` contents into prompts, exceptions, audit logs,
tests, or commit diffs.
- **Require `PYVEIL_SECRET`**: do not bypass missing-secret errors with static
fallback strings in production or shared configs.
- **No LLM unmasking tools**: never expose a reversible unmasking tool to an
agent or model.
- **Path guard is heuristic, not a sandbox**: blocking `.env`, `.env.*`
(except safe templates like `.env.example`, `.env.sample`, `.env.template`),
`*.pem`, `*.key`, `id_rsa`, `id_ed25519`, `.aws/credentials`, and `.netrc`
reduces accidental reads, but does not replace OS permissions, container
isolation, or least-privilege credentials.
- **Do not overclaim**: pyveil is local redaction middleware, not a regulatory
compliance guarantee (GDPR/HIPAA/PCI), a full DLP or secret-scanning suite, a
prompt-injection firewall, or a reversible token vault.