Compliance PoC — PII redaction & data retention (#275) - #279
Draft
illeatmyhat wants to merge 2 commits into
Draft
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>
illeatmyhat
force-pushed
the
feat/275-pii-retention-poc
branch
from
July 24, 2026 17:37
74773d0 to
cccbf43
Compare
|
No vulnerabilities found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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