π AegisGate Lens v0.1.4 is LIVE β CWS approved 2026-07-13, released the same day. This page documents the v0.1.4 architecture (the v0.1.0-beta baseline + 35 polish commits).
title: “AegisGate Lens β Architecture” description: “How AegisGate Lens works: 4-facet regex detection, Ed25519-signed bundle, Apache 2.0. The full technical architecture of v0.1.4.” type: “docs” weight: 2
- 8 AI providers: ChatGPT, Claude, Gemini, Copilot, DuckDuckGo, Perplexity, Mistral, Grok
- 132 regex patterns across 4 detection facets: PII, secrets, XSS, compliance
- 647 automated tests: 500/500 Node + 3/3 Go + 16/16 headless smoke + 128/128 mini-smoke (5/5 stable runs)
- 2.31% FPR on 6,500 WildChat prompts (5.1x better than v0.1.0-beta baseline)
- Sub-millisecond detection (p50 0.076ms, p95 0.085ms, p99 0.14ms for 500-char prompts)
- 100% on-device, zero network egress by default
- 12 privacy non-negotiables, Apache 2.0, zero external dependencies
- Free, forever
AegisGate Lens β Architecture
The full source code is on GitHub (Apache 2.0). This page summarizes the architecture of v0.1.4.
4-Facet Detection System
Lens runs 4 active detection facets in parallel on every prompt you type. v0.2.0 will expand the compliance facet (more frameworks: HIPAA, PCI, FedRAMP, FIPS 140-3) β the ML-based facets (Toxicity, Prompt-Injection ML) were evaluated and deferred, see the AegisGate v0.2.0 work plan.
| Facet | What it catches | Example |
|---|---|---|
| PII | Email, phone, SSN, credit card, bank account, DOB, address, driver’s license, passport, tax ID, IP address (55 patterns) | john.doe@example.com, 4111-1111-1111-1111 |
| Secrets | API keys (AWS, GitHub, OpenAI, Stripe, Slack), OAuth tokens, database credentials, RSA private keys (41 patterns) | ghp_abc123..., AKIA..., -----BEGIN RSA PRIVATE KEY----- |
| XSS | Cross-site scripting payloads (12 patterns) | <script>alert(1)</script> |
| Compliance | OWASP LLM Top 10 (5/10 implemented), MITRE ATLAS, EU AI Act, NIST CSF, ISO 27001, CCPA, LGPD, PIPEDA, POPIA (24 patterns) | “patient SSN:”, “credit card:” |
All 4 facets use regex patterns (fast, synchronous, on-device). No ML model. No heuristics. No inference latency. The detection is deterministic and auditable.
Why Regex (not ML)?
v0.1.4 is intentionally regex-only. The rationale (from the v0.1.3 baseline; v0.1.4 keeps the same approach):
- Privacy: regex is auditable. A model is a black box.
- Size: a TinyML model would add 1-2MB to the extension. Regex is 132 patterns = ~50KB.
- Latency: regex detects in <1ms. A model would need 50-100ms.
- Determinism: regex produces the same result every time. A model can drift.
- No training data: regex patterns are hand-curated. No need for training corpus.
- FPR: with the v0.1.4 postProcess tightening, FPR on 6,500 WildChat prompts is 2.31% β comparable to or better than ML approaches.
A TinyML model (1-2MB transformer) was planned for v0.2.0 to add the 2 missing facets (Toxicity, Prompt-Injection) and improve FPR on edge cases. After the v0.2.0 evaluation, the ML approach was deferred (6 model families failed to meet the ship gate β see Lesson #99 and the v0.2.0 work plan). The v0.1.4 approach remains regex-only; v0.2.0 will instead expand the compliance facet (more frameworks).
Architecture Stack
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Provider (ChatGPT, Claude, Gemini, ...) β
β (DOM content, user input, AI output) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Lens Content Script (MV3, injected into page) β
β ββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Event Listener (input, keyup, paste) β β
β β β β β
β β Debounced Detection (250ms throttle) β β
β β β β β
β β ββββββββββββββββββββββββββββββββββββββββ β β
β β β 4-Facet Detection (parallel) β β β
β β β All regex patterns β β β
β β β - PII (55) β β β
β β β - Secrets (41) β β β
β β β - XSS (12) β β β
β β β - Compliance (24) β β β
β β ββββββββββββββββββββββββββββββββββββββββ β β
β β β β β
β β PostProcess (FP rejection): β β
β β - Luhn validation for credit cards β β
β β - 4-4-4 CC pattern rejection β β
β β - ID-label context for ID-shaped patterns β β
β β β β β
β β UI Update (non-blocking banner) β β
β β - Show severity color β β
β β - Show rewritten text β β
β β - Show "Send anyway / Edit / Cancel" β β
β ββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ
(optional Tier 1 opt-in)
Hashed metadata only
NEVER prompt text
ββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β (Optional) AegisGate Platform Backend β
β - Hashed FP report aggregation β
β - Team-wide policy (Enterprise) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Detection Latency
| Prompt length | Detection time |
|---|---|
| Any length (regex only) | <1ms (typical: 0.3-0.5ms) |
| Worst case (10K+ chars) | ~2ms |
All detection is synchronous β the user gets the result before they can send. There is no async ML inference.
Ed25519 Commit Signing
All commits to the AegisGate Lens repository are signed with Ed25519 SSH keys (per GitHub’s signing docs). The Chrome extension .zip is built by GitHub Actions and distributed via the Chrome Web Store, which verifies the package on install.
To verify commits locally:
git log --show-signature
No Model Bundles (v0.1.4)
v0.1.4 is regex-only. There are no model bundles, no ML inference, no inference timeouts.
This means:
- No bundle signing is needed (no bundles to sign)
- No SLSA L2 provenance is needed (no bundles to attest)
- No Sigstore/Rekor integration is needed (no artifacts to log)
- No key ring is needed (no keys to manage)
If v0.2.0 adds a TinyML model (planned), the bundle signing and provenance flow will be added at that time and documented here.
Release Process
- Commits are signed with Ed25519 SSH keys
- The build runs in GitHub Actions on every push to the
v0.1.xbranches - The build produces the
.zipfile and uploads it as a CI artifact - The
.zipis submitted to the Chrome Web Store dashboard - Chrome Web Store verifies the package and distributes it to users
Zero External Dependencies
Lens has zero external dependencies. All code is in plain JavaScript. No npm, no node_modules, no bundled libraries.
This is a privacy feature, not just a code-quality feature: there are no third-party libraries that could be compromised and exfiltrate data.
File Structure
aegisgate-lens/
βββ src/ # Canonical source
β βββ api/ # Optional backend client
β βββ content.js # Content script (entry point)
β βββ background.js # MV3 service worker
β βββ popup/ # Browser action popup
β β βββ popup.html
β β βββ popup.js
β βββ welcome/ # First-install welcome page
β β βββ welcome.html
β β βββ welcome.js
β β βββ fonts/ # Bundled Inter font (OFL)
β βββ detectors/ # 4-facet detection
β β βββ regex/ # Regex pattern files
β β β βββ pii.js # Aggregator (loads 4 sub-files)
β β β βββ pii-us-core.js
β β β βββ pii-us-extended.js
β β β βββ pii-international-id.js
β β β βββ pii-financial.js
β β β βββ secrets.js
β β β βββ source_xss.js
β β β βββ compliance.js
β β βββ luhn.js # Credit card Luhn validation
β β βββ index.js # Detector orchestrator
β βββ privacy/ # Privacy + schema
β β βββ schema.js # Event schema validator
β β βββ domain_hash.js # SHA-256 domain hashing
β βββ util/ # Banner UI, dismiss logic, etc.
β β βββ banner-ui.js # Aggregator
β β βββ banner-ui-html.js
β β βββ banner-ui-lifecycle.js
β β βββ banner-ui-formatters.js
β β βββ banner.css
β β βββ banner-icons.js
β β βββ dismiss.js
β β βββ prompt-detect.js # Orchestrator
β β βββ prompt-detect-dom.js
β β βββ prompt-detect-lifecycle.js
β β βββ selectors.js # Provider host detection
β β βββ constants.js # Storage keys, TTLs, etc.
β β βββ typedefs.js
β β βββ logger.js
β βββ manifest.json # MV3 manifest
βββ test/ # 500/500 Node tests + 3/3 Go tests + 16/16 smoke + 128/128 mini-smoke
β βββ unit/ # 18 test files
β βββ helpers/ # Mock chrome, load-module
β βββ headless-smoke/ # 16/16 real-browser integration
β βββ e2e/ # empty (v0.2.0 scope)
βββ docs/ # Public documentation
β βββ ARCHITECTURE-v0.1.0-BETA.md
β βββ METRICS-v0.1.2.md
β βββ MODEL-CARD.md
β βββ API.md
β βββ SECURITY.md
β βββ THREAT-MODEL.md
β βββ A11Y-AUDIT-v0.1.4.md
β βββ PRODUCT-SUMMARY.md
β βββ CHANGELOG.md
βββ .plans/ # Internal planning (gitignored)
β βββ AEGISGATE-LENS-STANDING-RULES-2026-06-29.md
β βββ AEGISGATE-LENS-CHROME-STORE-LISTING.md
β βββ todo-v0.1.4.md
β βββ v0.2-burndown/ # v0.2.0 research artifacts (gitignored)
βββ README.md
Test Coverage
- 500/500 Node tests pass (using
node:testfrom Node 20+ stdlib) - 3/3 Go tests pass (in
tools/headless-smoke/flow/) - 16/16 headless smoke in real Chrome (the 4 facet detectors + 16 flow cases)
- Zero external dependencies for tests (no Jest, no Mocha)
- Real-browser E2E tests against 8 AI provider mocks
See Also
- Security Model β content security policy, vulnerability disclosure
- Privacy Policy β what we collect, what we don’t
- Changelog β version history
The full source code is at github.com/aegisgatesecurity/aegisgate-lens. PRs welcome.