What the agent reads
A refusal reads as a real terminal’s. The reason travels beside it.
The reason is on the result’s
decision, never in stderr:
policy denied: <reason>,
or requires approval: <reason> (ask <id>). A hidden path adds nothing,
here or in explain: the agent never learns it exists.
Which tools the agent gets
session.tools.names() lists only the tools the session’s profile leaves
it: shell needs a command the allow list allows, ls and grep
those commands, write and edit a mount the session may write. MCP,
RPC and the agent adapters offer exactly those, so an agent is never
offered a tool every call of which would be refused.
Explain
Explain asks every policy about a line or a VFS call and returns their answer. Nothing runs, nothing is written and no ask is spent.explain.vfs has the same 23 calls as session.vfs. An agent can ask
too, through MCP, HTTP, RPC or the CLI:
Every entry point returns the same JSON schema. Explain reads the line only, so
stdin,
cwd, runtime and a background job are refused with it.
What it evaluates
Explain stops before anything runs, evaluating only pre-execution checks:
The
post_ methods need a result. A line’s file calls reach pre_vfs only
when the line runs; explain a specific VFS call to see its admission result
without executing the line.
What comes back
With a profile that denies/data/keys/*:
A line adds
exit_code and stderr, what the agent would read, and
node, the line as a tree of commands. Each command in the tree has its
own outcome, answers, exit_code, stderr, runtime and words,
the command line word by word as policies read it (see
Context). Under an @line runtime, every
command’s runtime names it. A program only @external takes (make, gcc) names the runtime
that takes it.
A line
mirage shell --explain prints the tree:
outcome, exit_code and stderr are what holds the whole
line before any of it runs: a pre_execute answer, or a profile rule on
any command, the first such command giving the line its answer. A refusal
met only when its command runs shows on that command alone, and the line
stays allow: a word missing from the allow list, and a policy’s
pre_command answer.
Limits
- A hidden path explains like any path no rule names.
- A policy that reads a file to decide still reads it.