Optional Pi semantic permission checks¶
This is an optional rung behind the existing irreversible-floor matcher, not a replacement for deterministic policy, a compliance approver, or an OS sandbox.
Configuration¶
Existing catalog entries without capabilities remain chat models. Decision-only entries are not eligible for session, cron or skill chat selection.
host:
permission_decision_model: foundry-permission
model_choices:
foundry-permission:
capabilities: [decision]
provider: microsoft
model: Decision-1-2
decision_api: microsoft-system-one
base_url: [PII_URL_224]
api_key_env: OPENAI_API_KEY
Unset fleet pointer disables this feature. Agents inherit the pointer; an agent
may set its own permission_decision_model catalog ID or off. Apply renders
~/.pi/agent/permission-decision.json (0600) alongside the existing catalog.
Secrets remain in the normal shared/per-agent secret environment; configuration
contains only the variable name. No automatic vendor/endpoint substitution occurs.
Supported explicit codecs:
| decision_api | API suffix | Authentication |
|---|---|---|
| microsoft-system-one | /systemone | api-key |
| typesafe-system-one | /systemone | Bearer |
| openai-decisions | /decisions | Bearer |
The configured HTTPS URL may be either the API root or exact endpoint. Microsoft and TypeSafe use named question/answer maps; native OpenAI Decisions uses arrays. The OpenAI adapter is not a Responses structured-output emulation.
Flow and safety¶
- Explicit deterministic allow/ask/block remains authoritative.
- Only genuinely unmatched native Bash/MCP tool calls reach semantic classification. Existing deterministic asks use the description branch only; their tier cannot be overridden by a model. Codemode wrappers/enumeration do not; native nested calls reach the same hook.
- The per-session bridge event bus asks the existing PII filter to redact bounded messages/operation text. Its identity map, in-memory memo, persisted verdicts and withheld cache are reused. Unchanged strings hit existing cache entries. Known environment credentials are stripped locally first. Tool results, attachments, images, encrypted reasoning and full transcripts are excluded.
- Native decision and a short description run in parallel. Description resolves
the full
PI_SKILL_MODELbundle in an isolated runtime, with no tools and a local Responsesnonereasoning mapping. Unsupported description APIs skip that optional branch rather than silently using a different provider. The description prompt names its audience — the owner, a non-technical reader — and requires the evidence limits to be stated in the same plain words: a long script whose bulk was never reviewed, a named file that does not exist, a file too large to inspect. - Semantic allow proceeds; ask raises the existing cockpit Allow/Deny card. A model block label alone does not prove a binding prohibition: until there is independently verified prohibition evidence, it also raises an ask. Existing deterministic hard blocks are unchanged.
- Provider/refusal/invalid-response/timeout/redaction failure retains the legacy unmatched baseline. This is recorded as fallback, not model approval. Cancellation is different: a cancelled pending action must not execute.
The rubric treats the agent as its owner's personal helper: normal authorized work, including local offline development, is normal work. Uncertainty asks; it does not invent signing authorities, governance requirements or hard blocks. A script carried directly in the operation's own arguments (not a script-preview evidence item, which stays governed by the truncation caution above) is not opaque merely for being a script: a complete, fully-visible body that only reads or adjusts local, non-persistent page state — DOM/data queries, scrolling, local style, console output — with no network call, storage/cookie write, form/input simulation or navigation, has established effects and may be allowed outright.
Evidence and limitations¶
Requests contain the proposed operation, at most six recent user/assistant text messages (8 KiB each), and an optional 16 KiB script-source preview sent to both native decision and description. Straightforward interpreter/file invocations are inspected read-only under the actual tool cwd. Symlinks, outside-cwd paths and non-regular/binary files are skipped; no execution, imports or recursive following occurs. Shell chains/substitutions are not guessed. Preview text uses the same PII memo, including existing read-text cache hits, and known credentials are removed locally. The transmitted preview stays within 24 KiB after redaction expansion — 1.5x the read bound, because placeholder substitution makes text longer.
The 16 KiB read bound is the auxiliary redaction deadline rather than any model context limit: the preview is one uncached string at the PII detector, and the whole auxiliary redaction has 10 s before the request loses both its description and its decision.
Three evidence kinds are distinguished instead of collapsed into no evidence:
| kind | when | carries |
|---|---|---|
| script-preview | regular file at or under the 4 MiB inspection bound | preview, SHA-256, size, line count, preview line count, truncation, scope |
| script-missing | no file at that path, with the nearest existing ancestor still inside the cwd | path, scope |
| script-too-large | regular file over the 4 MiB inspection bound | path, size, scope |
A path whose ancestor resolves outside the cwd yields no evidence at all, including when it is absent: absence is reported only where existence may be read. Line count covers the whole inspected file and preview line count only the quoted part, so a description can state how much of a long script nobody reviewed.
That hash identifies the inspected bytes, not a guarantee of execution-time identity: a script can change after inspection or during the owner approval wait. Imports, omitted source and dynamic effects remain unknown. Opaque scripts must be treated as uncertain; a filename is not behavioral evidence. There is no calibrated numeric confidence threshold or independent safety claim.
Approval cards show the generated explanation as their primary text and keep command/MCP arguments in a collapsed, keyboard-accessible native details section. Description failure preserves the deterministic reason and the same owner ask. Returned labels and complete finite probability distributions are validated.
This Pi interactive gate does not cover cockpit mini-app /api/mcp, unattended
CLI callers, direct OS/root actions, native script subprocess effects, or Claude's
separate runtime. It is not a filesystem/execution sandbox.
Audit entries persist decision status, effective action, model IDs, policy/input hashes, provider token usage and latency, never raw input or credentials. Descriptions use the existing durable auxiliary transcript lane so existing fleet rollups can count their usage. Decision pricing is explicitly unconfigured: native decision tokens are recorded in the audit, not assigned invented Azure prices or silently included in existing chat pricing.
Rollout¶
Publish/release/install/apply/restart are separate steps. This PR does not enable the production ledger pointer. Activate only after reviewing representative owner-adjudicated cases, fallback behavior, PII handling, and real sustained quota.
Live development probes are Foundry-only. TypeSafe and native OpenAI use fixtures
until an authorized configured endpoint supports those APIs. Foundry's tested
/openai/v1/decisions route returned 404; never substitute the public API.
First representative review (2026-10-25, kareem, piloting this rung). One
responsive-design QA loop (resize/emulate a viewport, read layout via
evaluate_script, screenshot it, repeat per breakpoint) produced 218 semantic
round-trips and 95 owner-facing cards in under five hours — 91 approved, 0
denied, 4 timed out. Repeat, near-identical resize_page/emulate calls landed
close to 50/50 between allow and ask under the rubric above, which is the
decision model guessing rather than judging: neither tool has a network call,
a write outside its own page, or any authenticated effect for the rubric to be
uncertain ABOUT. Moved both to the deterministic browser-resize/
browser-emulate exemptions in the irreversible-floor catalog instead of
loosening the rubric for them — they are decidable from the tool name alone.
evaluate_script stayed on this rung, since its risk is a property of its
content, and the rubric's opaque-script clause above was added from this same
review: real scripts in the sample only queried/scrolled/read the DOM, with
zero denials across the owner-adjudicated sample.