Configuration
Quick valid configuration
The safest route is to open /delegate, choose exact models from Pi's available catalog, and apply the draft. In an active policy, every ordinary role needs an explicit decision: an exact, authenticated reference or disabled; at least one ordinary role must be enabled. Visual Design and Advisor are optional and do not satisfy that minimum.
Global defaults live at ~/.pi/agent/delegation-policy.json and are written in schema version 7:
json
{
"schemaVersion": 7,
"intensity": "normal",
"preference": "standard",
"small": { "provider": "example-provider", "model": "example-small" },
"medium": { "provider": "example-provider", "model": "example-medium" },
"large": null,
"uiDesign": { "provider": "example-provider", "model": "example-ui-design" },
"advisor": { "provider": "example-provider", "model": "example-advisor" },
"thinking": {
"small": { "level": "high" },
"medium": { "min": "low", "max": "high" }
},
"contextShunt": { "mode": "off" }
}The references are fictional. The example is the schema version 7 format that 0.16.0 writes and that the extension still reads as inherited input; a current save keeps advisor and advisorMode out of this file and stores them in the companion described under persistence. An absent setting inherits in a session or is not configured without a global value; an exact { "provider", "model" } reference enables an ordinary role; null explicitly disables it. Global uiDesign and advisor, when present, are exact references; only a session override may use null to disable that optional role.
thinking is optional and holds at most one policy per role. Omitting it, or omitting a role inside it, changes nothing: the main agent chooses that role's level for each launch.
Global defaults, session inheritance, and saving
Global defaults are spread over their files. The schema-7 delegation file holds intensity, preference, tri-state ordinary roles, the uiDesign key, the ContextShunt configuration and thinking policies per execution role; the Advisor companion and its extension hold Advisor 1, Advisors 2 and 3, advisorMode and advisorLaunch (persistence). If global intensity is absent, the built-in default is off. Preference defaults to standard, Advisor mode defaults to with-delegation, and Advisor launch defaults to tool.
A branch inherits a global value until it records an override. Use global default removes the branch override. A session null wins over a global model, and a session model wins over a global null. A session thinking null keeps no policy for that role in the branch even when global defaults set one. Sources are reported as default, global, or session.
Apply to this conversation (A) changes this conversation only. It appends entries to the current branch and never writes a shared file, whatever row changed. The values that also have a file of their own (the optional role entries, the guard rows, launch correction, and the Advisor reading and content-filter flags) travel in one branch entry, pi-delegation-policy:session-overrides, which every Apply writes whole; the nudge level travels in pi-delegation-policy:advisor-level. A row whose value comes from this conversation ends in · session, and Use global default drops that value again.
Save as defaults (S) is the only action that writes the shared files. It copies the effective configuration, including ordinary null values, the effective thinking policies, and the configured ContextShunt mode even while delegation suspends it. Before it writes it names the values it promotes and the files it writes, and it takes Y only: any other key answers “Nothing written yet. Y saves, Esc keeps editing.”, and the question stays answerable on a small terminal. It reads each file again just before writing and changes only the keys it saves, so a per-model nudge level, or a value another session wrote meanwhile, is kept. After a successful save the branch drops its own copies and inherits the new defaults. A role with no effective policy is written without one, never as null.
Admitting a provider extension is the one choice that is never per conversation: it decides which installed code may run, so it is stored for every session where you make it, after its own confirmation, and is not part of Apply. /delegate reset writes off for both intensity and Advisor mode and returns the other fields to global inheritance; Reset to off is only a draft until Apply.
Configuration change notice
A change to effective delegation settings adds one extension-owned notice to the requests of the next user turn. It names the previous and new intensity, preference, role models, thinking policies, Advisor settings, or ContextShunt mode and reader settings. It explicitly directs new work to the current valid assignments rather than older settings in the conversation. Changes to global defaults count when they reach the branch; opening or cancelling the editor, identical saves, and changes reverted before the turn do not produce a notice. Enforcement limits and path patterns are not tracked by the notice.
The notice is request-only, not a saved conversation message or part of system policy. It stays the same across the requests and retries of that turn. A change during a running turn updates the policy immediately as before and waits until the next user turn for its notice. Completing the earlier revision cannot consume a later change that has not been shown. Session starts, reloads and tree navigation reset the reference silently; extension-generated prompts do not consume pending notices.
Turning both axes off produces one notice: Delegation and Advisor disabled by this policy. After that, neither policy nor notice is injected while both remain off. An enabled but invalid Advisor is not described as disabled. The notice changes no other authority, permission or model, and it cannot guarantee obedience. Limits and privacy explains consumption, the accepted cancellation window and the verified host boundary.
Roles and validation
Active execution-delegation guidance requires each ordinary role to be an exact authenticated reference or disabled, with at least one enabled. An absent role is not configured. Any of the following produces D:ERR and removes execution-delegation guidance:
- an ordinary role with no value;
- an enabled reference that is missing, unavailable, out of scope, or unauthenticated;
- no enabled ordinary role;
- a configured thinking level an ordinary role's resolved model does not support, reported with the role, the level, and the model.
Disabled roles are not validated, and a configured Visual Design reference is validated whenever it is configured. Every optional entry is validated too, but an unusable or non-image entry is a warning that costs only that entry, never the delegation axis. A thinking level an optional entry's model does not support is one of those warnings, and so is the mirrored document thinking.uiDesign of Visual Design entry 1: neither produces D:ERR. The extension has no model fallback and never substitutes a role, model, or level. A policy set for a disabled or not configured role is stored and inert until that role is enabled again, and adds no error.
Thinking
The main agent chooses thinking for every delegated task from demand, difficulty, quantity, risk, error and review cost, and the selected model's capabilities. That per-launch choice is the default, and the extension neither stores it nor reports it.
A policy per role is optional and has three states:
- Unset (key absent) — the main agent chooses the level for each launch.
- Fixed (
{ "level": "<name>" }) — every launch of that role uses exactly that level. - Range (
{ "min": "<name>", "max": "<name>" }) — the main agent chooses a level inside the inclusive bounds.
Level names are off, minimal, low, medium, high, xhigh, and max, in lower case. A range whose min and max are equal is normalized to a fixed level. A configured policy is binding for that role and cannot come from an ambient launcher default or from another role. With pi-subagents the launch carries model: "provider/model:LEVEL", where a fixed policy appears as its literal level; another launcher may expose a separate per-run field.
A thinking entry outside those three states is a malformed document rather than a policy error: an unrecognized level name, an empty or malformed policy object, a min above its max, mixed or unknown keys, a non-object, an unknown role key, or null in global defaults. Global defaults then fall back to empty defaults with no injection, and a session branch falls back to off with a sanitized notice; neither case produces D:ERR.
Intensities
offreportsD:OFFand removes execution-delegation guidance before the next LLM request. An explicitly enabled Advisor keeps consultation-only guidance; with both off no policy block is injected. The change notice has the one-turn shutdown exception described above. A request already in progress and subagents already launched are unchanged.normaldelegates substantial, separable work only when the expected benefit clearly outweighs briefing, supervision, review, and integration. Borderline work stays with the main agent.aggressivedelegates suitable substantial, separable, independently checkable work by default when its objective and acceptance criteria are clear. Tightly coupled work or clearly prohibitive overhead stays with the main agent.orchestratordelegates all transferable execution before performing it whenever an enabled capable role and an authorized launcher are available, regardless of size. This includes small lookups, code reading, detailed planning, implementation, testing, writing, detailed review, and integration mechanics. Bootstrap is limited to mandatory instructions, tool discovery, and a narrow assignment scope; it must not pre-solve or broadly inspect the repository, and small tasks are grouped without recursive fanout. After assigning, it must not take the task over or run an equivalent worker while it is pending: it coordinates only disjoint work, waits through the host, and consumes the result before dependent work or finalizing. It retains strategy, objectives, critical user decisions, coordination, safety, evidence evaluation, final acceptance, and concise synthesis; that responsibility does not permit performing transferable review or integration. It reinspects only a concrete gap, risk, or contradiction, then delegates transferable fixes and rechecks. Direct execution is allowed only for genuinely non-transferable work, no enabled capable role, a confirmed unavailable authorized launcher, or an explicit user or higher-priority requirement, stated briefly before the minimum direct work. Size, triviality, convenience, economics, transfer cost, a final-review or integration label, and familiarity are not exceptions.
In normal and aggressive the main agent also retains global strategy, coordination, integration, and work whose essential context is too costly or risky to transfer.
Preference and role selection
The policy considers demand, difficulty, quantity, risk, acceptance criteria, evidence, and review cost. It first removes disabled roles, then chooses the least costly enabled role that can satisfy the work. A more capable enabled role may cover work normally suited to a disabled role only when it can meet the same acceptance and evidence. If no enabled role is sufficient, the main agent keeps the work.
- Small handles bounded, planned, and verifiable execution. Difficult but well-defined work can stay Small with higher thinking.
- Medium handles planning, ambiguity reduction, broad synthesis, several modules, comparison, context coordination, or difficult decisions. Small does not need to fail first.
- Large is exceptional while Small and Medium are enabled alternatives; in a partial configuration it may cover other delegable work only when it is the least costly enabled role that can satisfy the same acceptance and evidence.
Large quantities of repetitive independent work favor multiple Small delegations. Volume alone does not justify Medium or Large, and agent type does not determine the role.
efficient breaks a credible Small/Medium tie toward Small, intensive breaks the same tie toward Medium, and standard adds no bias. If Small or Medium is disabled, all three preferences are inert: they never redirect work to Large or another role.
Child briefs
While delegation is active, the block asks the main agent to write each child's brief before launching it: the bounded outcome and its owner, the context and invariants already decided, the scope and permissions with the exclusions, how the result is verified and accepted, what the child returns and where it goes, and when it stops to ask. An unresolved decision stays a question the child may answer, not a settled invariant, and a host agent name such as worker or reviewer does not stand in for the model role or grant a permission. A missing heading alone never blocks a launch: the main agent asks before launching only when a new material decision or authorization cannot be inferred from the session. One emphasis line and one example follow, for each enabled role only, so off and Advisor-only sessions carry no brief guidance.
Visual Design, Vision and Writing
Three optional specialists, none of them an execution tier, and each holds up to three exact models called entries. Visual Design exists for work whose result is judged by eye: restyling, layout, spacing, typography, colour, component styling, matching a mock or a screenshot. Vision exists for work that must look at images: screenshots, rendered pages, UI captures, diagrams, charts, scanned pages. Writing exists for text other people will read: public prose, announcements, release notes, issues, documentation prose and interface microcopy, and it changes only the words. Judging an image without changing it is Vision; changing how something looks is Visual Design, which keeps the words when the same work changes both.
Neither family takes part in the cheapest-role comparison, which covers Small, Medium, and Large only: an entry is the model you chose, not a price to beat. With no entries a family leaves no trace in the injected block. With entries, the block carries one rule per family, one line per entry with its exact model and thinking policy, and one line stating what the host registry reports for each configured model: text+image, text only, or unverified. When nothing configured can read an image the block says so as a fact, so image work is not handed to a model that cannot see it.
Entries
Entries fill in order and never leave a gap, and commands and status lists the exact forms.
Entries are stored in delegation-policy.roles.json next to the delegation defaults, one ordered list per family (uiDesign, vision, writing), each entry an exact provider/model plus an optional thinking policy. The file is versioned and separate because the policy document rejects unknown keys: a new key there would make every installed older version read the whole configuration as invalid. A missing file is the clean default, and a file this version cannot parse is reported and ignored rather than overwritten.
A reader older than the Writing role rejects the whole file, not only the unknown family, so remove Writing entries before you downgrade. Visual Design entry 1 is mirrored into the delegation document as uiDesign (with thinking.uiDesign), which is what the panel and older versions read. When the two disagree the document wins and the sidecar keeps the remaining entries, because the other writer was a version that cannot see this file: the document's model takes slot 1 and the sidecar's own slot 1 is not kept. Entry commands therefore write the global state only. They are refused while the branch owns a family's first slot, because that value belongs to the branch and must not become the shared default. /delegate … remove closes the gap, so the entry behind the removed one moves up into its slot. Slot 1 of Visual Design is edited in the panel, which also offers a row per entry —Visual Design 2, Visual Design 3, Vision, Vision 2, Vision 3, Writing, Writing 2, Writing 3. Each family's first row is always offered, so a family can be started from the panel, and the rest follow the one before them. In the panel those rows behave like every other row: Apply sets the family's whole list for this conversation only, Use global default drops it, and only Save writes the sidecar. Entry thinking stays in the file. vision 1 … and visual-design 1 … are rejected because a slot number is only 2 or 3.
Validation
Every configured entry is validated against the host registry. An entry whose model is missing, outside the scope, unauthenticated, or whose thinking level is unsupported is reported as a warning and simply cannot be launched; it never turns delegation into D:ERR and never affects the other roles. A vision entry whose model does not accept image input is reported the same way: the role keeps its place, and the block already says that model cannot see.
Advisor reading
An Advisor never executes work, and by default it also reads nothing: it answers from the context the host composes, or from the brief the main agent writes in manual mode. Reading is a separate capability, off until you turn it on for a specific Advisor. It applies to role launches only: consult_advisor runs a tool-free profile instead (the tool profile pi-delegation-policy.advisor-tool unless a packaged package serves that slot), so the panel does not ask the question while Advisor launch is tool, and a flag left over from a role launch changes nothing there.
In a role launch the panel asks right after you choose that Advisor's model — Advisor N reading, Off or On — and the flags are stored in delegation-policy.advisor-read.json, one boolean per slot, with trailing offs dropped so "none" has one representation. Turned on, that slot launches through pi-delegation-policy.advisor-read, a profile whose only tool is read, and the injected block says so in the role line (reading: on, open only the paths the brief names). The line states it only when that resolved profile is the reading one, so no profile claims a read it cannot do. An Advisor whose model a packaged provider serves reads through that package's reading half, pi-delegation-policy.advisor-provider-extension-read for an admitted provider and pi-delegation-policy.advisor-anthropic-auth-read for Anthropic's opt-in. Both declare read as their only Pi tool, a declaration qualified in the list below, and both load their provider's package: the admitted one through subagentOnlyExtensions, the Anthropic pair through its guard. In a tool launch that slot settles its package first and is asked no reading question; in a role launch the question comes right after the model and there is no package step. The row then shows the package and · reads files together.
The flag belongs to the slot, not to the model. Choosing a model in the selector asks the question again and opens on the answer already stored, and Use global default asks it the same way a hand-picked model does, so inheriting the model asks it too; the package step belongs to a tool launch and is offered there only. A slot re-pointed by /delegate advisor N … keeps the flag as it is. An Advisor moved onto an admitted provider can therefore be reading before the question is asked, and the row says · reads files while that is true, and a slot moved to Anthropic's opt-in keeps its flag for the same reason: both halves of that pair load the package and differ only in the tool their frontmatter allows.
What that buys and what it does not:
- The Advisor can open an image the main agent names, which is the point: a description of a screenshot is not the screenshot. A model that only accepts text cannot use it, and the profile tells the Advisor to say it could not see the image rather than describe it from the name.
- The tool is not a path boundary. This extension grants
read; the host's permission rules decide what it may reach, and the profile's instruction to open only paths the brief names is guidance. - An Advisor served by an admitted provider extension reads through
pi-delegation-policy.advisor-provider-extension-read. That profile declares exactly one Pi tool,read, so the package's own tool stays filtered out. The declaration is what the profile asks for, not what the child always gets: the provider builds itspi-bridgeMCP server only when the host hands it tools for the request and the agent it drives advertises MCP over HTTP, and a child where either fails is declared no Pi tool at all and opens the file with the provider's own read-only tool. The provider's native tools are never on that list either way, so the fixed rule and the Reading section are instructions there, not a block, and a read the brief did not name is still a read the provider could make. Thereading=ontoken of/delegate statusreports the profile that would launch, not what the runtime bridged to the child. - Anthropic's opt-in (
advisor-anthropic-auth, withadvisor-anthropic-auth-readfor reading) is the same pair with another package: the parent checks the same managed install, exact name, absence of a link, single internal entry and presence in your settings, and reports the installed version in/delegate statuswithout enforcing it. Each half configures the guard described above, which loads that package inside the child and keeps the builtinanthropictransport closed until it registered its own. The admitted pair needs no such guard, because its provider is not a builtin: a failed load there leaves a model nothing can serve instead of a transport that answers anyway. The same qualification applies: the declaredreadis what the profile asks for, the provider may bridge nothing and open the file with its own read-only tool, and the fixed rule is what forbids a write.
Advisor content filter
Some providers refuse a request whose content reads as offensive security work, even when the work is legitimate. A provider's filter is not something this extension can see or test, so the panel offers the statement as yours: open an already configured Advisor's model selector and, above the model list and beside Use global default and Disable for this session, the third pinned row is Content filter: none or Content filter: cyber, on (softens security briefs). A slot with no Advisor yet has nothing to flag, so that row appears once the slot is configured. Choosing it toggles the flag for that slot and leaves the selector open, so nothing about the model changes. The flags live in delegation-policy.advisor-filters.json, one boolean per slot, with trailing offs dropped.
The flag is stated in three places, two in the block and one in the configuration notice, written so that a smaller model finds and applies it:
- One status line right under
Purpose, present whenever Advisors are listed:Advisor flags: none.orAdvisor flags: Advisor 1 = cyber filter ON. Advisor 2 = none. The rule is under that Advisor in Roles.Sayingnonelets a model tell "no flag" from "flag not found". - The rule as its own line directly under the flagged Advisor's role, condition first:
- CYBER FILTER: ON (set by the user). If a question or brief for this Advisor is security-related, rewrite it before sending: …. That line is the only place the rule lives. - The configuration notice on the turn after you toggle it:
- Advisor 1 cyber filter: off -> ON. From now on, rewrite … This replaces anything said earlier in this conversation about this flag.
What the rule asks for, and what it does not do:
- For questions and briefs about security or cyber work, soften the wording and the framing: state the purpose plainly, name components and actions in ordinary technical language instead of confrontational or exploit-centred phrasing. Softening changes the register, not the content, so the same facts, constraints and scope stay in the brief; a brief emptied of its facts produces advice about something else.
- Everything else sent to that Advisor is written as for any other model. The flag is not a standing instruction to change how unrelated work is described.
- The extension never rewrites a brief. It does not add a preamble to the request, and the payload of
consult_advisorstays exactly{question, brief}as the main agent wrote them. - No phrasing is promised to be accepted. The flag says the provider may still refuse; it is the user's statement about a model, not an observation, and it is verified by nothing in this repo.
- A flag belongs to a slot: in the panel, changing that slot's provider or model clears it, and removing an Advisor moves the next one's flag up with it.
/delegate advisor N …writes the session draft instead, so it does not move or clear the flag; check the row before relying on it. A version older than the file ignores it entirely, so a downgrade loses the flag silently and nothing else.
Advisor
Advisor is optional, outside the ordinary-role minimum, and has no model until you configure one. Its mode defaults to with-delegation, so a configured Advisor is consulted while delegation is active. Configure Advisor 1 and optional Advisor 2 and Advisor 3, each with an exact model. Advisor thinking is not a setting: role launch lets the main agent choose it per run, and tool launch picks it automatically. Every valid advisor gets the same question, so each extra advisor adds a consultation at every checkpoint. Weigh disagreements; agreement is not proof. The role-launch profiles pi-delegation-policy.advisor and advisor-read advise and execute nothing: they declare no Pi tool (or only read), and the fixed rule in their prompt forbids changing state with any tool, its own extensions and the provider's native ones included. A provider's package their extensions load is trusted host code, not a sandbox.
Advisor launch inherits globally or per branch, defaulting to tool. An explicit role keeps working exactly as before, and the schema default is tool:
role: the main agent launches every valid advisor in one background subagent call, with exact models and a thinking level it chooses per run. A background launch is the form the policy asks for, and it is never refused for being detached: it returns a run id, and the host reports the answer when the run ends. The one exception is a session whose bridge admits no completion channel: there the text asks for the foreground launch,async: false, tells you once and leaves one record of it, because no background answer can be heard in that session. The extension observes matching attempts but does not launch them.tool: the always-registeredconsult_advisor({ question?, brief?, evidence? })launches one child per valid advisor in parallel through the publicpi-subagentsdelegation API. It requires stable SemVer>=0.76.1, with no upper bound; prereleases and invalid versions are rejected. Every launch must still pass the strict contract and terminal-binding checks. Otherwise it returns unavailable text. No model, provider or executor fallback is added.
In tool launch a consultation keeps each advisor's conversation for the rest of the operative task. The first call launches the packaged profiles and is the only turn that carries the verified launch contract. Later calls in the same task continue each thread with the public RPC resume, carrying only what changed since the previous consultation: the extension supplies the run id and the output path, and the host inherits the model and profile. The answer is accepted only from the per-turn output file the extension owns, after the new run id reports one completed step with the same agent, model and thinking; a resumed turn relies on the contract the host inherits plus those observed values, not on a re-verified digest. A mismatch, timeout or missing answer blocks the thread: it is never retried, replaced by a fresh launch, or continued from an older run id, and recovery can only use the receipt of the turn that is actually pending, never an earlier one. A task ends when it settles and cannot be resumed, even if persisting its closure fails. Its answered records remain closing obligations in the same journal; a new task still cannot bypass them, but the next consultation persists their closures itself, so no command is needed. Uncertain turns — including a turn that never returned a run id — are settled by two pieces of host evidence, in this order: the exact run id when the record has one, and otherwise the session's run list. A record with a run id closes when that run is in a terminal state (complete, failed, partial, paused, stopped, rejected), or when the host no longer holds that run and a whole list proves it absent. A record with no run id closes only when the list is whole — the host reports nothing omitted or byte-trimmed — and it holds no run that may belong to that thread: a live (queued or running) one attributed by the advisor agent name in the run label and its start time, a state this reader does not know, or one of our own started after the thread, which cannot be ruled out either. A trimmed list, an unreachable bridge or a live run of that profile closes nothing and keeps blocking. Nothing is ever stopped on a guess. A fresh prompt, a branch move or a configuration change starts a new thread, and a prompt an extension sends opens no task, so a consultation from one starts nothing. The journal is private and content-free; the answer files and child sessions keep the host's and provider's normal retention. Output paths are checked from the trusted agent directory before creating descendants or reading answers; pre-existing symlinks and junctions in the owned tree are refused. This is not protection against a malicious host runtime replacing paths concurrently.
Every configured advisor keeps its position and gets an explicit result, so two answers out of three report partial. The same reconciliation runs by itself before a consultation reports continuity as blocked; /delegate advisor threads status|recover|reset, or C in the /delegate panel, exposes the manual actions: recover runs it on demand and status only reports. reset abandons the turns that never returned a run id and that no evidence resolves; it refuses while a run may be live or while a record still holds a run id it cannot settle.
Continuity uses three lock directories of its own beside the journal, all under the same agent directory: delegation-policy.advisor-threads.json.lock/<parent> per session, delegation-policy.advisor-threads.json.commit.lock for each write, and delegation-policy.advisor-threads.json.reclaim.lock for the short reclamation section. What a contender takes is the owner record inside one of them, created exclusively, so a directory left without one — by a crash between those two steps or by a removal that failed halfway — is unclaimed and the next contender takes it instead of waiting on it forever. Releasing a claim renames the whole directory to a tomb and deletes only that; if Windows refuses the rename, it removes only its own owner record and tries a non-recursive directory removal, which leaves the directory claimable. A later claim cleans inert tombs best-effort, so a failed deletion cannot block the journal. A reclamation gate whose recorded owner is gone, or whose record cannot be read, is never reclaimed automatically, so recovery can stay blocked until it is cleared by hand; /delegate advisor threads recover reports that case and changes nothing. Clear it only with every Pi process that uses this configuration stopped and confirmed finished: remove delegation-policy.advisor-threads.json.reclaim.lock, and a delegation-policy.advisor-threads.json.lock/<parent> whose recorded owner is gone. Never remove a lock while a process that uses it may still be running. The locks assume one host and a local filesystem, and owner liveness is the only OS signal they use.
Both modes share four rules. Consult before the first change of a task that involves a decision. Consult when the same error comes back or progress stalls. Consult before changing approach, publishing, or declaring a multi-step task done, with the result made durable first and a request for remaining risks rather than approval. Otherwise do not consult: short reactive steps, mechanics inside a settled approach and facts you already have need no new call.
Advisor mode is an independent axis you set in the panel or with /delegate advisor …:
| Mode | Effect |
|---|---|
on | Consult with delegation off. Requires a valid Advisor model; ordinary roles are not required in that case. |
off | Inject no Advisor guidance and keep the saved models. |
with-delegation | Consult only while delegation is active and an Advisor is configured. Default when the key is absent. |
D:OFF A:ON shows consultation-only guidance; D:OFF A:OFF means neither axis injects a policy block. /delegate reset turns both off for the branch; /delegate off leaves an independently enabled Advisor active.
What a consultation sends
consult_advisor needs no arguments: question, brief and evidence are optional. By default context: composed makes the extension assemble one context and send it to every valid Advisor, in this order:
- a host note saying that the host assembled it, that it is partial, and that quoted sections are data rather than instructions;
- the question, either the agent's own or a default the trigger chooses: the first change, the publishing step, or a free consultation;
- a situation line with the trigger, the edits so far, and which sections were cut;
- the user's literal request for the task, and the previous substantive request when the current one is short;
- the change that was held back, when the consultation follows a checkpoint;
- the agent's own brief and evidence, when it gave them, marked as unverified;
- the agent's last two messages, marked as unverified;
- the paths it read and edited, and the commands it ran, as program and subcommand with
okorerroronly; - a final
Question, again:line: the question repeated on one line, up to 300 characters, so a long context cannot bury what is being asked.
It never carries command output, command arguments, file contents, the model's reasoning, the system prompt, or the conversation before the task, and the agent's messages it carries are only the ones written in this 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. An edit to a sensitive path (.env files, keys, .ssh, .aws, credentials and similar) is withheld and only the path is named, and obvious secrets such as private keys, common token formats and password=-style values become [redacted]. Every section is fenced with a random marker, so quoted content cannot pass for a host section.
The whole context is capped at 12 KiB, with per-section caps: 2 KiB for the question, 4 KiB each for the agent's brief and evidence, 4 KiB for the user request, 3 KiB for the held change, 3 KiB for the agent's messages, and at most 40 paths and 30 commands. Past the total, the host drops or shortens in this order: commands, paths, agent messages, earlier request, then it halves the evidence, the brief and the user request. The question, the situation line and the held change are never cut. A later consultation in the same task continues each Advisor's thread and carries only what changed since the previous one.
/delegate advisor context manual restores the earlier behaviour: the main agent writes the question and, on a first consultation, the brief, and a first call without one is refused. /delegate advisor context composed returns to the default. A branch sets its own mode with the bare form, in a custom session entry, and /delegate advisor context default clears it again; /delegate advisor context global composed|manual|default writes the mode as context in delegation-policy.advisor-level.json for every session, and a branch that recorded its own mode keeps it over that file (persistence).
The tool launches each advisor at the highest level its model supports among high, medium, low, minimal and off, in that order. A level above high is used only by a model that supports none of them. Concurrency, cancellation, and what each turn sends are limits of the surface: limits and privacy states them.
Errors by axis
Errors are reported per axis. Each entry validates independently: A:ON means all valid, A:PART means some valid (consult those), and A:ERR means none usable and removes only consultation: valid delegation and an otherwise authorized ContextShunt reader keep working. D:ERR removes delegation guidance and leaves a valid enabled Advisor alone. A malformed main delegation file still fails closed, and a malformed or stale Advisor companion affects only Advisor: delegation from the main file wins, and the companion keeps its saved model only while it is readable and valid, so the next save repairs that pair. A corrupt or unreadable companion cannot supply Advisor settings. Settings still present in a legacy delegation file are retained; otherwise, configure the Advisor model again.
Consulting sends the context described above to another model and can incur latency and cost, including with delegation off. The extension never adds the conversation, and it refuses a call that asks to fork the session for an Advisor. A fork default set in pi-subagents itself stays outside the extension's reach. The host sends it only after an explicit launch or tool call, never from a hook. See the limits and privacy reference for the signals and the retention of the executor and its provider.
Provider extension
The default role-launch profile is pi-delegation-policy.advisor (or advisor-read when the slot may read), with no configured Pi tools and extensions unset, so the child inherits yours. The tool launch (consult_advisor) runs pi-delegation-policy.advisor-tool, with no tools and extensions: empty, for every slot a packaged package does not serve. Choosing an anthropic model in an Advisor row asks for the profile only when Advisor launch is tool: Standard or an explicit Anthropic auth package opt-in. Escape keeps the profile that entry already had. The opt-in selects the packaged pair pi-delegation-policy.advisor-anthropic-auth and pi-delegation-policy.advisor-anthropic-auth-read, in tool and role mode alike. The model stays unchanged; role launches remain background. In configuration this is providerExtension: "anthropic-auth" on that Advisor entry, available in schema 10. Absence means the standard profile. Only provider anthropic is supported; an incompatible selection is an Advisor error, never a fallback to the standard profile or another model.
This option runs the installed @gotgenes/pi-anthropic-auth extension as trusted host code. Each profile configures one extension of this package, src/advisor-anthropic-guard.ts: it holds the anthropic provider with a transport that throws, loads that package in the child, and opens the provider only once the package registered its own, so a failed load fails the call instead of streaming through Pi's builtin anthropic transport. Its normal global/project configuration, startup hook and provider aliases are kept; only provider registrations cross into the child, so the package's tools, commands, MCP servers, renderers and other handlers stay on the guard's private loader and /anthropic-auth:status is not available inside an Advisor child, which runs in print mode anyway. The extension uses the provider's normal authentication, so the child holds whatever credentials this Pi installation holds for it; this package does not copy credentials or perform login. Empty model tools do not sandbox the provider code.
Only a managed user install resolved by Pi under its agent directory's npm/node_modules is supported, and the parent checks the same facts it checks for an admitted provider: the managed root, the exact package name, no link, a single extension entry inside the package, and that package listed in your own Pi settings. Project candidates, legacy installs, unexpected entries, an unlisted package and a missing package make this Advisor unavailable. The installed version is read and reported in /delegate status as extension=@gotgenes/pi-anthropic-auth@<installed> and nothing refuses on it: no version is enforced and no content is compared, which is what keeps a provider update from needing a release of this one. Nothing is installed automatically and other Advisors remain independent. The check loads no provider code while Advisor is off, it does not inventory irrelevant legacy copies, version labels are not signatures, and a resolution-to-load race remains. No provider payload or headers are reimplemented. One bounded fresh/background real-provider consultation completed on Pi 1.4.0 with pi-subagents 0.83.1. Launch metadata showed the prompt runtime and provider bridge, no required extensions and no observed tool calls. Fork, consult_advisor and other builds were not validated by that run.
With any provider opt-in saved, the extension companion uses envelope 2 containing the full schema-10 state and an exact normalized schema-8 base with Advisor off. The legacy companion also has Advisor off. Readers through 0.22.2 therefore leave all Advisors off, preserving ordinary delegation, rather than run a provider-dependent Advisor as a standard one. Missing, corrupt or stale envelope-2 state leaves them off until repaired. Without an opt-in, the envelope-1 format below is unchanged.
Admitted provider extensions
Some providers exist only because an extension registers them, for example a provider that keeps its keys in its own vault instead of Pi's credentials. In a role launch the standard Advisor profile leaves extensions unset, so the child loads your extensions and that provider works without an admission: choosing its model asks nothing and goes straight to the reading question. Only a tool launch (consult_advisor), whose profile keeps extensions: empty, needs a packaged profile to load one, and only there does choosing such a model ask for a provider extension: Standard profile (no provider extension) or one of your installed packages, shown as <package> <version> · trusted extension, identity only. The row then shows · <package> <version>. Anthropic keeps its own opt-in, which is also asked only for a tool launch.
An admission is global and per provider: when it names the reviewed package, every Advisor with that provider, in every session, uses the package profile pi-delegation-policy.advisor-provider-extension, or its reading variant pi-delegation-policy.advisor-provider-extension-read when that slot may read. Another package keeps the standard profile: role launch inherits it from your extensions, tool launch does not load it. Choosing a package opens a confirmation that says it applies to every session; Enter or Space stores the admission at once and Escape keeps the one the provider had. It is never part of Apply, and Standard removes it. The file is ~/.pi/agent/delegation-policy.provider-extensions.json:
json
{
"schemaVersion": 1,
"providers": {
"example-provider": { "package": "example-provider-extension", "version": "1.2.3" }
}
}Only a package you already load qualifies: your user settings must list npm:<package> (any version) unfiltered, Pi's managed user install must hold it with no links, and its manifest must declare exactly one extension entry inside the package. The panel also requires the exact installed user source and no project candidate before it offers a package, because those come from the package manager. /delegate validation and every launch repeat the narrower check described below, which reads the managed install directly. The child does not, and cannot: it resolves its model and its provider before any extension session_start runs, so a check inside the child would arrive too late to matter. An invalid file is ignored with a diagnostic and leaves the other Advisors running.
The packaged profiles name their package in subagentOnlyExtensions and keep extensions: empty, so the host loads exactly that package for the child and no ambient extension. The entry is the relative path ../../pi-antigravity-acp-provider, which the host resolves against the directory of the profile file: installed as a user package, that is <agentDir>/npm/node_modules/pi-antigravity-acp-provider. No version appears anywhere, so updating that package needs no release of this one. Its registration is the only one reviewed, and it may register antigravity_acp_permission, the tool that asks Antigravity for a permission decision the provider itself issued. The Advisor child launches with an empty tool allowlist, so that tool never reaches the model. A different package has no packaged profile to load here: role launch inherits it from your extensions, while tool launch keeps the standard tool profile.
What the parent checks before a launch is identity, not version or content: the path the profile resolves is the managed install, that install exists, it is not reached through a link, its manifest reports that package name, it declares exactly one extension entry inside its own directory, and your settings list the package. Paths are compared as the filesystem sees them, so a differently capitalised agent directory is the same directory on Windows and a different one on Linux. When the check fails, the message says what could not be confirmed and the remediation is to install the package as a user package. Because there is no version comparison, an admission whose recorded version differs from the installed one is served: the file holds the version you selected, and the profile loads whatever is installed now.
The check runs again at every launch that loads a packaged profile, not only when the session validation ran, and it reads package metadata only. That includes the Advisor profile that serves an admitted provider: a consultation refused there is an Advisor error, not a launch the host fails later. A package removed, replaced or re-linked after validation is therefore refused instead of loaded. One window stays open: the child loads the package after the check returns, so a change in that gap is not seen (SECURITY.md).
Execution profiles
A subagent child inherits your extensions, so a role whose model an extension serves needs nothing from this policy: the launch runs with the agent it stated and the child loads that extension like any other. The packaged profiles below are still shipped for a setup that restricts what children load (subagents.defaultExtensions): name one explicitly and it loads its package on its own. The table is code: provider, package, the one tool the review details, and the profile.
| provider | package | tool | writing profile | read-only profile |
|---|---|---|---|---|
antigravity-acp | pi-antigravity-acp-provider | antigravity_acp_permission | pi-delegation-policy.execution-antigravity-acp | pi-delegation-policy.reader-antigravity-acp |
The writing profile carries the worker tool set (read, grep, find, ls, bash, edit, write, contact_supervisor) and acceptanceRole: writer. The read-only profile carries the reviewer tool set (read, grep, find, ls, watchdog_diff, contact_supervisor) and acceptanceRole: read-only. Neither lists antigravity_acp_permission, both keep extensions: empty so no ambient extension reaches the child, and neither declares a model: the launch states it, as for any role. The read-only profile, and every other packaged profile that must not change state, opens its system prompt with a fixed environment rule: never create, modify, move or delete a file, and never run a command, with any tool, the provider's native ones included, while reading, searching and the tool that returns the answer stay allowed. It is an instruction the model follows, not a block (limits and privacy).
A launch that names one of these profiles is the only one checked for its provider, because the package a profile loads is static frontmatter: naming it with a model from another provider, or after its package stopped loading, is refused rather than followed. No builtin, alias or agent of yours is ever rewritten into one of them or refused for its provider.
This is trusted code, not a sandbox. The package identity is checked in this session, and that is the only check: the child loads the installed package before it can inspect anything. It can read files, use the network and reach its own accounts, and a provider it registers is the one used. Per-process state stays per process: a quota-rotating extension checks quota again in each child and can pick an account the main session already exhausted. An Advisor whose provider an extension supplies stays consulted and needs no admission in role launch, where the child inherits that extension; only a tool launch, whose profile loads no ambient extension, warns about it in /delegate status. An admission whose package passes the check but is not the reviewed one is not an error either: role launch inherits it, tool launch keeps the standard profile and warns. An admission whose reviewed package fails the check is an Advisor error. The candidate list holds every configured user package, not only providers. Releases before this option ignore the file and launch the standard profile, which may answer through the built-in provider or fail as before.
Launch correction mode
While delegation is active, or while an Advisor is enabled, the launch check corrects three unambiguous cases instead of refusing them, and tells the agent what it applied. The three cases, and the refusals that remain, are listed under launch check. Accepted role names are small, medium, large, visual-design, ui-design, uidesign, advisor, advisor-1, advisor-2 and advisor-3, case-insensitive. The added level is the role's fixed level, the lowest supported level inside its range, or medium clamped to what the model supports when the role has no policy.
A test mode refuses those cases instead, which keeps the pre-correction behaviour for measurement. Set it in /delegate, on the Launch correction row. correct is the default, and block is the measurement mode. Apply sets it for this conversation only, in the branch's session overrides, and the row then ends in · session; Use global default drops it. Save as defaults stores it in the shared file for every session, and Cancel discards the change.
The panel writes ~/.pi/agent/delegation-policy.launch-correction.json, whose format is:
json
{ "schemaVersion": 1, "mode": "block" }correct is the value to restore. The file is separate from the schema-10 policy document, which rejects unknown keys, so the mode needs no schema bump. A missing file means correct; an unreadable or invalid one is ignored with a diagnostic and never makes the delegation axis invalid, and the panel refuses to overwrite it until you fix or remove it. The replacement is a temporary-file write, so a failure leaves the previous file in place.
Advisor nudge level
The Advisor nudge row, formerly Advisor reminder, chooses how hard this extension pushes towards a consultation, and advisorLevel holds the same setting in configuration:
| Level | Note | Changes |
|---|---|---|
off | None | Never held |
standard | One after every 15 tool results of a task (default) | Never held |
strict | One warning after 3 changes with no consultation | Held from the 6th change until an Advisor answers, or until the operator changes the level and sends a new prompt or cancels the task |
guard | Same as strict, plus the consult-first switch | Its own rules first, then the same count as strict |
A prompt that starts with ?? is the one exception to "never held": it holds the changes of its task at any level. At off and standard the hold ends with the first answered consultation and no count starts afterwards. Every Advisor stays available at every level and can be consulted at any time. guard adds a closed set of its own decisions in front of the count, described under guard rules, and, when you choose a model for it, the extension's own model call after them (see the guard reviewer). The count is per task and starts over when a consultation answers. The checkpoint section describes what is held and what opens it.
Guard consult first is the user's own switch for guard, in user scope only and in ~/.pi/agent/delegation-policy.guard.json. When it is on, every guard task starts held: its first change waits until an Advisor consultation answers, and the guard count applies after that answer. It changes nothing in strict, standard or off, it acts in no subagent child, and it holds nothing when the session has no valid Advisor and no launcher, because a hold with no way out is worse than none. It opens no consultation by itself and passes no rule, so a hard rule stays refused whatever the switch says. The row reads Guard consult first on, Guard consult first on · session when this conversation set it, or Invalid · off when the file cannot be read. Apply sets it, and the two reviewer rows, for this conversation only; Save as defaults writes the file, and a file this version cannot read is reported instead of replaced.
Guard reviewer model and Guard reviewer mode are the optional second opinion for guard, in user scope only and in that same delegation-policy.guard.json. The model row reuses the role model picker: None pins the default, only models this host can already use are listed, and the main model is never offered, because it would judge its own calls with the same prompt. The row says which state the reviewer is in:
| Row reads | Meaning |
|---|---|
not set · rules only | No model, so no call is made |
<provider/id> · observing | Set, and running in observe |
<provider/id> · enforcing | Set, and running in enforce |
<model> · no credential · … | That provider has no configured credential here |
<model> · not available · … | The model is not registered, or is outside this session's scope |
<model> · same as the main model | The main model cannot be the reviewer |
<model> · idle (level is …) | Nothing runs, because the level in effect is not guard |
Invalid · off | The file cannot be read, so every guard setting is off |
Choosing a model returns the mode to observe, the same model or another, so nothing enforces on a model you have not seen it run in this session. The mode row offers observe and enforce, says · not running when the stored mode cannot act, and refuses to switch when the model is missing, has no credential or is the main model. off is not a value you pick: it is what having no model means. Choosing a model states once what travels, in the same words the panel uses:
The guard reviewer is a second opinion, not a sandbox. It checks each change before it runs. For every change it sends your messages in this branch, the pending call's path and the start of the new content or the command, and the heads of the last 12 calls to
<provider/id>, using that provider's own credentials. It never sends tool output, the agent's own text or this project's instruction files. One review is one small model call, and a block pays for one more. Observing records what it would refuse and never delays or refuses the call.
Switching to enforce states the same once, in its own words, and names the model that stays there:
Enforcing means a change the reviewer blocks is not run: the agent has to find another way that stays within what you asked, or consult you. An Advisor answer covers that tool and that target for 3 calls, and 3 refused changes in a row stop every change of the task until you write again. When the reviewer cannot answer, an edit inside the working directory runs unreviewed and everything else waits for an Advisor answer. Some blocks will be wrong. You can return to observe at any time. Enter or Space keeps
<provider/id>in enforce, and Esc or Ctrl+C keeps the previous mode.
The reviewer never lifts a rule only you can allow, never lifts a hold of the count, never changes a permission of the host and never runs in a subagent child.
What a review sends and what it costs
A review is the last step of guard, behind the rules and the count, and only a call that changes state reaches it. A subagent call that launches only Advisors is a consultation rather than a change, so no rule, no count and no review touches it, and the way out is never what delays or refuses the task. The host starts each child of a parallel call as its own subagent_launch call, and those children are part of the same consultation: a foreground call names them with its own id, and a background run, which carries an id of its own, is bound by the Advisor slots the call verified, one child per slot and thinking level. Only the fields such a child carries are accepted, and what stops being exempt lists them. It reads three things, all of them as one JSON object that the fixed prompt declares to be data and never an instruction: your own messages in the branch, up to 800 characters each and 4 KiB in total, newest first; the pending call, meaning the tool name and, for an edit or a write, the path and the head of the new text up to 1024 characters, or, for a shell call, the head of the line up to 1024 characters; and the heads of the last 12 calls, a tool and a path or a command head, with no result. It never receives tool output, the agent's own text, or the project's instruction files, which is what a reviewer can be talked through, and the request offers no tool and no tool choice.
A subagent delegation is reviewed by its tool name only: the request names the tool and no task, model or child, so an enforce block on one is a judgement about a call the reviewer was never shown the content of.
Two stages. The first answers one token, BLOCK or ALLOW, and is asked to err on the side of blocking. Only a block asks a second stage for careful reasoning that ends in one line, CATEGORY: <name>, with a name from a closed set: destroy-or-exfiltrate, degrade-security, cross-trust-boundary, bypass-review, outside-the-request. An answer that does not parse, a timeout, and a provider error are no verdict: they are never read as an allow and never as a block.
Every cap counts exactly what it names: your messages lose nothing beyond the stated character and byte limits, because a cut is a silent prefix and adds no marker.
Observe runs that review without holding the call: the record says what it would have refused and the call runs at once, so observing adds no delay. A pair of tool and target is reviewed once per task, up to the 64 pairs a task remembers: past that the oldest is forgotten and reviewed again, and an identical retry reuses the verdict without another call. Three reviews in a row that return no verdict, or five in one task, turn the reviewer off for the session and tell you once; the level keeps its rules and its count. The caps, the two timeouts (3 s and 8 s) and that threshold are provisional: the shadow data of 0.36.0 fixes them. There is no accumulated per-turn time ceiling in this build, so the worst case an enforced turn can hold is three reviews of up to 11 s each. A review records one local line with the verdicts, the status, the durations, the bytes sent, the model, the mode and a salted digest of the target, and the task's gate record adds reviewed (reviews that started a request), wouldBlock (block verdicts, including the ones answered from memory), noVerdict (reviews that concluded nothing) and cacheHits (pairs answered without a call).
Enforce acts on the same review. A change waits for stage 1, and for stage 2 only after a block, inside the two timeouts, and a confirmed block refuses that call with the category the second stage chose and one exit: find another way inside what you asked, or consult the Advisors. The agent keeps working; the refusal is a tool result, not the end of the turn. An Advisor answer covers that tool and that target for 3 calls, and an identical retry is refused from the task's memory without another paid call. The key is the tool and the normalised path, never the content, so one ALLOW covers every later call to that path in the task and the several spellings of one path are one pair. Three refused changes in a row stop every change of the task until the next message you write, and tell you once. When the reviewer cannot answer at all — no verdict, a timeout, an exceeded cap or an open breaker — the failure lane decides: an edit or write inside the working directory runs and is recorded as unreviewed, while a shell call, an unknown tool, a write outside the working directory and a push wait for an Advisor answer, and that answer then covers the call for its three passes. An open breaker only stops the paid calls: the verdict this task already holds and the passes an answer opened are checked first, so neither is lost when the reviewer switches itself off. The workspace rule compares the two strings alone: a drive-relative path (a bare C: included), another drive, a network share and a home shortcut count as outside, and a link inside the working directory that resolves outside still reads as inside. Nothing here is a sandbox: the host's permissions, the rules and the count decide first, a reviewer block is a judgement about intent that will sometimes be wrong, and the reviewer never lifts a rule only you can allow, never changes a host permission and never runs in a subagent child.
Calibration and removal criteria
These criteria were written before the first shadow measurement, and every number in them is a proposal until that shadow replaces it. scripts/guard-report.mjs reads the log and prints, with no content of any call: the tasks by end reason, the task counters, ruleHits, the reviewer counters (reviewed, wouldBlock, noVerdict, cacheHits, blocked, reviewPasses, unreviewed, unavailable, escalations), how many tasks carry a refused change or a review that would have refused one, and, for each rule, how many of the tasks it fired in also saw a reviewer block.
Three criteria read those figures directly: the share of absent verdicts is noVerdict against reviewed, the share of blocked changes is blocked against the change counters, and the spread the "one task in five" limit needs is the count of tasks with a refused change. The retirement of a SOFT rule reads the per-rule overlap. What the report cannot say is whether a given block was wrong or right, because the log carries no call and no text: that judgement is read in the per-line reviewer records, where a mode, a lane and a closed status sit next to the salted digest of the target, one line per review the task ran or skipped.
- The shadow runs for at least 50 tasks or two weeks, whichever comes first.
- The caps and the thresholds are fixed from the observed distribution, never from the table above.
- A
SOFTrule that produces no block the reviewer does not also produce is retired, and its case stays with the reviewer. A very long or encoded command is never retired, because the cap blinds the reviewer exactly there. - The
HARDset and the count gate are not retired with data. - In
enforce, false blocks above 2 % of the changes, or above one task in five, return the mode toobservebefore any other friction is added. - Absent verdicts above 5 % of the calls mean a different model or lower caps, never a lower blocking threshold.
With Advisor off the level has no effect. It is resolved from a session override first, then from the entry for the current main model, then from the global level, then from standard, and a task keeps the level it started with. The commands are /delegate advisor level off|standard|strict|guard|default for the branch, /delegate advisor level global … for every session and /delegate advisor level model … for the current main model, where default clears the value at that scope.
The note follows a count the host reports, not a judgment of the task. In standard it is presented in the request that follows the 8th tool result, and the count then starts over. In strict and guard the warning is presented once per run of changes, in the request that follows the 3rd change made with no consultation since the last answered one. A request carries at most one note, and a retry of the same request keeps the one it already carried. An attempted consultation ends the periodic note for that task even when it fails, and it does not end the warning, which is about changes made since the last answer. A control action that only names an Advisor is not a consultation. Turning the level off, a branch move, a new task or the task settling discards it. Neither the note nor the refusal tells the model a count.
The reminder 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: subagent for role, consult_advisor for tool. A session that cannot consult is never told to, and no preflight, status call or process is started to find out. 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 is still a main session and keeps the reminder, and a missing marker proves nothing, so foreground children that load this policy and can consult are covered too.
The line is appended to the request copy after the policy block and the configuration notice, and never to the conversation. It starts no turn, no child and no consultation, adds no authority and revokes no instruction, and it cannot promise to arrive before the first edit. It is sent to the provider like the rest of the request, so it is not a promise about cost or retention, and a note is not evidence that a consultation happened.
Apply sets the level for this conversation only, as the same branch entry /delegate advisor level writes, and the row then ends in · session; Save as defaults writes the file for every session, and Cancel leaves it as it was. It reads Advisor nudge standard, or Invalid · standard when the file cannot be read, because the level then falls back to standard and stays active, and that fallback is not a value you chose. The file is ~/.pi/agent/delegation-policy.advisor-level.json, schema 1:
json
{
"schemaVersion": 1,
"level": "standard",
"models": { "example-provider/example-main": "strict" },
"context": "composed"
}level is global, models maps an exact provider/id main-model key to its own level, and context is the consultation context mode. Unknown keys are ignored, so a file from a newer version stays readable. An unreadable or invalid file falls back to standard with a notice and never disables delegation. The branch keeps its own session entry. Older versions ignore both, so a downgrade loses the level and returns to the reminder setting.
delegation-policy.advisor-reminders.json, schema 1 with mode (off or remind), is read only as a fallback when the level file does not exist: off maps to off and remind to standard. A missing level file with no reminder file resolves to standard, and a present level file is this setting's own answer even when it carries no level.
Advisor checkpoint
The checkpoint applies in strict and guard. It counts the changes a task was allowed to make. The 1st to the 5th run. From the 6th on, every change is refused until an Advisor consultation answers. Reading always passes, including while changes are held. A refused change is not counted, and repeating the refused call does not unblock it. An answered consultation covers the changes made so far, and the count starts over.
A change is a tool call that changes state, decided closed by default:
edit,writeandmulti_editare changes.- Any tool the extension does not know is a change, including a
subagentlaunch that is not an Advisor consultation. - A shell command is a change unless every one of its segments is a known read. Known reads are commands such as
ls,cat,rg,grep,head,wc,git status,git diff,git log,git show, andfindwithout-deleteor-exec. - Redirections, command substitution,
sudo,xargs,sed,awk,node,python, test runs and builds are changes, because the extension cannot know what they write. So is any option that names an output file or a program to run, such as--outputor--exec. A redirection character inside quotes is an argument, not a redirection, and2>&1or a stream sent to the null device does not count. read,grep,find,ls,globandconsult_advisorare never changes, and neither are thestatus,listandguideactions ofsubagent. Session control is never a change either:ask_user_question,todo,bg_waitandsubagent_supervisorsteer the session or its children and touch no project state, so a held task can still ask the user. These are name matches:bg_waitis the host's default name for its wait tool, so a wait tool the host renamed counts as a change. Every other tool counts, including any MCP tool, whatever it does.
Shell text is read as data and never executed. Counting tests and builds has a known cost: an edit-and-test loop reaches the hold quickly.
A consultation answers when the host reports an answer from at least one Advisor. Text alone proves nothing, because both launchers return text when they fail. In tool launch those are the details consult_advisor writes: the per-turn output file the extension owns. In role launch it is the result of a single or tasks launch, or the completion the host reports when a background run ends. A foreground result is read from the details of the host's subagent tool: a single or tasks launch whose every child is a configured Advisor, with a child that ended cleanly, was not cut short and left output of its own. A launch that names workflow: "parallel" is a consultation too, and the children the host starts for it belong to the same call: in the foreground the call's own id names them, and a background run, which carries an id of its own, is bound by the Advisor slots the launch verified, one child per slot and thinking level. Such a child is no change at all, so no rule holds it, the count skips it and the reviewer never sees it, while a child that fails the field list stays a change and can reach the hold in the middle of the call. A workflow script that chooses its own children is not read, so it counts as a change like any other unknown call. A single foreground Advisor launch is enough to answer. Those details were read against pi-subagents0.89.1. A result in a shape this version does not recognize opens nothing and keeps the hold.
A background launch is not refused while changes are held. It returns a run id, and the checkpoint opens on the completion the host advertises when that run ends, subscribed under the name the bridge itself advertises, never a constant here. The report has to name a run this task launched, in this session, that ended complete and was not stopped, timed out or cut short, and at least one of its children has to be a configured Advisor profile with that slot's model, output present and no error. The tool call that launched it and the run id are both read as host identifiers, the report of one run decides it once, and a report that proves nothing changes nothing. Nothing parses the text of a notice or of a message, so a message the agent writes cannot open a hold. A bridge that does not advertise the event admits no completion channel: the operator of a session that can hold a change is told once, the session's record says so, and the text of that session asks for the foreground launch with async: false, whose own result is a report the hold already reads. A host that rewrites an explicit async: false into a background launch, such as pi-subagents with forceTopLevelAsync, leaves that launch unanswered and unreported here: its receipt carries no children, and no run is registered for it because only a background launch registers one. So while that option is set, a role launch answers nothing, foreground or background. A completion that arrives after the task ended opens nothing. A consultation that returns an error or empty text opens nothing. Nothing releases the hold automatically, and a run of failures does not either. Two consultations in a row that did reach an Advisor and did not answer give the operator one warning notification per such pair and leave every change refused. The notification names the level, the launcher and the closed statuses the failed slots stated (in role launch it states none, because that result reports children and not slots), says the task stays held, and lists the three things a person can do. The refusal to the model keeps its text and gains one clause: two consultations have not answered, so ask the user and stop. A later pair is reported again, and no pair releases a change, because a release the model can compute it can forge. The hold ends with an answered consultation or with the operator, who can fix the Advisor, change the level with /delegate and send a new prompt, because a task keeps the level it started with, or cancel the task. These levels are not meant for unattended runs. Only details that prove an Advisor started count as such a failure, which is why every slot the tool plans states whether its host run was issued. A call that consulted nobody, a blank question, a busy executor, a launch the host refused and a first turn refused for want of a brief before any launch count nothing, so repeating one buys nothing at all. A result whose shape this version cannot read keeps the hold too, and a result the host reports twice counts once.
The refused call returns this text, verbatim, in tool launch:
text
Not an error: this call was not run. Advisor checkpoint.
The checkpoint holds every change in this task until an Advisor consultation answers. Reading is not affected.
Call consult_advisor once; it asks all Advisors. It needs no arguments; the host supplies the context.
After the consultation answers, make this change again.Once two consultations in a row did reach an Advisor and did not answer, the same text ends with one more line instead of changing anything it already said:
text
Two consultations have not answered, so ask the user and stop rather than calling this again.In role launch the third line states Consult all Advisors in one parallel call: <the configured Advisor profiles>. and then the background launch that answers it, so the model launches what this configuration resolves instead of counting copies. In tool launch with /delegate advisor context manual it asks for a question, and for a brief on a first consultation, instead of saying the call needs no arguments. consult_advisor in role launch also redirects to a background launch.
It refuses nothing when a consultation is not possible: no valid Advisor, no launcher for the configured launch mode, no open task, or a subagent child process. A consultation that is merely running is not that case: the path exists, so the hold stands and its changes are counted until the answer arrives. A ?? at the start of a prompt asks for a consultation before the first change at any level: that task starts with changes held, as long as an Advisor can be consulted, and at off and standard the hold ends with the first answer.
The classification is a nudge, not a security boundary. It reads the tool name and the text of a shell command, it can be wrong in both directions, and it never authorizes or inspects a permission. In particular it knows a short list of options that make a known read write a file or run a program, and an option outside that list is not recognized.
Guard rules
guard decides in this order: its own deterministic rules, then the checkpoint count. Neither calls a model, and both work with nothing else configured. The reviewer is the one step of guard that does call one, and only when you choose a model for it. A rule reads the same call the count reads, never refuses a read, and comes in one of three closed sets.
Only the user can allow these. A consultation lifts nothing here: the way out is the user, who can make the call, change the level with /delegate, or cancel the task.
| Rule | What it covers |
|---|---|
| Force push | git push --force, -f, --force-with-lease, origin +main |
| Hard reset | git reset --hard |
| Forced clean | git clean -f, -fd, -fdx, and not -n |
| Recursive delete | rm -rf of an absolute path, the home directory, a parent, a path built from a variable, or .git |
| Download piped to a shell | curl … | sh, wget … | bash, curl … | zsh, curl … | dash on a certain line |
| Publishing | npm publish and the other registry publishers, gh release create, gh pr merge |
| Writing credentials | .env*, .ssh/, .netrc, .git-credentials, .aws/credentials, .docker/config.json, id_rsa, *.pem, written and not read |
| Skipping the hooks | --no-verify, core.hooksPath, HUSKY=0 |
| This extension's own files | delegation-policy*.json, its log, its sidecars, agents/pi-delegation-policy.*.md |
A credential or policy file that only appears as an argument is not a write: cat .env and git add .env are not held for writing a credential. The write positions are exact: the target of an unquoted > or >>, every operand of tee and sponge, the last operand of cp and mv, and the path an edit or write tool call names. A commit message that mentions one writes nothing. A shell editor such as vi or nano, or sed -i, is not one of those positions, so rewriting a credential in place is not a hard refusal here: that is the declared edge of this cut, and the count still sees the change. A package publish with --dry-run is not a publish either; gh and hub have no dry run and ignore the flag. A download piped into an interpreter that reads it (curl … | python -m json.tool) is not this rule either, and neither is a script already on disk.
An answered consultation lifts these, for the target it covers. An answered consultation opens a pass for the exact pair of rule and target that was refused, and the pass covers a few calls of that same pair and nothing else. A pass never covers a rule above and never moves the count.
| Rule | What it covers |
|---|---|
| Continuous integration | .github/workflows, .github/actions, .gitlab-ci.yml, .circleci, Jenkinsfile |
| Git hooks | .git/hooks, .husky, lefthook.yml, .pre-commit-config.yaml |
| npm configuration | .npmrc |
| Lockfile edited by hand | package-lock.json, yarn.lock, pnpm-lock.yaml, go.sum and the like |
| A newly named package | an install that names a package, as opposed to npm ci or npm run |
| A line it cannot judge | a wrapper or launcher, an escape, a substitution, a quoted command word, a shell call with no text, or a command over 1 KiB |
Trajectory holds look at the task instead of the call, and lift the same way:
| Rule | What it covers |
|---|---|
| Repeated failing runs | three executions in a row that failed, then the next command |
| The same file edited again | three edits of one file with failures between them |
| Several files with no answer | three distinct files edited since the last answered consultation |
The count keeps working as it did in 0.35.0: a warning at 3 changes made with no consultation and a hold from the 6th. The rules do not lower it, and a refused call never moves it.
The refusal names the category and says the call was not run; it states no count and no pattern, so that satisfying the text does not become a way through. A soft rule refuses like this in tool launch:
text
Not an error: this call was not run. Guard rule: continuous integration configuration.
Call consult_advisor once; it asks all Advisors. It needs no arguments; the host supplies the context.
A consultation that answers covers this target for a few calls. Reading is not affected.A rule above the count sends the model to the user instead, and repeating the call or consulting an Advisor does not change that.
What the reader is certain of
The rules rest on reading a line, and no small reader reads every shell dialect. So this one never guesses: it either reads a line it is certain about, or it says it cannot and refuses to judge it as if it could.
A certain line is a small grammar and nothing else: one or more simple commands and pipelines or lists split on ;, |, &&, ||, & and a newline outside quotes, so a two-line script is read line by line; plain words with single or double quotes, with no backslash, no $(…), no backtick, no here-doc, no <(…) and no unclosed quote; and no wrapper at all. sh, bash, zsh, dash, ksh, ash, fish, pwsh, powershell and cmd with a wrapper flag (-c, a short group ending in c, --command, -Command), eval, xargs, busybox, chroot, stdbuf, setsid, ionice, watch and strace make a line uncertain: this reader does not follow them. The prefixes that only set up the command that follows are transparent — sudo, doas, env, nice, timeout, nohup, time, command, exec, builtin, and the package runners npx, pnpx, bunx, npm exec|x, pnpm exec|dlx, yarn exec|dlx and bun x — but only with the options each one documents and with -- ending them, so sudo -n rm -rf /, sudo -- rm -rf /, sudo -u root rm -rf /, nice -n 10 rm -rf /, env -i rm -rf /, timeout -s KILL 5 rm -rf /, command rm -rf /, exec -a x rm -rf / and npx rm -rf / are read, while npx tsc is ordinary. An option one of them does not document makes the line uncertain instead of being skipped blindly. A runner is read only in its exact shape: the runner name, then the subcommand when it has one, then its flags and --, then the program. An assignment in that prefix is uncertain too, and the program behind a runner is judged by the closed hard list only, so npx rimraf .git is not hard.
Anything else is uncertain, and what makes it so is a construct, never a size: a backslash, a substitution, a backtick, a here-doc, process substitution, a wrapper, or a quoted or variable command word. An uncertain line is never allowed silently and never judged as if it parsed: it is a soft refusal under long-command, "a line this reader cannot judge with certainty", which an answered consultation covers for that exact line once and never another one. A command over 1 KiB is not read at all and is held the same way, with the refusal asking for it to be split into shorter commands or written with the write tool. Either way the refusal names an exit, and a line built to hide what it runs is still a change for the count.
The rules never act in a subagent child session, where there is no user to ask and no Advisor to answer, and a soft or trajectory rule refuses nothing when this configuration cannot consult at all, because that hold would have no way out. They read the text of bash, which on Windows is Git Bash, so POSIX and Windows forms appear in the same line; the separate powershell tool is an unknown tool that already counts as a change. Once two consultations in a row reach an Advisor and fail, a refusal by any rule that names a consultation ends with the same clause the count adds and sends the model to you. What no part of this follows is indirection: a script the line names, an alias, a variable that holds the dangerous words. It is a nudge, not a sandbox, and the host's own permissions still decide what runs.
Advisor child extensions
An Advisor child in a role launch runs with its own system prompt and inherits the session's ambient extensions. The tool-launch profile and the packaged provider profiles keep extensions: empty and load no ambient extension. To add a personal extension everywhere a native child can load one, name it in delegation-policy.advisor-extensions.json beside the delegation document:
json
{ "schemaVersion": 1, "extensions": [{ "package": "example-prompt-layer", "version": "1.2.3" }] }Admission is as strict as a provider admission: an exact package@version, listed unfiltered in your own settings, installed by Pi, with one extension entry inside the package. Up to two entries. The host loads them for every local native child, Advisors included, while an Advisor is enabled. That is the only granularity the host offers, so the ContextShunt reader loads them too and its contract expects the same ids. An invalid file, or a package that no longer passes the check, is ignored with a warning and the Advisors keep working without it.
These extensions run as trusted host code in the child, with your files and network, and they can change the Advisor's prompt. The child does not revalidate them. A prompt layer that prepends text means the advice comes from the Advisor role plus your own instructions, in that order.
How the policy reaches the model
The block is written into the system prompt, and it also travels as one message of its own right after the system message on every request, while either axis is on. The message carries a revision: line: the fingerprint of the block it holds. Two reasons, and the second is the one you can observe:
- A host that rebuilds the system prompt every request then carries the same policy twice, once in the system role and once as the delivered message. That is redundant, and it is not free: the block starts around 6 KB and grows past 11 KB with three Advisors, so the duplicate is real input on every request. The cache makes it cheap, not invisible.
- The final-payload rewrite only reaches payload shapes it recognizes. In the residual case — an unrecognized shape, or the block sitting outside a recognized instruction field — the system copy the host built at session start is what the model reads, and a later change could be invisible. That is the case the delivery covers: the policy in force arrives on the next turn, whatever the system prompt says.
What it costs and what it does not:
- While the configuration holds, the delivery is byte-identical on every request and sits in the same position, so a provider reuses its cached prefix. The turn where something changed replaces that one message and re-bills from there, which is the same turn the system copy changes too.
- Both axes off: no block, no delivery.
- The message is ephemeral. It is rebuilt from the current configuration on every request and never written to the session transcript, so older copies never accumulate.
- The block is not delivered when the host cannot hand over a text system message; the request is then left untouched.
- Known limit: when the system copy is the stale one, the model reads the current policy as user text while an older copy still sits in the system role. The
revision:line is the only ordering rule it has, and no test or real run here proves the model resolves it the right way. Replacing the system copy with a short pointer, so only one block ever travels, is the planned follow-up.
Persistence and compatibility
- Global defaults:
~/.pi/agent/delegation-policy.json, schema 7: intensity, preference, the tri-state ordinary roles,uiDesign, the thinking policies, and the ContextShunt configuration. - Guard settings:
delegation-policy.guard.json, schema 2 withconsultBeforeFirstChangeand an optionalreviewer: {model, mode}, andreviewer: nullmeans the same as leaving it out. Missing means off, an unreadable or invalid file is reported and means off with no reviewer, and writing everything off removes the file. Schema 1 is still read, as a reviewer that is off. Amodeother thanoffneeds a model, and the writer stores a mode with no model asoff. - Launch correction mode:
delegation-policy.launch-correction.json, schema 1 withmode. Missing or invalid state meanscorrect. Older versions ignore it. - Advisor nudge level:
delegation-policy.advisor-level.json, schema 1 withlevel, optionalmodelsand optionalcontext. Missing state meansstandard; invalid state falls back tostandardwith a notice and never disables delegation. Older versions ignore it. - Advisor reminder:
delegation-policy.advisor-reminders.json, schema 1 withmode(offorremind). Read only as a fallback when the level file does not exist. Older versions ignore it. - Legacy companion:
delegation-policy.advisor.json, envelope 1 with schema 8 state for Advisor 1. Versions0.17–0.20see its mode and model in role mode;0.16sees delegation without Advisor. None of those versions sees Advisor 2, Advisor 3 or tool launch. - Advisor extension:
delegation-policy.advisor-extension.json, envelope 1 with normalized schema-8base, optionaladvisor2, optionaladvisor3, andadvisorLaunch. Missing, invalid, unreadable or mismatched state falls back to Advisor 1 andtoollaunch with a diagnostic, notA:ERRfor a valid first advisor. Older versions ignore it, and0.21–0.23fall back to Advisor 1 when it holdsadvisor3. A save from one of those versions then drops Advisors 2 and 3. - Provider admissions:
delegation-policy.provider-extensions.json, schema 1 withproviders, one package and version per admitted provider. An invalid file is ignored with a diagnostic and leaves the other Advisors running. - Advisor content filter:
delegation-policy.advisor-filters.json, schema 1 withcyber, one boolean per Advisor slot, trailing offs dropped. Missing state means no Advisor is flagged; invalid state is a diagnostic that flags none and leaves the block active. Older versions ignore it. - Session Apply: schema 2 off guard, extension entry, schema-8 companion, then schema-7 delegation commit. The legacy companion remains adjacent to that commit. A failure leaves both axes off. The values that also have a shared file follow in
pi-delegation-policy:session-overrides, schema 1, a whole snapshot per Apply where the newest valid entry wins, and the nudge level inpi-delegation-policy:advisor-level. Versions up to 0.38.0 ignore the overrides entry, so after a downgrade those values come from the shared files again.
Schema 9 accepts ordered advisors: [{provider, model}] with 1–3 entries and inherited advisorLaunch: role|tool. An omitted list inherits; a list replaces every entry; session advisors: null disables. Legacy advisor and thinking.advisor are single-advisor shorthand, not combinable with advisors. A per-entry thinking, or a thinking.advisor saved by an earlier version, must still be well formed, but it is ignored and dropped on the next save. Schemas 2–9 resolve into the schema-10 effective state in memory without writing.
Compatible saves and interruption recovery
Global saves replace delegation, companion, then extension, individually atomically, not as a transaction. All three previous files must be readable or absent. On failure, restore and verify only our committed prefix, never a detected foreign write; otherwise report partial save and reload disk. Checks are not locks. A crash can leave Advisor off or Advisor 1 only in role mode until repaired.
Content-free events go to delegation-policy.events.jsonl in the same agent directory, never to the network. Limits and privacy lists every field, the rotation, the shutdown drain, and the cases in which no event is written.
Version floors
These are the version requirements and admissions the extension enforces. Anything outside them fails closed rather than falling back to another model, provider, or executor.
| Component | Requirement | When it is unmet |
|---|---|---|
| Pi | >=0.87.1 | The extension needs the per-request hook that this floor introduced, so earlier Pi is unsupported. |
pi-subagents (Advisor tool, reader) | stable SemVer >=0.76.1, no upper bound | unavailable text or reader-unavailable, before any request |
@gotgenes/pi-permission-system | only 33.0.3 is admitted, and only when the host adds it | The reader rejects the extra runtime and returns reader-unavailable |
@gotgenes/pi-anthropic-auth | the managed user install, exact package name, no link, one internal entry and listed in your settings; required only when the opt-in is selected, and no version is admitted or compared | That Advisor is unavailable with the cause, with no fallback to the standard profile |
@earendil-works/pi-ai | the copy this extension resolves must export providers/all (getBuiltinModels), which exists in 0.84.3, the declared floor | An older copy fails the import when the extension loads; that same copy decides what the launch check finds, so a model it does not carry keeps the provider-profile refusal |
Downgrade
Before downgrading to a package that cannot read schema 4, set global and branch ContextShunt to off. Before downgrading to 0.6.0, set intensity to off, normal, or aggressive and run /delegate off in every active branch. For <=0.5.0, convert global defaults to schema 2 and replace ordinary null values with exact references. The downgrade guarantee of this line is for schema 7 readers such as 0.16.0; earlier versions keep their existing limitations.
ContextShunt
contextShunt.mode is independent from delegation intensity: off is the default and does no classification, metrics, archive I/O, or interception. observe records decisions without changing calls or results. enforce covers only recognized native reads, one conservative bounded Get-Content/gc form on bash and powershell, and known successful textual results. Delegation off suspends the effective mode without deleting the saved preference.
Limits, patterns, and the reader settings inherit per field between global defaults and the branch. Preflight limits use declared lines and post-result limits use real UTF-8 bytes and returned lines. exceptionPatterns exempt matching paths only from this optimization and never grant filesystem access; delegationHintPatterns label an already blocked declared excess as a delegation hint. Three further keys control the opt-in inline reader:
readerEnabled(boolean, built-infalse) — allowcontext_shunt_delegateto answer from a preserved artifact.readerRole(small,medium, orlarge, defaultsmall) — an existing ordinary role whose exact model answers. No separate reader model is stored, and the role must be enabled with an available model.answerMaxBytes(integer, 1024 to 16384, default8192) — cap on the serialized result, including its citations and envelope.
The reader also needs an effective mode of enforce, an active delegation intensity, and a valid configuration. It requires stable pi-subagents SemVer >=0.76.1, with no upper bound, and the unchanged strict launch contract. Older, prerelease, invalid or contract-incompatible builds fail closed with reader-unavailable. The reader was verified with 0.76.1 on Pi 1.1.0. Context advanced in the panel edits these values and each limit, and Reset ContextShunt draft clears all branch values. Schema 4 still accepts a positive limits.readerOutputBytes from older files, but ignores it and never writes it again.
Read limits and privacy for the request, the answer contract, and retention.