Limits and privacy
Product boundary
pi-delegation-policy requires Pi 0.87.1 or later and adds one policy while an active configuration is valid. It travels two ways in the same request: the marked block inside the system message, which the public context_with_system hook refreshes before each LLM request, and one message of its own right after the system message, carrying the same block and a revision: fingerprint. The second one is what reaches the model when a host keeps serving the system prompt it built at session start, and it is rebuilt on every request rather than stored in the conversation. The final provider request re-applies the current marked block inside the recognized instruction fields of the outgoing payload, so a host or another extension that replaces the system prompt afterwards cannot drop it; a payload whose shape is not recognized is left untouched, and that is the case the delivered message covers. Turning delegation and Advisor off removes both copies. The host system message, tools, context, other extension sections, and stored conversation are preserved.
The extension never launches children from hooks. Only explicit tools launch through the authorized external executor: context_shunt_delegate for a preserved artifact, and consult_advisor in tool mode. Default role mode leaves Advisor launches to the main agent. Neither replaces permissions, backends, delegation, or Pi's main model or thinking. There is no network telemetry or direct network client; the executor performs model calls. A content-free local log is described below.
Launch check
While delegation is active, or while an Advisor is enabled, the extension checks a subagent call before anything launches. It corrects the three cases that are unambiguous instead of refusing them by default (the global row can still be set to block, which refuses every call it would otherwise correct):
- a role name in place of a model (
small,medium,large,visual-design,ui-design,uidesign,advisor,advisor-1toadvisor-3, case-insensitive) becomes that role's exact provider/model with a level; - a role's exact model with no
:LEVELgains one: the role's fixed level, the lowest supported level inside its range, ormediumclamped to what the model supports when it has no policy; - a child whose model is exactly one configured Advisor's runs with that Advisor's profile, whatever profile it named or omitted;
- nothing is corrected or refused for the model's provider. A child keeps the agent it stated, and a model an extension serves resolves there because the child inherits your extensions; if it does not, the host reports its own error for that launch.
The correction is written into the call the host already validated, so it changes what executes; the stored transcript keeps what the model sent. The extension then appends a note to that call's tool result saying what it applied, so the agent sees the difference. Corrections apply per child and to a shared top-level model once; a call whose children would resolve differently, or whose model fits more than one role or Advisor, is refused instead of guessed.
Only a launch that names one of this package's own profiles is checked for its provider, because that profile loads a fixed package: the launch is refused when the model comes from another provider, or when the parent cannot confirm that package's managed install, an unlinked directory with one entry, and the package listed in your settings. Every other agent, builtin or yours, runs as stated. The allowed launches a refusal lists are the ones that would run: a role whose thinking policy its model cannot honour is not named there.
A subagent child inherits your extensions, this one included, so the providers and prompt extensions you use work there too. This policy stays out of the child: inside a subagent process it adds no policy block, no configuration notice and no reminder, and it holds, refuses or compacts none of the child's tool calls. The host's subagents.defaultExtensions setting replaces that inheritance with a fixed list; with it set, a child gets only what the list names, so a model whose provider is not on it fails in the host. Everything else is refused as before: a child with no model, a model that is not the exact model of an enabled role, a thinking level or Advisor profile it cannot settle, or an Advisor profile with a model that is not that Advisor's. Parallel tasks and chain steps are checked one by one, and one invalid child refuses the whole call; a top-level model applies to children that state none. Workflow scripts, inline, by path, by name or through options.script, are refused because their models live in code the extension cannot read: launch one child, use tasks or chain, or workflow: "parallel" with every model stated. Calls with action are management or control and pass; resume keeps the child's original model. A child that will run with an Advisor profile is refused if the call asks for context: "fork", because an Advisor answers from the brief the extension writes and never from your conversation. With delegation off and Advisor on, only Advisor profile launches are checked, and scripts are not.
The refusal lists the accepted launches. The check applies to every subagent tool call in the session, including ones other skills request: council mode, which uses a workflow script, is refused while delegation is active. Slash commands, RPC and schedules created earlier do not pass through this tool call and are not checked. The check sees only the call: it cannot decide whether work should have been delegated. An invalid delegation configuration refuses new ordinary launches until it is fixed; valid Advisors keep working.
A test mode refuses every corrected case instead, keeping the pre-correction behaviour for measurement. It is the global Launch correction row in /delegate, stored in delegation-policy.launch-correction.json next to the global defaults and described in the configuration reference.
Configuration change notice
An effective configuration change can add an ephemeral notice to the next user turn's request context, in addition to the current policy. Turning both delegation and Advisor off has a single exception to zero injection: one notice says they were disabled by this policy; subsequent turns inject nothing while both stay off. This does not revoke authority from the user, host, or another extension and does not itself cancel children or initiate a turn.
Pi converts the custom message to user-role text and drops its custom metadata. Its text identifies it as an extension notice, not something the user wrote. The extension does not write notice text to session history or its local log, so stored summaries and branches cannot inherit the notice. This is not a promise about request retention by providers or other authorized host components.
The presented revision is consumed at final settlement when the last recorded assistant response completed; a failed attempt followed by a successful retry counts as completed. A final reported error, abort, or unknown outcome preserves the change for another user turn. Pi has no public signal for an abort or exception after the last successful response and before final settlement: that accepted window can still consume a notice. A newer, unpresented configuration change is not consumed by the earlier response.
The Pi peer remains >=0.87.1. Notice hooks and conversion were verified against 0.87.1 public APIs and a synthetic registered-hook harness, not a full host process or later hosts. The harness encodes that host's input then before_agent_start order. No real-provider notice test, model-obedience measurement or provider-cache measurement is claimed. Configuration lists the tracked settings.
Advisor nudge level
The setting is advisorLevel: off, standard (the default), strict or guard. It replaces the old reminder setting, which is now read only as a fallback when the level file does not exist, and with Advisor off it has no effect. off leaves the written rules alone, standard adds a note every few tool results and refuses nothing, and strict holds every change of a task once several were made with no consultation, until an Advisor answers or the operator changes the level and sends a new prompt, or cancels the task. guard adds its own deterministic rules in front of that count, listed under guard rules. Those rules call no model. The optional reviewer is the one step of guard that does, and only when a model is chosen for it. Configuration describes the levels, the precedence and the file.
In standard, strict and guard an automatic note adds one short extension-owned line to the request context: after a count of tool results in standard, and once per run of changes made with no consultation since the last answered one in strict and guard. It is presented only while a valid Advisor is active, the task is live and the configured launch mode has its launcher among the active tools. An attempted consultation ends it for that task even when it fails. A control action that only names an Advisor is not a consultation.
The line lives in the request copy after the policy block and the configuration notice, never in the conversation, and it starts no turn, child or consultation. It adds no authority and revokes no instruction. It is sent to the provider, so it is not a promise about cost or retention, and it is not a guarantee that a consultation happens: a presentation is not evidence of obedience, and it can arrive after the first edit. It follows counts of tool results and of changes, never stdout, the user's words or a model's intent, and it is not a classifier of task complexity. Only the documented pi-subagents process markers (PI_SUBAGENT_CHILD=1, PI_SUBAGENT_RUNNER_PID) exclude a child; a /fork or /clone of a human session keeps the reminder, and a missing marker proves nothing, so the approved scope also covers foreground children that load this policy and can consult.
The level is stored in delegation-policy.advisor-level.json, schema 1, and a branch keeps its own session entry. An unreadable or invalid file falls back to standard with a diagnostic and never changes the delegation or Advisor axis, and the panel row then reads Invalid · standard instead of presenting the fallback as a choice. The extension writes no reminder text to session history or its local log. Configuration describes the row and the file.
Advisor checkpoint
In strict and guard the checkpoint refuses every state-changing call of a task once several were made with no consultation, and only an Advisor consultation that answers opens it. Reading always passes, and so does session control: asking the user, the task list and the supervisor channel are never changes, and neither is the wait tool under its default name bg_wait, so a held task keeps its way to a person; a wait tool the host renamed counts as a change like any other unknown tool. It never refuses when a consultation is not possible, and a ?? at the start of a prompt holds the changes of that task at any level, as long as an Advisor is available. At off and standard that hold ends with the first answer and no count starts afterwards.
In guard the checkpoint is preceded by its own rules: a closed set only the user can lift, a closed set an answered consultation lifts with a pass for the exact rule and target, and three trajectory holds. A refusal names the category and never a count or a pattern, and no rule acts in a subagent child session. Configuration lists them.
It is a nudge, not a security boundary or a sandbox. The extension decides what changes state from the tool name and the text of a shell command, which it never runs, and that reading can be wrong in both directions: a command it takes for a read may write, and a harmless one may be held. Test runs and builds count as changes, so an edit-and-test loop reaches the hold quickly. Nothing releases the hold automatically: a pair of consultations that reached an Advisor and failed tells the operator once per such pair, says the task stays held, and tells the model to ask the user and stop, and every change stays refused. Only an answered consultation, a level change with /delegate and a new prompt, or a cancelled task ends it, so these levels are not meant for unattended runs. A call that consulted nobody is not a failure and counts nothing. It grants no permission and inspects none. Configuration states the conditions and the refusal text.
Fail-closed behavior
In normal, aggressive, or orchestrator, Small, Medium, and Large must each be an explicit model reference or disabled, and at least one must be enabled. An absent ordinary role is not configured and produces D:ERR, as does any enabled reference that is missing, unavailable, out of scope, or unauthenticated, or no enabled ordinary role at all. A configured Visual Design reference is validated too. When one of these is wrong, the ordinary-role minimum is not met and delegation fails closed; the ContextShunt reader is unauthorized until the configuration is corrected.
Delegation and Advisor are validated separately. An enabled Advisor whose model, scope or authentication is wrong produces A:ERR when none is valid (A:PART when only some are valid), leaving valid delegation and an otherwise authorized reader available; invalid delegation does not suppress a valid enabled Advisor. With Advisor off, an unusable Advisor state is reported as a diagnostic while the footer keeps A:OFF. See errors by axis.
A configured thinking policy is validated locally against that role's resolved model. A well-formed level the model does not support is a D:ERR cause and injects no policy, and the diagnostic names the role, the level, and the model. A malformed thinking entry is a document error rather than D:ERR: it invalidates the whole document, so global defaults fall back to empty defaults and a branch falls back to off with a sanitized notice. A policy set for a disabled or unconfigured role is stored and inert and adds no error.
If the latest stored session entry is malformed or from a newer schema, restoration forces both delegation and Advisor off and keeps only a sanitized warning. Changes affect the next LLM request, not one already in progress. Role subagents remain host-owned; detected tool authorization changes cancel the extension-owned group.
Local data and privacy
The extension stores intensity, preference, Advisor mode, the Advisor nudge level, explicit disabled markers, provider/model identifiers, the optional ContextShunt configuration, and each role's thinking policy in local global defaults and Pi session entries. It never stores credentials, prompts, panel catalog metadata, or the thinking level chosen for an individual run. It sends no telemetry and makes no network request of its own.
Review local configuration before sharing diagnostics: model identifiers and provider names can reveal information about your environment. Remove credentials, prompts, personal paths, session files, and unredacted logs from anything you publish.
Advisor role
Advisor has no model by default and stays outside the ordinary-role minimum. Its entries, launch mode, and mode are configured in configuration. This section states only what a consultation sends and retains. The standard pi-delegation-policy.advisor profile has no Pi tools and inherits your extensions in a role launch; consult_advisor uses pi-delegation-policy.advisor-tool for a slot no packaged package serves, whose empty extensions: loads none (an admitted package or the Anthropic opt-in keeps its own packaged pair). Both profiles instruct the Advisor to advise and execute nothing.
tool is the default launch mode, and it also runs when no setting names a mode. In role mode the main agent launches each valid advisor and the extension only observes matching attempts. In tool mode the always-registered consult_advisor({ question?, brief?, evidence? }) launches one child per valid advisor through the public pi-subagents delegation API. It requires stable SemVer >=0.76.1, with no upper bound, and it rejects prereleases and invalid versions. Every launch must still pass the strict contract and terminal-binding checks, or it returns unavailable text. No model, provider or executor fallback is added.
Every consultation runs in fresh context, and the extension never adds the conversation. In the default context: composed the extension, not the model, decides what leaves the machine: it sends each Advisor's provider the user's literal request, the main agent's last two messages, the paths it read and edited, the commands it ran as program and subcommand with ok or error only, and the change it was about to make when a checkpoint held it back. That provider may differ from the main model's provider, and the same context goes to every valid entry.
It sends no command output, no command arguments, no file contents, no model reasoning, no system prompt and nothing from before the task, and the agent's messages in it are only the ones from the current task. The one exception to file contents is the change a checkpoint held back: its path, its line count and up to 3 KiB of the new text travel with the context, which for a write can be file content, and a sensitive path is withheld with only the path named. Obvious secrets such as private keys, common token formats and password=-style values become [redacted]. Each section is fenced with a random marker, the whole context is capped at 12 KiB, and past that cap the host drops commands, paths, agent messages and the earlier request before it shortens the brief, the evidence and the user request.
/delegate advisor context manual keeps the earlier behaviour, in which the main agent writes the question and, on a first consultation, the brief: the Advisor then sees only what that brief says, so a thin brief weakens the advice. What a consultation sends lists the sections, the per-section caps and the order in which they are cut.
A later call in the same task sends only what changed. A call that asks for context: "fork", on the child, in the call's options or at the top level, is refused when an Advisor is involved. One residual stays outside the extension's reach: a default such as defaultSubagentContext: "fork" lives in the pi-subagents configuration, which the extension does not read, so check it if this matters to you.
One pending call per tool: an advisor group launches one child per configured valid advisor, while the independent reader can run alongside it (at most four children). Abort, branch change, shutdown and detected authorization changes cancel the tool group. Partial results preserve a successful answer. Local timeouts and cancellation do not cap external generation, retries or cost.
Operator extensions in the Advisor child
An Advisor child extension is operator-chosen, exact-version admission only, and the parent registers it for the session before any launch. Once registered it runs as trusted host code inside the child, with your files and network, and nothing in the child checks it again. The host registers per session, so once an Advisor is enabled at session start or after a branch change, the layer reaches every local native child, the ContextShunt reader included, not only the Advisor children. A prompt layer can prepend its own text to the Advisor's system prompt, so the advice then reflects both the Advisor role and your instructions. Removing the file or the package stops the registration on the next session start, and a launch never expects an extension the host did not register.
Optional provider extension
The packaged pair pi-delegation-policy.advisor-anthropic-auth and pi-delegation-policy.advisor-anthropic-auth-read loads the installed managed-user @gotgenes/pi-anthropic-auth after a per-Advisor opt-in. Each profile configures one extension, the guard, which takes the anthropic provider with a transport that throws and hands it over only after that package registered its own: that is what stops a failed load from streaming through Pi's builtin anthropic transport, and it is the guard, not the absence of code, that provides it. The property lasts as long as the guard itself loads: the profiles list it under extensions:, so a missing or broken file of this package costs one Extension error line in the child and the session goes on, and that child resolves anthropic/<model> on the builtin transport. Listing the guard among the child's required extensions would make the host throw instead, and it is not done because that listing applies to the whole session: every local native child would load this guard, more reach than the two Advisor profiles need. The guard confirms the managed root, the exact package name, the absence of a link and a single internal entry; the parent adds two more — the package's presence in your own settings and that the path the profile resolves relative to its own file is that managed install — and it runs before any child. It reports the installed version without enforcing it. What the package brings is kept as far as a child can use it: its normal configuration, startup hook and provider aliases. Only provider registrations cross into the child; the package's tools, commands, MCP servers, renderers and every handler other than session_start stay on the guard's private loader, so its /anthropic-auth:status diagnostic is not available inside an Advisor child, which runs in print mode anyway. Trusted host code has its normal authentication and files, so the child holds the credentials this Pi installation holds for that provider, even though the tool-free half declares no model tools and the reading half only read. This is not a sandbox or a metadata-only extension.
The guard protects the two profiles that name it. An agent of your own or of the project that declares subagentOnlyExtensions for a package serving a provider Pi also ships as a builtin has no guard, so a failed load there falls back to the builtin transport quietly. This extension checks the install of the profiles it launches and cannot see what another agent file loads, so that case is outside what it can refuse.
Only that installed entry is loaded, and other configured extensions are not inherited. A missing or unconfirmed package leaves that Advisor unavailable with the cause named by the parent, and a package that vanishes between that check and the child's load leaves the guard closed, so the call errors instead of falling back to the builtin transport. The check does not sign code, does not compare a version, and does not eliminate a resolution-to-load race. What the guard assumes of the host is that extension provider registrations are applied before the model is resolved, verified on pi-subagents 0.89.1; the admitted floor is >=0.76.1 with no upper bound, so older builds are not covered by that evidence. Withdrawing the previous pass's aliases needs pi.unregisterProvider on that host's extension API: the installed build has it, its presence across the floor is unverified, and a host without it serves the pass that registered the aliases and throws on the next session_start that has them to withdraw, after the transport was already cleared, which fails closed. Configuration lists the supported installations and why a downgrade to 0.22.2 silences all Advisors when an opt-in is saved.
An admitted provider extension works the same way for any other provider, with a weaker check: only its installed identity and listed user source are verified, and only in the parent. The child does not revalidate the package, because it has to load it to resolve the model at all. Once the host loads it, it is trusted host code with your files, network and its own accounts. The admission applies to every session. A packaged profile names one package and is the only way tool launch can load it; role launch needs no admission because the child inherits your extensions. A second package therefore runs in role launch as trusted host code, but tool launch keeps the standard tool profile.
The execution child of a provider extension
When an ordinary or optional role runs on a model a provider extension serves, the launch check writes the packaged execution profile that loads that package (configuration). That child has tools, unlike an Advisor child, or the packaged read-only profile when the builtin it replaced was read-only, and what it can actually do was measured on 2026-11-27 against pi-antigravity-acp-provider 0.1.22:
- Pi tools go through the provider's MCP bridge. The provider starts a loopback
pi-bridgeMCP server and Antigravity calls the child's Pi tools through it. The bridge is built only when the host hands the provider tools for that request and the agent it drives advertises MCP over HTTP, so a child where either fails is declared no Pi tool at all and works with the provider's native tools alone, as the reading Advisor did on 2026-11-24. Those calls only complete while the provider's permission mode does not ask. With an asking mode the provider turns the request into its own permission tool, and a headless child cannot answer it, so every tool comes back denied. The mode that does not ask is/antigravity-acp permissions yolo, and it applies to the whole Pi agent directory, parent and every child alike. - A PreToolUse hook that asks has the same effect. Antigravity's own pre-tool hook layer can return an ask before the bridge call is ever made. Nothing in a child can answer it, so every tool is denied while that hook matches.
- Antigravity keeps native tools that Pi cannot see. Tools such as
view_filerun in Antigravity's own loop, bypass Pi's tool list and Pi's permission system, and cannot be disabled from Pi. That includes the Advisor child whose Pi tool list is empty, and the ContextShunt reader. - The packaged profiles that must not change state say so themselves. The Advisor profiles, the reading Advisor, the ContextShunt reader,
bulk-readerandreader-antigravity-acpopen their system prompt with a fixed environment rule: never create, modify, move or delete a file, and never run a command, with any tool at all, the Pi tools or a native tool of the provider, and refuse and report that step, with no exception the task can lift. The writing profile is the one without it. This is an instruction the model follows, not a block: the native tool still exists. On 2026-11-28, withyoloas the provider's permission mode, a child onreader-antigravity-acpwrote a file withwrite_to_file, and the same child, given the rule, refused that step and wrote nothing, verified on disk.
So the execution profile bounds what Pi hands to the model, and that rule narrows what the model does with what Pi cannot see. Neither bounds what Antigravity does on its own: the package is trusted host code rather than a sandbox.
Local content-free log
Records are written only while a policy block is active; both delegation and Advisor off produce no events, except records written in the short window before the next request notices that the policy is off. Content-free events go to ~/.pi/agent/delegation-policy.events.jsonl (or Pi's configured agent dir): time, extension version, SHA-256 policy-block hash when it changes, intensity, Advisor modes, context and count; consultation model IDs, status, context and duration; one task summary per main-agent task from a user prompt to the next settle (duration, tool calls, edits, the position of the first edit and of the first consult, whether the consult came before the first edit, subagent launches and refusals); one launch record per subagent call that launches children (allowed or refused, a closed refusal code, child count, one role code per child, and the closed kinds of correction applied); an allowed record with no children appears only in that off window and still counts as a launch, while a refusal (for example a workflow script or a parallel call without tasks) can also carry no children. Consultation, task and launch records repeat the policy hash they ran under. A task record also carries mainModel, the exact provider/id key or null, and advisorLevel. A consultation record also carries mainModel, advisorLevel, noArgs, which is true when the model passed no question, brief or evidence, and contextBytes, which is 0 in manual mode. One completion record is written for every report a held task reads from the completion channel the bridge advertises, with a closed status and nothing else: answered, failed, ignored, unreadable when the reading threw before anything was applied, notice-failed when the verdict was applied while the operator notice could not be delivered, or channel-missing once per session whose bridge admitted no completion channel, which is why that session is told to consult in the foreground. One gate record is written per task whose gate opened, which is a strict or guard task or any task a ?? prompt opened, including a task that ended by a branch move or by shutdown: endReason (settled, branch-change or shutdown), changes (counted since the last answered consultation), totalChanges, holds (refused changes), answers, failures, ruleHits (refusals by guard rule, by closed code, a code that never fired is absent; engine-failure is the code for a guard that could not judge the call at all), passes (calls a consultation pass let through), notes (notes presented), mainModel, advisorLevel, and the four reviewer counters of the next paragraph. Every field is an enum, a boolean, a number or a bounded identifier such as the policy hash and model keys. advisorConsults counts attempts: a consult_advisor call counts whether or not it reached a model, and its real outcome is the consultation event. subagentLaunches counts allowed calls that launch a child other than an Advisor: a call that launches only Advisors counts as a consult, a mixed call counts as both, and a refused call counts only as a refusal. Role observations are attempts, not proof of completion; duration zero means unknown. Questions, briefs, answers, conversations, project paths and raw errors are excluded. Writes are serialized, rotate at 256 KiB to one .1 backup, and failures never break a request. Shutdown drains queued writes for at most five seconds, then drops remaining work. An in-flight filesystem operation may finish later, but starts no further operation. /delegate status reads this log back, and only this log: it tails the current file and its rotated predecessor, bounded to the last 4 MiB of each, and reports allowed launches per role plus a refusal count. The tail can cut a line, which is skipped, so the report may undercount and never invents a record; a missing or unreadable log reports launches=none recorded. Reading it changes no file and touches no launch. The guard report script in the repository is the other reader: it summarises the gate and completion records of a log file and its rotated predecessor (tasks by end reason, the counters, ruleHits, the reviewer counters and the closed status of each completion) and prints nothing else from the log.
A reviewer record is written per review the guard reviewer runs or skips: turn (the assistant message it ran in), tool (the tool name, reduced to an identifier token), stage1 (block, allow or null), stage2 (one of the five closed categories or null), status (ok, cached, skipped-cap, unparseable, timeout, error, internal or off), stage1Ms, stage2Ms, inputBytes of the JSON data block, model, mode, lane (observe, pass, unreviewed or refuse, which is what the extension did with the outcome) and target, which is a 16-hex digest of the tool and its normalised target salted once per session, so no path or command line is stored and two sessions cannot be joined on it. The same task's gate record adds reviewed (reviews that started a request), wouldBlock (block verdicts, including the ones answered from the task's memory), noVerdict (reviews that concluded nothing) and cacheHits (pairs answered without a call), plus blocked (calls a block refused), reviewPasses (calls an Advisor answer's pass let through, apart from the rules' own passes), unreviewed (calls the failure lane let through), unavailable (calls it refused) and escalations (times a task stopped after three refused changes in a row). The target a verdict, a pass or a block is keyed on is the tool and the normalised target, never the content: the several spellings of one path (./a, a/./b, a/x/../b, and the case of a drive path) collapse to one pair, and one ALLOW covers every later call to that path in the task. The workspace rule of the failure lane reads the two strings only: it places drive-relative paths, another drive, network shares and home shortcuts as outside, and a link inside the workspace that resolves outside still reads as inside, because no hook in this extension touches the disk.
The nested call a consultation starts
pi-subagents makes one nested subagent_launch call before it starts each workflow child. The fields observed in 0.89.1 are workflowRunId, key, agent, task, cwd, model, async, worktree, resume, commands and output; a thinking level is a suffix of model, not a field of its own, and commands appears only when it would carry something, because that version writes it only for a non-empty list. guard reads that call only to tell a child of a consultation from a change. It accepts the six fields a verified child carries (workflowRunId, key, agent, task, model, async), plus this session's own cwd. An empty commands list is accepted too, but that is this code allowing for a shape the host does not send rather than one it observed. Anything else is a change, so a version of pi-subagents that adds a field, or a child with a worktree, a resume, commands, an output path or another directory, stays a change instead of being trusted.
The exempt child is bound to the Advisor slot the launch verified, by the packaged profile name, that slot's own model and the thinking level the launch asked for, one child per slot and level, and a repeated launch finds no entry left. A child that inherits the call's own top-level model is bound by the model the launch check resolved for it, so an admitted consultation keeps all of its children. A background run is named with an id of its own rather than the call's, which is why the slot and not the id decides there. The binding lives until the task ends, the branch moves or the session closes, and lifting the hold is never part of it: only the host's own report of a finished run does that.
No network telemetry is sent; model identifiers can still be sensitive.
The writer serializes within one process, not across processes; concurrent sessions share no lock. Role observations cover exact packaged agent targets, including tasks arrays, not arbitrary workflows. Preflight binds the tool session identity; the public request API cannot prove that the live executor uses the same session. Terminal mismatch can reject an answer only after context exposure. This check validates a declared contract, not a sandbox or an executor signature.
Retention
Questions, briefs, composed contexts and replies can persist in executor argv, temporary files, sessions, lifecycle records and at each provider. No deletion, external TTL or absence of cost is promised. Turn Advisor off when session content must not reach those providers, or use /delegate advisor context manual to keep the request, the agent's messages and the change it held back out of the context. Local log rotation is not an external retention policy.
ContextShunt limits
ContextShunt starts off. In that mode its hooks return immediately without classification, metrics, artifact I/O, or changes. observe simulates the same admitted-request window as enforcement but returns the original call and result. enforce consults Pi's public getAllTools() provenance and blocks only built-in known declared oversized ranges: native read, and a deliberately narrow Get-Content/gc form with -TotalCount or -First accepted on the bash and powershell tools. Declared limits count lines only, and rejected calls do not consume or renew the shared tool-and-declared-path window. Same-named SDK or extension tools remain unchanged; observe may report those names only as non-binding heuristics. Composite commands, redirects, pipes, unbounded shell reads, user ! commands, and unknown or replaced tool contracts are not rewritten or preblocked.
After an authorized tool runs, enforcement considers only one-block successful text results from recognized read, bash, powershell, or grep contracts. It counts UTF-8 bytes and LF, CRLF, or CR lines from the returned text, then preserves the original before returning a compact message. A valid read offset is 1-indexed; invalid offsets stay with the original tool. Errors, valid JSON text of every root type, images, binaries, mixed blocks, and unrecognized contracts remain intact. Preservation failures, quota exhaustion, and cancellation leave the original result intact, and commands are never run again.
Artifacts have opaque random IDs and live in a private process temporary directory, capped at eight artifacts and 512 KiB per session. Each artifact expires 30 minutes after creation; scheduled cleanup runs while the process is active, recovery does not renew the expiry, and shutdown cancels cleanup and removes the temporary directory. A crash or operating-system suspension can delay cleanup until the process resumes or the OS removes its temporary data, so this is not a guarantee of deletion after the process stops. Recovery accepts exactly one bounded line or byte range, and neither status nor metrics expose source paths or corpus.
These bounds are not a sandbox, an access-control system, or protection against every prompt-injection or output route.
An oversized recognized call can be narrowed or granted once only through an explicit user command tied to the matching input, tool call, requested range, and a one-minute expiry. The line limit applies to the declared range and the byte limit to the real returned result. At most eight consumed authorizations are retained; an evicted, changed, expired, cancelled, agent-ended, branch-changed, or terminal result uses the ordinary post-result limits. Pending user-authorized tokens survive a normal agent end until their expiry. This fixed safety bound has no configuration setting, and content from a model cannot create an exception. Nothing starts the reader from a hook: it runs only when the agent explicitly calls context_shunt_delegate.
ContextShunt reader
The inline reader is opt-in and off by default: contextShunt.readerEnabled resolves to false. A call is authorized only with an effective mode of enforce, an active delegation intensity, a valid configuration, and the ordinary role named by contextShunt.readerRole enabled with an available model. In any other state context_shunt_delegate returns a bounded error and no answer, and nothing is launched.
The launch uses the packaged profile agents/pi-delegation-policy.context-shunt-inline-reader.md: fresh context, empty tools: and extensions:, a replace prompt, no project resources, and the internal structured_output tool as its only surface. It analyzes the supplied snapshot and cites only the ranges it was given. It cannot read files, run commands, delegate, or see the conversation. context_shunt_delegate launches it through the external executor, and nothing launches it from a hook. The package also ships the guided pi-delegation-policy.bulk-reader profile for discovery by a compatible executor. This extension never installs it into user agent directories and never launches it.
Input is validated before anything is launched:
artifactId— the opaque ID of a live preserved artifact.question— required, not empty, at most 2048 UTF-8 bytes.thinking— required; one level the reader role's resolved model supports.
The answer comes only from the preserved snapshot of that one artifact. It carries a status, a short answer, and at most 16 citations to exact line ranges of that snapshot. answered requires at least one citation, and insufficient-evidence carries none. A citation to another source, an out-of-range or repeated range, a blank answer, or any other JSON shape is rejected as invalid-answer and never reaches the agent.
The serialized tool result — answer, citations, and envelope — stays within contextShunt.answerMaxBytes (1024 to 16384, 8192 by default). A validated answer over that cap is preserved as a separate artifact and returned as a receipt carrying its ID, which context_shunt_recover reads back with one bounded line range (lineOffset, lineLimit) or byte range (byteOffset, maxBytes). The extension does not truncate JSON or citations and never returns a raw executor response. If the answer cannot be preserved, the result is output-unavailable and the source artifact stays as it was.
Failures use bounded codes that carry no paths, content, or secrets:
| Code | Meaning |
|---|---|
invalid-request | The input is missing, empty, over a cap, or uses a level the reader role's model does not support. |
evidence-expired | The preserved source is gone, so no answer is returned without recoverable evidence. |
invalid-answer | The reader result failed the approved contract, the source ID, the line ranges, or the citation cardinality. |
output-unavailable | The call is not authorized, or the validated answer cannot be preserved within the cap. |
reader-unavailable | The external executor is absent, below the stable SemVer minimum, or contract-incompatible. |
reader-busy | Another context_shunt_delegate call is in flight. |
reader-cancelled | The request was revoked by a branch change, by applying or discarding a panel draft, by off or reset, or by session shutdown. |
reader-timed-out | The request used its whole local time budget. |
reader-failed | The executor failed, or its launch contract did not match. |
One context_shunt_delegate request may be in flight at a time.
What one request sends
The reader task carries the preserved snapshot text, its opaque source ID, its line count, and the question. It carries no conversation, no other tool call or result, and no other artifact. The launch payload that the external executor receives also carries the working directory, the reader profile's name, the model and the thinking level for that call, and opaque request, run, and node identifiers that correlate the launch with its result. The snapshot is sent during the preflight that resolves the launch contract as well, before any launch.
Both the snapshot and the answer are untrusted data rather than instructions. The extension never follows text inside them and never executes it.
The reader requires stable pi-subagents SemVer >=0.76.1, with no upper bound. Prereleases, invalid versions and older builds, including 0.69.0, return reader-unavailable before REQUEST. Every launch must still pass the unchanged strict contract checks: the version floor does not promise future-build compatibility. The reader was verified with 0.76.1 on Pi 1.1.0; Pi 0.87.1, the declared minimum, is not verified for the reader. There is no fallback model, provider, or retry.
The reader also accepts the host's permission runtime described below. Builds up to 0.18.0 reject any extra runtime, so with host permission rules their reader returns reader-unavailable.
The contract check accepts a child that loads only the packaged prompt runtime. It also accepts that runtime followed by the exact @gotgenes/pi-permission-system 33.0.3 entry, which the host adds when it has permission rules. Any other extension, another version, a reordered or duplicated list, or a child that inherits global context fails the check. If the permission package is not installed, the reader uses the prompt-only launch. If the host adds a permission entry whose package, version, or manifest does not verify, the check rejects it.
The host owns its permission rules. The reader never reads, copies, normalizes, or changes them, and it never grants itself an exception. A default ask decision can block a headless child that has no authorizer; the reader then fails closed and does not fall back to another model, provider, or launch. In isolated synthetic runs, a child that the host allows only for structured output completes. When the host asks or denies that output, the reader fails closed, with no accepted answer and no second delegation request. An ask decision can make two model calls inside that one request. Neither the reader nor the request sets a ceiling on generation, retries, or cost, and the local timeout does not limit them.
The host may append its own tool-surface block to the child's system prompt. In those synthetic runs the block held exactly Pi's two universal guidelines, and the child prompt gained no project context, skills, resources, or source text. The working directory in that prompt comes from host metadata, not from the tool's model-supplied arguments. The child model can call only structured_output, and the host may remove or deny that tool.
This is an exact compatibility check for one verified runtime, not a support guarantee for the host. The verified combination is pi-subagents 0.76.1 on Pi 1.1.0, with a synthetic loopback provider. A real provider, personal permission rules, and Pi 0.87.1 were not tested with this reader. The runtime the host loads is trusted host code, not authority granted to the model. Version labels and digests are not signatures: the digests check only their format. The preflight is bound to the session of the tool's context. The public API does not show that the launch request runs in that same session, so a mismatched terminal digest rejects the answer only after the snapshot has been sent. The check confirms the contract the executor declares, not the executor's code.
Retention
The preserved snapshot and the answer may persist in the executor's argv, temporary files, sessions, and lifecycle records, and at the model provider. The project promises no deletion, no external TTL, and no absence of cost. A failed reader call leaves no answer artifact.
Panel and status limits
The panel shows a compact preview, one row per setting, and a hint block with the focused row's explanation and sources. Model selection presents the model ID first and [provider] last, and can show transient public metadata that the extension never persists.
/delegate status shows exact effective references and provenance (default, global, or session), one thinking-<role> token per role, and sanitized diagnostics. D:NORM, D:AGG, and D:ORCH mean local validation passed; they do not prove that a delegated launch occurred or that another system followed the guidance.
Reporting vulnerabilities
For an undisclosed vulnerability, use GitHub's vulnerability reporting page; do not open a public issue. Include the affected version or commit, operating system, Pi version, reproduction steps, expected behavior, observed behavior, and a minimal sanitized configuration. For ordinary changes, read the contribution guide.
More information
- Getting started installs and configures the extension.
- Configuration defines policy values and inheritance.
- Commands and status explains operation and diagnostics.
- Source repository
- Package on npm