Harness security for AI agents · open source · Apache 2.0
Your agent asks. A Lock holds the keys. You sign in lox run.
Your AI agent works on your databases, queues, files, logs and servers (and, inside lea, the web) through a Lock that holds the credentials and masks the data. Reads flow; a connection, a write or anything risky waits for your y in lox run, outside the agent's harness.
brew trust davidgodefroid/tap
brew install davidgodefroid/tap/lockfamily
lox add locksqlin your project, one source at a timelox runin a terminal of its own; your agent in another (claude,codex,gemini, … orlea). Quick start
Works with any MCP client (Claude Code, Codex, Cursor, Gemini CLI, …) for every Lock but lockhttp, which guards agents running inside lea. The Locks and the hub run in Docker.
ticket shop / primary · locksql
- asked by
- your agent, in its harness
- class
- write · always asked
- request, masked
UPDATE orders SET status = ‹p***(4)›
WHERE id = ‹4***(5)› -- 1 row- the hub holds
- this masked screen only: no clear value, no result
approved · you · y · 14:03
signed decision bound to this exact plan; the Lock runs the UPDATE only on it
audit 14:03 agent ◆ shop primary write ✔ you ✓
lox run shows it to you. Answer n, or nothing, and the Lock never runs it.See it work: a read comes back masked, a write waits for you
UPDATE held for you, your y in lox run, then the line in lox audit. Drawn from the captures of one real run, with the agent on the host; with reduced motion it shows the last frame. On a small screen, scroll it sideways.One Lock per data source, and lea for the agents
-
SQL databases
locksql
The agent queries; personal data comes back masked. Connections and writes wait for you.
-
RabbitMQ
lockmq
Masked queue inspection. Connections, peeks and unmasked reads wait for you.
-
Files
lockfile
The agent asks yes/no questions about files it never reads, and gets 1 or 0: never a byte, a name or a size.
-
Outbound HTTP(S) · agents in lea
lockhttp
Reads of trusted hosts pass; anything that sends data or reaches an unknown host waits for you. The proxy injects credentials the agent never sees. Guards agents running inside lea only.
-
Logs · early release
locklog
Masked, bounded log search: the agent reads the logs, not the people in them. A clear value waits for you.
-
SSH · pre-release
lockssh
Allow-listed commands run at once; the rest waits for you. The SSH key never leaves the console.
-
Runs the agents
lea
Many coding agents (Claude Code, Codex, …) in a container that never sees your SSH keys or your private network. Their Lock requests wait for
lox run.
01
One write, from the agent's request to your signature
An agent harness is the program that runs a model as an agent and hands it tools. Harness security is the layer around it: every approval is answered outside the harness. For an agent that runs confined, in lea, it holds whatever the model is talked into; an agent on the host runs as you and could still drive Docker (security model).
Here is one UPDATE, line by line, as the audit log records it.
- 14:03:01agent
Asks its Lock client to run
UPDATE orders SET status = 'paid' WHERE id = 41277. The client is an MCP server with no credential and no connection; it passes the request over a socket to the Lock. - 14:03:01lock
In its own container, parses the statement, classes it a write and masks every value:
status = ‹p***(4)›. It runs nothing yet and sends the hub a ticket with that masked screen. - 14:03:01hub
Queues the ticket for
lox run. A lea agent has no route to it. The hub never runs a request and never sees a result or a value in clear. - 14:03:02you
In
lox run, your own terminal. Auto mode passes reads by rule, but a write is always asked: the bell rings, you read the masked screen and press y. - 14:03:04hub
Signs the decision, bound to that exact plan and naming who decided: you, not a rule.
- 14:03:04lock
Checks the signature, runs the
UPDATEand returns1 row updated. On n, no answer or a closedlox run, nothing runs and the agent only learns it was denied. - lateraudit
lox auditlists the line: who asked, the masked request, who or which rule decided, and the outcome.
Each Lock reaches only the endpoints of its reviewed profile. Decisions can also come from an auto rule, lox approve, Slack, Telegram or a paired phone (the hub).
02
One boundary around the agent, one console per data source
Where agents run
Your agent, or lea
Any MCP client on your machine. Or lea: coding agents (Claude Code, Codex, …) in a container that sees one projects directory and reaches the internet only through a proxy that refuses your private network.
What agents reach: one Lock per data source, its console started by lox run
locksql
SQL databases
lockmq
RabbitMQ brokers
lockfile
Files on S3, SFTP or disk
lockhttp
Outbound HTTP(S)
locklog
Files, journald, Docker, Loki, Elasticsearch (preview)
lockssh
Commands over SSH
Shared core
lockkit
The Go core every Lock is built on:
- the console, hub-attached only, with its isolated account and socket;
- policies the AI may tighten and only you loosen;
- the approval screen, the hub's tickets and the audit log;
- credentials kept in the console: an
askpassword typed at the first connection inlox runand sealed to the Lock, or a login read from HashiCorp Vault; - personal-data masks, MCP and agent wiring.
- One hub runs every Lock.
lox runstarts the hub and each Lock's console with Docker Compose; there is no standalone console. - Each Lock is fenced. Every Lock but lockhttp sits on an internal network, behind an egress gateway that reaches only its reviewed profile's endpoints: no internet, cloud metadata or other host port.
- Agents reach sockets, never the hub. lea's agents find the Locks' sockets in
.lockfamily/up.json. An agent on the host does too, through each Lock's launcher (locksql mcp, …). - lea is optional, except for lockhttp, whose gate runs beside lea's proxy: it guards only agents running inside lea, not an agent on the host.
~/.ssh and reaching 192.168.1.10 are blocked.03
The hub: every Lock's tickets, answered from one place
- locksql
- lockmq
- lockfile
- lockhttp
- locklog
- lockssh
lox runyour terminallox approve- Slack, Telegram
- a paired phone
Every Lock runs attached to lockhub. Its console holds the credentials, checks each request and sends the hub a signed ticket with the masked screen.
lox run decides it. The hub signs the decision, bound to the exact plan, and the Lock runs only on that signed decision. The hub never runs a request, never sees its results and never sees values in clear.
The lox CLI sets each source up (lox add), runs the hub and the Locks and serves the decisions (lox run), and lists what happened (lox audit).
lox run. The one terminal you keep open, outside lea and any agent harness. It shows every ticket and decision live, masked, and runs in auto mode by default: reads pass by rule, writes and DDL are asked every time.A connection is asked once per profile per session (an
askpassword is typed there and sealed to the Lock), a new lockhttp endpoint once per session. locksql, lockmq, locklog and lockssh take auto rules per profile (auto,askordeny). Shift+Tab switches to manual; the bell rings only for a question; quitting fails closed.- Other facades.
lox approve, lea's deck, Slack, Telegram, and a paired phone (an installable web app the hub serves, with optional Web Push). Each risk class goes only where it is safe to answer (see “routing” below); a workspace can narrow the routing, never widen it. - Clear values. Screens are masked everywhere. With
reveal: trueon a lock, o (or Ctrl-O, where the terminal passes it) inlox approveshows a ticket's clear values, sealed by the lock to that facade: the hub relays ciphertext. Never on chat. - Phones. With
devices: truea lock pins the paired phones, and a phone signs its own decisions (WebAuthn): the hub's key alone cannot pass for it.require_devicelists the risk classes only a phone's signature may approve;seal_clearseals the clear screen to the phones. - lea. Since v0.9.0, lea handles no approvals: it starts no hub and shows no ticket. When the projects directory declares Locks and no
lox runserves them, lea says to run it, and the agents' requests wait at the hub.lea mounts
.lockfamily/read-only in its agents and gives them the Locks' sockets named in.lockfamily/up.json. No agent reaches the hub. - Host agents. Any MCP client on the host reaches every Lock but lockhttp through each Lock's launcher (
locksql mcp,lockmq mcp,lockfile mcp,locklog mcp), its MCP server.The launcher finds the nearest
.lockfamily/up.jsonup from the working directory and mounts the Lock's socket read-only once Docker confirms it islox run's. Approve inlox run.
# 1. In the project: the agent's files (init claude writes Claude Code's;
# any MCP client can start `locksql mcp`), a database profile (engine,
# host, TLS, where the password comes from; never the password), then
# doctor --fix (.locksql/ as lox run reads it)
cd ~/projects # your project (with lea: lea's projects directory)
locksql init claude
locksql profile add --profile orders
locksql doctor --fix --yes
# 2. Declare the lock: pinned by digest to its latest signed release;
# the hub's image is pinned with it
lox add locksql orders --profile orders
# 3. In a terminal of its own, outside the agent: review everything,
# start the hub and the console, then serve the decisions
lox run
- A database on this machine is
host.docker.internal; on Linux it must listen on the Docker bridge, not only on 127.0.0.1. - A database behind an SSH host is reached through the profile's built-in ssh bastion (
[profiles.NAME.ssh]); one that publishes no port must publish it. A profile'sproxy_commandis not supported underlox run, which stops before the review on such a lock. Egress, and the ssh example - For lea's agents, the lock names your uid (
allowed_uids: [1000],id -u, inlockfamily.yaml);lox addadds it when lea is installed. - Then ask an agent: “how many orders were placed yesterday?”.
lox runasks you once for the connection, then the read runs, masked; a write waits for your y every time. lox doctorchecks the setup, the egress allowlist included, and changes nothing. How lox run, lea and host agents fit
lox run [--manual] [--no-start] [--no-upgrade] [--review] [-v]
[--pin sha256:DIGEST] [--rotate hub|INSTANCE|all]
# review, start the hub and the locks, then serve decisions live:
# auto mode (Shift+Tab: manual), a: the audit, q q: quit (fail closed);
# 0…9, Tab: a lock's own tab; w: withdraw stuck tickets;
# --no-start: serve only; --no-upgrade: keep the pinned images;
# --review: everything, line by line; -v: cosign's and docker's output;
# --pin: the hub image by digest; --rotate: replace a key first
lox init [--review] [--hub-image REF]
# start the project's hub alone (no question for a hub alone); hints at the sources its files name
lox add TYPE # locksql, lockmq, lockfile, lockhttp, locklog, lockssh: its questions, profile,
# declaration, a short review, the console's questions; a failure before the console
# starts restores the profile and lockfamily.yaml (the agent's files stay)
lox add TYPE INSTANCE [--version vX.Y.Z | --image REF] [--profile P] [--hub-image REF]
# the older form: only declares the lock, pinned by digest, cosign-verified
# (an --image or --hub-image is taken as is, verified at the next lox run)
lox add slack --team T… --channel C… --user U… # tokens asked at the terminal
lox add telegram --chat ID --from ID # bot token asked at the terminal
lox remove NAME [--purge] # take a lock out after one review; its profile stays unless --purge
lox import [SUB…] # merge sub-projects' lockfamily.yaml, strictest routing kept
lox down # stop the stack; volumes, keys and tickets kept
lox attach INSTANCE # a console's terminal, for debugging (lox run asks its questions in cards)
lox approve [--once] # y, n reason, s, q; o (Ctrl-O + Enter, not macOS): clear values;
# r on an expired ticket: approve again
lox mobile pair --name phone # one-time code, confirmed at this terminal
lox mobile list
lox mobile revoke NAME
lox doctor # hub, locks, keys, egress allowlists, socket, network; changes nothing
lox tickets [--lock NAME] [--error] [--json]
# the tickets pending at the hub, without lox run
lox withdraw INSTANCE/ID… | --lock NAME --all-pending|--error
# withdraw them; each lock gets the hub's signed denial
# (an unverifiable ticket's lock is not told: its TTL ends it)
lox audit [show ID] # every exchange: masked request, rule or human, outcome
lox audit verify --data DIR --hub-key-file FILE [--lock INSTANCE=PATH] [--anchors FILE]
# the hub's audit chain and every decision's signature
The workspace commands take --file to name another lockfamily.yaml. lox up is deprecated: it says to use lox run. The full lox reference
A company bounds every lock, lox included, with one root-owned file its administrator signs and deploys. Managed configuration
version: 1
hub:
image: ghcr.io/davidgodefroid/lockhub@sha256:…
facades: [tty, mobile, slack]
routing:
orders: [tty, mobile] # narrows an instance, never widens
slack:
team: T0123
channel: C0123
users: [U0123]
mobile:
origin: https://hub.example.ts.net # your TLS proxy or tunnel to 127.0.0.1:8444
seal_clear: true # clear values, end to end to the phone
require_device: [prod-write] # only a phone's own signature approves these
push: true # Web Push, no payload
locks:
orders:
type: locksql
image: ghcr.io/davidgodefroid/locksql@sha256:…
profile: orders # the profile the console serves
allowed_uids: [1000] # id -u of the account that runs lea
devices: true # pins the paired phones
reveal: true # o / Ctrl-O in lox approve
lox run writes .lockfamily/up.json for lea and the launchers. It keeps the hub's data, keys and audit log under $XDG_STATE_HOME/lockfamily/ (default ~/.local/state/lockfamily/), out of the workspace.
A lockfamily.yaml at the workspace's root (the older layout) is still read, with a warning, until .lockfamily/ exists.
| Risk class | Terminal, lea's deck | Phone | Slack, Telegram |
|---|---|---|---|
| read, read-pii, write | yes | yes | yes, never a production ticket |
| prod-write, policy-loosen | yes | yes | no |
| unlock, grant | yes | no | no |
| clear values | on demand: o / Ctrl-O (reveal: true) | sealed to it (seal_clear) | never |
A chat facade never answers a production ticket, whatever its risk class. Chat facades show masked screens only, every agent-supplied string escaped: a chat account is only as safe as the devices signed in to it.
04
Install, add your sources, keep lox run open
brew trust davidgodefroid/tap
brew install davidgodefroid/tap/lockfamily
Homebrew asks you to trust a third-party tap once. Without Homebrew: curl -fsSL https://lockfamily.dev/install.sh | sh installs the same tools into ~/.local/bin, each verified with cosign (what it does). The script itself is signed: check it with cosign before you run it.
# 2. In your project (with lea: lea's projects directory), one source at a time
cd ~/projects
lox add locksql # or lockmq, lockfile, lockhttp, locklog, lockssh
# 3. In a terminal of its own, outside the agent: approvals live here
lox run
# 4. Your agent, in another terminal: claude, codex, gemini, … or lea
lox add TYPEsets one source up and creates.lockfamily/lockfamily.yamlif needed: its questions, the launcher'sprofile add,init claudeanddoctor, a short review, then the console's own questions. A failure, an n or Ctrl-C before the console starts restores the profile andlockfamily.yaml(the agent's files and the doctor's repairs stay).lox initstarts the hub alone first, if you prefer. For a hub alone it asks nothing, and it lists the data sources the project's files name (.env*,compose*.yaml,config/: hints only, never a secret).- Where to run them: for lea, in its projects directory, the only place lea reads
.lockfamily/up.json. For an agent on the host, in the project or any parent: each Lock's launcher looks up from the working directory. - A Lock added while lea runs reaches it at lea's next start:
lea stop, thenlea. lockfile is Linux only.
brew trust davidgodefroid/tap # once: Homebrew asks you to trust a third-party tap
brew install davidgodefroid/tap/lockfamily # or locksql alone, with lox and cosign: brew install davidgodefroid/tap/locksql davidgodefroid/tap/lox cosign
cd ~/projects # your project (with lea: lea's projects directory)
lox add locksql # its questions, then the review; lea stop, then lea, if lea runs
lox run # in a terminal of its own, outside the agent
Then ask your agent: “how many orders were placed yesterday?”. lox run asks once for the connection; reads then run masked, and each write waits for your y. locksql on GitHub
brew trust davidgodefroid/tap # once: Homebrew asks you to trust a third-party tap
brew install davidgodefroid/tap/lockfamily # or lockmq alone, with lox and cosign: brew install davidgodefroid/tap/lockmq davidgodefroid/tap/lox cosign
cd ~/projects # your project (with lea: lea's projects directory)
lox add lockmq # its questions, then the review; lea stop, then lea, if lea runs
lox run # in a terminal of its own, outside the agent
Then ask your agent: “which queues have no consumer?”. Catalogue calls answer at once; message reads wait for your approval in lox run. lockmq on GitHub
brew trust davidgodefroid/tap # once: Homebrew asks you to trust a third-party tap
brew install davidgodefroid/tap/lockfamily # or lockfile alone, with lox and cosign: brew install davidgodefroid/tap/lockfile davidgodefroid/tap/lox cosign
cd ~/projects # your project (with lea: lea's projects directory)
lox add lockfile # its questions, then the review; lea stop, then lea, if lea runs
lox run # in a terminal of its own, outside the agent
Plugins are installed into the console's home (lockfile plugin install format.is-pdf@1.0.0) and applied with :review in the console. Then ask your agent about a file by its exact key. lockfile on GitHub
brew trust davidgodefroid/tap # once: Homebrew asks you to trust a third-party tap
brew install davidgodefroid/tap/lockfamily # or lockhttp alone, with lea, lox and cosign: brew install davidgodefroid/tap/lockhttp davidgodefroid/tap/lea davidgodefroid/tap/lox cosign
cd ~/projects # lea's projects directory
echo LEA_LOCKHTTP=1 >> ~/.config/lea/lea.conf # opt-in: lea's gate asks the hub
lea stop --all # if lea runs: the gate starts with lea
lox add lockhttp # its policy
lox run # in a terminal of its own, outside lea
lea # in another terminal
Reads of trusted hosts go through; a post, an upload or an unknown host waits for your y in lox run (or a paired phone). A new endpoint is asked once per session.
With TLS decryption (LEA_LOCKHTTP_MITM=1), or plain HTTP to an internal host, a policy inject entry has the gate add an API's header for one exact host from its own secrets file, so the agent never holds the credential. lockhttp on GitHub
brew trust davidgodefroid/tap # once: Homebrew asks you to trust a third-party tap
brew install davidgodefroid/tap/lockfamily # or locklog alone, with lox and cosign: brew install davidgodefroid/tap/locklog davidgodefroid/tap/lox cosign
cd ~/projects/shop # the project whose logs the agent investigates
lox add locklog # its questions, then the review; lea stop, then lea, if lea runs
lox run # in a terminal of its own, outside the agent
Then ask your agent: “when did the 502s start?”. Counts, patterns and traces come back free and masked; a scan or an unmask waits for you in lox run. On the host, locklog is a trial for non-production data; for production, run the agent in lea or a container of its own. locklog on GitHub
brew trust davidgodefroid/tap # once: Homebrew asks you to trust a third-party tap
brew install davidgodefroid/tap/lockfamily # or lockssh alone, with lox and cosign: brew install davidgodefroid/tap/lockssh davidgodefroid/tap/lox cosign
cd ~/projects # your project (with lea: lea's projects directory)
lox add lockssh # host, login, key file, allow rules; lea stop, then lea, if lea runs
lox run # in a terminal of its own, outside the agent
A command an allow rule matches (systemctl status *, df -h) runs at once. Anything else is refused or, with exec = true, becomes a ticket you decide. Output comes back masked; the key stays in the console's account.
Its console runs hub-attached only: current lockssh releases need lox v0.12.0 or later (v0.11.0 was the first that knew lockssh). lockssh on GitHub
brew trust davidgodefroid/tap # once: Homebrew asks you to trust a third-party tap
brew install davidgodefroid/tap/lockfamily # or lea alone, with lox and cosign: brew install davidgodefroid/tap/lea davidgodefroid/tap/lox cosign
cd ~/projects # lea's projects directory
lea # the first run sets lea up
lox add locksql # per source; lea stop, then lea, brings it in
lox run # in another terminal, outside lea: approvals live here
lea runs coding agents: Claude Code by default, Codex and other providers too. Or use lea's own installer: curl -fsSL https://leadeck.dev/install.sh | sh installs lea only; lox add and lox run also need lox and cosign (v2.5.0 or later). In the first agent, sign in to its provider once (/login in Claude Code); press n for another agent.
lea shows no approval: when the projects directory declares Locks and no lox run serves them, lea says to run it, and the agents' requests wait. lea on GitHub
Known limits
- Everything, the hub included, is before v1. lockhttp and lockssh are pre-releases; locklog is an early release. lockhub, lea, locksql, lockmq, lockfile and lockkit may still change. The current release of each is in its formula in the Homebrew tap.
- Auto mode approves reads by rule: switch to manual (Shift+Tab) to answer every ticket yourself.
- The console is the enforcement point and runs hub-attached only; skills and tool descriptions only guide the agent. Masking is best effort.
- Chat facades never answer production tickets: a chat account is only as safe as the devices signed in to it.
Each project documents what the agent can see and its residual risks in its security model: locksql, lockmq, lockfile, lockhttp, locklog, lockssh, lea.