How It Works
Quick Start
1
Enable redaction in config
2
Redact text directly
Automatic PII redaction on every LLM call
enable_pii_redaction() scrubs secrets from every outgoing message before it reaches the LLM — call it once at process start and all agents in the process are covered.
enable_pii_redaction() registers a sequential BEFORE_LLM hook. Sequential is what actually mutates the outgoing message stream — parallel hooks cannot write modified_input back. If you built your own PII-style hook, register it with sequential=True or it will silently no-op. (Fixed in PraisonAI PR #4034, released with praisonaiagents versions built from main on/after 2026-08-19.)
The scrubbing runs as a
sequential=True BEFORE_LLM hook. See Sequential vs Parallel Hooks for why only sequential hooks can rewrite the payload.Redaction Patterns
Automatically redacted:Using Redaction
Path Validation
validate_monitor_path detects absolute paths across operating systems and blocks writes to sensitive system locations.
Cross-platform behaviour
Absolute detection follows three rules regardless of the host operating system:
A bare drive-relative path like
C:context.txt has no separator after the drive, so it is treated as a relative path. Relative project paths that merely contain a matching substring (for example myapp/home/config.txt or project/users/context.txt) are accepted — the suspicious-pattern check only runs when the path is absolute or a home reference.
Suspicious roots blocked include /etc/, /var/, /usr/, /root/, /home/, ~, and the Windows entries /windows/, /system32/, and /users/.
Ignore/Include Patterns
Respect.praisonignore and .praisoninclude files:
.praisonignore
.praisoninclude
Configuration
Environment Variables
Redaction in Snapshots
All snapshot outputs are redacted:Adding Custom Patterns
Best Practices
Keep redaction enabled
Keep redaction enabled
Default redaction is on for a reason — do not disable it in shared or production environments.
Prefer relative paths in snapshots
Prefer relative paths in snapshots
Absolute paths can leak usernames and directory layout to logs or support tickets.
Maintain .praisonignore
Maintain .praisonignore
Exclude secrets, credentials, and env files from context indexing and snapshots.
Rotate keys if exposed
Rotate keys if exposed
If a snapshot ever captured a live secret, rotate the credential immediately — redaction is not retroactive.
Sharing a saved session? Redact it at export time with
praisonai session export <id> --sanitise — the CLI writes stable [redacted:<category>:<n>] placeholders in place of secrets and absolute paths, and never mutates the on-disk session. See Sanitise before sharing.Related
Context Monitor
Snapshot output and formats
Protected Paths
Restrict file access in agents
Hooks
Sequential vs parallel hooks — why redaction must be sequential
Hook Events
Which events read/write
modified_inputSanitise Session Export
Opt-in redaction for
praisonai session export — stable placeholders, standard vs strict
