Files
dev 278ecca018 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.
2026-09-16 11:33:09 +03:00

34 lines
890 B
Makefile

CTXGUARD := python3 plugins/ctxguard/scripts/ctxguard.py
.PHONY: help test verify leaks scan status lint all
help:
@echo "test - engine unit tests"
@echo "verify - canary corpus through the real hook entry points"
@echo "leaks - scan transcripts for values that actually reached the model"
@echo "scan - report sensitive values in this repo (counts only)"
@echo "status - show what ctxguard has active"
@echo "lint - byte-compile every script"
@echo "all - lint + test + verify"
test:
python3 plugins/ctxguard/tests/unit/test_engine.py
verify:
$(CTXGUARD) verify
leaks:
$(CTXGUARD) scan-transcript
scan:
$(CTXGUARD) scan .
status:
$(CTXGUARD) status
lint:
python3 -m compileall -q plugins/ctxguard/scripts
python3 -c "import json,glob,sys; [json.load(open(f)) for f in glob.glob('**/*.json', recursive=True)]; print('json ok')"
all: lint test verify