Loading...
PRIVATE.ME Docs
Explore ACIs
PRIVATE.ME PLATFORM

Redact: PII Redaction Engine

Four-layer pipeline that progressively strips personally identifiable information from text before it reaches any external service. L1 regex with checksum validation. L2 schema-aware field matching. L3 named entity recognition. L4 optional LLM for ambiguous cases. Deterministic placeholders enable reinjection after the LLM responds — the user never sees redacted output. macro-F1 0.94 across 40+ entity types.

AI / ML AVAILABLE NOW 505 Tests @private.me/redact PLATFORM ACI
NOW AVAILABLE
@private.me/redact is built and tested. 505 tests across multiple test files — all passing. Four detection layers (regex, schema, NER, optional LLM), deterministic entity maps with placeholder reinjection, numeric confidence scoring, configurable thresholds, and 40+ PII entity types including SSN checksum validation, Luhn credit card verification, and 11 international phone formats.

Enterprise toolkit shipped: @private.me/redact-cli — self-hosted redaction server on port 3200, 3-role RBAC, batch processing, pattern management, Docker deployment. Part of the Enterprise CLI Suite — 21 self-hosted servers, Docker-ready, air-gapped capable.
Section 01

The Problem: PII Leaks in the AI Pipeline

Every LLM API call sends the full prompt to remote servers. If the prompt contains a patient name, social security number, credit card, or email address, that PII is now stored on third-party infrastructure. This violates HIPAA, GDPR, CCPA, and internal data governance policies.

Organizations face an impossible choice: use AI and leak PII, or protect PII and forfeit AI. Existing redaction tools force this tradeoff by offering detection without reinjection — the LLM response arrives with placeholder tokens the end user cannot understand. The sanitized text cannot be restored to its original form without manual effort.

Regex-only tools miss context-dependent entities: names in non-standard formats, international phone numbers, PII embedded in JSON payloads. Cloud-based redaction services like AWS Comprehend and Google DLP solve some detection problems but create new ones — the PII must leave the network to be detected, which is the exact problem you are trying to solve.

Competitive Failure Table

ToolPII TypesReinjectionConfidence ScoresLocal Processing
Presidio (Microsoft)50+NoPartialYes
AWS Comprehend~30NoYesNo (cloud)
Google DLP120+NoPartialNo (cloud)
spaCy NER~18NoNoYes
Redact (PRIVATE.ME)40+YesYesYes

No existing tool combines local processing, numeric confidence scoring, broad entity coverage, and deterministic reinjection. Redact is the first pipeline designed for the LLM-era workflow: strip, send, reinject.

The Old Way

Prompt contains PII SSN, names, CC Cloud LLM SEES ALL PII logs prompts HIPAA violation PII Exposed regulatory risk
Section 02

The Solution: Strip, Send, Reinject

Redact is a four-layer pipeline that progressively detects PII with increasing sophistication. Entities are replaced with deterministic placeholders. After the LLM responds, entities are reinjected to restore the original context — transparently to the end user.

Layer 1 — Regex: High-precision patterns for structured PII. SSN with area/group checksum validation. Credit cards with Luhn algorithm verification. Email addresses, 11 international phone formats, dates, IP addresses. Zero false positives on well-structured data. Sub-millisecond latency.

Layer 2 — Schema: Context-aware matching using JSON field names, CSV column headers, and document structure. Detects PII that regex misses — a field named "patient_ssn" containing a value without dashes, or a "dob" column with non-standard date formats.

Layer 3 — NER: Named entity recognition via compromise.js for person names, organizations, locations, and titles. Lazy-loaded on first invocation (~200ms), cached for subsequent calls. Catches context-dependent entities that neither regex nor schema patterns can detect.

Layer 4 — LLM (optional): Ollama-based local LLM for ambiguous cases. Activated only when confidence scores from L1-L3 fall below configurable thresholds. Entirely optional — L1-L3 cover 95%+ of PII patterns without any external model dependency.

The New Way

Prompt with PII Redact L1-L4 pipeline Clean no PII LLM safe call Reinject entity map restore PII [PERSON_1] ↔ John Smith · [SSN_1] ↔ 123-45-6789
Section 03

Architecture: Four-Layer Pipeline

Four detection layers execute in sequence. Each layer catches progressively harder entities. Confidence scores aggregate across layers. Deterministic entity maps enable bidirectional replacement.

L1 Regex SSN, CC, email, phone checksum + Luhn L2 Schema JSON fields, CSV headers context-aware L3 NER compromise.js lazy-loaded ~200ms L4 LLM optional Ollama local sidecar Entity Map (deterministic placeholder ↔ original value) [PERSON_1] → John Smith · [SSN_1] → 123-45-6789 · [EMAIL_1] → john@example.com Confidence Scoring 0.0 — 1.0 per entity · configurable threshold Reinjection Engine restore originals in LLM response · bidirectional 505 tests · macro-F1 0.94 · 40+ entity types · 11 international formats
Key Architecture Properties
Sequential pipeline: L1 runs first, L2 operates on unmatched spans, L3 operates on remaining unmatched spans, L4 activates only for low-confidence residuals. No redundant processing.
Deterministic placeholders: Same entity always maps to the same placeholder. [PERSON_1] is always the first detected person name. Consistent across calls for the same input.
Bidirectional entity map: The entity map is returned alongside the redacted text. Pass both to the reinject function after the LLM responds. The user never sees placeholders.
Configurable thresholds: Per-entity-type confidence thresholds. High precision for SSNs (0.99), lower threshold for names (0.7). Tune per use case.
Section 04

Deep Dive: Layer Analysis

Each layer is purpose-built for a specific class of PII detection. Together they cover 40+ entity types from structured identifiers to context-dependent names.

L1: Regex Engine

L1 handles structured, well-defined PII patterns with deterministic detection. Each pattern includes validation beyond simple matching.

SSN detection: Matches XXX-XX-XXXX format with area number validation (no 000, 666, or 900-999 area groups), group number validation (no 00), and serial number validation (no 0000). This eliminates false positives from random 9-digit sequences that happen to contain dashes.

Credit card detection: Matches 13-19 digit sequences with Luhn checksum verification. Covers Visa (4xxx), Mastercard (5xxx/2xxx), Amex (34xx/37xx), Discover (6011/65xx), and Diners Club. The Luhn check reduces false positives by 99%+ compared to digit-only matching.

Phone number detection: Eleven international formats: US (+1, parenthetical, dash, dot), UK (+44), Germany (+49), France (+33), Japan (+81), China (+86), India (+91), Brazil (+55), Australia (+61), Mexico (+52), South Korea (+82). Each format includes country-specific digit grouping validation.

Other L1 patterns: Email addresses (RFC 5322 subset), IPv4 and IPv6 addresses, dates (ISO 8601, US, EU formats), US zip codes (5-digit and ZIP+4), passport numbers (US format), IBAN (2-letter country + check digits + BBAN).

L1 confidence: 0.95-1.0 for checksum-validated matches. Sub-millisecond per document.

L2: Schema-Aware Matching

L2 uses structural context to detect PII that regex alone would miss. When the input is JSON, L2 examines field names; when the input contains labeled data, L2 uses the labels as classification hints.

JSON field matching: Fields named ssn, social_security, patient_id, credit_card, dob, date_of_birth, phone, mobile, email, address, zip, or variations. Values in these fields are classified as the corresponding entity type regardless of format.

CSV/TSV header matching: Column headers map to entity types. A column named "Patient Name" causes all values in that column to be classified as person names. Handles common header aliases and abbreviations.

Label proximity: Inline labels followed by values — "Name: John Smith", "SSN: 123456789" (no dashes), "DOB: Jan 15 1990". The label provides the classification that regex alone cannot.

L2 confidence: 0.80-0.95 depending on label specificity. Negligible additional latency.

L3: Named Entity Recognition

L3 uses compromise.js — a lightweight NLP library — for named entity recognition. It detects person names, organizations, locations, and titles that have no structural markers.

Lazy loading: The NER model loads on first invocation (~200ms) and stays cached for subsequent calls. This avoids startup overhead when L1-L2 are sufficient.

Entity types: Person names (first, last, full), organizations, geographic locations (cities, countries, regions), honorifics and titles. Handles compound names, hyphenated surnames, and common name formats.

Disambiguation: "Washington" could be a person, city, or state. L3 uses sentence context to disambiguate. When context is insufficient, the entity is tagged with both possible types and the higher-confidence interpretation is used.

L3 confidence: 0.65-0.90. Runs only on text spans not already matched by L1-L2.

L4: LLM Layer (Optional)

L4 sends remaining unclassified text spans to a local Ollama instance for LLM-based PII detection. This catches entities that all previous layers missed — nicknames, code names, indirect identifiers ("the patient from room 302").

Activation: Only for spans where L1-L3 produced confidence below the configured threshold. In practice, L4 activates for less than 5% of typical documents.

Local-only: Ollama runs as a local sidecar. No data leaves the machine. The LLM itself never sees the original PII that L1-L3 already detected — it only sees unmatched residual text.

Entirely optional: L1-L3 achieve macro-F1 0.94 without L4. The LLM layer is available for organizations that need maximum recall on ambiguous content, but the pipeline works fully without it.

L4 confidence: 0.50-0.85. Latency depends on model size (~100ms-1s per span).

Section 05

Benchmarks

Measured against real-world PII patterns. L1-L3 processing completes in under 5ms per document for typical payloads. Reinjection is instantaneous.

0.94
macro-F1 score
<1ms
L1 latency/doc
~200ms
L3 NER load (once)
505
test cases

Performance Comparison

MetricPresidioAWS ComprehendspaCy NERRedact
F1 Score~0.85~0.90~0.820.94
Latency (per doc)~50ms~200ms (network)~30ms<5ms (L1-L3)
ReinjectionManualNot supportedNot supportedBuilt-in
Offline capableYesNoYesYes
Checksum validationPartialNoNoSSN + Luhn
Schema awarenessNoNoNoL2 JSON/CSV
Confidence scoringPartialYesNoPer-entity numeric
Benchmark Methodology
All benchmarks run on a single-threaded Node.js process. Latency measured as P50 over 1,000 iterations with warm caches. F1 scores measured against a synthetic corpus of 2,000 documents containing 40+ entity types across medical, financial, legal, and general business domains. No cherry-picked samples.
Section 06

ACI Surface

Four core functions. Import, call, and compose with any ACI in the platform.

redact(text: string, config?: RedactConfig): Promise<RedactResult>
Detect and replace PII entities with deterministic placeholders. Returns cleaned text, entity map for reinjection, and per-entity confidence scores. Configure which layers to run, confidence thresholds, and entity type allowlists/blocklists.
reinject(text: string, entities: EntityMap): string
Restore original PII values in the LLM response using the entity map from redact(). Deterministic replacement ensures correct bidirectional mapping. Call this after receiving the LLM response to produce user-facing output with original names, numbers, and identifiers.
detectEntities(text: string, config?: DetectConfig): Promise<Entity[]>
Detect PII entities without replacing them. Returns an array of detected entities with type, span (start/end offsets), original value, and confidence score. Useful for audit, analysis, and building custom redaction logic on top of the detection engine.
createEntityMap(): EntityMap
Create a fresh, empty entity map. Useful for building custom redaction flows where you need manual control over placeholder assignment. The entity map maintains deterministic ordering — the first person detected is always [PERSON_1].
Usage Example
import { redact, reinject } from '@private.me/redact';

// Redact PII from a prompt
const result = await redact(
  'Patient John Smith SSN 123-45-6789 needs refill',
  { layers: ['regex', 'schema', 'ner'], threshold: 0.7 }
);
// result.text: "Patient [PERSON_1] SSN [SSN_1] needs refill"
// result.entities: Map { "[PERSON_1]" => "John Smith", "[SSN_1]" => "123-45-6789" }
// result.scores: Map { "[PERSON_1]" => 0.88, "[SSN_1]" => 0.99 }

// Send clean text to any LLM
const llmResponse = await llm.complete(result.text);

// Reinject originals in the response
const final = reinject(llmResponse, result.entities);
// User sees real names and numbers โ€” never sees placeholders
Section 07

Use Cases

Redact protects PII across every industry that uses AI on sensitive data.

AI / ML
LLM Prompt Sanitization

Strip PII from prompts before sending to any LLM API — OpenAI, Anthropic, Google, or self-hosted. Reinject entities in the response. Use any cloud AI safely without leaking personal data.

L1-L4 Pipeline
Healthcare
HIPAA-Compliant AI Usage

Remove patient names, SSNs, medical record numbers, and dates of birth before AI analysis. L1-L3 detects all 18 HIPAA Safe Harbor identifiers. Compliant de-identification without expert review.

HIPAA Safe Harbor
Privacy
GDPR Data Minimization

Minimize personal data sent to third-party services per GDPR Article 5(1)(c). Strip PII before data transfer, analytics processing, or cross-border transmission. Automated enforcement of data minimization principles.

GDPR Art 5
Finance
Financial Data Redaction

Redact credit card numbers with Luhn validation, bank account numbers, routing numbers, and financial identifiers before processing. PCI DSS Requirement 3 compatible cardholder data masking.

PCI DSS Req 3
AI Models (Anti-Piracy)
Protected Model Inference

Redact proprietary model weights and training data signatures from inference outputs to prevent model extraction attacks. L4 semantic analysis detects output patterns that leak model architecture. IP protection for vendors shipping model APIs without exposing the underlying model.

Model Protection
Section 08

Regulatory Compliance

Redact maps directly to specific regulatory requirements. Each regulation mandates PII protection — Redact provides the technical enforcement layer.

RegulationRequirementRedact Capability
HIPAA Safe HarborDe-identify 18 PHI types (names, dates, SSN, MRN, geographic data, phone, fax, email, etc.)L1-L3 detects all 18 identifier categories. Automated de-identification without expert determination.
GDPR Art 5(1)(c)Data minimization — collect/process only what is necessaryStrip PII before third-party transfer. Configurable entity types per processing purpose.
CCPA §1798.100Consumer data protection — right to know, right to deleteAutomated PII detection for data inventory. Entity maps enable targeted deletion.
PCI DSS Req 3Protect stored cardholder data — mask PAN, do not store CVVL1 Luhn-validated credit card detection. Automatic masking before storage or transmission.
FERPAProtect student education records and PIIL2 schema matching detects student IDs, grades, and enrollment data in structured records.
SOX §302Protect financial reporting data integrityRedact financial identifiers before external analysis. Audit trail via entity maps.
Local Processing = No Additional Data Transfer
Because Redact runs entirely locally (L1-L3), PII never leaves the machine for the purpose of detection. Cloud-based redaction tools like AWS Comprehend or Google DLP require sending PII to their servers first — which creates the exact data transfer that the regulation is trying to prevent. Redact eliminates this circular dependency.
Section 09

Cross-ACI Composition

Redact integrates with other PRIVATE.ME ACIs to create end-to-end data protection pipelines. Each composition multiplies the security guarantees.

xLink + Redact
Sanitize M2M payloads before transmission. When two services communicate via xLink (encrypted agent-to-agent channels), Redact strips PII from payloads before they enter the transport layer. Even if a share is compromised, the payload contains no PII. Defense in depth: threshold encryption protects the message, redaction protects the content within the message.
xFuse + Redact
Identity-verified redaction pipelines. xFuse threshold identity fusion verifies the identity of the entity requesting redaction before the pipeline executes. Only authenticated, authorized agents can invoke the redaction engine. The 5-step xFuse pipeline (verify, validate, evaluate, execute, log) wraps Redact calls with cryptographic accountability.
xCompute + Redact
MPC-verified redaction without data exposure. xCompute performs multi-party computation on XorIDA shares. Combined with Redact, organizations can verify that redaction was correctly applied to data without any single party seeing the original data. The redaction is proven correct via xCompute's threshold verification, not trusted.
xStore + Redact
Redact before split-storage. xStore distributes data across multiple storage backends using XorIDA threshold splitting. By running Redact before xStore, PII is stripped from the data before it is split and distributed. Even if all shares are reassembled by an unauthorized party, the reconstructed data contains no personal identifiers.
Section 10

Security Properties

Five core security guarantees. Each backed by a specific mechanism and verified by the test suite.

PropertyMechanismGuarantee
PII detection coverage4-layer pipeline (L1-L4)macro-F1 0.94 across 40+ entity types
SSN/CC detectionL1 regex + checksum/Luhn validationZero false negatives on valid format inputs
Name detectionL3 NER (compromise.js)Context-aware disambiguation
International support11 phone format patternsGlobal coverage (US, UK, DE, FR, JP, CN, IN, BR, AU, MX, KR)
Deterministic replacementEntity map with ordered placeholdersSame input always produces same placeholders
Reinjection integrityBidirectional entity mapEvery placeholder correctly maps back to its original value
Local processingL1-L3 run entirely in-processPII never leaves the machine for detection

Redact vs. Traditional Approaches

DimensionRegex-Only ToolsCloud Redaction (AWS/GCP)Redact
Detection depth1 layer (pattern match)ML models (cloud)4 layers (regex + schema + NER + LLM)
ReinjectionNot supportedNot supportedBuilt-in deterministic reinjection
Data residencyLocalSent to cloud providerLocal (L1-L3) + optional local LLM (L4)
Confidence scoringBinary match/no-matchProvider-dependentPer-entity numeric confidence 0.0-1.0
Schema awarenessNo contextNo contextJSON fields, CSV headers, label proximity
Offline capableYesNoYes (L1-L3 fully offline)
505
test cases
0.94
macro-F1
4
detection layers
40+
entity types
11
intl phone formats
VERIFIED BY XPROVE

Verifiable Data Protection

Every Redact operation produces a verifiable audit trail via xProve. HMAC-chained integrity proofs let auditors confirm that PII was detected, redacted, and reinjected correctly — without accessing the original data.

XPROVE AUDIT TRAIL
Every redaction operation generates HMAC-SHA256 integrity tags covering the input hash, entity map, redacted output, and configuration. xProve chains these into a tamper-evident audit trail that proves PII was correctly handled at every step. For regulated use cases (HIPAA audits, GDPR data subject requests, PCI DSS compliance reviews), this provides cryptographic proof of correct redaction without revealing the protected data. Upgrade to zero-knowledge proofs when regulators or counterparties need public verification.

Read the xProve white paper →
VERIFIABLE WITHOUT CODE EXPOSURE

Ship Proofs, Not Source

Redact generates cryptographic proofs of correct execution without exposing proprietary algorithms. Verify integrity using zero-knowledge proofs โ€” no source code required.

XPROVE CRYPTOGRAPHIC PROOF
Download proofs:

Verify proofs online โ†’

Use Cases

๐Ÿ›๏ธ
REGULATORY
FDA / SEC Submissions
Prove algorithm correctness for AI inference protection without exposing trade secrets or IP.
Zero IP Exposure
๐Ÿฆ
FINANCIAL
Audit Without Access
External auditors verify PII redaction + encryption without accessing source code or production systems.
FINRA / SOX Compliant
๐Ÿ›ก๏ธ
DEFENSE
Classified Verification
Security clearance holders verify AI inference protection correctness without clearance for source code.
CMMC / NIST Ready
๐Ÿข
ENTERPRISE
Procurement Due Diligence
Prove security + correctness during RFP evaluation without NDA or code escrow.
No NDA Required
Section 12

Honest Limitations

Honest engineering requires honest documentation. Four known limitations with their mitigations.

LimitationImpactMitigation
L4 requires Ollama No LLM-based detection layer without a local Ollama sidecar. Organizations that cannot run local models lose the L4 fallback for ambiguous entities. L1-L3 cover 95%+ of PII patterns. macro-F1 0.94 is achieved without L4. The LLM layer provides marginal recall improvement for edge cases only.
Non-English NER L3 NER (compromise.js) is optimized for English. Lower recall for non-Latin names, non-English organization names, and non-Western address formats. L1 regex works for all scripts (SSN, CC, email, phone patterns are language-independent). L2 schema matching is language-agnostic. Non-English NER is a targeted improvement area.
No image PII Cannot detect PII embedded in images, scanned documents, or screenshots. Only text input is processed. Pair with OCR preprocessing (Tesseract, AWS Textract output) to convert images to text first, then pipe through Redact.
Entity count scaling Documents with more than 1,000 detected entities per document may experience increased processing time as the entity map grows. Chunk documents larger than ~50KB into segments. Process each segment independently. Entity maps can be merged post-processing.
Section 13

Enterprise CLI

@private.me/redact-cli is a self-hosted PII redaction server — Docker-ready, air-gapped capable, with three-role RBAC, batch processing, custom pattern management, and append-only audit logging.

3200
Default port
3
RBAC roles
REST
API protocol
Docker
deployment

Key Endpoints

MethodPathPermissionDescription
GET/healthHealth check
POST/redactredact:executeRedact PII from text
POST/reinjectredact:executeReinject entities into response
POST/detectredact:detectDetect entities without redacting
POST/batchbatch:executeBatch redaction job
GET/batch/:idbatch:readGet batch job status
POST/patternspattern:createAdd custom regex pattern
GET/patternspattern:listList custom patterns
DELETE/patterns/:idpattern:deleteRemove custom pattern
GET/configconfig:readGet server configuration
PUT/configconfig:writeUpdate configuration
GET/auditaudit:readAudit log entries

RBAC Roles

Admin — full access: redaction, batch processing, pattern management, configuration, API keys, audit logs.
Operator — redaction execution, batch processing, pattern listing, configuration viewing.
Auditor — read-only: audit logs, configuration, pattern listing. Cannot execute redactions.

Air-Gapped Deployment
redact-cli runs entirely self-contained. No external network calls for L1-L3 detection. Custom patterns are stored locally in JSONL files. Audit logs are append-only and never leave the server. Deploy behind a firewall with zero outbound connectivity.
Docker Deployment
docker build -t redact-cli -f packages/redact-cli/Dockerfile .
docker run -d --name redact -p 3200:3200 \
  -v redact-data:/data \
  -e REDACT_ADMIN_KEY=your-secret-key \
  redact-cli
Section 14

Enhanced Identity with Xid

Redact can optionally integrate with Xid to enable unlinkable inference identity โ€” verifiable within each redaction context, but uncorrelatable across documents, tenants, or time.

Three Identity Modes

Basic (Default)
Static Model Operator DIDs
One DID per model operator, persistent across all inference requests and documents. Simple, but linkable โ€” same identity can be tracked across redaction jobs, tenants, and time.
Current Redact behavior
Redact+ (With Xid)
Ephemeral Per-Inference DIDs
Each redaction inference gets a unique operator DID derived from an XorIDA-split master seed. DIDs are unlinkable across documents and rotate per epoch. Verifiable within inference context, but cross-document correlation is impossible. ~50ยตs overhead per inference.
Unlinkable inference binding
Redact Enterprise
K-of-N High-Assurance Inference Binding
Require 3-of-5 signals (biometric + device TPM + location + time + YubiKey) to authorize redaction inference. IAL2/3 assurance levels for classified documents, PHI redaction, or legal privilege review. Continuous refresh ensures only authorized operators can process sensitive content.
IAL2/3 compliance

How Ephemeral Inference Identity Works

Redaction Workflow (Redact+ with Xid)
// Initialize Redact with Xid integration
import { RedactClient } from '@private.me/redact-cli';
import { XidClient } from '@private.me/xid';

const xid = new XidClient({ mode: 'ephemeral' });
const redact = new RedactClient({ identityProvider: xid });

// Each inference derives unlinkable DID automatically
const result = await redact.process({
  document: medicalRecord,
  policy: 'PHI'
});
  → [Redact] Deriving ephemeral operator DID from master seed...
  → [Redact] DID: did:key:z6MkJ... (unique to this inference + tenant + epoch)
  → [Redact] Ran inference with ephemeral identity (~50ยตs)
  → [Redact] Key purged (<1ms exposure)

// Inference is audited with unlinkable DID
// Verification works within document, but cross-document correlation fails
Integration Pattern
Redact+ is not a new ACI โ€” it's an integration of two existing ACIs (Redact + Xid). This demonstrates ACI composability โ€” building blocks combine to create enhanced capabilities without requiring new primitives.

See the Xid white paper for details on ephemeral identity primitives and K-of-N convergence.

Market Positioning

Industry Use Case Compliance Driver
Healthcare PHI redaction with HIPAA-compliant unlinkable inference logs HIPAA, 42 CFR Part 2, HITECH
Legal Attorney-client privilege redaction with unlinkable operators ABA Model Rules, work product doctrine
Government Classified document redaction with IAL3 operator identity FISMA, CJIS, FedRAMP, DoD IL5/6
Finance PII redaction with SOX-compliant audit trails SOX, GLBA, GDPR, SEC 17a-4

Key Benefits

  • Cross-document unlinkability โ€” Can't track operators across redaction jobs
  • Per-inference derivation โ€” Same operator has different DIDs per document
  • Epoch rotation โ€” DIDs automatically rotate daily/weekly/monthly
  • Split-protected derivation โ€” Master seed is XorIDA-split, never reconstructed
  • Privacy-preserving ML โ€” Inference identity without cross-context correlation
  • Multi-tenant isolation โ€” Customer unlinkability built into identity layer
Section 15

Get Started

Install Redact, strip PII from your first prompt, and reinject entities in the LLM response — all in a few lines of code.

Install
npm install @private.me/redact
Quick Start — Redact and Reinject
import { redact, reinject, detectEntities } from '@private.me/redact';

// 1. Redact PII from a prompt
const result = await redact(
  'Patient John Smith (SSN 123-45-6789) called from 415-555-0142.'
);
// result.text:
// "Patient [PERSON_1] (SSN [SSN_1]) called from [PHONE_1]."

// 2. Send clean text to any LLM API
const llmResponse = await llm.complete(result.text);
// LLM never sees John Smith, SSN, or phone number

// 3. Reinject originals into the LLM response
const userOutput = reinject(llmResponse, result.entities);
// User sees real names and numbers โ€” never placeholders

// 4. Detect without redacting (for audit/analysis)
const entities = await detectEntities(
  'Email: jane@example.com, Card: 4111-1111-1111-1111'
);
// [{ type: 'EMAIL', value: 'jane@example.com', confidence: 0.99, span: [7, 23] },
//  { type: 'CREDIT_CARD', value: '4111-1111-1111-1111', confidence: 1.0, span: [31, 50] }]
Advanced — Custom Configuration
const result = await redact(input, {
  layers: ['regex', 'schema', 'ner'],  // skip L4 LLM
  threshold: 0.7,                      // minimum confidence
  entityTypes: [                        // only these types
    'SSN', 'CREDIT_CARD', 'PERSON',
    'EMAIL', 'PHONE'
  ],
  thresholds: {                         // per-type overrides
    SSN: 0.99,
    PERSON: 0.7,
    PHONE: 0.85,
  }
});
GET STARTED

Ready to deploy Redact?

Talk to Sol, our AI platform engineer, or book a live demo with our team.

Book a Demo