sva-gate
by eyeoverthink
README.md
# `@eyeoverthink/sva-gate` (`v1.0.0`)
[](https://github.com/eyeoverthink/sva-gate/actions/workflows/ci.yml)
[](LICENSE)
**Zero-dependency 3-layer verification SDK, CLI, and stdio MCP server for AI agents.**
Unifies the proven standards from [`eyeoverthink/sva-standard`](https://github.com/eyeoverthink/sva-standard) (`v1.7.0`, 106/106 tri-runtime conformance) and [`eyeoverthink/logic-chain-judge`](https://github.com/eyeoverthink/logic-chain-judge) (`v1.0.0`, 321 tests) into **one installable package** with **zero external runtime dependencies** (Node 22+ ESM with TypeScript `.d.ts` definitions + pure Python 3.10+ stdlib companion in `python/`).
---
## 1. Drop Into Claude Code / Cursor / Codex / Any MCP Client (4 Lines)
```json
{
"mcpServers": {
"sva-gate": {
"command": "npx",
"args": ["-y", "@eyeoverthink/sva-gate", "mcp"]
}
}
}
```
Gives any agent **6 deterministic verification tools** over stdio JSON-RPC 2.0:
| MCP Tool | Layer | What It Enforces |
| --- | --- | --- |
| `sva_seal_text` | Layer 2 (`EMA/1`) | Seals PII/secrets (emails, SSNs, API keys, phones) into typed placeholders + `StreamSealGuard` cross-token split-secret sealing + zero-width prompt-injection scan |
| `sva_mint_receipt` | Layer 1 (`SVA-ER/1`) | Mints an Ed25519-signed, RFC 6962 `0x00`/`0x01` Merkle-proven receipt + matching `OPEG/1` `S4_COMMIT` envelope |
| `sva_verify_receipt` | Layer 1 (`SVA-ER/1` + `AER-1`) | Verifies **`SVA-ER/1`** receipts AND **IETF `draft-zambo-aer1-26` (`AER-1` v0.4)** receipts offline |
| `sva_opeg_check` | Layer 2 (`OPEG/1`) | Fail-closed pre-commit gate: blocks `DIRECT_INFERENCE`, tampered `R_san` digests, and invalid receipts (`sva-er/1` or `aer-1`) |
| `sva_judge_audit` | Layer 3 (`SVA-JEV/1`) | Calibrated epistemic judge gates: Wilson 95% CI > 2/3, author self-vote exclusion, mandatory verbatim `>= 12`-char quotes, hidden planted-fake traps, and zero-LLM `new_terms` invention scanner |
| `sva_crystallize_skill` | Layer 1 (`VSC/1`) | Zero-LLM deterministic parameter binder induction with leave-one-out verification and novel-wording near-miss rejection |
---
## 2. CLI Quick Start (10-Second Offline Self-Test)
```bash
# Run built-in 3-layer verification (receipts + OPEG tamper block + StreamSealGuard + SVA-JEV/1 + skill crystallizer)
npx @eyeoverthink/sva-gate self-test
# Seal secrets & scan for prompt injection
npx @eyeoverthink/sva-gate seal "Patient SSN 123-45-6789 key sk-ant-api03-abcdefghijklmnop1234567890"
# Demo cross-token split-secret streaming redaction
npx @eyeoverthink/sva-gate stream-demo
# Mint a signed SVA-ER/1 receipt + OPEG/1 envelope
npx @eyeoverthink/sva-gate mint '{"answer":42,"unit":"ms"}'
# Verify an SVA-ER/1 OR IETF AER-1 v0.4 receipt offline
npx @eyeoverthink/sva-gate verify receipt.json [deliverable.json]
# Evaluate an OPEG/1 gate or SVA-JEV/1 judge envelope fail-closed
npx @eyeoverthink/sva-gate gate opeg-envelope.json
npx @eyeoverthink/sva-gate judge jev-envelope.json
```
---
## 3. JS / TypeScript SDK (`0` Dependencies)
```js
import {
mintSvaEr1,
verifyAnyReceipt,
evaluateOpeg1,
evaluateSvaJev1,
StreamSealGuard,
JEV_SEMANTICS,
} from '@eyeoverthink/sva-gate';
// 1. Mint & verify an SVA-ER/1 receipt + OPEG/1 S4_COMMIT envelope
const { receipt, deliverable, opegEnvelope } = mintSvaEr1({ rSan: { ok: true, value: 42 } });
console.log(verifyAnyReceipt(receipt, { deliverable })); // { format: 'sva-er/1', ok: true, outcome: 'verified', ... }
console.log(evaluateOpeg1(opegEnvelope)); // { ok: true, gate: 'pass', ... }
// 2. Seal split-token API keys across streaming chunks
const sg = new StreamSealGuard();
const safe = ['Key sk-', 'ant-api03-abcdefghijklmnop1234567890 ok'].map((c) => sg.push(c)).join('') + sg.flush();
// 3. Enforce SVA-JEV/1 epistemic judge gates
const verdict = evaluateSvaJev1({
spec: 'sva-jev/1',
semantics: JEV_SEMANTICS,
mode: 'claim_trace',
ledgerTexts: ['[stage 1] Enforce 80% quorum via verify_run.'],
briefText: 'Enforce 80% quorum with 9999 retries via invented_helper_v2.',
plantedFakes: [{ id: 'fake-1', verdict: 'unsupported' }],
});
// -> { ok: false, newTerms: ['9999', 'invented_helper_v2'], ... }
```
---
## 4. Pure Python 3.10+ Companion (`python/`)
Zero `pip` dependencies (standard library only):
```bash
pip install ./python
python -m unittest discover -s python/tests -v
```
```python
from sva_gate import JEV_SEMANTICS, evaluate_sva_jev1
res = evaluate_sva_jev1({
"spec": "sva-jev/1",
"semantics": JEV_SEMANTICS,
"mode": "calibration",
"answered": 36, "total": 36, "right": 33, "realFound": 12, "realTotal": 12,
})
```
---
## Honest Limits
- **Signatures prove post-signing integrity and key possession**, not that a compromised host didn't fabricate data prior to signing. Local unsynced clocks are explicitly labeled `unattested`.
- **`SVA-JEV/1` verdicts are stamped `stability-signal-not-correctness`** — multi-model consensus is never proof of truth.
- **Deterministic `new_terms` catches invented numbers and code identifiers**, not subtle semantic paraphrasing.
## Related Repositories & Live Offline Playgrounds
- **Open Standards & 5 Zero-Backend Browser Labs:** https://eyeoverthink.github.io/sva-standard/ (`eyeoverthink/sva-standard`)
- **Calibrated Epistemic Judge Pipeline:** https://github.com/eyeoverthink/logic-chain-judge
## License
Apache-2.0 — see [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues