Configuration Cookbook
Everything in the distribution is tuned with small JSON files. This page is recipes: find the one that matches what you want, copy it, adjust, restart pi.
Where your settings live:
| File | What it controls |
|---|---|
|
Your personal overlay on the modes system — models, rules, the judge, guards. Merges over the package defaults (a rule you name for a shipped pattern can only get stricter). |
|
Your model catalog for Vertex — Claude, Gemini and the MaaS models: which models, which publisher kind, which regions, auth-retry behaviour. Replaces the shipped catalog whole: start from a copy of it (below). |
|
Operational knobs for the workflow guards: the reflection review’s time bound and thinking level, the review-context caps, the reviewer’s snapshot caps. Optional; the guards' decisions are not tunable. |
|
A different model or turn cap per seeded helper (Explore, Research; a
turn cap for general-purpose, which names no model of its own).
Optional; the file stays managed and keeps receiving prompt
updates — only the |
|
Ordinary pi settings — including your theme. pi-modes adds one key here
when it is absent: |
|
Project-specific guidance injected for everyone working in that repo. |
After editing, restart pi (mode and model changes need a fresh session).
Back to the package defaults
Package upgrades never touch the files above — which is also how tuning drifts: an overlay written for one preference keeps applying long after the reason is forgotten.
-
/gadhs-resetlists the local tuning in force: each file, and what it changes in your terms (the modes overlay’s carve-outs, the helper model overrides, the catalog entries). -
/gadhs-reset --apply, after a confirm, moves each file to a dated.bakbeside it. Nothing is deleted; restart pi and the packages re-seed the agents and the permission config and read their defaults. -
It leaves two things where they are: a file reached through an environment variable (
GADHS_PI_MODES_CONFIG,VERTEX_CONFIG) — it names the variable instead, since moving the file would leave the variable pointing at nothing — and a seeded agent file that still carries itsgadhs_managedmarker, which package updates maintain. -
Files are found by name (
gadhs-pi-<package>.json, the catalog override, agent files without the marker, the seeded permission config), so a new package’s tuning file joins the list by following the name.
Modes
Change which model a mode uses
You prefer Sonnet 5.5 for everyday work in auto mode:
{
"modes": [
{ "id": "auto", "label": "Auto",
"model": "vertex-anthropic/claude-sonnet-5-5", "effort": "medium" }
]
}
Only the fields you set change; everything else about auto (its rules, judge, guards) comes from the package.
Start every session in plan mode, applied immediately
{
"applyOnStartup": true,
"cycle": ["plan", "auto", "manual", "yolo"]
}
The first entry in cycle is the startup mode. With applyOnStartup off
(the default) a fresh session keeps whatever model you had; a mode you were
in when you closed pi is always restored either way.
Keep your chosen model when switching modes
{ "stickyModel": true }
With sticky on, a model you picked (with /model, or your configured pi
default) rides through mode switches, together with the thinking level it
was running; the notice says what the mode would have used ("keeping
fable at high; mode default is opus at medium").
-
A model a mode set gives way to the next mode’s default — sticky protects choices, not defaults — and on a mode’s own model the next mode’s
effortapplies as usual. -
A mode that declares an effort with no model applies it to whatever is running.
-
Without sticky (the default), a mode applies its declared model: plan pairs deep reasoning with read-only investigation, and the pairing is part of what the mode is.
Every switch is announced — to you as a notice, and to the model as a
gadhs-mode-change message in its context naming both modes and any
model swap, since a model cannot tell a recomposed system prompt from its
own assumptions. The mode a session opens in is applied quietly.
Keep pi’s own working text
While a turn runs, the working text names the running tool, the elapsed time, the helpers and the turn’s spend (the working line). To keep pi’s own text:
{ "workingLine": false }
Rebind or unbind the pending-queue and hub keys
alt+a and alt+x approve or deny the newest step waiting on you
(the pending queue); alt+h opens the hub
(the hub). None of them is a key pi binds itself; deny
was alt+d until #587, which took pi’s delete-word-forward in the editor. If your terminal owns one of those keys,
rebind it, or set it to null to unbind it:
{ "shortcuts": { "approvePending": "ctrl+shift+a", "denyPending": null, "hub": "ctrl+g" } }
Turn off the turn recap
At the end of every turn, one line says when it ended, and what it did when it ran at least 3 tool calls or 20 seconds (the recap). It never reaches the model. To leave it out:
{ "recap": false }
Stop dropped images going to the model
By default, a prompt that names an image file on this box sends the image
with it. Dropping a file on the terminal, or ctrl+v of a screenshot,
does exactly that (how it works). To send
paths only:
{ "dropToAttach": false }
Change or remove the mode-cycling shortcut
{ "cycleShortcut": "alt+m" }
Set it to null to have no shortcut. (Shift+Tab is taken by pi itself.)
Add your own mode
A "demo" mode: fast model, no thinking, judge on a short leash:
{
"cycle": ["auto", "demo", "plan", "manual", "yolo"],
"modes": [
{
"id": "demo", "label": "Demo",
"model": "vertex-anthropic/claude-haiku-5-5", "effort": "off",
"systemPrompt": "Demo mode: prefer short answers and visible steps.",
"workspaceWrites": "allow",
"judge": { "model": "vertex-anthropic/claude-haiku-5-5", "authority": "deny-only" }
}
]
}
Remember to add the new id to cycle, or /mode next will skip it.
The high-consequence list
Name the actions that should always stop and ask you — before any model gets an opinion. This list is empty by default because every team’s is different: a team that ships on merge has a different list from one that ships on tags.
{
"modes": [
{ "id": "auto", "label": "Auto",
"highConsequence": [
"git push*main*",
"git push*master*",
"glab mr merge*",
"npm publish*",
"*terraform apply*",
"*production*"
] }
]
}
Patterns are simple globs (* matches anything) tested against the whole
command and against file paths. A match is never refused outright — it just
becomes a question for you.
Permission rules
Block something outright in auto mode
Your team never wants the agent touching Kubernetes:
{
"modes": [
{ "id": "auto", "label": "Auto",
"permission": { "bash": { "kubectl *": "deny", "helm *": "deny" } } }
]
}
deny is instant and final — no model, no prompt. The agent is told why.
Send something to the judge instead of allowing it
ask means "let the judge look at it" (or you, in manual mode):
{
"modes": [
{ "id": "auto", "label": "Auto",
"permission": { "bash": { "docker *": "ask" } } }
]
}
Carve an exception out of a shipped rule
Rules are matched most-specific-wins, so a narrower pattern can carve an
exception out of a broader one. The shipped rules refuse reads under
/.ssh/; this lets the harmless known_hosts file through while keys stay
refused:
{
"modes": [
{ "id": "auto", "label": "Auto",
"permission": { "read": { "*/.ssh/known_hosts": "allow" } } }
]
}
-
Same pattern, stricter wins: where your pattern and a shipped one are identical, the stricter action stands — an overlay cannot loosen policy head-on.
-
A refinement, yours wins: an allow outranks a deny only by naming a subset of it, meaning the deny’s pattern matches yours (with the recipe above,
known_hostsreads allow andid_ed25519reads still deny). A longer pattern that merely overlaps the deny does not outrank it: a sibling glob like*known_hostscarves nothing (#222). -
Carve-outs are reported: each overlay pattern that narrows a shipped rule to allow what it would refuse is listed at session start (
modes overlay carves 1 exception into the baseline: auto: read "/.ssh/known_hosts" allow inside "/.ssh/*" deny). A name on that list you did not mean is an overlay that drifted.
Pre-approve one exact command (a standing approval)
You told the agent "merge once pre-push passes, no need to ask", and the
judge still queues the merge for you. It cannot know what you said in
conversation, and an agent’s memory proposal does not change policy
(#468 discusses wider standing approvals). The easy way is
/pending always N on the queued step (modes page, § the pending queue):
it writes the rule below for you, after showing it. By hand, write the
approval as an allow rule on that exact command:
{
"modes": [
{ "id": "auto", "label": "Auto",
"permission": { "bash": {
"glab api --method PUT projects/gadhs%2Fexample/merge_requests/*/merge": "allow" } } }
]
}
Keep the pattern exact. Put a only where a value really varies, here the
merge request number: a matches anything, spaces included. What the rule
does not do (#475):
-
It applies to that one command. On its own the line takes the allow. Inside a longer line it counts only where the plain-line stage clears every other command too (
plainLines, #888):cd /tmp && <the merge>runs with no model. A line with a substitution, a heredoc or a command nothing clears goes to the judge whole (#205). -
It never passes the safety valve. A line the valve names still goes to the judge, capped there (#222), as does one carrying a secret-shaped value (#923). No allow of the gate’s passes either check (#901).
-
Your
highConsequencelist still asks first. A command you put there stops for you whatever the rules say: take it off the list if this rule is meant to replace the question. -
Only you can write it. In every mode that has rules, an agent may read your overlay files but its write, edit and bash access to them is refused. The approval is yours, not something an agent can grant itself.
Restart pi after editing.
Two rules for authoring patterns:
-
A pattern containing a pipe matches the pipeline as written. Bash rules see every pipeline whole and every stage of it:
echo x | shis the pipelineecho x | shand the stagesecho xandsh. So* | shfires on the pipeline (the shipped shell-sink rules are written that way, spaced and unspaced), and a pattern on a stage fires on the stage. -
Extend allowlists from evidence, not guesswork.
node tools/task.mjs verdictsshows what the judge was actually asked; the entries worth allowing are the routine ones that dominate that list.
The judge
Auto’s shipped judge is Sonnet 5.5 at low with authority advise. A
judge block in your overlay replaces the mode’s whole judge, so every
recipe below restates all three: leave authority out and it falls back
to deny-only — the judge can then never approve, and every routine ask
comes to you.
Use a different judge model
Sonnet 5, Sonnet 4.6 and Haiku 4.5, the earlier judges on the battery’s judge corpus (the model battery), have left the catalog (#942, #987). Haiku 5.5, for example:
{
"modes": [
{ "id": "auto", "label": "Auto",
"judge": { "model": "vertex-anthropic/claude-haiku-5-5", "effort": "low", "authority": "advise" } }
]
}
Make the judge stricter (it can refuse, never approve)
{ "modes": [ { "id": "auto", "label": "Auto",
"judge": { "model": "vertex-anthropic/claude-sonnet-5-5", "effort": "low", "authority": "deny-only" } } ] }
With deny-only, anything the judge would have approved comes to you
instead. Good while you are building trust in a new setup.
Give the judge your own rubric
{ "modes": [ { "id": "auto", "label": "Auto",
"judge": { "model": "vertex-anthropic/claude-sonnet-5-5", "effort": "low", "authority": "advise",
"prompt": "/home/me/.pi/agent/my-rubric.md" } } ] }
The prompt can be a file path or inline text. Keep it short and
mechanical: rubric attention is finite — a five-line addition to one
bullet has been measured flipping the verdict on an unrelated case, and
halving the wording removed the regression. After any rubric change,
re-run the whole corpus (node tools/task.mjs eval --repeat 3, from a
checkout of this repository), not only the cases you were aiming at.
Keep certain actions interactive even in yolo
Yolo declares its own valve — an empty one, on purpose — so the shared
list does not reach it. Give yolo its own list; the judge block replaces
yolo’s whole judge, so keep allow-all:
{ "modes": [ { "id": "yolo", "label": "YOLO",
"judge": { "authority": "allow-all", "alwaysAsk": ["pnpm publish*", "git push --force*", "helm upgrade*"] } } ] }
The shared safetyValve (top level) is the list auto and plan use, since
neither declares its own. Setting it in your overlay replaces the
shipped list rather than adding to it, so copy the shipped list from
modes.json and edit it. That is also how to hold registry publishes
again, which left the shipped list in #304: copy the shipped patterns and
add the publish commands you want held (npm publish*, cargo publish*,
docker push* and so on). The patterns it holds are listed in
the safety valve. Start a pattern with the
command it names (helm upgrade*), not with : a leading matches
the word anywhere, in a grep or a commit message too. Wrappers such as
timeout 60 are stripped before matching, so you don’t need a pattern
for them.
Tune the denial-loop guard
If the agent gets refused 3 times in a row (or 20 in a session), everything starts coming to you instead — a sign something is off. Adjust or disable:
{ "modes": [ { "id": "auto", "label": "Auto",
"judge": { "model": "vertex-anthropic/claude-sonnet-5-5", "effort": "low", "authority": "advise",
"maxConsecutiveDenials": 5, "maxTotalDenials": 0 } } ] }
(0 disables that limit.)
Turn off the registry check on installs
An install of a package the project lacks is checked against npm, PyPI or crates.io before the judge (Workflow Modes, #268). On an air-gapped box every such install would wait out the deadline for nothing, so turn it off, or shorten the wait:
{ "registryFacts": false }
{ "registryTimeoutMs": 1500 }
Cap what a session spends
The shipped cap is 0: none. To have a session stop and ask once it has
spent $25 (the footer’s cost, judge and helpers included), in every mode:
{ "spendCapUsd": 25 }
Or cap only yolo, which has no other brake, overriding the top level:
{ "modes": [ { "id": "yolo", "spendCapUsd": 10 } ] }
Past the cap, the next tool call waits on you. Approving (/pending approve
in auto or plan, the confirm in manual or yolo) allows another cap’s worth;
denying stops the run.
Warn before a request is too big for the provider
Every image read stays in the session’s context, as base64 text a third
larger than the file. Enough of them push a request past the provider’s
size limit, and the session stalls until you compact (#452). pi warns
once when a request reaches 20 MiB, naming its size and the way out
(/compact, or a new session), and warns again only after a smaller
request. To warn later, for a provider with a larger cap, or not at all:
{ "requestWarnMb": 28 }
0 turns the warning off. The size is the request’s JSON, which is what
goes on the wire.
Leave old images out of a big request
Before it comes to the warning, pi leaves old images out (#452). When the
images in one request pass imageBudgetMb (12 MiB of image data by
default, leaving the 20 MiB warning room for text), the oldest go out as
a one-line placeholder until the rest fit in half the budget. A read
image’s placeholder names its file and tells the agent to read it again;
an attached one says it was attached. The session keeps every image:
only the request changes, and you are told once each time it trims.
Three rules keep the trim from costing more than it saves:
-
A trimmed image stays out of every later request. The provider’s prompt cache breaks once, at the trim, not on every request.
-
A file read again is a new image and goes out whole.
-
An image the model has not answered yet is never left out, nor is the newest one.
To keep more images per request, or trim sooner:
{ "imageBudgetMb": 8 }
0 sends every image, as before.
Keep images smaller
pi itself sizes every image before it enters the session: a file the agent reads, one you attach, and one a tool returns. By default an image larger than 2000 by 2000 pixels, or 4.5 MiB once encoded, is scaled down and re-encoded: PNG when that fits the byte cap, else JPEG at falling quality, else smaller again. The model is told the scale, so coordinates still map back. Anything within both passes untouched. A dozen large renders under that cap can still add up past the provider’s request limit (#452).
To send images smaller for a model, set its inputLimits in pi’s own
~/.pi/agent/models.json. modelOverrides reaches the models pi-vertex
registers (vertex-anthropic, vertex-gemini, vertex-maas):
{
"providers": {
"vertex-anthropic": {
"modelOverrides": {
"claude-opus-5-5": {
"inputLimits": { "images": { "resize": { "maxWidth": 1568, "maxHeight": 1568, "maxBytes": 1048576 } } }
}
}
}
}
}
With that, a 3000 by 2000 render reaches the model as 1568 by 1045 and
under 1 MiB, against 2000 by 1333 and about 2.9 MB by default. The fields
are pi’s: maxWidth, maxHeight, maxBytes (base64 bytes) and
jpegQuality (80 by default). An image is sized once, when it enters the
session, so a change applies to images read after it.
What the provider would do anyway, to choose values: Claude 4.7 and later scale an image down to a 2576-pixel edge, older Claude models to 1568, so a larger image only costs bytes. A request holding more than 20 images holds each to a stricter limit (3000 pixels is safe), and Vertex caps a request at 30 MB. Smaller images save context at the cost of detail: for design review, keep the default.
Models on Vertex
Full reference: Models on Vertex AI. The highlights:
Generate an image
The agent calls generate_image with a prompt and a path (modes page,
§ Images). Nano Banana 2.1 is the default; to default to another image
model, set it in ~/.pi/agent/gadhs-pi-modes.json:
{ "imageModel": "vertex-gemini/gemini-3-pro-image" }
From a codemode script, the same models answer models.generateImages():
const painter = await models.getModelOfType("image", "vertex-gemini", "gemini-nano-banana-2.1");
const result = await models.generateImages(painter, { input: [{ type: "text", text: "A red fox, watercolor" }] });
for (const block of result.output) if (block.type === "image") image(block);
The five image models, their prices and their speed are on the Vertex page (vertex.adoc#image-models).
What is there out of the box
Three provider ids from one package, one config file, the same ADC, no
login: vertex-anthropic/… (Claude), vertex-gemini/… (Gemini 4 Argon,
Carbon, Neon and Hydrogen) and vertex-maas/… (gpt-oss 120B, Grok 4.20
Reasoning and Non-Reasoning, Grok 4.7). /model lists them all on install;
the image models above are not chat models and are not among them. A model’s publisher kind in the catalog decides which id it lives under; you never configure Gemini one way
and Claude another.
Point at your own GCP project
export ANTHROPIC_VERTEX_PROJECT_ID=my-team-project
gcloud auth application-default login
Switching models mid-session
Any model, any time — with one rule: the context has to fit. Switching a
long session into a model with a smaller window gets a warning with the
numbers and an offer to compact where you came from first; /new is the
clean slate. Details: session.adoc#_switching_to_a_model_the_context_does_not_fit.
Add or remove models, change regions
~/.pi/agent/vertex-models.json replaces the shipped catalog: it is the
whole file the provider reads, not an overlay, and pi refuses to start if
it has no models array. Start from a copy of the shipped one and edit
that (the path is pi’s npm root on a default install):
cp ~/.pi/agent/npm/node_modules/@gadhs/pi/dist/assets/@gadhs/pi-vertex/models.json ~/.pi/agent/vertex-models.json
Remove the entries you do not want, change a region, or add one. A
Gemini entry needs only its id, publisher, region and rates — pi-ai’s
catalogue supplies the rest. A MaaS entry needs more: vertexModel (the
publisher-prefixed name Vertex expects) and the model’s window and output
cap (contextWindow, maxTokens), which no catalogue supplies and which
otherwise fall back to generic defaults — start from a shipped MaaS
entry. In your copy, Hydrogen’s entry reading like this moves it from
global to the us multi-region, which it also answers from — a
US-residency posture in one edit (the other fields as shipped):
{ "id": "gemini-4-hydrogen", "publisher": "google", "region": "us", "thinkingWire": "level-xhigh",
"contextWindow": 1048576, "maxTokens": 65536, "costUntil": "2027-01-11",
"cost": { "input": 1.5, "output": 7.5, "cacheRead": 0.075, "cacheWrite": 0 } }
To see which models and regions your project can reach, run the probe that
ships beside it:
node ~/.pi/agent/npm/node_modules/@gadhs/pi/dist/assets/@gadhs/pi-vertex/probe.mjs
(--publisher google|maas|anthropic for one kind). Its --json output
lists what answered, with placeholder zero rates: fill in the
publisher’s rates before using an entry, or it misreports session cost.
Restart pi after editing the file.
Auth expiry: how long to wait for you to re-login
When your Google session expires mid-task, pi does not fail the task — it
tells you to run gcloud auth application-default login and retries on a
timer until you have, for as long as the turn is alive; pressing escape is
what ends it. Tune the poll, cap the wait, or disable it with a top-level
key of your vertex-models.json copy (Add or remove models, change regions — never a file
on its own):
{ "adcRetry": { "intervalMs": 30000, "maxWaitMs": 600000 } }
(Defaults: every 60 s, no cap. maxWaitMs is opt-in: set, the turn ends on
the original error after that long and the notice says it gave up.
intervalMs: 0 disables.)
Headless hosts: how long a host gets to answer
Under pi --mode rpc — an IDE plugin, pi-web-ui, a daemon, the pivot
client — there may be no one to answer a dialog, or someone on a phone who
needs a minute. Two waits, in the modes overlay
(~/.pi/agent/gadhs-pi-modes.json or GADHS_PI_MODES_CONFIG):
{ "unattended": { "gateTimeoutMs": 30000, "dialogTimeoutMs": 600000 } }
gateTimeoutMs (default 30 s) is how long the host gets to confirm a
permission ask the gate deferred; silence denies. dialogTimeoutMs
(default 10 min) is how long it gets to approve a plan or answer ask;
silence refuses. Either at 0 means do not ask at all - the gate denies
without the confirm, the approval and ask refuse without the dialog
(pi itself would read a zero timeout as none). Neither applies in
the terminal, where a human is at the keyboard and dialogs do not time out.
See what changes at a headless host.
The monitor: how long it may run, how many, how long an action gets
A monitor runs for its timeout_ms, 5 minutes by default, up to a cap of 1
hour. persistent runs it until the session ends
(how it works). The monitor block in the modes
overlay sets these limits:
{ "monitor": { "maxTimeoutMs": 0, "defaultTimeoutMs": 900000 } }
-
maxTimeoutMs(default 3 600 000) capstimeout_ms;0removes the cap, so a monitor may run for any time. -
defaultTimeoutMs(300 000) is used when the agent gives no timeout. It is refused at load if above the cap. -
maxMonitors(8) is how many may run at once in a session. -
actionTimeoutMs(60 000) bounds one run of an unattendedon_matchaction. -
allowPersistent: falserefusespersistentwhile a cap is set.
The terminal’s title and tab
The title carries a glyph while a turn runs (◐) or a dialog waits (⚠),
followed by the number of running helpers when there are any (◐2; ○2
when only helpers run),
and the tab an OSC 9;4 progress state Windows Terminal, ConEmu and iTerm2
render. Both on by default; in the modes overlay:
{ "title": { "enabled": true, "progress": false } }
enabled: false turns both off; progress: false keeps the title glyph and
drops the OSC, for a terminal or multiplexer that renders the sequence badly.
Nothing is written at a headless host either way. See
what the states mean.
When a dialog opens or a turn ends, the terminal also rings and shows a desktop notification, unless its window has focus (#342). To ring for dialogs only, or not at all:
{ "title": { "nudge": "asks" } }
nudge is "all" (the default: dialogs, steps queued in /pending, and
finished turns), "asks" (dialogs and queued steps only) or "off". enabled: false turns it off with the rest.
The context budget: how heavy the instructions may get
At session start, when the AGENTS.md / CLAUDE.md files pi reads into
every turn total more than 16 KiB, one warning names the total and the
heaviest file. A repository whose instructions are legitimately large
can widen the budget, or turn the notice off with 0; in the modes overlay:
{ "contextBudgetKiB": 32 }
Never a block. Set it to 0 as well if you run pi with
--no-context-files: the extension cannot see that flag and would weigh
files pi is not loading. See what it
measures.
Compaction: the summarizer of last resort
When the session’s provider refuses the summarization request - a policy classifier blocking it, not a model failing; Anthropic’s has done this to a long session full of quoted model output - retrying there is futile, and pi’s default compaction is the same call. The summary is then written once on a fallback from another provider family:
{ "compaction": { "fallbackModel": "vertex-gemini/gemini-4-hydrogen" } }
That is the default. null turns the fallback off; the warning then names
the way out by hand (/model to another provider, /compact, /model
back). Any provider/model the registry knows is accepted; the session’s
own model is never used as its own fallback. A transport error or a
length stop is not a refusal and does not reach this. See
when the provider
refuses the request.
Cache warming: keep the prompt cache alive between runs
pi’s cacheWarming setting was "streaming" by default up to pi 1.5.0:
the prompt cache kept warm during a long tool call and left to expire once
the run settles. The pauses that cost the agency are between runs - a
monitor’s wake, a helper’s result, the human’s answer - so pi-modes sets
the key to "idle" in ~/.pi/agent/settings.json once, when no value is
there, and says so at that session’s start; the value applies from the
next start or /reload. pi 1.5.1 made "idle" its own default, so on
that pi the key only writes down what pi would do anyway; it is still set
because the distribution’s floor is pi 1.5.0. A value you set is yours,
whatever it is:
{ "cacheWarming": "streaming" }
warms during tool runs only; "off" warms nothing. The warming itself is
pi’s: a refresh costs a cache read of the context, is sent only while the
expected saving clears pi’s threshold, and stops after half an hour idle.
It needs the model’s cache lifetime, which every Claude on Vertex now
declares (the catalogue); an entry with
"promptCache": null is never warmed. /session shows the next decision.
Cache retention: the one-hour tier, when your pauses are long
Anthropic keeps a cache entry five minutes, or an hour on its extended tier, which charges a cache write at 2x input instead of 1.25x. Whether the hour pays is your workload’s. An agent that waits on batteries, helpers and a human for 5-60 minutes at a time comes back to a warm cache every time and sends no refreshes at all (pi’s warmer refreshes at 90% of the lifetime, 54 minutes, past its half-hour idle ceiling): on canopy’s week-long session the hour would have cost about $130 in cache writes and misses against $200-245 for the five-minute tier with warming. A session whose turns come seconds apart, and whose pauses are either short or longer than an hour, pays the higher write for nothing - on that same week, $56 of incremental writes instead of $35. So it is opt-in, in your modes overlay:
{ "cacheRetention": "long" }
pi-modes sets PI_CACHE_RETENTION=long on the process at load, before
any request, where pi-ai reads it per request; the session’s first screen
says so and what it costs. Remove the key for the five-minute tier. A
PI_CACHE_RETENTION you set in the environment wins over the overlay,
and the first screen says that too when the two disagree. Vertex accepts
the tier and reports its writes apart (cacheWrite1h), which pi prices at
2x input; only Claude reads the variable. The entry’s content is the same
on either tier - a cache is a prefix, not a state - so nothing the model
sees changes.
The pivot client (/remote-control)
One file, ~/.pi/agent/gadhs-pi-remote.json:
{ "relay": "wss://pivot.dhs.example/ws", "boxName": "chris-laptop" }
-
relay— the DHS relay’s WebSocket URL;wss://except for alocalhostrelay in tests. TheGADHS_PIVOT_RELAYenvironment variable wins over the file. -
boxName— what the phone shows for this machine; defaults to the hostname. -
agent— the name every session of this agent directory sends agent messages as, one line of 1-64 characters (#564). Absent, each session is its project’s path (messaging). -
spaces—{ "allow": ["label", …] }: the spaces this agent directory’s sessions listen to, by label (#563). Absent, every space the box holds. A convenience, not a boundary: the box holds every secret it was granted either way.
Nothing else is tunable: the pairing window is the relay’s two minutes,
the reconnect ladder 1 s doubling to 30 s, and the waits a phone gets at
a headless host the unattended ones above.
State and diagnostics. The identity and the trusted devices
(devices.json) live in ~/.pi/agent/gadhs-pi-remote/; edit neither by
hand — /remote-control forget <device id> drops a device. link.log there
always records the link’s life — started, up, connect failed, silent,
stopped and why, the session boundary, restored, a device paired, a phone
on an older wire — and rotates to link.log.1 past 256 KiB. It holds the
relay URL, the session’s directory, reasons, a device’s id and label —
never a token, never a line of the transcript.
The diagnostics stream (diagnostics.adoc#diagnostics) carries the full trail
(every frame dropped, every peer, a phone’s abort) under the same promise.
pi over SSH
pi runs here and works on a remote checkout (pi over SSH is the whole story). These are the things people set or do.
Start working on a remote checkout
/ssh dev@box:/srv/app
Or from a shell, straight into one: pi "/ssh dev@box:/srv/app". pi
first checks that it can connect and that the directory exists. Then it
writes the project’s local anchor and switches into a new session for
it. The remote needs to be POSIX, with Node 22 or later and key or agent
authentication (ssh.adoc#start). /ssh status says what the
session is connected to, /ssh reconnect makes a fresh connection, and
/resume lists the project’s earlier sessions.
Open a remote dev server here
/ssh forward 3000
/ssh forward 3000:8080
/ssh forwards
/ssh unforward 3000
The first makes the remote’s port 3000 reachable at
http://127.0.0.1:3000 on this machine; the second uses local port
8080. A port that starts listening on the remote is named with the command
that opened it, and the agent is told which ports are forwarded
(ssh.adoc#ports).
Forward new ports without asking
~/.pi/agent/pi-ssh.json:
{ "autoForward": true }
Each port that starts listening on the remote is then forwarded at once, and its URL named. Ports below 1024, and the remote’s sshd port, are only ever named. Only this file counts: a repository’s files cannot open ports on your machine (ssh.adoc#ports).
A remote whose node is not on the PATH
The same file:
{ "node": "/opt/node/bin/node" }
The start says so when it is needed: "node is not on dev@box’s PATH; set its full path as "node" in ~/.pi/agent/pi-ssh.json." The path is the remote’s Node, not this machine’s.
Check whether a dropped link can hurt you
/ssh status ends with the link’s state. "link: resilient" means pi’s
helper on the remote is a daemon: a command, monitor or spawned program
goes on across a Wi-Fi drop, and its output arrives when pi reconnects.
"link: not resilient" means no daemon could start on the remote, so a
drop ends what runs (ssh.adoc#dropped-link). Either way, pi’s
normal exit ends what its session started there.
Turn it off
GADHS_PI_SSH=off in pi’s environment loads none of pi over SSH:
/ssh is gone and the tools are pi’s own. Leave any remote session
first, since its anchor would then be an ordinary local directory
(ssh.adoc#off).
The workflow guards
The guards themselves are not configurable — they run in every mode and
cannot be opted out of. A few operational knobs are, in
~/.pi/agent/gadhs-pi-workflow.json. The file is optional; a key the
package does not recognise is reported at session start and the file is
ignored (defaults apply), so a typo cannot quietly change what a guard does.
Give the reflection reviewer more (or less) time
The cold review is an upper-bounded call. The default bound is ten minutes — a backstop against a dead connection, not a budget: a reviewer thinking hard over a large diff is doing its job, and a model with a real problem returns an error rather than hanging. If the bound ever fires, the commit proceeds with no cold read (the block message says so), which is why the default is generous. Milliseconds, positive integer:
{ "reviewTimeoutMs": 1200000 }
Every review logs its duration and outcome (git_guard.reflection_done in the
diagnostics stream; /diag), so tune from evidence: if reviews of your typical diffs take
three minutes, the bound should not be four.
Choose who reviews your commits
By default Gemini 4 Neon (at medium) reviews every commit, and the
author’s own model reviews instead in the same attempt when Neon’s review
does not happen (#432, #811, #1035, The commit review). To keep
Gemini 4 Carbon, set "commitReviewer": "vertex-gemini/gemini-4-carbon".
To name another reviewer, give a model as
provider/id, or "author" for the author’s own model alone (never below
Sonnet 5.5), the rule before #432:
{ "commitReviewer": "author" }
Anything else is refused at session start, and the defaults apply, so a misspelt reviewer never quietly becomes another. The fallback applies to whatever model you name. Plan review is unaffected.
Choose the second opinion on your plans
A plan gets two independent cold reads before you are asked (#70, #996,
#1010, Asking the human: ask and plan mode). Round one is by the author’s own model. Round two,
by Gemini 4 Neon (at high) by default, reads the edited draft fresh on the agent’s
next exit_plan_mode — blind to round one’s review — after the agent has
dealt with round one’s findings (#886, #996). Round two adds one call and
about two minutes. To name another second
reviewer, give a model as provider/id, or "none" for round one alone:
{ "planSecondReviewer": "none" }
Round two is skipped when it would be round one’s model. Anything else is refused at session start and the defaults apply.
Credit commits to another address
Every commit the agent writes gets
Co-Authored-By: <model name> <noreply@dhs.ga.gov> (Workflow guards).
Some users and repositories need another address in that line, such as a
no-reply address their forge recognises (#454). Give it as
coAuthorEmail:
{ "coAuthorEmail": "ai-noreply@example.org" }
Only the address changes. The name stays the model’s, since the name is the
credit. The value must be one name@domain address with no spaces, angle
brackets or quotes, because it goes inside the trailer’s quoted argument.
Anything else is refused at session start, and the defaults apply.
A repository can set its own address, for its commits only (#558), in
.pi/gadhs-pi-workflow.json in the project directory, beside the other
per-project files in .pi/:
{ "coAuthorEmail": "team-ai@example.org" }
It is read only when pi trusts the project, so an untrusted clone cannot choose the address its commits are credited at. In an SSH session it is the remote repository’s file. It overrides the address in your own file. A repository sets nothing else here: the review tunables stay yours, and any other key it sets is ignored with a warning naming it. A malformed file, or an address that fails the check above, is reported at session start and ignored; your address stands.
Commit measured data without sending it to the reviewer
The commit review reads a staged diff whole, up to 1,500,000 characters,
and refuses a longer one (The commit review). Measured data is not
something a reviewer can stop a merge for: a model battery fill commits
hundreds of thousands of lines of recorded JSON, and a prune of old
records deletes as many. List such paths as reviewDataPaths, per
repository by its origin URL exactly as git remote get-url origin prints
it (#916):
{ "reviewDataPaths": {
"git@gitlab.com:gadhs/standard/package/pi.git": [
"tools/model-battery/store/**/*.json",
"tools/model-battery/store/**/*.jsonl",
"tools/model-battery/store/**/*.diff"
] } }
A commit’s changes under those paths reach the reviewer as counts of files
added, modified and deleted, and the rest of the diff is read whole. Each
such commit says so: a notice before the review, and its
Reflection-Review trailer ends ; <n> data file(s) by count.
-
Name the file types.
store/would hide a.tssomeone put there;store//*.jsonleaves it in front of the reviewer. A file under a data path that is not an ordinary file (an executable, a symlink, a submodule) makes the whole commit read as before. -
A pattern names a directory at the repository’s top and stays inside it:
/-separated segments of letters, digits and._-, at least two, none.or.., the first without. So,/*.json, an absolute path and git’s:(…)magic are refused. At most 16 patterns a repository. -
List each spelling of the origin you use: an
https://clone of a repository listed by itsgit@URL is not listed, and is read as before. -
Only this file sets it. A repository’s own
.pi/gadhs-pi-workflow.jsonthat sets the key is warned about and ignored, as for the other review keys. -
Add the key on a release that knows it. An earlier release reads the file as having an unknown key, reports it and runs on the defaults.
-
A
git commit -ais read as before: its listing cannot show what changed in the worktree.
Make the reflection reviewer think more (or less) than you do
By default the reviewer thinks at the level your session is set to, raised
to the reviewer model’s floor where it has one (#434: Opus 5.5 high on
commits, Sonnet 5.5 high on both, Argon high on plans, Hydrogen
medium on both), clamped to what the reviewer model declares. Three
reviewers are asked for a level of their own whatever you write at (#858,
#1010, #1035): Neon medium on commits and high on plans, Carbon low on
commits and medium on plans, Fable 5.2 high on both.
Otherwise it never reviews below the level you write at. To
pin it independently, one of pi’s level names, off included (the one way
below a floor):
{ "reviewThinking": "high" }
A level the reviewer model does not declare is snapped to its nearest
(xhigh on Sonnet is high; off on a model that cannot stop thinking is
its lowest). No output ceiling is set — the model’s own cap is the bound,
and the timeout above is the wall-clock one. Each review logs the level
wanted, where it came from (config | model | session | default | floor), the level
sent, and the tokens the provider reported (usage: input, output, and
reasoning where the provider breaks it out), so raise or lower this from
numbers.
While a review runs you can see it: a notice when it starts ("Cold review:
plan draft + 8 files (180 KB) by claude-fable-5-2 — bound 10 min"), the
working row and the footer carrying the same while it runs, and a notice with
the verdict and the elapsed time when it lands. Pressing escape ends the
review at once; nothing is decided, no attempt is spent, and the next commit
or exit_plan_mode reviews in full.
Answer a flagged review in the commit message
When the cold review returns FLAGS and you re-run the same commit, the message must carry the disposition of each flagged question:
fix: bound the retry budget Body as usual. Review-Response: J3 disputed - the branch at limiter.ts:40 is covered by the existing case Review-Response: J5 disputed - out of scope here, #77 filed for the doc comment Review-Context: test/limiter.test.ts
One line per question, disputed, the reason after a dash or colon, never
empty (#893). A finding you agree with you fix: the changed diff is reviewed
afresh and needs no line. accepted on an unchanged diff is refused, since
an accepted finding left unfixed lands unchanged; a deferral is a dispute
that names its issue. Write it in the message body (-m, or -F on a
file) — not with git’s --trailer, and not in an editor the guard cannot
read. fixed is not an answer here: change the diff, and the fresh review
says whether it is fixed. The lines are stripped before the review key is
hashed and before the reviewer reads the message, so adding them does not
cost a second review; they land in git history with the commit.
Size the review context to your repository
Review-Context: (commits) and reviewPaths (plans) let the author hand
the reviewer unchanged files. The guard caps that list, and the shipped caps
were sized against a few thousand lines of TypeScript. A million-line Rust
tree is not that: its files are bigger and it takes more of them to explain
a change. All three caps are yours.
{
"reviewContextMaxFileBytes": 400000,
"reviewContextMaxTotalBytes": 1500000,
"reviewContextMaxFiles": 40
}
(Defaults: 80 000 bytes per file, 200 000 total, 32 files. Each is a positive integer; a refusal always quotes your number, not the default.)
What raising them costs. The reviewer’s input context is finite. Past some
size the provider refuses the call, or the reviewer’s answer stops before its
VERDICT: line. Neither is silent: both become an unreviewed outcome with
the reason attached, the attempt is counted, and the commit or plan is told
it has no cold read. So a cap set too high buys a visible non-review rather
than an invisible bad one — raise it, watch reflection_done, and lower it
if reviews start coming back unreviewed.
Size the reviewer’s own reads
Beyond the declared files the reviewer may read the candidate snapshot
itself — read_file, grep, list_files over the index, the
worktree under -a, or the disk for a plan. Two caps bound it per review;
the per-result cap is reviewContextMaxFileBytes.
{
"reviewSnapshotMaxCalls": 36,
"reviewSnapshotMaxBytes": 600000,
"planReviewSnapshotMaxCalls": 128,
"planReviewSnapshotMaxBytes": 1000000
}
(Defaults: commits 24 calls / 400 000 bytes; plans 96 calls / 800 000 bytes.
Positive integers.) Past the budget every
call answers "budget exhausted … answer from what you have"; a reviewer that
keeps asking is stopped two rounds later and the pause is unreviewed with
that reason. reflection_done and plan_review.done carry
snapshotCalls and snapshotBytes: a repository whose reviews routinely
exhaust the calls wants a higher cap; one whose reviewer reads nothing wants
none. Each read is a provider round trip on top of the review’s own, so the
calls cap is also a latency cap.
The bash tool’s shell on Windows
On Windows the bash tool runs Git Bash. From #652 to #907 a box could opt in to brush, a native bash-compatible shell; it was removed as not ready.
Guidance
Add project-specific guidance for everyone in a repo
Create <repo>/.pi/gadhs-guidance.md:
## This repo
- The API layer is generated; edit the OpenAPI spec, never src/api/.
- Integration tests need the docker compose stack up.
It is injected into the system prompt for anyone working in that repo with the package installed (trusted repos only).
Appearance
Use the agency theme
/settings → Theme → gadhs-human-services-dark (or -light,
or the gadhs-foundation-* pair). To follow your terminal’s light/dark
automatically, put this in ~/.pi/agent/settings.json:
{ "theme": "gadhs-human-services-light/gadhs-human-services-dark" }
themes array in settings.json is inert: the key
validates but pi’s resource loader never reads it, so it silently does
nothing. Themes load only from packages (pi.themes in package.json), the
--theme CLI flag, and the scanned directories (~/.pi/agent/themes,
.pi/themes).
Subagents
Restrict which helpers a mode may launch
{ "modes": [ { "id": "auto", "label": "Auto",
"canSpawn": ["Explore", "Research"] } ] }
An empty (or missing) list means no delegation at all in that mode.
Run a helper on a different model
The seeded helpers ship with Explore on Gemini 4 Hydrogen (argued on the
model-battery page) and Research on Sonnet 5.5. To run one
elsewhere without owning its file, name the model in
~/.pi/agent/gadhs-pi-agents.json:
{ "models": { "Explore": "vertex-anthropic/claude-haiku-5-5",
"Research": "vertex-gemini/gemini-4-carbon" } }
-
The seed is rendered with your model in place of the packaged one; the file keeps its
gadhs_managedmarker, so the next package update still lands its prompt — only themodel:line is yours. Remove the entry and the packaged model returns on the next start. -
Keys must name packaged helpers and values must be
provider/model; a malformed file, or a key naming a helper the package does not ship, is reported at start and the whole file ignored — never obeyed in part. -
If a helper’s model is not available in the session, pi-subagents runs it on another model without saying so: the closest match it can reach, or the session’s own. At start, the seeding extension checks each helper’s model as its file now names it, whether the packaged default, your override, or a file you own. It resolves each the way pi-subagents will, and warns by name, saying where the helper will really run ("Explore names vertex-gemini/gemini-4-hydrogen, which is not available in this session — pi-subagents will run it on the session model instead"; #439). A missing project or an expired login is then a visible line, not a quiet bill on the frontier model.
-
The packaged helpers lock
modelagainst whoever launches them (pi-subagents'locked), and Research locksthinkingtoo: asubagentcall that passes a locked parameter runs on the file’s value anyway, and its result says which parameters were locked. The model you name here is the file’s model, so it still wins; a caller can still setmax_turnsor background the helper. -
Explore runs at
mediumthinking, unlocked (#374): a caller may passthinkingto go lower for a quick lookup or higher for a report-shaped task.lowis not the floor it looks like on Gemini 3.8 Flash: measured on one Explore task, two runs a level,lowsent no reasoning on any turn, andmediumreasoned on every turn at about 2.3 times the cost and time (cents a run). A helper that never reasons has no channel in which to notice it is stuck; the 2026-10-12 loop ran atlow.
Why each helper runs where it does, with the numbers: the model battery.
Change a helper’s turn cap
Every helper runs under a turn cap (#372, #376), so a helper that loops stops on its own instead of when its parent session ends. The caps sit above the longest healthy runs seen, so they stop a loop, not good work:
| Helper | Cap | Set by |
|---|---|---|
Explore |
300 |
its packaged file ( |
Research |
100 |
its packaged file |
general-purpose |
200 |
its packaged file |
any other (your own agents) |
200 |
the package, at spawn |
Two turns before the ceiling the helper is warned, and the packaged helpers yield what they have at that warning, the rest marked uncertain. To change a cap, from narrowest to widest:
-
One call: the
subagentcall’s ownmax_turns,0for unlimited. It wins over everything below. -
A seeded helper, every time:
maxTurnsin~/.pi/agent/gadhs-pi-agents.json, besidemodels:{ "maxTurns": { "Explore": 500, "Research": 0 } }It is rendered into the seeded file’s
max_turns:line the way a model is, so the file stays managed.0is unlimited; a cap that is not a whole number from 0 to 10000 refuses the whole file, as a bad model does. -
Every helper without a cap of its own: pi-subagents' own
defaultMaxTurns, in~/.pi/agent/subagents.jsonfor the box or, in a trusted project, through/subagents:settings. When it is set,0included, the package’s 200 stands down: the package fills the cap only when the call, the agent’s file and this setting all say nothing. An untrusted project’s setting is not consulted, so a cloned repo cannot switch the package’s cap off.
Run a helper in its own worktree
So that a helper can draft, test and commit on a branch while your own
checkout stays free (for a long pre-push run, say), list its agent type in
~/.pi/agent/gadhs-pi-modes.json:
{ "worktreeAgents": ["general-purpose"] }
The helper runs in a fresh worktree on helper/general-purpose-<id>, and
commits there under its own commit guard and review (modes page,
§ A helper in its own git worktree). When it finishes, its result names
the branch, and a worktree holding work is kept for you to merge from.
It is opt-in on purpose: the default is the primary checkout, one unit at
a time, where one gitignored build directory serves every branch. A
worktree is a second tree, and a build inside it is a second build
directory of the same size - set CARGO_TARGET_DIR (or the ecosystem’s
equivalent) to the repository’s own target/ for helpers that build, and
keep scratch files under <repo>/.pi/scratch/
(modes), never in the worktree’s temp
directory.
To pause it between phases, have it end phase one with a question. For
example, the task says "draft the change, then ask me whether the machine
is free before running the tests". The worktree and session stay while
the question waits, up to unconsumedSessionRetentionMinutes (720 by
default). Your answer resumes it in the same worktree.
Keep a finished helper resumable longer
pi-subagents keeps a finished helper’s session so subagent resume can
continue it with its context, then releases it. Once its result has been
read, the window is consumedSessionRetentionMinutes, default 10. If
the result was never read, it is unconsumedSessionRetentionMinutes,
default 720. Both accept 1 to 20,160 minutes (two weeks). A resume waits
for a free slot under maxConcurrent like a spawn, and while one waits, a
second resume of the same helper is refused (pi-subagents 25, #396). A two-phase
pattern, such as drafting before a long pre-push run and resuming after
it, needs a longer read window:
{ "consumedSessionRetentionMinutes": 60 }
in ~/.pi/agent/subagents.json, or a project’s .pi/subagents.json,
which wins over it. Each helper’s result ends with the time it stays
resumable until, read from these settings (#478): “Resumable until 14:32
(consumedSessionRetentionMinutes 10); after that its session is released
and resume refuses.”
Choose whether ESC stops background helpers
An interrupt of the session’s run (ESC, or stopping one foreground call)
leaves background and queued helpers running (#720). pi-subagents' own
default, abortAllOnInterrupt: true, stops every one of them, and in
craig’s session the human stopping one bash call ended three unrelated
helpers. So the distribution writes the opposite into
~/.pi/agent/subagents.json when that file is absent, and says so once
at session start:
{ "abortAllOnInterrupt": false }
A file that exists is never touched, so a box that already has one keeps
pi-subagents' default unless it adds the line. For ESC to stop every
helper again, set it true there, or in a project’s .pi/subagents.json,
which wins over it; /subagents:settings ("Abort all subagents on ESC")
toggles the project’s. A foreground helper holds the session’s own signal
and stops on ESC either way; a background one runs on to its end, bounded
by its turn cap.
In a session over SSH the file is on this machine, in pi’s agent
directory (C:\Users\<you>\.pi\agent\subagents.json on Windows), not
on the remote: pi-subagents runs where pi runs.
Make a helper’s results machine-checkable
In the helper’s definition file (say a project helper of your own, <repo>/.pi/agents/Check.md), declare what
its final answer must look like:
output_schema:
type: object
required: [passed, evidence]
properties:
passed: { type: boolean }
evidence: { type: string }
The schema is read as YAML, by the same parser pi-subagents reads the file with, so a schema written as JSON (which is YAML) reads the same (#396). If the helper’s answer does not match, you are told the result is unverified — instead of silently trusting a confident-sounding summary.
Overriding an agency helper in your repo (a .pi/agents/Research.md of your
own) replaces its prompt and its model, but not its contract unless you
declare one: leave output_schema out and the agency’s schema still applies,
and any violation message tells you that and which file to change.
Web access
Web search and fetching come from pi-web-access, which reads its own
config: ~/.pi/agent/web-search.json (a ~/.pi/web-search.json written
for an older version is still read when the new file is absent). Its
providers, keys and limits are documented with the package.
Search falls back to Google (#853). With no configuration the plugin
sends every search to Exa’s keyless endpoint, which is limited per
address and shared by every session and helper on a box. When it
refused, the search failed. So a box with no web-search.json gets one
seeded on its first start, and the first session says so:
{
"geminiAuth": "adc",
"geminiLocation": "global",
"searchModel": "gemini-4-hydrogen",
"searchRouting": {
"providers": ["exa", "gemini"],
"fallbackOn": ["quota", "transient", "network", "invalid-response"]
},
"pdf": { "provider": "unpdf" }
}
Exa stays first. When it refuses for rate, or fails with a server fault,
a network error or an unreadable answer, the same search is answered by
Gemini with Google Search, through the Vertex login and project the box
already uses for its models. No key and no per-box setup. A search that
names its provider (provider: "exa") is not routed. A box with no
Vertex project or no Google login keeps the earlier behaviour: Gemini is
skipped as unavailable.
The file is yours once written: it is never rewritten, and a file that
already exists, in either place the plugin reads, is left as it is. To
get the route on a box that already had a file, add those keys to it.
The file lands where the plugin looks, which is $PI_CODING_AGENT_DIR
when set, $XDG_CONFIG_HOME/pi when that is set, and ~/.pi/agent
otherwise.
Gemini is the fallback and not the first choice for what a trial on one box showed, fourteen real queries through both (measured on Gemini 3.8 Flash before the seed moved to Gemini 4 Hydrogen in #951):
| Gemini 3.8 Flash via Vertex | Exa, keyless | |
|---|---|---|
Answered |
14 of 14 |
14 of 14, paced 12 s apart |
Median time |
20 s |
0.4 s |
Twenty at once |
all answered |
not run; it refused one of four that day |
Returns |
a written answer with source links |
a ranked list with excerpts |
Only two named domains |
cited others too |
kept to them |
Not one named domain |
cited it first |
left it out |
So a search that falls back loses its domainFilter, and its
recencyFilter is a request to the model, not a rule. The result says
which answered (“Provider: gemini”). A query that falls back leaves
the box for Vertex at the global location, where before it went only
to Exa; a box that must not do that removes gemini from the route.
pdf.provider is pinned to local extraction: with the Vertex login
turned on, the plugin’s automatic order would otherwise send every PDF
to Gemini. Page fetching is unchanged.
The bundled plugin is patched to make this work
(patches/pi-web-access@0.48.0.patch, one file). As published it mints
the Vertex token by hand and accepts two credential types; our boxes
hold a third, an impersonated service account, which it refused by
name. It also looked for the login only where gcloud keeps it on Linux,
and did not read the lower-case project name pi-vertex sets (#832). The
patch has google-auth-library, which pi-vertex already ships, mint the
token. The same change is offered upstream; when a release carries it,
the patch and its two entries in pnpm-workspace.yaml go with the bump,
and a test fails until they do or the patch is carried forward.
Its toolActivation setting decides when the web tools appear. With the
default, "auto", a fresh session on the packaged Vertex models gets them
straight away. With a model whose API takes tool changes mid-conversation,
or with "dynamic", a session starts with one tool, web_enable, which
turns the rest on when the model calls it; "eager" always registers
them up front. web_enable refuses unless every tool it enables is
registered, and a helper’s session registers only the tools its agent
allows. So plan mode, Explore and Research each allow all four,
web_search, source_check, fetch_content and get_search_content,
beside web_enable. Web search then works under every setting, and Explore
can read a long page that pi-web-access stored rather than inlined (#437).
@gadhs/pi pins the version it bundles, and a test loads it through pi’s
own loader and holds those five names to the tools it registers. An
upstream rename fails the build, instead of shipping a tool that asks on
every call (#396).
Memory
The distribution remembers small, local facts and puts them in every prompt. Work state belongs in issues and repo truths in AGENTS.md; memory is for what has no better home. It keeps two pools (#814):
-
The project’s: notes about one repository, shown only in it.
-
The machine’s: notes that hold on this machine in any project.
/remember the integration suite needs the docker stack up # this project
/remember box: docker compose needs sudo here # this machine
/memory # both pools, and how full
/memory promote [<id>] # confirm an agent proposal
/memory forget [<id>] # remove (archived, never vanished)
-
A pool holds ten notes, confirmed ones and agent proposals together. Twenty short notes always fit, so every note in scope is in the prompt, the project’s first, and
/memorylists exactly those. Its header for each pool counts both kinds:project: 3 of 10 (2 confirmed, 1 unconfirmed). -
An agent’s proposal never displaces anything. Proposals (the
remembertool) are labelled unconfirmed and expire after 7 days unless you/memory promotethem, or/rememberthe same note. Into a full pool a proposal is refused, and the refusal names that pool’s oldest proposals by id. One project’s proposals cannot fill another’s pool or the machine’s. -
Your own note makes its own room.
/rememberinto a full pool archives one other note of that pool and says which: the oldest unconfirmed proposal, else the least useful confirmed note (fewest hits, then oldest). Promoting a proposal evicts nothing, since the pool already counted it. -
What a project is: the repository’s origin URL, found from any directory inside the checkout, so worktrees and moved checkouts share its notes. A repository with no origin is known by its git directory’s path on this machine; give it an origin later and its notes stay under the path. Outside any repository there is no project pool: a plain
/rememberstores to the machine’s and saysremembered (machine: no project here). -
There is no pool for you. A
dev:scope once followed you into every repository, and agents filed one project’s facts under it, which then showed in all the others. It is retired:/remember dev: …is refused. A standing preference that is about no project goes in the machine pool, on each machine; an agency-wide one belongs in the guidance. -
Picking, not typing hashes:
/memory promote ` completes the pending proposals in place (id, text, scope, age, hits); a bare `/memory promoteor/memory forgetopens a list to pick from, and dismissing it changes nothing. -
The agent can forget a memory itself (its
forgettool, #310): any memory in scope, yours included, by its text or its id; an ambiguous match lists ids. A forgotten memory goes to the archive (causeforgotten-by-agent), so it stays recoverable. -
A note that negates another ("do not", "never") is its correction, not its duplicate: both are kept, for you to forget the stale one. A real repeat is refreshed, and the command quotes the note it matched.
-
One store for the machine:
~/.pi/agent/gadhs-memory.json, read fresh by every command and prompt and replaced whole by rename on each write. Two writes in the same instant can still lose one (there is no lock); an unreadable file disables memory for the session, loudly, and is not written over. Everything removed goes to~/.pi/agent/gadhs-memory-archive.jsonlwith its cause. -
In an SSH session the store is the remote host’s (#915): the
gadhs-memory.jsona pi on the box uses, in its pi directory, read and written over the connection. The project’s pool is the remote checkout’s, keyed by its origin as a local clone’s is, so a note filed on the box and one filed over SSH are in the same pool; the machine’s pool is the remote host’s. A turn reads it once (the session’s first also finds the remote’s keys), and a remote that does not answer within five seconds at any step costs that turn its notes, said once (pi over SSH).
Updating from a release before the pools. The first session start
converts the store once and tells you what it archived: every dev: note
(cause scope-retired), and whatever a pool held beyond ten, unconfirmed
first (cause cap-eviction). Re-file what still holds with /remember
inside the project it is about, or /remember box:. To see them again:
grep '"cause":"scope-retired"' ~/.pi/agent/gadhs-memory-archive.jsonl
A session of the older release still running beside an updated one reads the new store as unreadable and turns its memory off, with a warning, until it is restarted. It writes nothing.
Seeing what happened
node tools/task.mjs verdicts 20 --why # recent decisions, with the ask and the reason
node tools/task.mjs policy-diff # has your permission seed drifted from the default?
node tools/task.mjs gitlab-check ID # which GitLab identity is actually in effect
/diag 50 # in pi: the last 50 diagnostics records, for a bug report
Troubleshooting quick hits
| Symptom | Likely cause and fix |
|---|---|
"The 'gadhs-mode-judge' authorizer denied this '<tool>' call", and you want to know why |
A policy, the judge or the pending queue decided; to the permission system
they are all one authorizer, which is the name its sentence gives. The
|
Model reverts after restart |
Fixed in current versions — resumed sessions continue on the model they left on. Update the package. |
Everything suddenly needs your approval |
The denial-loop guard tripped (3 refusals in a row). The status line says "now checking everything with you" (one refusal earlier: "one more block and I ask about everything"). Usually means the agent is stuck on something a rule forbids — scroll up to the trace. Answering the ask ends the run. |
|
No token reached glab, and pi keeps glab’s stored login out of reach (#300),
because on a shared machine it may not be yours. Export |
"time measured, not posted: no GITLAB_TOKEN" |
The time post (#576, time on the
issue) found no token. It reads |
Google auth expired mid-task |
Run |
Commit blocked with a review of your diff |
That is the reflection pause: an independent model read your staged diff cold and answered the J1–J8 checklist, citing file and line. Address what you agree with (or say why you disagree), then run the same commit again — the identical diff passes on retry, and staging any fix earns a fresh review. Every commit gets exactly one review attempt; it advises, it does not veto. |
Commit blocked saying the reviewer "could not be reached" |
The reviewer call failed (provider error, or the time bound). That is not a review, so re-running the same commit tries the reviewer again. The message says which attempt it was: after two consecutive failures on the same diff, the next run proceeds on your own J1–J8 pass. A fresh staged change starts the count over. |
Commit or |
The author declared a file for the reviewer (a |
|
That is the plan draft’s cold-review pause (P1–P6), the same one commits get. The
agent addresses material findings by editing the draft and calling
|
Commit refused because it stages and commits at once |
Run the staging and the commit as two separate commands. The review runs
before your command does, so combined staging would let the reviewer see the
wrong diff. Staging here means |
A new file gained a license header you didn’t type |
Working as intended — new source files get the SPDX header automatically. |