pi-bro 0.13.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +109 -8
  3. package/bro.ts +1261 -37
  4. package/package.json +4 -3
  5. package/prompt.ts +29 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to pi-bro are documented here.
4
4
 
5
+ ## [0.14.0] - 2026-09-20
6
+
7
+ ### Added
8
+
9
+ - `bro_advisor` — a tool the **executor agent** (not the human) can voluntarily call mid-task for a second opinion from a fresh, standalone Agy process with real, unsandboxed tool access in the workspace (`--dangerously-skip-permissions`). Bro automatically captures a harness-neutral snapshot of the executor's system instructions, active tools, and conversation so far (including tool calls and results) and sends it, plus an optional executor-supplied question, to the advisor. The advisor is instructed to investigate before advising and to leave edits to the executor, but that boundary is behavioral, not enforced. Invocation failures retry twice (5s, then 10s) with the identical snapshot before surfacing Agy's own diagnostic.
10
+ - `/bro advisor-steer` — an editor for one persistent, session-scoped steering brief the advisor always reads (e.g. "quick prototype; keep A and B careful, everything else minimal"). The brief is stored as session-only extension data, is never added to Pi's conversation or sent to the main model, persists across resume/reload, and is inherited by forks.
11
+ - `/bro advisor` — a quick notice of whether `bro_advisor` is currently exposed and active, pointing at `/bro config`, `/bro advisor-steer`, and `/bro doctor`. `/bro doctor` carries the full diagnostic, including the Agy 1.1.15+ compatibility check.
12
+ - `/bro config` — a production settings screen replacing the earlier configuration-only spike: a shared default model/effort (still owned by `/bro model`/`/bro effort`) plus optional per-capability overrides for `explain`, `show`, `btw`, and `advisor`. An override always pins both model and effort together and is only ever cleared by an explicit "Default" selection. Saves are serialized and coalesced, with in-place revert and an inline error notice on failure.
13
+
14
+ ### Changed
15
+
16
+ - Requires Earendil Pi `>=0.84.2 <1` and `agy >=1.1.15` (up from `>=0.78.1 <1` and `>=1.1.11`).
17
+
5
18
  ## [0.13.2] - 2026-09-19
6
19
 
7
20
  ### Changed
package/README.md CHANGED
@@ -11,7 +11,7 @@ with your selected model.
11
11
 
12
12
  ## Quick start
13
13
 
14
- You need Earendil Pi `>=0.78.1 <1`, Node.js `>=22.19.0`, and `agy >=1.1.11`
14
+ You need Earendil Pi `>=0.84.2 <1`, Node.js `>=22.19.0`, and `agy >=1.1.15`
15
15
  installed and available on your `PATH`. Run `agy` once in your terminal to sign
16
16
  in, then install Bro:
17
17
 
@@ -63,10 +63,13 @@ text directly captures a new source the same way.
63
63
  | `/bro show [n-turns] [query]` | Draw recent session turns (default last 1) as shapes instead of prose, from user and assistant conversation text only — tool calls, tool results, reasoning, and images are omitted. An optional query steers what the shapes focus on, with or without a leading turn count. |
64
64
  | `/bro doctor` | Check Bro's settings, Agy installation, account, model, effort, and mode. |
65
65
  | `/bro usage [--provider agy]` | Show current Agy resource limits. |
66
- | `/bro model [id]` | View or choose the Agy model. |
67
- | `/bro effort [low\|medium\|high]` | View or choose the supported reasoning effort. |
66
+ | `/bro model [id]` | View or choose the shared default Agy model. |
67
+ | `/bro effort [low\|medium\|high]` | View or choose the shared default reasoning effort. |
68
68
  | `/bro mode [brief\|balanced\|faithful]` | View or choose the explanation mode. |
69
+ | `/bro config` | Open an interactive settings screen for the shared default model/effort, explain mode, show turns, and per-capability (explain/show/btw/advisor) model and effort overrides. |
69
70
  | `/bro btw [--fresh] [--full] [question]` | Open a side conversation in a modal. Sandboxed (read-only) by default; `--full` lets it read and edit the workspace, `--fresh` skips main-session context. |
71
+ | `/bro advisor` | Quick notice of whether the executor's `bro_advisor` tool is available right now, pointing at `/bro config`, `/bro advisor-steer`, and `/bro doctor`. |
72
+ | `/bro advisor-steer` | View, edit, save, or clear the one persistent steering brief the advisor always sees. |
70
73
  | `/bro help` | Open the built-in quick reference. |
71
74
 
72
75
  Giving `/bro` the input directly works the same way:
@@ -127,6 +130,78 @@ conversation unless you explicitly copy it into the editor.
127
130
  - The thread lives in memory only — it clears when you switch Pi sessions,
128
131
  reload extensions, or quit Pi.
129
132
 
133
+ ## Bro advisor
134
+
135
+ `bro_advisor` is a tool the **executor agent** — not you — can voluntarily
136
+ call mid-task for a second opinion. Unlike `/bro btw`, which is a side
137
+ conversation for you, `bro_advisor` is a tool for the model you're working
138
+ with; it shows up as a normal tool call/result in the transcript, not a
139
+ modal. It is registered like any other tool when the extension loads and has
140
+ no on/off switch of its own — whether the executor can actually call it
141
+ depends entirely on this host's own tool restrictions.
142
+
143
+ `/bro advisor` is a quick notice of whether `bro_advisor` is available right
144
+ now, pointing at `/bro config`, `/bro advisor-steer`, and `/bro doctor`.
145
+ `/bro doctor` has the full diagnostic: whether this host exposes and
146
+ activates `bro_advisor`, its resolved model/effort, steering presence, and
147
+ the Agy compatibility floor — it also checks the installed Agy version and
148
+ gives an `agy update` action when it is too old.
149
+
150
+ - **Automatic context, no prep needed**: the executor never assembles a
151
+ summary. Bro captures a harness-neutral snapshot — the executor's system
152
+ instructions, its active tools, and the conversation so far including tool
153
+ calls and results — and sends it, along with an optional `question` the
154
+ executor may pass, to a **fresh, standalone Agy process** for every
155
+ consultation. Nothing is resumed or reused across calls, including retries.
156
+ - **Instructed to investigate, not implement**: the advisor process has real
157
+ tool access in the workspace with permissions auto-approved
158
+ (`--dangerously-skip-permissions`) — there is no enforced read-only
159
+ isolation. It is instructed to verify claims itself and return advice,
160
+ leaving edits to the executor, but that instruction is not enforced, so
161
+ treat its findings as advice to verify, not a guaranteed hands-off review.
162
+ - **Steering**: `/bro advisor-steer` opens an editor for one persistent
163
+ steering brief — e.g. "quick prototype; keep A and B careful, everything
164
+ else minimal" — that the advisor always reads. **Ctrl+S** saves and keeps
165
+ the editor open; **Enter** or **Shift+Enter** inserts a newline; **Ctrl+K**
166
+ clears both the saved brief and draft while staying open; **Ctrl+C** copies
167
+ the entire current draft, including unsaved edits; and **Esc** closes without
168
+ saving unsaved edits. Actions and clipboard errors are reported inline. The
169
+ brief is stored as session-only extension data and is **never added to Pi's
170
+ conversation or sent to the main model** — the advisor is the only thing
171
+ that reads it.
172
+ - **Persistence**: the steering brief persists with the Pi session (not
173
+ globally, not per project) and is restored on resume or reload. Forking a
174
+ session inherits it; edits made after the fork are independent of the
175
+ original branch.
176
+ - **Retries**: on an invocation failure (not a completed answer — "I need
177
+ more evidence" is a normal result, not a failure), Bro retries with the
178
+ identical snapshot, steering, and question: once after 5 seconds, once more
179
+ after 10 seconds, then returns Agy's own diagnostic — including a
180
+ context-length error, verbatim — as the failure. Cancelling the tool call
181
+ aborts immediately and skips any pending retry wait.
182
+ - **Progress and provenance**: while an attempt is running, Bro parses the
183
+ advisor's own stream for the last thing it actually reported — either a
184
+ tool name or a user-facing response line (hidden reasoning is never
185
+ surfaced) — and shows it with how long ago it arrived, e.g. `last reported:
186
+ Read src/app.ts (2s ago)`. Before Agy reports anything, this reads
187
+ explicitly as "awaiting first activity from Agy" rather than guessing at
188
+ what it might be doing. This is what was actually reported, not a live
189
+ claim about Agy's current tool, and silence is never described as
190
+ "stalled". Expanding a running consultation shows up to the last 4 reported
191
+ activity lines. Each retry starts this trail over empty — a failed
192
+ attempt's activity never carries into the next one. Elapsed running time
193
+ still ticks once a second regardless of activity; a retry countdown with
194
+ the last failure is shown the same way as before. The returned answer
195
+ starts with model, effort, actual attempt count, duration, workspace,
196
+ steering presence, snapshot size, no-Bro-truncation status, and known
197
+ omission/compaction notes; the advisor's complete answer follows unchanged.
198
+ - **Model/effort**: resolved the same way as explain/show/btw, through
199
+ `/bro model`/`/bro effort` (shared default) or `/bro config` (per-capability
200
+ override).
201
+
202
+ See [docs/plans/2026-09-19-bro-advisor-design.md](docs/plans/2026-09-19-bro-advisor-design.md)
203
+ for the full design.
204
+
130
205
  ## Bro show
131
206
 
132
207
  Where the explanation modes rewrite dense prose in simpler words, `/bro show`
@@ -610,15 +685,41 @@ Bro creates this user-editable settings file when the extension loads:
610
685
  }
611
686
  ```
612
687
 
613
- Use `/bro model`, `/bro effort`, and `/bro mode` to update it from Pi, or edit
614
- it directly. Bro reads the file again before each explanation, so manual changes
688
+ `model` and `effort` are the **shared default**: explain, show, and btw all use
689
+ them unless a capability has its own override. An optional `overrides` object
690
+ adds per-capability overrides, each a full `{ "model": ..., "effort": ... }`
691
+ pair:
692
+
693
+ ```json
694
+ {
695
+ "model": "gemini-3.7-flash",
696
+ "effort": "low",
697
+ "mode": "balanced",
698
+ "showTurns": 1,
699
+ "overrides": {
700
+ "show": { "model": "gemini-3.7-pro", "effort": "high" }
701
+ }
702
+ }
703
+ ```
704
+
705
+ Use `/bro model`, `/bro effort`, and `/bro mode` to update the shared default
706
+ and mode from Pi, `/bro config` to review or change the shared default and any
707
+ per-capability (explain/show/btw/advisor) overrides interactively, or edit the file
708
+ directly. Bro reads the file again before each explanation, so manual changes
615
709
  apply to the next `/bro`. Use a model ID shown by `/bro model`; `effort` must be
616
710
  one of the levels shown by `/bro effort`. Models without adjustable effort use
617
711
  `default`. `mode` must be `brief`, `balanced`, or `faithful`; existing settings
618
712
  without it use `balanced`. `showTurns` is the default number of turns `/bro
619
- show` draws (default 1); `/bro show <n-turns>` overrides it for a single run. There
620
- is no `/bro showTurns` command — edit the file directly. The choices remain active across Pi restarts until
621
- you change them. `/bro help` shows the active settings and exact file path.
713
+ show` draws (default 1); `/bro show <n-turns>` overrides it for a single run. Settings
714
+ written before per-capability overrides existed load unchanged, with no overrides. The choices remain
715
+ active across Pi restarts until you change them. `/bro help` shows the active
716
+ settings, any overrides, and the exact file path.
717
+
718
+ `/bro config`'s changes save immediately as you make them. Pressing Esc inside
719
+ a model or effort picker cancels that pick without changing anything; pressing
720
+ Esc on the settings screen itself just closes it, keeping whatever was already
721
+ saved. If a save fails (for example, a read-only settings file), the screen
722
+ shows the error inline instead of losing the change silently.
622
723
 
623
724
  If `PI_CODING_AGENT_DIR` is set, the file lives there instead. `PI_BRO_MODEL`
624
725
  chooses the initial model only when Bro creates a missing settings file: