CODITECT Privacy Control Manager
Implements privacy-aware data handling with PII detection, redaction, and 4-level privacy model for MEMORY-CONTEXT system.
Privacy Levels:
- PUBLIC: Can be shared publicly, no PII
- TEAM: Internal team sharing, some PII allowed
- PRIVATE: Restricted access, full PII allowed
- EPHEMERAL: Never stored, session-only
Features:
- Automatic PII detection (emails, phones, SSN, credit cards, IP addresses, etc.)
- Configurable redaction strategies
- Privacy-aware export filtering
- GDPR compliance support
- Audit trail for privacy operations
Usage: from privacy_manager import PrivacyManager, PrivacyLevel
pm = PrivacyManager()
# Detect PII
pii_found = pm.detect_pii(text)
# Redact based on privacy level
safe_text = pm.redact(text, level=PrivacyLevel.PUBLIC)
# Check if content is safe for level
is_safe = pm.is_safe_for_level(text, PrivacyLevel.TEAM)
Author: AZ1.AI CODITECT Team Sprint: Sprint +1 - MEMORY-CONTEXT Implementation Date: 2025-11-16
File: privacy_manager.py
Classes
PrivacyError
Base exception for privacy management errors.
PIIDetectionError
Raised when PII detection fails.
RedactionError
Raised when redaction operation fails.
ConfigLoadError
Raised when privacy configuration cannot be loaded.
PrivacyLevel
Privacy levels for data handling.
PIIType
Types of Personally Identifiable Information.
PIIDetection
Represents a detected PII instance.
PrivacyConfig
Privacy configuration settings.
PrivacyManager
Manages privacy controls for MEMORY-CONTEXT system.
Functions
main()
CLI entry point for testing.
to_dict()
Convert to dictionary.
detect_pii(text, pii_types)
Detect PII in text.
redact(text, level, detections)
Redact PII based on privacy level.
is_safe_for_level(text, level, threshold)
Check if text is safe for given privacy level.
get_privacy_summary(text)
Get privacy analysis summary for text.
Usage
python privacy_manager.py