Open-source AI agent privacy guard
What stops an AI agent from reading a confidential file?
Working with client loan tapes inside Claude Code, Gemini CLI, or Copilot? Veil intercepts tool calls before they run, blocks direct reads and raw dumps of protected files, and steers the agent to redacted local tools like shape and rvl instead. Runs locally on your device.
Blocked 2 direct reads of data/clients/oct_loan_tape.csv and let 2 redacted spine checks run.
An AI agent tries to inspect a protected client loan tape. veil blocks Read and cat before raw loan rows enter model context, while letting redacted shape and rvl commands run locally.
| Agent call | Decision | Why |
|---|---|---|
| Read: data/clients/oct_loan_tape.csv | DENY | Read on "data/clients/oct_loan_tape.csv" would pull raw protected contents into model context (matched data/clients/**; label: protected).Next: Run an authorized spine tool instead (for example: shape data/clients/oct_loan_tape.csv --json, profile stats data/clients/oct_loan_tape.csv, or rvl ... --json). |
| Bash: cat data/clients/oct_loan_tape.csv | DENY | cat attempts to access protected path "data/clients/oct_loan_tape.csv" (matched data/clients/**; label: protected).Next: Use a redacted spine tool instead (for example: shape data/clients/oct_loan_tape.csv --json or profile stats data/clients/oct_loan_tape.csv). |
| Bash: shape data/clients/sep_loan_tape.csv data/clients/oct_loan_tape.csv --key loan_id --json | ALLOW | Authorized spine tool "shape" runs redacted against "data/clients/sep_loan_tape.csv" (no raw values enter context). |
| Bash: rvl data/clients/sep_loan_tape.csv data/clients/oct_loan_tape.csv --key loan_id --json | ALLOW | Authorized spine tool "rvl" runs redacted against "data/clients/sep_loan_tape.csv" (no raw values enter context). |
Runs on your device · Zero uploads (works with Wi-Fi off)
Edit protected globs & inspect Claude hook JSON / .veil.toml / audit log
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "deny",
"permissionDecisionReason": "Read on \"data/clients/oct_loan_tape.csv\" would pull raw protected contents into model context (matched data/clients/**; label: protected)."
}
}Install hook locally
brew install cmdrvl/tap/veil
veil install && veil doctorTest a path or run macOS sandbox
veil test data/clients/oct_loan_tape.csv --json
veil sandbox -- claudeInteractive browser simulator (veil v0.4.2 local CLI rules): Mirrors cmdrvl/veil v0.4.2 hook rules (protected globs, authorized spine tools, denied raw-value flags, compound Bash splitting, egress class, and .veil.toml write guard) locally in your tab with zero uploads. Real shell hooks and macOS Seatbelt sandboxing run via the local veil binary.
Run it locally
Install veil, wire your agent hooks, then verify with veil doctor.
Install the local Rust binary via Homebrew, run veil install to add PreToolUse hooks with a 30-second timeout, and keep your protected patterns in ~/.cmdrvl/config/veil/config.toml (project .veil.toml files can only tighten rules, never loosen them).
veil CLI (v0.4.2)
Installs PreToolUse hooks for Read, Grep, Bash, MCP tools, and config-file Write guards, writes refusals to a local audit log (~/.cmdrvl/logs/veil/audit.jsonl), and provides veil test / veil explain / veil audit.
1. Install via Homebrew
brew install cmdrvl/tap/veil2. Run locally
veil install && veil doctor && veil test data/clients/oct_loan_tape.csv --json- Supported harnesses
- Claude Code, Gemini CLI, GitHub Copilot, and Grok hooks
- OS sandbox option
- Opt-in macOS Seatbelt confinement via veil sandbox -- <cmd>
- Bypass test matrix
- 162 of 217 real vectors blocked in CI (27 open limits documented)
- Companion boundary
- Pairs with airlock for outbound model-boundary attestation
For scripts and CI: standalone veil binary, exit codes, and refusal codes
macOS Seatbelt sandbox & wrapper API
Read bypass matrix on GitHub ->On macOS, veil sandbox -- <cmd> confines a process under Seatbelt while veil exec <tool> brokers authorized spine tools outside the sandbox. Local wrappers can query veil test / explain / scan --json (veil.path-decision.v1).
Install standalone binary
curl -fsSL https://raw.githubusercontent.com/cmdrvl/veil/main/install.sh | bashInvoke directly
veil sandbox -- claudeExit codes & verdicts
NO DECISION (ALLOW)
Exit 0
Call does not violate policy (for example an allowlisted doc or a redacted spine tool). On Claude Code and Copilot, veil prints nothing so it never auto-approves on the harness's behalf.
DENY
Exit 0 (JSON deny)
Call named a protected path, a denied raw-value flag (--explicit), an egress command, or a veil config write. Emits permissionDecision: deny with remediation guidance and logs to audit.jsonl.
FAIL-CLOSED REFUSAL
Exit 2
Hook payload or config could not be read, a check exceeded the 20-second bound, or a path could not be normalized. Fails closed so errors never silently open protected files.
Common refusal & finding codes
| Code | When it fires | Remediation |
|---|---|---|
| direct_read | Read, Grep, or a known shell reader named a protected path | Run an authorized redacted spine tool (shape, rvl, profile, verify) |
| denied_raw_flag | Authorized spine tool invoked with --explicit, --raw, --dump, or --show-values | Drop the raw-value flag so only redacted metadata enters context |
| argv_path (egress) | Outbound transfer tool (curl, scp, rsync, gh, mail) named a protected file | Keep raw files local; attest derived payloads with airlock |
| mcp_argument | MCP tool arguments referenced a protected file path | Pass redacted summaries rather than protected file paths |
| dynamic_path_unresolvable | Shell variable or command substitution target could not be resolved safely | Use explicit literal paths or run inside veil sandbox |
| config_guard | Agent attempted to edit or delete .veil.toml or ~/.cmdrvl/config/veil/config.toml | Edit veil configuration manually outside the agent session |
Learning progression
Privacy guard locked in? Loop back to run redacted diffs under veil.
veil sits at the ingress boundary so AI coding agents can run rvl, shape, profile, verify, and pack on sensitive folders without raw rows ever entering model context.
- 01rvlSee what moved
- 02shapeCheck compatibility
- 03profileScope columns
- 04verifyEnforce rules
- 05packSeal proof
- 06 · HEREveilGuard privacy
Previous · 05 pack
Seal redacted reports into a tamper-evident pack.
Once veil keeps raw source files out of context, seal the lockfiles and redacted reports with pack so any audit can verify every byte offline.
Full loop · 01 rvl
Run redacted spreadsheet diffs safely under veil.
Because rvl redacts raw IDs and values by default, veil lets AI agents run rvl on protected loan tapes while blocking --explicit and cat.
What veil handles
- Intercepts Claude Code, Gemini CLI, GitHub Copilot, and Grok PreToolUse calls before direct reads execute
- Splits chained Bash lines (;, &&, ||, |, subshells, wrappers, and inline scripts) and blocks on the first violation
- Allows authorized spine tools (shape, rvl, profile, verify, pack) while stripping authority if raw-value flags (--explicit) or unsafe env overrides appear
- Enforces tightening-only project .veil.toml layers and guards config files from agent writes
- Provides opt-in macOS Seatbelt OS confinement (veil sandbox -- <cmd>) with a brokered veil exec path that blocks file writes and scans output for secrets/PII
- Ships a CI-verified 217-vector bypass matrix documenting every blocked vector and every remaining open limit honestly
Explicit boundaries & limits
- Hook mode is advisory and parser-based: anything hidden outside the command text (for example a pre-existing hardlink or an unknown runner) requires OS-level sandboxing.
- veil has no grant workflow and no tamper-evident ledger; it refuses reads and writes to a local audit log (use pack for tamper-evident sealing and airlock for outbound model attestation).
- veil sandbox uses macOS Seatbelt and is not available on Linux today; it denies reading, renaming, and removing protected paths, not network access.
- Project .veil.toml rules cannot protect themselves if deleted outside the hook; policies you cannot afford to lose belong in ~/.cmdrvl/config/veil/config.toml.
- Cairn roles
- Software factory
- Evidence roles
- What is missing
- Contribution
- Intercept AI agent tool calls to block direct reads, raw-value flags, and outbound paths for protected files, steering agents to redacted local tools.
- Limit
- Hook enforcement is advisory and parser-based (opt-in macOS Seatbelt sandboxing via veil sandbox); veil has no grant workflow or tamper-evident ledger and does not replace OS permissions.
Questions this tool can support
- Do we own any bonds backed by those loans?
Apply explicit grants to supported sensitive-file reads in a local agent workflow. This proposed use does not establish a secure holdings integration or cover every data path.
Potential use, not demonstrated here
Open-source starter -> Paid lineage stack
Start free on local files. License the paid stack for warehouse-wide lineage.
Open-source Rust CLIs and @cmdrvl/web browser engines cut document token spend 10x to 100x locally and work alongside any AI assistant or hosted workspace (Rogo, Hebbia, Harvey, Claude, ChatGPT, or Codex). When your firm needs end-to-end lineage across Snowflake or your cloud warehouse (Reveal catalog, paid MCP servers, Evidence MCP receipts, x402 APIs, and offline twinning and evals), license the paid stack or start with a $500 half-day founder workshop.
Complete open-source CLI suite (17 interactive offline demos)
Explore every deterministic tool in the spine.
Intake & identity
Compare & validate
Reconcile, decide & seal
Workstation guardrails (CLI-only)
- veilcurrent
- airlockGate outbound prompts
Common questions
- Does veil replace OS permissions or stop every possible exfiltration path?
- No, and the repository is explicit about that. Hook mode is advisory and parser-based (162 of 217 test vectors blocked in CI, with all 27 remaining gaps documented in docs/bypass-matrix.md). On macOS, veil sandbox adds opt-in Seatbelt OS-level read confinement.
- Why does veil allow rvl and shape on protected files but block rvl --explicit?
- By default, rvl, shape, profile, and verify redact raw row IDs, column names, and dollar figures into ordinal references. Adding --explicit turns those tools back into raw-value readers, so veil denies --explicit on protected paths.
- Can an AI agent edit .veil.toml to disable protection?
- No. veil guards .veil.toml and ~/.cmdrvl/config/veil/config.toml against Write, Edit, and shell modifications, and project .veil.toml files can only tighten user/system settings, never loosen them.
- How is veil different from airlock?
- veil works at ingress to stop raw sensitive files from entering the agent context in the first place. airlock works at egress to attest what derived artifacts crossed a model boundary.