> ## Documentation Index
> Fetch the complete documentation index at: https://evalvcr.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Scorers & Security Guards

> 14 atomic scorers (13 deterministic + cached llmJudge) and SARIF security guards in @evalvcr/scorers.

Install `@evalvcr/scorers` alongside `evalvcr`:

```bash theme={null}
npm install -D @evalvcr/scorers
```

## Functional, Tool & Budget Scorers

| Scorer | Purpose |
| :- | :- |
| `exactMatch` | Exact normalized string/value equality against `expected` |
| `contains` | Substring or array inclusion check |
| `jsonSchema` | Lightweight deterministic JSON Schema validation (types, required fields, enums, properties) |
| `toolCallAccuracy` | Precision/recall/argument matching for expected tool calls |
| `toolCallOrder` | Strict or subsequence tool-call ordering verification |
| `latencyBudget` | Enforces `durationMs` budget thresholds |
| `tokenCostBudget` | Enforces `usage.totalTokens` and `usage.costUsd` budgets |
| `levenshteinSimilarity` | Normalized edit-distance similarity (`0..1`) |
| `llmJudge` | SHA-256 cached wrapper around a caller-supplied `judgeFn` |

## Deterministic Security & Integrity Guards

All 5 security/integrity guards emit `SecurityFindingV1` objects with scrubbed `evidence`, actionable `remediation`, and support optional `{ severity?: "error" | "warning" | "info" }` overrides:

| Scorer | `ruleId` | Default Severity | Detects |
| :- | :- | :- | :- |
| `piiLeakGuard` | `evalvcr/pii-leak` | `error` | US SSNs, Luhn-valid cards, emails |
| `promptInjectionGuard` | `evalvcr/prompt-injection` | `warning` | Instruction override / jailbreak phrases |
| `sqlDestructiveGuard` | `evalvcr/sql-destructive` | `error` | `DROP TABLE`, `TRUNCATE`, `DELETE` without `WHERE` |
| `secretLeakGuard` | `evalvcr/secret-leak` | `error` | API keys, Bearer tokens, PEM blocks, DB credentials |
| `testIntegrityGuard` | `evalvcr/test-integrity` | `error` | Disabled/skipped assertions or tampered test signals |

## Custom Scorers

Use `createScorer` from `evalvcr/scorer` to build a focused deterministic scorer:

```ts theme={null}
import { createScorer } from "evalvcr/scorer";

export const nonEmpty = () =>
  createScorer({
    name: "nonEmpty",
    scorer: ({ output }) => (String(output ?? "").trim().length > 0 ? 1 : 0),
  });
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.