Skip to content

Commit 8d606ba

Browse files
committed
phase 5
1 parent 60b26b5 commit 8d606ba

43 files changed

Lines changed: 3561 additions & 15 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,45 @@ NanoMask now includes packaged integration recipes under `examples/integrations/
177177

178178
The sidecar, gateway, and LiteLLM recipes each include smoke-test commands plus operator notes for auth, TLS, streaming, and health checks. The OpenAI-compatible kit includes reusable client environment settings and streaming client samples.
179179

180+
### SDK Wrappers
181+
182+
Phase 5 adds lightweight SDK wrappers under `sdk/` so teams can point official OpenAI clients at NanoMask without hand-assembling `base_url` and entity headers every time.
183+
184+
- `sdk/python`: installable `nanomask-openai` package, imported as `nanomask`
185+
- `sdk/node`: installable `@nanomask/openai` package
186+
- both packages default the client endpoint to `http://127.0.0.1:8081/v1`
187+
- both packages expose `verify()` helpers for CI and readiness checks
188+
189+
Quick local install:
190+
191+
```bash
192+
pip install ./sdk/python
193+
npm install openai ./sdk/node
194+
```
195+
196+
See `sdk/README.md` plus each package README for examples.
197+
198+
### Buyer Evaluation Kit
199+
200+
Phase 5 also packages the buyer-facing evaluation assets:
201+
202+
- `evaluation/README.md`: evaluation kit entry point
203+
- `evaluation/report-only-workflow.md`: first-pass rollout workflow
204+
- `evaluation/benchmark-card.md`: short proof artifact
205+
- `evaluation/pilot-runbook.md`: pilot onboarding flow
206+
- `evaluation/pilot-success-criteria.md`: scorecard template
207+
- `docs/commercial_offers.md`: pilot, sidecar, and gateway offer ladder
208+
- `site/index.html`: single-page landing site with positioning, quick start, and competitor framing
209+
180210
### Supported Features
181211

182212
Core redaction and restore surface:
183213
- SSN redaction is always available for supported text and JSON bodies.
184214
- Entity masking and response unmasking can be driven from `--entity-file` / `NANOMASK_ENTITY_FILE` or per-request `X-ZPG-Entities`.
185215
- Fuzzy matching targets OCR-style name drift in text that has already been extracted into the HTTP payload.
186-
- Optional pattern-library flags expose built-in redactors for email, phone, credit card, IP address, and healthcare identifiers.
216+
- Optional pattern-library flags expose built-in redactors for email, phone, credit card, IP address, healthcare identifiers, IBANs, UK National Insurance numbers, passport values, and common international phone formats.
187217
- Optional schema-aware JSON mode exposes `KEEP`, `REDACT`, `SCAN`, and `HASH` actions through `--schema-file`, `--schema-default`, `--hash-key`, and `--hash-key-file`.
218+
- Optional AI control-plane features expose request guardrails (`--enable-guardrails`) and tenant-aware semantic caching (`--enable-semantic-cache`).
188219
- Schema-aware request redaction now streams JSON bodies with bounded parser memory instead of buffering the full request body first.
189220

190221
Current limits:

docs/brand_kit.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# NanoMask Brand Kit
2+
3+
## Positioning line
4+
5+
NanoMask is the self-hosted privacy firewall for regulated AI traffic.
6+
7+
## Voice
8+
9+
- direct
10+
- technical
11+
- compliance-aware
12+
- operator-friendly
13+
14+
## Visual system
15+
16+
- primary ink: `#0d1b19`
17+
- primary accent: `#0f766e`
18+
- secondary accent: `#c2410c`
19+
- surface: `#fff9f0`
20+
- grid line: `rgba(13, 27, 25, 0.10)`
21+
22+
## Logo assets
23+
24+
- `site/assets/nanomask-mark.svg`
25+
- `site/assets/nanomask-wordmark.svg`
26+
27+
Use the mark for square surfaces and the wordmark for docs, decks, and the landing page hero.

docs/commercial_offers.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Commercial Offers
2+
3+
NanoMask's commercial packaging should stay aligned to the regulated-AI wedge and the actual deployment journey.
4+
5+
## Offer ladder
6+
7+
| Offer | Best fit | Includes | Upgrade trigger |
8+
|---|---|---|---|
9+
| Pilot package | first regulated-AI evaluation | evaluation kit, security packet, report-only onboarding, weekly review cadence | buyer approves success criteria and wants active masking on production-shaped traffic |
10+
| Team sidecar deployment | one application team or bounded service group | sidecar patterns, SDK wrappers, starter schemas, support for rollout and tuning | multiple services need shared policy, audit, or centralized controls |
11+
| Enterprise gateway deployment | hospital, payer, claims platform, or shared AI platform team | centralized gateway topology, admin API/RBAC, audit evidence, semantic-cache controls, security review support | cross-team traffic consolidation or procurement of broader support/security commitments |
12+
13+
## Packaging principles
14+
15+
- sell the pilot around speed-to-proof, not feature sprawl
16+
- keep sidecar deployment as the low-friction expansion path
17+
- reserve gateway packaging for orgs that actually need shared controls and auditable central policy
18+
19+
## Success metrics for expansion
20+
21+
- seeded coverage target hit on the buyer's evaluation corpus
22+
- latency overhead remains inside agreed SLO
23+
- no compatibility regressions on required headers or streaming routes
24+
- operator team can own the deployment without founder-only intervention

docs/semantic_cache.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Semantic Cache
2+
3+
Semantic caching lets NanoMask skip duplicate upstream LLM calls after de-identification.
4+
5+
## What is cached
6+
7+
- request key inputs: HTTP method, URI, tenant identifier, transformed request body
8+
- cached value: eligible upstream response body
9+
- isolation: per-tenant using `--semantic-cache-tenant-header`
10+
11+
## Enable it
12+
13+
```bash
14+
zig build run -- \
15+
--target-host api.openai.com \
16+
--target-port 443 \
17+
--target-tls \
18+
--enable-semantic-cache \
19+
--semantic-cache-ttl-ms 300000 \
20+
--semantic-cache-max-entries 256 \
21+
--semantic-cache-tenant-header X-NanoMask-Tenant
22+
```
23+
24+
## Current behavior
25+
26+
- duplicate transformed prompts can short-circuit the upstream request path
27+
- entries expire by TTL
28+
- cache capacity is bounded and old entries are evicted
29+
- response caching is limited to successful, identity-encoded, text or JSON responses
30+
31+
## Metrics
32+
33+
- `nanomask_semantic_cache_requests_total{result="hit"}`
34+
- `nanomask_semantic_cache_requests_total{result="miss"}`
35+
- `nanomask_semantic_cache_requests_total{result="eviction"}`
36+
- `nanomask_semantic_cache_entries`
37+
38+
## Cost reduction framing
39+
40+
Use semantic cache when the same de-identified prompts recur across:
41+
42+
- repeated summarization templates
43+
- common support or claims-routing prompts
44+
- batch reprocessing jobs
45+
46+
Estimated savings model:
47+
48+
`monthly_savings = cache_hits * average_prompt_cost`
49+
50+
The buyer conversation is not just privacy. It becomes privacy plus reduced API spend.

evaluation/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# NanoMask Evaluation Kit
2+
3+
This folder is the repeatable buyer package for healthcare, claims, and regulated-AI evaluations.
4+
5+
## What is included
6+
7+
- Reference deployments:
8+
`examples/integrations/sidecar/README.md`,
9+
`examples/integrations/gateway/README.md`,
10+
`starters/healthcare/deployments/`
11+
- Sample data packs:
12+
`starters/healthcare/payloads/`,
13+
`starters/healthcare/entities/`,
14+
`starters/healthcare/schemas/`
15+
- Report-only evaluation workflow:
16+
[report-only-workflow.md](report-only-workflow.md)
17+
- Benchmark card:
18+
[benchmark-card.md](benchmark-card.md)
19+
- Compatibility summary:
20+
[compatibility-summary.md](compatibility-summary.md)
21+
- Pilot scorecard and runbook:
22+
[pilot-success-criteria.md](pilot-success-criteria.md),
23+
[pilot-runbook.md](pilot-runbook.md)
24+
- Security packet:
25+
`docs/security_packet.md`
26+
27+
## Recommended evaluation flow
28+
29+
1. Start in report-only mode with the healthcare starter assets.
30+
2. Run the compatibility suite and attach `compatibility/compatibility-matrix.json` to the evaluation packet.
31+
3. Switch one bounded workflow from report-only to active masking.
32+
4. Review the security packet and threat model with the buyer's security team.
33+
5. Lock pilot success criteria before production-shaped traffic is enabled.
34+
35+
## Reproducible starter command
36+
37+
```bash
38+
zig build run -- \
39+
--listen-host 127.0.0.1 \
40+
--target-host httpbin.org \
41+
--target-port 80 \
42+
--entity-file starters/healthcare/entities/patient-demographics.txt \
43+
--schema-file starters/healthcare/schemas/patient-demographics.nmschema \
44+
--schema-default KEEP \
45+
--hash-key-file starters/healthcare/hash-key.example.txt \
46+
--enable-email \
47+
--enable-phone \
48+
--enable-healthcare \
49+
--report-only
50+
```
51+
52+
Then send the included sample payload:
53+
54+
```bash
55+
curl -X POST http://127.0.0.1:8081/post \
56+
-H "Content-Type: application/json" \
57+
--data-binary @starters/healthcare/payloads/patient-demographics.json
58+
```

evaluation/benchmark-card.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Benchmark Card
2+
3+
This card is the short proof artifact to hand to buyers during technical evaluation.
4+
5+
## Core performance claims
6+
7+
| Surface | Current proof point | How to reproduce |
8+
|---|---|---|
9+
| SSN redaction | 16+ GB/s single-core scan in ReleaseFast | `zig build bench-all` |
10+
| Exact entity masking | 260 MB/s | `zig build proof-report` |
11+
| OCR-tolerant fuzzy matching | 193 MB/s | `zig build proof-report` |
12+
| Compatibility coverage | 5/5 reference flows passing | `zig build compat-matrix -- compatibility/compatibility-matrix.json` |
13+
14+
## Operational proof points
15+
16+
- single static Zig binary with no runtime dependency chain
17+
- request and response header fidelity covered by the compatibility matrix
18+
- optional report-only mode for low-risk first deployment
19+
- Prometheus metrics for redaction, guardrail, and semantic-cache behavior
20+
21+
## Evaluation note
22+
23+
Use this card together with:
24+
25+
- `compatibility/compatibility-matrix.json`
26+
- `docs/security_packet.md`
27+
- `evaluation/pilot-success-criteria.md`
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Compatibility Summary
2+
3+
Current checked-in compatibility artifact: `compatibility/compatibility-matrix.json`
4+
5+
## Summary
6+
7+
- total reference flows: 5
8+
- passed: 5
9+
- failed: 0
10+
11+
## Covered flows
12+
13+
- OpenAI-compatible JSON: header fidelity, body mutation, response headers, path/query fidelity
14+
- Anthropic-style SSE: streaming fidelity plus request and response header checks
15+
- Azure OpenAI-style routes: path and query preservation
16+
- Generic REST JSON: ordinary API compatibility outside AI-specific routes
17+
- LiteLLM-style headers: proxy and vendor header preservation
18+
19+
## Buyer takeaway
20+
21+
NanoMask is positioned as a drop-in reverse proxy, not a custom integration project. This artifact is the proof packet for that claim.

evaluation/pilot-runbook.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Pilot Runbook
2+
3+
## Before kickoff
4+
5+
- confirm target workflow, owner, and upstream API surface
6+
- choose deployment shape: sidecar or centralized gateway
7+
- choose evaluation corpus from `starters/healthcare/` or buyer-supplied sanitized payloads
8+
- agree on pilot success criteria and review cadence
9+
10+
## Day 0 setup
11+
12+
1. Validate the config with `--validate-config`.
13+
2. Start in report-only mode.
14+
3. Run the compatibility suite against the buyer's preferred API shape.
15+
4. Hand over the security packet and threat model.
16+
17+
## Day 1 validation
18+
19+
1. Replay seeded traffic and compare detections to the expected corpus.
20+
2. Review false positives and tighten schema or entity inputs.
21+
3. Enable active masking for one bounded route or integration.
22+
23+
## Day 2+ operationalization
24+
25+
1. Turn on audit logging and metrics scraping.
26+
2. Measure latency overhead and operational fit.
27+
3. If applicable, enable guardrails or semantic cache after privacy controls are accepted.
28+
29+
## Closeout packet
30+
31+
- benchmark card
32+
- compatibility summary
33+
- pilot scorecard against success criteria
34+
- security packet
35+
- recommended next commercial motion
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Pilot Success Criteria
2+
3+
Agree on these metrics before pilot start so expansion is tied to evidence, not opinion.
4+
5+
| Area | Target | Evidence |
6+
|---|---|---|
7+
| Detection coverage | 95%+ of seeded PII/PHI test values detected in agreed workflows | report-only logs, audit events, sample replay |
8+
| False positive rate | <2% on buyer-approved evaluation corpus | redaction review worksheet |
9+
| Latency overhead | within buyer-approved SLO for proxied routes | local benchmark plus pilot traffic measurement |
10+
| Deployment time | first environment live in 1 business day or less | onboarding runbook timestamps |
11+
| Compatibility | no auth, header, or SSE regressions in target workflows | compatibility suite plus pilot smoke tests |
12+
| Security review readiness | security packet accepted for initial review without blocker gaps | buyer security questionnaire and meeting notes |
13+
| Expansion trigger | sidecar or gateway rollout justified by measured coverage and operator fit | signed pilot closeout |

evaluation/report-only-workflow.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Report-Only Workflow
2+
3+
Use report-only mode to prove coverage and operational safety before payload mutation is enabled.
4+
5+
## Objectives
6+
7+
- measure what NanoMask would redact without changing traffic
8+
- baseline false positives on real prompts, notes, and claims payloads
9+
- show auditors that rollout starts with observation, not blind enforcement
10+
11+
## Commands
12+
13+
Start NanoMask with the healthcare starter pack:
14+
15+
```bash
16+
zig build run -- \
17+
--listen-host 127.0.0.1 \
18+
--target-host httpbin.org \
19+
--target-port 80 \
20+
--entity-file starters/healthcare/entities/encounter-notes.txt \
21+
--schema-file starters/healthcare/schemas/encounter-notes.nmschema \
22+
--schema-default KEEP \
23+
--hash-key-file starters/healthcare/hash-key.example.txt \
24+
--enable-email \
25+
--enable-phone \
26+
--enable-healthcare \
27+
--report-only \
28+
--audit-log
29+
```
30+
31+
Send representative traffic:
32+
33+
```bash
34+
curl -X POST http://127.0.0.1:8081/post \
35+
-H "Content-Type: application/json" \
36+
--data-binary @starters/healthcare/payloads/encounter-note.json
37+
```
38+
39+
## Evidence to capture
40+
41+
- structured logs showing detected classes and request IDs
42+
- audit events for each detected pattern or entity match
43+
- `/metrics` snapshots before and after the sample run
44+
- operator notes on any expected-but-undetected values or false positives
45+
46+
## Exit criteria
47+
48+
- all sample payloads produce detections on the expected fields
49+
- no critical false positives block adjacent non-PII fields
50+
- operators understand what will change when enforcement is turned on

0 commit comments

Comments
 (0)