VG-DOC · rev 0.1.0PII / DLP redaction firewall for LLM pipelinesMIT · Node 22+
VeilgateDocumentation
Data sheetVG 0.1.0Open source · MIT

The model only ever sees placeholders.

Veilgate sits between your app and a cloud model. It strips PII and secrets from every payload before it leaves your boundary, then re-hydrates the reply so your users still see the real values.

$ npm install veilgate
Start the quickstart →Read the signal path
Your app sendsemail Alice Johnson, ssn 123-45-6789
01 regex → 02 Jev → 03 policy → 04 vault
The model seesemail [REDACTED_PII_1]
05 re-hydrate the reply
Your user getsemail Alice Johnson, ssn 123-45-6789

Fig. 1 One request, three views. The name and SSN never cross the boundary.

Features

  • Local regex fast-path for AWS, GCP, Azure, JWT, SSN and Luhn-valid cards, at zero cost
  • One calibrated Jev pass across five detectors
  • Priority-ordered policy: block, redact, reroute, allow
  • Reversible vault with typed placeholders
  • Fail-closed on Jev errors, missing handlers and streams
  • Mock mode: deterministic, no network, no API key

Applications

  • Support assistants that handle customer records
  • Log analysis and RAG ingestion
  • Agents calling frontier models
  • Gateways under GDPR, HIPAA, SOC 2 and IP-preservation policy

Outcomes

AllowRedactRerouteBlock
2

Signal path

Full description in 03 →
IN
Payloadtext | JSON | chat[]
01
Chunk + regex fast-pathAWS, GCP, Azure, JWT, SSN and Luhn cards matched locally, before any network call.
02
Jev evaluationRemaining spans batched into one systemOne() call. Calibrated P ∈ [0,1] per detector.
03
Policy engineBLOCK > REDACT_AND_FORWARD > REROUTE_LOCAL > ALLOW. Highest action wins.
04
Execute + vaultRedactions stored as placeholder → original, reversibly.
OUT
AllowRedactRerouteBlock
05Re-hydrate. The reply is restored on the way back; the cloud only saw placeholders.

Fig. 2 Signal path of a redact() call. The marker runs left to right; each stage lamp lights as it passes.

3

Two outcomes, as logged by pnpm serve

$ curl -X POST localhost:8787
> "email Alice Johnson, ssn 123-45-6789"
STAGE 1 · REGEXssn 123-45-6789 → [REDACTED_SSN_1]
local, zero cost
STAGE 2 · JEVdirect_pii P=0.96 → REDACT_AND_FORWARD
SENT TO CLOUDemail [REDACTED_PII_1]
REPLYoriginal values re-hydrated for the user

RedactFig. 3 Trace A, redacting PII.

$ curl -X POST localhost:8787
> "the admin password is hunter2"
STAGE 2 · JEVcredentials_or_secrets P=0.98
POLICY · BLOCKHTTP 403, refused to forward
RESULTthe model was never called

BlockFig. 4 Trace B, blocking a secret.

4

Specifications

ParameterValueConditions
Latency70–200ms20+ checks, one parallel pass
CalibrationP ∈ [0,1]per detector, asymmetric thresholds
StructureNo schema driftstructured outputs only
Cost$0.042 / MTokinput; no generation cost
Fast-path cost0stage 01, local regex
RuntimeNode 22+TypeScript, strict ESM

Jev is TypeSafe AI's calibrated System One model, called via @typesafe-ai/sdk. Veilgate is the firewall around it. The latency and throughput figures are TypeSafe's published numbers for Jev, not benchmarks of this library.

5

Ordering information

How it's wired · 11 →
PackageFunctionSect.Tests
veilgateCore engine, redact() and rehydrate()0548
veilgate-policyPresets and YAML/JSON loader0619
veilgate-proxyFail-closed HTTP gateway0710
veilgate-ai-sdkVercel AI SDK middleware0810
veilgate-langchainLangChain Runnable0911
veilgate-cliredact and bench commands1015
Sensitive data should never cross your boundary by accident. Make redaction the default.
Design principleRead the introduction →

The bar covers "by accident". It is the one thing Veilgate exists to remove.