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:
dev
2026-09-16 11:33:09 +03:00
commit 278ecca018
34 changed files with 5315 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
---
description: Show what ctxguard has been blocking and substituting
---
```
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/ctxguard.py" audit -n 40
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/ctxguard.py" status
```
The audit log records rule ids, tool names and aliases — never plaintext, so it is
safe to read inside a session.
Read it for false positives: a rule that keeps firing on harmless content is a rule
that will get the whole plugin switched off. Fixes, in order of preference:
add the value to `allowlist` / `allowlist_substrings` in `policy.json`, narrow the
rule, or add it to `disabled_secret_rules`.