Add ctxguard: hook-enforced context sanitization
Keeps credentials, company names, personal names and PII out of the model's context. Enforcement lives in Claude Code hooks rather than in instructions to the agent: a skill alone cannot protect anything, because by the time the agent reads a rule the surrounding context has already been sent. Credentials are removed irreversibly and marked. Entities from a user-supplied dictionary become stable aliases, rewritten back to real values on their way to disk and to the shell, so code and commands referring to them still work. Published from a clean tree; development history is not included.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
---
|
||||
description: Turn a block of text (ticket, log, email) into an aliased version safe to paste
|
||||
---
|
||||
|
||||
The user has text containing sensitive data and needs an aliased version they can
|
||||
send. A hook cannot rewrite a prompt, only block it, so this is the supported route.
|
||||
|
||||
Ask the user to paste the text into a file (or use text they already have on disk),
|
||||
then run:
|
||||
|
||||
```
|
||||
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/ctxguard.py" sanitize < <file>
|
||||
```
|
||||
|
||||
The aliased text goes to stdout; a per-rule summary goes to stderr.
|
||||
|
||||
Note: only values already in the dictionary become aliases. Credentials and PII are
|
||||
detected by pattern regardless. If a company or person came through untouched, it is
|
||||
not registered yet — offer `/ctx-entity`.
|
||||
Reference in New Issue
Block a user