pi-bro 0.20.0 → 0.22.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,77 @@
2
2
 
3
3
  All notable changes to pi-bro are documented here.
4
4
 
5
+ ## [0.22.0] - 2026-10-11
6
+
7
+ ### Fixed
8
+
9
+ - Persist settings with atomic replacement and mode 0o600 (#84):
10
+ - Replace direct `writeFile` with atomic sibling write (`.tmp`) and `rename` to prevent settings corruption on failure, crash, or disk full (`ENOSPC`).
11
+ - Flush writes before replacement (`flush: true`) and clean up temporary files on failure.
12
+ - Enforce `mode: 0o600` on replaced settings files so permissions are never loosened.
13
+ - Resolve symlinks via lstat and realpath before replacement to preserve dotfile-managed configuration symlinks, and reject if an existing symlink target cannot be resolved.
14
+ - Align on-disk state with modal rollback behavior in `/bro config`.
15
+
16
+ ### Added
17
+
18
+ - Guided Review (#104): open a PR by URL/number in local Pi to automatically get an explanation and quality assessment, captured Git evidence, findings with fix/check suggestions, diffs and optional private questions. Acquisition uses authenticated `gh` outside the active working tree. Findings remain model proposals, not approval or applied changes.
19
+ - Automatic local remembering of questions/drafts/reading position; reopening the same PR restores the captured revision without a model call. Bare `/bro guided-review` lists saved reviews; `resume` remains an alias. Close saves automatically; Stop and close cancels first. Copy finding copies to the system clipboard without submission.
20
+ - Confirmed same-revision regeneration replaces one current guide and preserves original private context; failed/cancelled generation retains it and save errors offer recovery. There is no guide-version UI or prototype-format migration. Review has its own backend override.
21
+ - Bounded live checks demonstrated an unchanged-caller defect and successful regeneration; manual UX accepted. This is not a general accuracy guarantee, live five-backend matrix or complete #104 scope. Notes, examination tracking, branch/update review and feedback delivery are not implemented.
22
+
23
+ - Durable advisor steering across sessions in `~/.pi/agent/bro-advisor.md` (#97):
24
+ - Ingest standing priorities from `bro-advisor.md` alongside session steering (`/bro advisor-steer`).
25
+ - Labeled prompt composition in `buildAdvisorPrompt`: standing priorities appear under `### Standing priorities (durable across sessions)` and session priorities under `### Session priorities (this session only)`.
26
+ - Session-specific priorities take precedence over standing defaults where they conflict.
27
+ - Fail-closed validation rejects files > 64 KB and > 4,000 characters before spawning any backend process.
28
+ - Doctor reports both `Advisor steering (session)` and `Advisor steering (durable)`.
29
+ - Tool result context line and details track `steeringSources: { durable, session }` while preserving backwards-compatible `steeringIncluded` boolean.
30
+ - Retries use a frozen prompt snapshot built prior to `runAdvisorWithRetries`.
31
+ - Clearing session steering leaves durable steering intact.
32
+
33
+ ### Changed
34
+
35
+ - Doctor treats an unsupported optional review backend as an informational override hint, not a broken installation; healthy Agy/Grok/Codex defaults still report ready.
36
+ - Review is file-only on Claude/Muse: no shell, write or web tools; Agy/Grok/Codex review calls fail closed without switching backend. Other features retain their access behavior.
37
+ - Capture uses depth-1 head/merge-base trees instead of full history; fetch gets a ten-minute bound while evidence stays offline. Interrupted-capture recovery remains.
38
+ - Removed prototype record migrations after one-time backup/normalization of development records; split validation and formatted review modules/tests to the repository tab style.
39
+
40
+ - Guided Review UX consistency pass: origin-preserving Back, focused-action Enter, topic-filtered findings, pane-aware paging, visible focus/overflow, selected-item previews and compact full-width 36×18 layout. Discussion follows conversation/composer/actions order; save errors have shared retry controls and failed questions have draft-safe explicit edit/resend. Request errors are separate from model answers, streaming follows again at the bottom, and acquisition/resume/close messages give clearer orientation. Current review behavior, controls, access/storage and recovery are documented in the user guide; developer/testing guidance records its implementation rules and verification limits. Review itself has no publication action.
41
+ - Remove dead declarations and stale backend naming (#90):
42
+ - Enable native TypeScript unused checks (`noUnusedLocals`, `noUnusedParameters`) in `tsconfig.json`.
43
+ - Remove verified unused declarations across `bro.ts`, `backend.test.ts`, `benchmark/run.ts`, `codex.test.ts`, and `release.test.ts`.
44
+ - Drop pass-through re-exports from `bro.ts` (`agyFailureMessage`, `agySelection`, `advisorFlagErrorHint`, `parseBtwAgyLine`); tests and consumers import them directly from `backend.ts`.
45
+ - Rename multi-backend facilities with obsolete Agy prefixes: `runAgyText` -> `runBackendText` in `bro.ts` and `killAgyGroup` -> `killProcessGroup` in `backend.ts`.
46
+ - Modernize outdated single-backend and pre-extraction comments.
47
+ - Separate Bro responsibilities and unify settings and backend-selection policy (#83):
48
+ - Extract `settings.ts` (schema, typed `EXTERNAL_BACKENDS` metadata, selection policy, pure transitions, and file persistence).
49
+ - Extract `sources.ts` (self-contained document text extraction and public web scraping with SSRF protection).
50
+ - Extract `config-ui.ts` (`/bro config` modal, setting items, and async save serialization).
51
+ - Extract `util.ts` (shared leaf utility helpers).
52
+ - Unify legacy flat and v2 settings parsing into one converged validation pipeline in `settings.ts`, eliminating duplicate validation branches.
53
+ - Initialize clean version 2 settings on fresh installations in `ensureSettingsFile()`.
54
+ - Share pure state transitions (`applyModelChange`, `applyEffortChange`) across default and capability override rows.
55
+ - Fix Agy variant model reselection bug where resolved effort from suffixed variants was lost.
56
+ - Consolidate CLI version probes in `/bro doctor` into a single `checkCliVersion` helper.
57
+
58
+ ## [0.21.0] - 2026-10-04
59
+
60
+ ### Added
61
+
62
+ - `bro-preferences.md`: tell Bro about yourself and how you like answers. Bro adds it, JSON-quoted and labelled, to every explain, `/bro show`, and `/bro btw` prompt alongside its own instructions; the advisor never receives it. Preferences can change wording, tone, technical depth, and the answer language (code, commands, paths, names, and numbers stay verbatim). In Show they change only wording and language. Per-run choices (the mode, **M**, a Show steering query, a BTW question) win over them, and Bro's source rules, Show's hard rules, and BTW access mode always apply. Blank or missing preferences leave every prompt byte-identical to 0.20.0 (#94).
63
+ - `/bro preferences` edits the file (**Ctrl+S** save, **Ctrl+K** delete, **Ctrl+C** copy, **Esc** close). Without a file it opens with unsaved starter text that restates the old built-in audience and brief wording. Saves are checked against the 4,000-character limit, and an oversize file still opens so it can be trimmed (#94).
64
+ - The modal header shows `· prefs` when preferences shaped an explanation, drawing, or BTW turn; `/bro open` keeps the result's tag (#94).
65
+
66
+ ### Changed
67
+
68
+ - Modes, **M**, and the source guard now always apply; nothing disables them (#94).
69
+ - Preferences over 4,000 characters stop explain, Show, and BTW with an actionable error before any backend call instead of being truncated. `/bro doctor` replaces its Prompt check with a Preferences check, and `/bro help` shows the preferences status (#94).
70
+ - When preferences change mid-thread, the next BTW turn starts a fresh native session reseeded with the quoted thread, on every backend, so old preferences don't linger in the backend's history (#94).
71
+
72
+ ### Removed
73
+
74
+ - **Breaking:** `bro-prompt.md` is no longer read. It was a full replacement template for the explain prompt that disabled modes, **M**, and the source guard and did not affect Show or BTW. Bro does not migrate, rename, or delete it. Move what you want to keep into `/bro preferences`, and use `/bro mode brief` for the original ELI-simpleton instruction (#94).
75
+
5
76
  ## [0.20.0] - 2026-10-04
6
77
 
7
78
  ### Added
package/README.md CHANGED
@@ -1,14 +1,11 @@
1
1
  # pi-bro
2
2
 
3
- Turn a dense AI reply, pasted text, local document, or public webpage into a
4
- plain-language explanation — or open a separate side conversation with
5
- `/bro btw` — without adding anything to your main agent's context.
3
+ Turn a dense AI reply, pasted text, document or webpage into a plain-language explanation. Ask side questions with `/bro btw`, or understand and assess a PR with `/bro guided-review`. These windows do not add their discussions to your main agent's context.
6
4
 
7
5
  `pi-bro` is an extension for [Earendil Pi](https://github.com/earendil-works/pi).
8
6
  Experimental [PiG 0.3.0 compatibility](docs/pig-compatibility.md) uses the same npm package and requires Node.js. See the compatibility notes for verified coverage and the PiG RPC tool-exclusion limitation.
9
7
  It opens explanations in a separate modal and runs them through a CLI backend
10
- you already have installed and signed in to. Explain, show, BTW, and the
11
- advisor all work across five backends:
8
+ you already have installed and signed in to. Explain, show, BTW and advisor use five backend adapters. Guided Review generation/questions require Claude or Muse file-only inspection (live verification varies by feature):
12
9
 
13
10
  - [Google Antigravity CLI](https://antigravity.google/docs/cli-install) (`agy`) — the default for new settings
14
11
  - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (`claude`)
@@ -72,9 +69,12 @@ text directly captures a new source the same way.
72
69
  | `/bro url <url>` | Explain one public, text-based webpage. |
73
70
  | `/bro open` | Reopen the latest explanation without calling the simplifier again. |
74
71
  | `/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. |
75
- | `/bro doctor` | Check Bro's settings, prompt, and each selected backend, with the effective backend/model/effort per feature. |
72
+ | `/bro doctor` | Check Bro's settings, preferences, and each selected backend, with the effective backend/model/effort per feature. |
76
73
  | `/bro mode [brief\|balanced\|faithful]` | View or choose the explanation mode. |
77
- | `/bro config` | Open an interactive settings screen for the shared default backend/model/effort, explain mode, show turns, and per-capability (explain/show/btw/advisor) overrides. |
74
+ | `/bro preferences` | View or edit what Bro knows about you and how you like answers; see [Preferences](#preferences). |
75
+ | `/bro config` | Open settings for the shared backend/model/effort, explain mode, show turns, and per-capability (explain/show/btw/advisor/review) overrides. |
76
+ | `/bro guided-review <PR number or URL>` | Automatically explain and assess a captured PR in local Pi, with source evidence and optional private questions. Opening the same PR restores its saved review. |
77
+ | `/bro guided-review` | List saved reviews; `resume` is an alias. |
78
78
  | `/bro btw [question]` | Open a side conversation in a modal, seeded with recent main-session context. Starts conversation-only; type `/mode` inside to toggle full permission (read and edit the workspace) without losing the thread. |
79
79
  | `/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`. |
80
80
  | `/bro advisor-steer` | View, edit, save, or clear the one persistent steering brief the advisor always sees. |
@@ -91,7 +91,8 @@ Giving `/bro` the input directly works the same way:
91
91
  ## Explanation modes
92
92
 
93
93
  Bro treats the source as data, rejects embedded instructions, preserves its
94
- language, and avoids adding facts, advice, or conclusions in every mode. Choose
94
+ language (unless your [preferences](#preferences) name another), and avoids
95
+ adding facts, advice, or conclusions in every mode. Choose
95
96
  a persistent mode with `/bro mode`, or press **M** in an explanation to try the
96
97
  next mode without saving it:
97
98
 
@@ -112,19 +113,58 @@ next mode without saving it:
112
113
  - **M**: Re-simplify the captured source in the next mode (brief → balanced →
113
114
  faithful → brief). It applies to this explanation only and does not change
114
115
  the mode saved by `/bro mode`; pressing it again while Bro is working skips
115
- ahead. Not offered while a custom prompt is active
116
+ ahead
116
117
  - **O**: Open the HTML diagram when a show reply contains one
117
118
  - **Esc**: Close the modal, or cancel while Bro is working
118
119
 
119
120
  The modal header shows the model and reasoning effort the explanation or
120
121
  drawing used (`default` when the model's own effort applies), followed by the
121
- explanation mode; `/bro open` keeps the original labels and mode.
122
+ explanation mode, and `prefs` when your [preferences](#preferences) shaped the
123
+ result; `/bro open` keeps the original labels, mode, and tag.
122
124
 
123
125
  Bro temporarily captures mouse input while its modal is open. Native mouse
124
126
  selection may be unavailable or visually extend outside the modal depending on
125
127
  your terminal mode; press **C** to copy the complete explanation reliably.
126
128
 
127
129
 
130
+ ## Guided Review
131
+
132
+ **Open a PR → read and investigate → leave when satisfied.** Bro automatically
133
+ prepares an explanation and quality assessment with captured code, ranked
134
+ findings and suggested fixes/checks. Asking private questions is optional.
135
+ Nothing is automatically applied or posted to GitHub.
136
+
137
+ ```text
138
+ /bro guided-review https://github.com/OWNER/REPO/pull/123
139
+ ```
140
+
141
+ Local Pi interactive mode, Git, authenticated `gh`, and Claude or Muse configured for review
142
+ are required. A new review makes a model call using that backend's account.
143
+ Opening the same PR restores its saved review without another model call.
144
+ Bare `/bro guided-review` lists saved reviews (`resume` is an alias).
145
+
146
+ Contents holds Overview, topics, Findings, Coverage, Changed files and Your
147
+ questions. Enter opens an item or focuses contextual actions; Enter on a
148
+ highlighted action activates it. Tab changes focus. Esc goes back, then closes
149
+ from Contents. Your work is saved automatically; **Close** leaves normally,
150
+ and **Stop and close** cancels active work before saving and leaving.
151
+
152
+ Optional conveniences:
153
+ - **Copy finding** copies its text to the system clipboard; nothing is submitted.
154
+ - **Regenerate guide** makes a confirmed model call about the **same captured
155
+ revision**. Success replaces the guide while retaining original private
156
+ discussion context; failure keeps it. It does not fetch later commits.
157
+
158
+ Reopening also keeps the captured revision, even after the author pushes.
159
+ Findings are model suggestions, not approval; citations show real locations,
160
+ not proof of the conclusion. Review uses Claude or Muse file-only inspection: shell, writes and web tools are disabled. Agy/Grok/Codex review requests fail clearly; choose a review override in `/bro config`. Saved reviews remain readable with any selection. Repository text can still mislead the model; tool restrictions are not proof of its conclusions.
161
+ Use `pi --tui-mode fullscreen` for pane-local wheel scrolling.
162
+
163
+ See the [Guided Review guide](docs/guided-review.md) for controls, calls and
164
+ costs, source freshness, access/privacy, local storage, recovery and current
165
+ scope. Notes, examination tracking, branch/update review and feedback delivery
166
+ are not implemented.
167
+
128
168
  ## Bro btw (side conversation)
129
169
 
130
170
  `/bro btw` opens a separate multi-turn conversation in a modal, so you can ask
@@ -198,18 +238,21 @@ presence, and backend compatibility (for Agy, a minimum CLI version with an
198
238
  return advice, leaving edits to the executor, but that boundary is a
199
239
  behavioral prompt instruction rather than an enforced sandbox constraint, so
200
240
  treat its findings as advice to verify, not a guaranteed hands-off review.
201
- - **Steering**: `/bro advisor-steer` opens an editor for one persistent
202
- steering brief — e.g. "quick prototype; keep A and B careful, everything
203
- else minimal" — that the advisor always reads. **Ctrl+S** saves and keeps
204
- the editor open; **Enter** or **Shift+Enter** inserts a newline; **Ctrl+K**
205
- clears both the saved brief and draft while staying open; **Ctrl+C** copies
206
- the entire current draft, including unsaved edits; and **Esc** closes without
207
- saving unsaved edits. The brief is **never added to Pi's conversation or
208
- sent to the main model** — the advisor is the only thing that reads it.
209
- - **Persistence**: the steering brief persists with the Pi session (not
210
- globally, not per project) as custom extension data in the session file and
211
- is restored on resume or reload. Forking a session inherits it; edits made
212
- after the fork are independent of the original branch.
241
+ - **Steering**: The advisor reads standing priorities from `~/.pi/agent/bro-advisor.md`
242
+ and session-specific priorities from `/bro advisor-steer`.
243
+ `/bro advisor-steer` opens an editor for one session steering brief — e.g. "quick
244
+ prototype; keep A and B careful, everything else minimal". Session steering takes
245
+ precedence over durable standing defaults where they conflict.
246
+ **Ctrl+S** saves and keeps the editor open; **Enter** or **Shift+Enter** inserts
247
+ a newline; **Ctrl+K** clears both the saved session brief and draft while staying open;
248
+ **Ctrl+C** copies the entire current draft, including unsaved edits; and **Esc**
249
+ closes without saving unsaved edits. Neither steering source is **ever added to Pi's
250
+ conversation or sent to the main model** — the advisor is the only thing that reads them.
251
+ - **Persistence**: standing defaults persist across all sessions in `~/.pi/agent/bro-advisor.md`.
252
+ The session steering brief persists with the Pi session as custom extension data in the
253
+ session file (`bro-advisor-steering`) and is restored on resume or reload. Forking a
254
+ session inherits session steering; edits made after the fork are independent of the
255
+ original branch. Clearing session steering leaves durable steering intact.
213
256
  - **Retries**: on an invocation failure (not a completed answer — "I need
214
257
  more evidence" is a normal result, not a failure), Bro retries with the
215
258
  identical snapshot, steering, and question: once after 5 seconds, once more
@@ -241,7 +284,9 @@ assistant conversation text, including every intermediate assistant message in
241
284
  a turn — tool calls, tool results, reasoning, and images never leave the
242
285
  session. It runs the same backend-specific model call and shows the result
243
286
  in the same modal, never touching your conversation. `/bro show` uses its own
244
- draw prompt; the explanation modes and `bro-prompt.md` do not affect it.
287
+ draw prompt; the explanation modes do not affect it. Your
288
+ [preferences](#preferences) can change only its wording and language, never
289
+ which shapes it draws or its rules.
245
290
 
246
291
  Because the draw model only ever sees conversation text, its shapes reflect
247
292
  what was *reported* in the conversation — what the assistant said it did or
@@ -693,7 +738,7 @@ it as a PDF, then use `/bro file <path>`.
693
738
  ## Check your setup
694
739
 
695
740
  Run `/bro doctor` when Bro is newly installed or something is not working. It
696
- checks Bro's settings and prompt, then probes only the backends some feature
741
+ checks Bro's settings and preferences, then probes only the backends some feature
697
742
  actually selects, and reports the effective backend/model/effort for each
698
743
  feature. Failed checks explain what to fix.
699
744
 
@@ -712,7 +757,7 @@ succeed.
712
757
  ## Settings
713
758
 
714
759
  Use `/bro config` to review or change the shared default backend/model/effort
715
- and any per-capability (explain/show/btw/advisor) overrides, the explanation
760
+ and any per-capability (explain/show/btw/advisor/review) overrides, the explanation
716
761
  mode, and the default show turn count. Changes save immediately. Esc inside a
717
762
  picker cancels that pick; Esc on the settings screen closes it, keeping
718
763
  whatever was already saved. A failed save (for example, a read-only file) is
@@ -765,13 +810,13 @@ credentials, and does not copy credentials or rewrite backend configuration.
765
810
  Each backend and your model provider may retain sessions, logs, and request
766
811
  data under their own settings and policies.
767
812
 
768
- | | Explain / show | BTW conversation-only | BTW full permission | Advisor |
769
- | --- | --- | --- | --- | --- |
770
- | **Agy** | Temporary directory, Agy sandbox | Temporary directory, Agy sandbox | Workspace, permissions bypassed | Fresh workspace process, permissions bypassed |
771
- | **Claude Code** | Scratch directory, tools/MCP/skills disabled, no session persistence | Workspace, tools disabled | Workspace, permissions bypassed | Fresh workspace process, permissions bypassed |
772
- | **Grok** | Temporary directory, **prompt instruction only** | Workspace, **prompt instruction only** | Workspace, permissions bypassed | Fresh workspace process, permissions bypassed |
773
- | **Codex** | Scratch directory, read-only sandbox, ephemeral session | Workspace, read-only sandbox | Workspace, approvals and sandbox bypassed | Fresh workspace process, approvals and sandbox bypassed |
774
- | **Muse** | Scratch directory, approval/write/shell disabled, no session log | Workspace, approval/write/shell disabled | Workspace, permissions bypassed (`--yolo`) | Fresh workspace process, permissions bypassed (`--yolo`) |
813
+ | | Explain / show | BTW conversation-only | BTW full permission | Advisor | Guided Review |
814
+ | --- | --- | --- | --- | --- | --- |
815
+ | **Agy** | Temporary directory, Agy sandbox | Temporary directory, Agy sandbox | Workspace, permissions bypassed | Fresh workspace process, permissions bypassed | Unavailable; choose Claude/Muse |
816
+ | **Claude Code** | Scratch directory, tools/MCP/skills disabled, no session persistence | Workspace, tools disabled | Workspace, permissions bypassed | Fresh workspace process, permissions bypassed | Restricted Read/Grep/Glob only; confined checkout, no persistence |
817
+ | **Grok** | Temporary directory, **prompt instruction only** | Workspace, **prompt instruction only** | Workspace, permissions bypassed | Fresh workspace process, permissions bypassed | Unavailable; choose Claude/Muse |
818
+ | **Codex** | Scratch directory, read-only sandbox, ephemeral session | Workspace, read-only sandbox | Workspace, approvals and sandbox bypassed | Fresh workspace process, approvals and sandbox bypassed | Unavailable; command execution is not allowed for review |
819
+ | **Muse** | Scratch directory, approval/write/shell disabled, no session log | Workspace, approval/write/shell disabled | Workspace, permissions bypassed (`--yolo`) | Fresh workspace process, permissions bypassed (`--yolo`) | Captured checkout; writes/shell/web disabled, no session log |
775
820
 
776
821
  - Grok always runs with its sandbox off and permissions bypassed; its tools,
777
822
  hooks, skills, plugins, and MCP may remain available. "Answer only from the
@@ -800,7 +845,7 @@ data under their own settings and policies.
800
845
  ### Configuration precedence
801
846
 
802
847
  When resolving backend, model, and reasoning effort:
803
- 1. **Per-capability override**: `overrides.<capability>` (`explain`, `show`, `btw`, or `advisor`) pins that capability's complete selection.
848
+ 1. **Per-capability override**: `overrides.<capability>` (`explain`, `show`, `btw`, `advisor`, or `review`) pins that capability's complete selection.
804
849
  2. **Shared default**: otherwise the capability inherits `default` (root `model`/`effort` in older flat files).
805
850
  3. **Agy catalog normalization**: for Agy selections, Bro maps suffixed variant IDs and handles fixed-effort models.
806
851
  4. **Initial file creation only**: `PI_BRO_MODEL` has no effect once the settings file exists.
@@ -809,41 +854,66 @@ When resolving turn count for `/bro show`:
809
854
  1. **Command argument**: an explicit count like `/bro show 3` or `/bro show 1 query` overrides for that run.
810
855
  2. **Saved setting**: `showTurns` (defaults to 1).
811
856
 
812
- When resolving the explanation prompt (`explain` capability only):
813
- 1. **Custom prompt**: a valid `~/.pi/agent/bro-prompt.md` (or `$PI_CODING_AGENT_DIR/bro-prompt.md`) completely overrides all built-in modes.
814
- 2. **Saved mode**: `mode` in `bro-settings.json` (defaults to `balanced`).
815
- 3. `bro-prompt.md` applies only to `/bro`, `/bro text`, `/bro file`, and `/bro url`; it does not affect `/bro show`, `/bro btw`, or `bro_advisor`.
857
+ When shaping an answer, each part has one owner:
816
858
 
817
- ## Custom prompt
859
+ | Part | Decided by |
860
+ | --- | --- |
861
+ | Bro's source rules: quoted source treated as data, no added facts, Show's traceability rules, BTW access mode | Built in; nothing overrides them |
862
+ | How much of the source an explanation keeps | The mode: **M** for one explanation, otherwise the saved `mode` |
863
+ | What a Show drawing focuses on | The steering query |
864
+ | Who the answer is for: wording, tone, depth, and answer language | Your [preferences](#preferences), otherwise Bro's built-in defaults |
818
865
 
819
- Bro uses a built-in prompt by default. To use your own, create:
866
+ ## Preferences
820
867
 
821
- ```text
822
- ~/.pi/agent/bro-prompt.md
823
- ```
868
+ Tell Bro about yourself and how you like answers. Bro adds what you write to
869
+ every explain, `/bro show`, `/bro btw`, and Guided Review prompt as a labelled section,
870
+ alongside its own instructions. It never replaces them: modes, **M**, and the
871
+ source rules keep working. The advisor never receives your preferences; use
872
+ `/bro advisor-steer` for it.
824
873
 
825
- Your prompt must include `{{response}}` exactly once. For example:
874
+ Run `/bro preferences` to edit them: **Ctrl+S** saves, **Ctrl+K** deletes the
875
+ file, **Ctrl+C** copies, and **Esc** closes without saving. The first time,
876
+ the editor opens with this starter text, which is not saved until you press
877
+ **Ctrl+S**:
826
878
 
827
879
  ```md
828
- Explain this in plain English in no more than 200 words.
829
- Keep important warnings and next steps.
830
-
831
- Text to explain:
832
- {{response}}
880
+ ## About me
881
+ I'm an overworked white-collar worker, and so are my colleagues. By the end of a
882
+ hard day our brains are fried and we can only handle simple language, no matter
883
+ how sharp we are at our best.
884
+
885
+ ## How I like answers
886
+ - Explain it like I'm a simpleton: plain, everyday words.
887
+ - Go easy on analogies. No forced ones.
833
888
  ```
834
889
 
835
- Bro re-reads this file every time you simplify, so your edits take effect
836
- immediately without reloading Pi. Bro never creates or modifies this file.
837
- Existing valid custom prompts continue working unchanged.
890
+ You can also edit the file directly (under `$PI_CODING_AGENT_DIR` instead when
891
+ that is set):
892
+
893
+ ```text
894
+ ~/.pi/agent/bro-preferences.md
895
+ ```
838
896
 
839
- A valid custom prompt fully overrides all built-in mode instructions.
840
- `/bro show` is separate: it always uses its own built-in draw prompt and
841
- ignores `bro-prompt.md`. `/bro
842
- mode` still changes the saved mode, but that mode remains inactive while
843
- `bro-prompt.md` exists. Remove or rename `bro-prompt.md` to use the saved
844
- built-in mode again. If the custom prompt is invalid—for example, it has no
845
- `{{response}}` placeholder or has more than one—Bro blocks the explanation;
846
- run `/bro doctor` for the exact problem.
897
+ - **Free-form**: no placeholder or structure is required. Bro re-reads the
898
+ file on every request, so edits apply next time. A missing or empty file
899
+ means no preferences, and Bro's prompts are then exactly the built-in ones.
900
+ - **What preferences can change**: wording, tone, technical depth, length in
901
+ BTW, and the answer language. If you name a language, code, commands, paths,
902
+ names, and numbers still stay exactly as written. In `/bro show`,
903
+ preferences only change wording and language. Guided Review also receives preferences for explanation/answer wording; they do not override its evidence or review rules. A per-run choice (the mode,
904
+ **M**, a Show steering query, or what a BTW/review question asks for) wins over a
905
+ standing preference.
906
+ - **Limit**: 4,000 characters, because the text goes with every request. A
907
+ longer file stops explain, Show, BTW, and Guided Review with an error until you trim it;
908
+ Bro never cuts it silently. `/bro doctor` reports the problem, and the
909
+ editor still opens the file so you can fix it.
910
+ - **BTW threads**: when your preferences change, the next side question starts
911
+ a fresh backend session that is caught up on the thread, so old preferences
912
+ don't linger.
913
+
914
+ `bro-prompt.md`, the full prompt template from earlier versions, is no longer
915
+ read. Move what you want to keep into `/bro preferences`, and choose
916
+ `/bro mode brief` for the original ELI-simpleton instruction.
847
917
 
848
918
 
849
919
  ## Privacy and safety
@@ -856,6 +926,10 @@ run `/bro doctor` for the exact problem.
856
926
  seeded main-session conversation text (plus earlier turns when a native
857
927
  session is reseeded) to the selected backend. In full permission mode the
858
928
  side agent can additionally read and edit the workspace.
929
+ - **Guided Review requests**: PR identity/description, captured diff, relevant private discussion and preferences go to the selected backend, which can inspect captured files using Claude/Muse read-only tools. Main-session context is not attached. Review shell/write/web tools are disabled; Claude file tools are confined with `--restricted`, Muse uses workspace-scoped inspection. Prompt injection can still corrupt conclusions or reveal captured content to the provider; this is not a general confidentiality guarantee. See [Guided Review access and storage](docs/guided-review.md#access-privacy-and-storage).
930
+ - **Preferences**: `bro-preferences.md` is sent with every explain, Show,
931
+ BTW, and Guided Review request to the selected backend. It is never sent to the advisor or
932
+ to Pi's main model.
859
933
  - **Advisor requests**: `bro_advisor` sends the executor agent's system
860
934
  instructions, active tool list (excluding `bro_advisor`), ordered
861
935
  conversation history including tool calls and tool results (unlike Show,
@@ -871,10 +945,12 @@ run `/bro doctor` for the exact problem.
871
945
  steering brief to Pi's conversation history or main-agent context. BTW text
872
946
  reaches the main editor only through `/insert` or `/insert-all`, and advisor
873
947
  results appear as normal tool results in the executor's transcript.
948
+ - **Saved reviews**: Guided Review records, questions, drafts and captured Git source persist under the host's `getAgentDir()/bro-reviews/`. No automatic cleanup or sync is provided; see [storage and removal](docs/guided-review.md#access-privacy-and-storage).
874
949
  - **Memory**: the latest explanation (for `/bro open`) and the BTW thread live
875
950
  only in process memory and clear when you switch Pi sessions, reload
876
951
  extensions, or quit Pi. Backend-native sessions can persist independently.
877
- The advisor steering brief is stored as session-scoped extension data
952
+ Standing advisor priorities are stored in `~/.pi/agent/bro-advisor.md`, and
953
+ the session steering brief is stored as session-scoped extension data
878
954
  (`bro-advisor-steering`) in the session file.
879
955
  - **File safety**: `/bro file` reads only regular files whose resolved path is
880
956
  inside Pi's current workspace, including after resolving symlinks. Bro's
@@ -892,7 +968,7 @@ run `/bro doctor` for the exact problem.
892
968
  Bro writes it to `/tmp/pi-bro-<uid>/bro-show-<hash>.html` with a restrictive
893
969
  Content-Security-Policy, and opens it in your browser only when you press
894
970
  **O**. **C** copies the full reply, including the HTML.
895
- - **Clipboard**: **C**, `/copy`, and `/copy-all` copy text to your system
971
+ - **Clipboard**: **C**, `/copy`, `/copy-all`, and Guided Review's Copy finding copy text to your system
896
972
  clipboard, where your operating system or clipboard manager may retain it.
897
973
 
898
974
  ## Troubleshooting and current limits
@@ -920,8 +996,8 @@ tool before giving it to Bro.
920
996
  - HTML diagrams open in your default browser; pressing **O** on a remote or
921
997
  headless session with no display reports the failure instead of opening
922
998
  anything.
923
- - Keeps only the latest explanation in memory and does not store history or
924
- export directly to files.
999
+ - Explain keeps only the latest result in memory and does not export directly to files. Guided Review separately persists review records and captured source.
1000
+ - Guided Review is local-Pi interactive only, keeps its captured revision on reopen, and does not publish, review a branch or fetch later PR changes. See [review recovery and limits](docs/guided-review.md#if-something-goes-wrong).
925
1001
  - Bro temporarily captures mouse input while its modal is open so mouse-wheel
926
1002
  and trackpad scrolling work in regular and fullscreen modes. Native mouse
927
1003
  selection may be unavailable or visually extend outside the Bro window;
@@ -935,7 +1011,7 @@ npm test
935
1011
  pi --tui-mode fullscreen -e ./bro.ts
936
1012
  ```
937
1013
 
938
- `npm test` uses fake `agy`, `claude`, and `grok` executables and never calls an
1014
+ `npm test` uses fake `agy`, `claude`, `grok`, `codex`, and `muse` executables and never calls an
939
1015
  external model. See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for the code
940
1016
  map and invariants, [docs/TESTING.md](docs/TESTING.md) for the manual
941
1017
  end-to-end checklist, and [docs/README.md](docs/README.md) for the docs index.