Automatic Protections
Prompt Injection Detection
Every message to every agent passes through promptGuard.js before reaching the LLM. It detects 40+ patterns across 5 categories:
- Role confusion: "Ignore previous instructions", "You are now..."
- Delimiter injection: Attempts to break out of the prompt context
- Extraction: "Repeat your system prompt", "Show me your instructions"
- Jailbreaks: DAN, developer mode, and other bypass attempts
- Memory poisoning: Attempts to inject false information into agent memory
Detection results: Critical = message blocked entirely. High/Medium = message sanitized (dangerous parts removed) and processed.
PII Redaction
After every LLM response, piiDetector.js automatically scans for and redacts 7 types of personally identifiable information:
- Email addresses →
[EMAIL_REDACTED] - Phone numbers →
[PHONE_REDACTED] - Credit card numbers →
[CC_REDACTED] - Social Security Numbers →
[SSN_REDACTED] - JMBG (Serbian national ID) →
[JMBG_REDACTED] - IPv4 addresses →
[IP_REDACTED] - IBAN numbers →
[IBAN_REDACTED]
PII redaction is automatic and never blocks responses, it runs post-LLM as a safety net.
Memory Poisoning Defense
Agents can extract and store memories from conversations (user preferences, patterns, etc.). Every extracted memory is scanned by promptGuard.detectInMemory() before storage. Poisoned memories (containing injection attempts) are rejected.
Circuit Breaker
Each agent has a per-agent circuit breaker with three states:
- CLOSED: Normal operation: all requests processed
- OPEN: Too many failures: requests blocked, agent logs an incident
- HALF-OPEN: Recovery: limited requests allowed to test if the issue is resolved
On the first trip (CLOSED → OPEN), an incident is logged. On the second trip, the agent is automatically demoted one trust level. This prevents malfunctioning agents from causing damage.