Documentation
Everything you need to install, configure, and run Sentinel — the unified AI agent security platform.
Installation
Sentinel installs with three commands. The installer handles everything automatically.
$ git clone https://github.com/ParthaMehtaOrg/sentinel-site-packages.git $ cd log-prompt-agent && git checkout feature/unified-sentinel $ ./install.sh
The installer does the following:
- Sets up OpenClaw gateway and LLM provider
- Installs the 8-hook security plugin + observation hook
- Installs the
sentinelPython package with all dependencies - Seeds default block rules (passwords, API keys, SSNs, credit cards)
- Generates breach-intel credentials (
~/.breach-intel/.env) - Adds
BREACH_INTEL_URL+BREACH_INTEL_TOKENto your shell profile - Installs a
sitecustomize.pyhook so every Python process is auto-monitored - Configures the LLM proxy (routes OpenClaw LLM traffic through Sentinel for inspection)
- Starts three background services that auto-start on login/boot
- Restarts the gateway
Prerequisites
- Python 3.10+
- Node.js 22+ (for OpenClaw)
Services & Ports
All services auto-start on boot via macOS LaunchAgent. Nothing to configure.
| Service | Port | Auto-starts? | Purpose |
|---|---|---|---|
| OpenClaw Gateway | 18789 | Yes (LaunchAgent) | AI agent runtime with 8 security hooks |
| Policy Engine | 8000 | Yes (LaunchAgent) | Prompt analysis, DLP, unified dashboard |
| Breach Intel | 8081 | Yes (LaunchAgent) | Compliance breach classification & audit |
| LLM Proxy | 18790 | Yes (LaunchAgent) | Intercept & inspect LLM API responses |
| Auto-Instrumentation | — | Yes (sitecustomize.py) | Monkey-patch all LLM frameworks |
| OpenClaw Plugin | — | Yes (loaded by gateway) | 8-hook + 2-tool security enforcement |
Auto-Instrumentation
Sentinel uses Python's sitecustomize.py mechanism to auto-patch AI frameworks at import time. No code changes required.
How it works
./install.shwrites a persistentsitecustomize.pyhook to your Python site-packages- When any Python process starts, the hook runs first
- It checks for the
BREACH_INTEL_URLenvironment variable (set in your shell profile by the installer) - If set, it calls
auto_attach()which monkey-patches all detected AI framework methods - The agent auto-registers (agent_id from hostname + PID, detected frameworks as capabilities)
- Every LLM response is silently sent to the breach-intel policy agent for classification — including trace_id, span_id, latency_ms, and token counts
Supported frameworks
| Framework | Patched Method |
|---|---|
| OpenAI | chat.completions.create |
| Anthropic | messages.create / AsyncMessages.create |
| LangChain | BaseChatModel.invoke / ainvoke |
BREACH_INTEL_URL is not set, the hook exits silently with zero overhead. Your agents are unaffected.Example (zero code changes)
# This agent has NO sentinel imports — monitoring is automatic import openai client = openai.OpenAI() response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "Look up customer SSN"}] ) # This response is silently emitted to the breach-intel policy agent. # If it contains PII, a CRITICAL breach is logged automatically.
Diagnostics
Run diagnostics to verify your installation:
$ python -m sentinel.breach_intel.sdk.cli doctor ✓ BREACH_INTEL_URL = http://localhost:8081 ✓ Persistent hook installed ✓ Detected frameworks: OpenAI, Anthropic ✓ Server health: OK ✓ Credentials: valid ───────────────────────────── All checks passed.
Policy Engine
The policy engine provides 3-layer prompt analysis, running on port 8000.
| Layer | Speed | Method |
|---|---|---|
| Layer 0 | <1ms | Pattern matching (prompt injection, sensitive files, exfil commands) |
| Layer 1 | <50ms | Weighted risk scoring (6 categories, compound patterns, evasion detection) |
| Layer 2 | 1-5s | Local Ollama LLM (semantic analysis for ambiguous cases) |
Endpoint Monitors
Five monitors run concurrently, detecting threats at the system level.
| Monitor | What It Detects |
|---|---|
| Process | Malicious agent processes (OpenClaw, AutoGPT), environment variable secrets |
| Behavioral | 7-signal EMA anomaly scoring: file spikes, network bursts, CPU anomalies |
| File | Filesystem events via watchdog — threat file creation, sensitive file access, real-time DLP |
| Honeypot | Decoy files (~/.honeypot/.env, .aws/credentials, .ssh/id_rsa) — any access triggers alert |
| Privilege | Root/admin detection, world-readable secret files |
Block Rules
The block rule engine supports keyword, regex, recipient, and channel rules. Default rules are seeded during installation.
$ python -m sentinel rules --list $ python -m sentinel rules --add keyword:password --reason "sensitive" $ python -m sentinel rules --remove r_abc12345 $ python -m sentinel rules --add "channel:whatsapp" --reason "WhatsApp disabled" $ python -m sentinel rules --add "recipient:+1234567890" --reason "blocked number"
DLP Scanners
9 scanners run on content, detecting PII, credentials, financial data, and more. Includes LLM classification across 8 threat categories.
- DLP scanner (SSNs, credit cards, emails, phone numbers)
- Credential scanner (API keys, tokens, passwords)
- Prompt Guard (3-layer analysis)
- Content Analyzer (LLM-powered classification)
- Text Extractor
- Financial data scanner
- PII pattern scanner
- Secret file scanner
- Exfiltration command scanner
LLM Proxy
The proxy sits between OpenClaw and upstream LLM APIs (Anthropic, OpenAI) on port 18790. For every request it:
- Measures latency (wall-clock round-trip time)
- Extracts token counts from response JSON/SSE streams
- Computes cost using a built-in pricing table (16 models)
- Checks block rules — replaces blocked responses with
[Blocked] - Reports trace spans to the policy engine (
POST /trace)
All data feeds into the dashboard's Overview (cost/latency cards, model heatmaps) and Traces tab (expandable span trees).
8 Security Hooks
The OpenClaw plugin enforces security at 8 hook points. Every hook auto-connects to both the policy engine and breach-intel.
message_received→ prompt attack detectionbefore_tool_call→ tool pre-validationafter_tool_call→ DLP scan on tool resultsbefore_prompt_build→ inject block rules into system promptllm_input→ deep prompt analysis, can BLOCK LLM call entirelyllm_output→ DLP scan + local rules + auto-emit to breach-intelmessage_sending→ hard-block outbound to channelsbefore_message_write→ block session transcript persistence
Secure Tools
Two additional tools provide DLP-filtered access:
secure_read— reads files with content scanning, blocks if PII/credentials detectedsecure_exec— executes commands with output scanning, blocks if sensitive data in output
Channel Security
OpenClaw has native channel adapters. After connecting a channel, all Sentinel hooks enforce automatically.
# Telegram $ openclaw channels add --channel telegram --token YOUR_BOT_TOKEN # WhatsApp (QR code pairing) $ openclaw channels login --channel whatsapp # Discord $ openclaw channels add --channel discord --token YOUR_DISCORD_BOT_TOKEN # Verify $ openclaw channels status --probe
The message_sending hook blocks outbound messages containing PII/credentials, and before_message_write prevents them from being saved to conversation history.
Breach Intel
Rule-based breach classification — deterministic, <1ms per event, no LLM in the critical path. Runs on port 8081.
Breach Intel SDK (for explicit use)
from sentinel.breach_intel.sdk import PolicyAgentClient client = PolicyAgentClient("http://localhost:8081", agent_id="my-agent") result = client.emit_llm_response("Customer SSN is 123-45-6789") # result.is_breach = True, result.severity = "CRITICAL"
Fintech
12 breach types. Covers: PII_EXPOSURE, CARD_DATA_EXPOSURE, CROSS_TENANT_LEAK, DATA_EXFILTRATION, SUSPICIOUS_TRANSACTION, UNAUTHORIZED_ACCESS, PRIVILEGE_ESCALATION, REGULATORY_VIOLATION, HALLUCINATION_FINANCIAL, AUDIT_TRAIL_MISSING, SCOPE_CREEP, UNAPPROVED_EXTERNAL_CALL.
Regulations: PCI-DSS, SOX, GDPR.
Healthcare
14 breach types. Covers: PHI_EXPOSURE, CLINICAL_NOTE_LEAK, UNAUTHORIZED_PRESCRIPTION_ACTION, DIAGNOSTIC_HALLUCINATION, MINORS_DATA_EXPOSURE, MENTAL_HEALTH_DISCLOSURE, HIV_STATUS_DISCLOSURE, GENOMIC_DATA_EXPOSURE, INSURANCE_DATA_LEAK, CROSS_PATIENT_LEAK, and more.
Regulations: HIPAA, 42 CFR Part 2, GDPR.
Pharma
14 breach types. Covers: TRIAL_DATA_FABRICATION, UNBLINDING_BREACH, AUDIT_TRAIL_VIOLATION_21CFR11, ESIGNATURE_BYPASS, REGULATORY_SUBMISSION_VIOLATION, PHARMACOVIGILANCE_BREACH, GMP_VIOLATION, and more.
Regulations: FDA 21-CFR Part 11, ICH-E6 (GCP), ICH-Q10 (GMP).
Hash Chain
Every breach record is SHA-256 checksummed. Each record includes the hash of the previous record, forming an immutable chain. No UPDATE or DELETE allowed.
{
"id": "br_00042",
"breach_type": "PII_EXPOSURE",
"severity": "CRITICAL",
"prev_hash": "a3f8c1d9...",
"record_hash": "7b2e4f8a...",
"timestamp": "2026-04-15T14:22:01Z"
}
Tamper detection runs automatically. If a single record is modified, the chain breaks and an alert is created.
Unified Dashboard
Access at http://localhost:8000/unified — a React SPA with 6 tabs. Auto-refreshes every 3 seconds.
| Tab | What It Shows |
|---|---|
| Overview | Total events, blocked/allowed, PII leaks, breaches, risk prompts, total cost, tokens, avg/p95 latency, model usage heatmaps |
| Live Events | Real-time SSE feed — click any event for full detail modal |
| Traces | LLM call traces grouped by trace_id — expandable span trees with per-span latency, tokens, cost, blocked status |
| Breach Monitor | Compliance breach log with severity badges — click for forensic detail |
| Block Rules | Active block rules with CLI management instructions |
| Settings | Configure breach-intel API connection (auto-configured by installer) |
Traces & Cost Tracking
The LLM proxy reports trace spans for every request. The dashboard's Traces tab shows expandable span trees with:
- Per-span latency (wall-clock round-trip)
- Input/output token counts
- Cost computed from the built-in 16-model pricing table
- Blocked status (if a block rule was triggered)
- Model and provider identification
REST API
Policy Engine (port 8000)
POST /prompt
Submit a prompt for 3-layer analysis. Returns risk score, category, and block decision.
POST /check
Quick check for block rules and pattern matching.
POST /llm-input
Pre-LLM-call analysis. Can block the LLM call entirely.
POST /llm-output
Post-LLM-call DLP scan and breach detection.
POST /trace
Submit a trace span (from LLM proxy or auto-instrumentation).
GET /traces
List trace spans, grouped by trace_id.
GET /events
SSE stream of real-time security events.
GET /unified
Serves the unified dashboard SPA.
Breach Intel (port 8081)
POST /events
Submit an agent event for breach classification.
GET /breaches
List breach records. Supports filtering by agent, severity, type, and date range.
GET /agents
List registered agents with framework info and breach counts.
GET /health
Server health check.
CLI Reference
| Command | Description |
|---|---|
| python -m sentinel watch [--api] [--proxy] | Monitors + API + LLM proxy |
| python -m sentinel api [--port 8000] | Policy engine + dashboard |
| python -m sentinel breach [--port 8081] | Breach compliance server |
| python -m sentinel proxy | LLM response proxy |
| python -m sentinel status | Check threats + privilege level |
| python -m sentinel scan <path> | Scan directory for secrets/PII |
| python -m sentinel intercept --source websocket|hook|pipe | Event interception |
| python -m sentinel rules --list | View block rules |
| python -m sentinel rules --add | Add block rule |
| python -m sentinel install --hook|--plugin|--proxy-config | OpenClaw integration |
| python -m sentinel.breach_intel.sdk.cli doctor | Diagnose setup |
| python -m sentinel.breach_intel.sdk.cli status | Check server health |
| python -m sentinel.breach_intel.sdk.cli install-hook | Install persistent hook |
| python -m sentinel.breach_intel.sdk.cli uninstall-hook | Remove hook |
| python -m sentinel.breach_intel.sdk.cli run python agent.py | One-shot monitoring |
Environment Variables
These are set automatically by the installer. Manual configuration is only needed for advanced use.
| Variable | Description |
|---|---|
| BREACH_INTEL_URL | Breach Intel server URL (default: http://localhost:8081) |
| BREACH_INTEL_TOKEN | Agent-scoped API key for authentication |
| SENTINEL_API_PORT | Policy engine port (default: 8000) |
| SENTINEL_PROXY_PORT | LLM proxy port (default: 18790) |
~/.breach-intel/.env and injected into your shell profile by the installer.Container Security
Sentinel includes a hardened Docker setup:
- Non-root user, read-only rootfs
cap_drop: ALL,no-new-privileges- Custom seccomp profile blocking ptrace, mount, bpf, kexec_load
- 9-point verification script