Risk Engine
The Risk Engine produces a numerical score (0.0 to 1.0) and a categorical risk level for every memory operation. This assessment is computed before the Policy Engine runs, so policy rules can branch onrisk_score and risk_level.
The current scorer is memproof-baseline-v1.
Risk Factors
Each operation is evaluated across up to five factors. Every factor produces acontribution value between 0.0 and 1.0.
Operation Type
Different operation types carry different inherent risk. Read operations are low-risk; destructive operations are higher.
| Operation | Contribution |
|---|---|
get | 0.05 |
search | 0.05 |
remember | 0.30 |
update | 0.40 |
forget | 0.50 |
PII Detection
Content is scanned against regex patterns for personally identifiable information. If PII is detected, a factor with contribution 0.60 is added.Detected patterns include: Social Security numbers, email addresses, credit card numbers, and phone numbers.
Secrets Detection
Content is scanned for embedded credentials and secrets. If a secret is detected, a factor with contribution 0.70 is added.Detected patterns include: API key assignments, bearer tokens, and keys matching the
sk- prefix pattern.Source Trust
The
context.source field is compared against a set of trusted sources: langgraph, openai_sessions, and mcp.| Source | Contribution |
|---|---|
| Trusted (known adapter) | 0.05 |
| Untrusted (custom/unknown) | 0.40 |
Scoring Formula
The final score is computed in two steps: Step 1: Weighted averageThe floor boost is a deliberate design choice. A memory operation that contains an API key should never score “low risk” just because all other factors are clean.
Worked Example
Consider aremember operation from a trusted source (langgraph) that contains an email address:
| Factor | Contribution |
|---|---|
| operation_type (remember) | 0.30 |
| content_pii (email) | 0.60 |
| source_trust (trusted) | 0.05 |
Risk Levels
The score maps to one of four risk levels using configurable thresholds:| Level | Score Range | Default Threshold |
|---|---|---|
low | 0.00 — 0.30 | low_max: 0.30 |
medium | 0.31 — 0.60 | medium_max: 0.60 |
high | 0.61 — 0.80 | high_max: 0.80 |
critical | 0.81 — 1.00 | critical_max: 1.00 |
risk_thresholds:
Content Flags
In addition to the scored risk assessment, the Risk Engine produces boolean content flags that are passed to the Policy Engine as condition fields:content.contains_pii and content.contains_secret fields available in policy rule conditions.
How Risk Feeds Into Policy
TheRiskAssessment and content flags are passed to the Policy Engine as part of the evaluation context. Policy rules can use any combination of risk data:
RiskAssessment Model
Every operation response includes the full risk assessment:RiskFactor in the factors list includes:
| Field | Type | Description |
|---|---|---|
name | string | Factor identifier (e.g., operation_type, content_pii) |
contribution | float | Score contribution, 0.0 to 1.0 |
description | string | Human-readable explanation |
evidence | string or null | Specific pattern matched (e.g., “Email address”) |