Compliance PoC — PII redaction & data retention (#275)#279
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Replace the pre-seam PoC demos (which imported the now-removed PIIConfig/NullRedactor/backend.redactor) with seam-native presentation files showing how to USE the merged hook seam (PR #295): - examples/pii_redaction_demo.py: regex + semantic PII plugins via HooksConfig; headline is that semantic catches the NAME regex cannot. Guards + graceful macOS/MPS fallback to regex-only. - examples/secrets_demo.py: SecretsFilterMemoryPlugin redacts a fake AWS key + GitHub token on write and on LLM egress. - DEMO.md: presentation walkthrough — evolve hooks init / HooksConfig, the runnable demos with real output, retained measured results, defence-in-depth + limitations (incl. MPS caveat). This branch is main + these demo files (presentation branch, not a history-preserving merge). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
74773d0 to
cccbf43
Compare
|
Checks Summary Last run: 2026-07-24T17:46:00.646Z Mend Unified Agent vulnerability scan found 4 vulnerabilities:
|
What changed
The original PoC predated the memory hook seam and imported detectors directly (
PIIConfig/NullRedactor/backend.redactor) — all since removed frommainand replaced by the seam. This branch has been reset tomain+ demo files and now shows how to USE the merged seam (PR #295): plugins configured viaevolve hooks init→evolve.hooks.yaml(auto-discovered) or code-firstHooksConfig(plugins=[HookPluginSpec(...)]), firing at the backend read/write choke points and before every LLM call.The two #275 asks, plus secrets — three redaction methods on one seam
memory_pre_write+llm_pre_call:PIIFilterMemoryPlugin,[pii-regex]) — structured identifiers (email, phone, SSN, card, IP) at precision ~1.00; no NER.ReadiSemanticPIIPlugin,[pii-semantic]) — IBM READI NER; catches the names regex cannot.evolve retention run --policy <file> [--apply](dry-run by default).SecretsFilterMemoryPlugin([secrets]) redacts credentials/tokens (AWS keys, GitHub/Slack tokens, private keys) on write and on LLM egress.Running all three together is the recommended defence-in-depth posture.
Runnable demos
Measured results (retained — they measure detector/model behavior)
English — ai4privacy, 43,501 records — per-entity recall:
[pii-regex])en_core_web_trf)Japanese — ai4privacy openpii-1.5m, 2,000 records — a language-matched model (one config line) is decisive:
ja_core_news_trf)Regex is high-precision on well-formed structured PII but blind to names and non-Western formats; semantic NER adds names/locations (~4× recall on English) but is language-bound. Hybrid (regex + language-matched NER + secrets) is the production shape.
Reviewer note
Branch =
main+ demo files only. Diff vsmain:examples/pii_redaction_demo.py,examples/secrets_demo.py,DEMO.md(all new). Everything the demos exercise (the seam, the three plugins, retention,hooks_demo.py/retention_demo.py/pii_benchmark.py) is already onmain. macOS/Apple-Silicon caveat: READI fails closed on the MPS backend, so the semantic e2e path needs a CPU/CUDA host;pii_redaction_demo.pyfalls back to regex-only with a printed note on darwin. Reproduce, don't trust the prose — full walkthrough inDEMO.md.🤖 Generated with Claude Code