How it works

How lockfile works

Two sides in two OS accounts. Only the console touches the file.

The source credentials, the plugins, the fetched files and the audit log live in the console account lockfile. The agent side, in your own account, holds none of them and gets 1s and 0s.

Two sides

  • The console (lockfile console --profile P) is started by lockhub’s lox with its hub flags, in a container of its own. It serves the profile on a socket in /run/lockfile. Its plans are decided in lox run.
  • The agent side is the lockfile CLI (status, sources, plugins, plan, run, answers, release) and the lockfile mcp server with the same seven tools. It holds no secret, no plugin and no file.

The life of a plan

  1. The agent picks its questions. lockfile plugins lists the installed plugins: each one’s question and what 1 and 0 mean. The agent knows the exact key from you or from a ticket: there is no listing and no stat.

  2. The agent submits a plan. lockfile plan --key K --plugin X --plugin Y, or the lockfile_plan MCP tool.

    The console validates the request: the profile exists, the key is under its prefix, every plugin is installed and verified, and the count stays within max_plugins_per_handle. It then fetches the file once to hash it. The sha256 and size go only to the masked screen lockhub shows you, never to the agent; a file that cannot be fetched is told only after an approval, as fetch_failed.

  3. You decide. The plan becomes a ticket on lockhub: the canonical key (and a typed line when the agent typed it otherwise), each plugin with its question, version and marketplace, how many answers the plan reveals, and the file’s sha256 and size. The agent hears pending with the ticket. You answer it in lox run (y approves, n denies), or a lox run auto rule does; a plan with an unofficial plugin or typed values always waits for a human.

  4. The agent runs the ticket; the console fetches again. lockfile run TICKET. The file goes into a fresh 0700 workspace in the console account, and bytes other than the approved ones are refused (E_STALE). An object above max_object_bytes is refused while streaming.

    Any fetch failure (missing, too big, denied, network) reaches the agent as one code, fetch_failed. The cause goes to the audit.

  5. Each plugin runs in its own sandbox with the file as a read-only fd 3. It must write exactly 1 or 0 and exit 0. Anything else is plugin_error with result: null.

  6. The answers come back together, at the next multiple of answer_quantum after the run started. The agent gets a handle (f_…) for follow-up questions.

An approved ticket runs once, for the agent that asked, with the policy unchanged. The console keeps the plan 24 hours; a ticket that expired before its run is asked again as a new ticket for the same plan, which the agent hears as pending.

The approval screen

A first plan on a file

╭─ SAMPLES · file plan · 2 answers ─────
│ requested by uid 1000 (alice) · pid 48211 · exe /usr/local/bin/lockfile
│ agent: check the invoice reported as blank
│
│ key    invoices/2026/10/abc123.pdf
│
│ file.non-empty@1.0.0  (official)
│   ? Does the file contain at least one byte?   1 = size > 0   0 = the file is empty
│ format.is-pdf@1.0.0  (official)
│   ? Does the file start like a PDF?   1 = `%PDF-` appears within the first 1024 bytes   0 = no PDF header
│
│ this plan reveals at most 2 answers about the file
│ sha256 9f2c…e41a · 48213 bytes
╰─ pending: ticket 01J…

A follow-up on the same file

╭─ SAMPLES · follow-up on f_8Kq2xR · 1 answers ─────
│ requested by uid 1000 (alice) · pid 48211 · exe /usr/local/bin/lockfile
│
│ handle f_8Kq2xR (no new fetch)
│
│ pdf.parses@1.0.0  (official)
│   ? Does the file parse as a PDF without errors?   1 = pdfcpu reads and validates it (relaxed mode)   0 = parsing or validation fails
│
│ this plan reveals at most 1 answers about the file
╰─ pending: ticket 01J…

The sha256 line is on lockhub’s masked screen only: the console window and the agent never get a size, type, hash or path. A follow-up fetches nothing, so its screen has no such line.

A plugin from an unofficial marketplace adds a red ▲ UNOFFICIAL MARKETPLACE line, and its plan is never auto-approved.

From the agent’s side

# What can I ask?
lockfile plugins --json

# Ask: the answer is pending, with a ticket
lockfile plan --key invoices/2026/10/abc123.pdf \
  --plugin file.non-empty --plugin format.is-pdf --json

# Once the human decided it in lox run, run the ticket
lockfile run TICKET --json

# One more question on the same file, no refetch
lockfile plan --handle f_8Kq2xR --plugin pdf.parses --json
lockfile run TICKET --json

# What was already answered, then delete the fetched file now
lockfile answers f_8Kq2xR --json
lockfile release f_8Kq2xR
Agent commands and MCP tools
CommandMCP toolWhat
lockfile statuslockfile_statusthe running consoles’ state
lockfile sourceslockfile_sourcesprofiles of the running consoles (busy: waiting for the human or a run)
lockfile pluginslockfile_pluginsquestions, meaning of 1 and 0
lockfile plan --key K --plugin X…lockfile_planask the human to approve: answers pending with a ticket
lockfile run TICKETlockfile_runrun the decided ticket once
lockfile answers HANDLElockfile_answersanswers already given
lockfile release HANDLElockfile_releasedelete the fetched file now

Every agent command and lockfile mcp take --instance NAME, to reach one lock among several of this type. Without it, the one lockfile mcp server reaches them all and routes each call to the lock that serves its profile.

Exit codes depend on the outcome only, never on an answer: 0 answered or pending, 1 no console or error, 2 refused, 3 denied or no answer in time, 64 usage.

Refusals the agent can act on

Every refusal but E_FETCH_FAILED and E_STALE is computed from the request and the local install, before or without reading the file.

Each one carries a stable code, a static hint and a retry rule: rewrite the request, ask the user, or stop.

Refusal codes
CodeRetryMeaning
E_KEY_OUTSIDE_PREFIXrewritethe key is not under the profile’s prefix
E_UNKNOWN_PROFILErewriteno console serves that profile
E_TOO_MANY_PLUGINSrewritethe plan would pass max_plugins_per_handle
E_HANDLE_EXPIREDrewritethe handle expired or was released; plan again with the key
E_PLUGIN_NOT_INSTALLEDask the userthe human must install it
E_PLUGIN_YANKEDask the userthe marketplace withdrew that version
E_PLUGIN_TAMPEREDstopan installed plugin does not match its lock entry (lockfile plugin verify)
E_SANDBOX_UNAVAILABLEstopthe plugin sandbox is unavailable (lockfile doctor)
E_PROC_NOT_HIDDENstopother accounts can watch the plugins’ processes in /proc (lockfile doctor)
E_LITERAL_INPUTrewritea plugin input is bound to a literal value; bind it to a placeholder like ${email}
E_INPUT_INVALIDrewritea typed value does not fit its input, or is no longer held; plan again
E_STALErewritethe file changed since the plan was approved; plan again with the key
E_FETCH_FAILEDstopthe key could not be fetched (the cause is in the audit only)

In the console

The console prints each outcome as plan pl_…: answered or refused <code>.

The answers, causes, sizes and hashes go to the audit. Read it with lockfile audit [--since 24h] [--json], in the console account only.

Reach the console with lox attach NAME, then:

  • :review: apply a pending loosening (a plugin installed or a marketplace added while the console runs).
  • :status: the console state.
  • :quit: stop the console; fetched files are deleted.

More:

  • Usage guide: every command, profiles, the agent flow, MCP.
  • Security model: what the agent can see, the boundaries, the residual risks.
  • Plugins: the official marketplace and how to write a plugin.