pi-bro 0.37.0 → 0.38.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 (43) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +18 -22
  3. package/docs/README.md +7 -7
  4. package/docs/elevate.md +10 -93
  5. package/docs/examples.md +1 -1
  6. package/docs/feature-map.md +33 -0
  7. package/docs/features/architecture.md +1 -1
  8. package/docs/features/elevate.md +122 -0
  9. package/docs/features/explain.md +16 -20
  10. package/docs/features/grill-me.md +65 -0
  11. package/docs/features/guided-review.md +150 -0
  12. package/docs/features/overthink.md +66 -0
  13. package/docs/features/remember-me.md +92 -0
  14. package/docs/features/show.md +9 -15
  15. package/docs/getting-started.md +5 -5
  16. package/docs/grill-me.md +5 -51
  17. package/docs/guided-review.md +14 -113
  18. package/docs/overthink.md +7 -46
  19. package/docs/piG-agent-shell-qualification.md +3 -3
  20. package/docs/pig-compatibility.md +1 -1
  21. package/docs/reference/commands.md +18 -33
  22. package/docs/reference/data-and-permissions.md +9 -9
  23. package/docs/reference/settings.md +8 -8
  24. package/docs/reference/troubleshooting.md +3 -3
  25. package/docs/remember-me.md +6 -75
  26. package/docs/user-guide.md +4 -4
  27. package/package.json +6 -4
  28. package/src/advisor.ts +1 -1
  29. package/src/architecture.ts +1 -1
  30. package/src/backend.ts +1 -0
  31. package/src/bro.ts +47 -189
  32. package/src/btw.ts +10 -199
  33. package/src/composer-modal.ts +197 -0
  34. package/src/explain-modal.ts +28 -79
  35. package/src/grill.ts +3 -2
  36. package/src/overthink-state.ts +3 -3
  37. package/src/overthink.ts +2 -2
  38. package/src/remember.ts +3 -2
  39. package/src/session-state.ts +46 -28
  40. package/src/settings.ts +11 -3
  41. package/src/simplify-engine.ts +50 -24
  42. package/src/simplify-ui.ts +165 -126
  43. package/src/sources.ts +3 -3
@@ -0,0 +1,65 @@
1
+ # Grill Me (experimental)
2
+
3
+ [Docs home](../README.md) · [Commands](../reference/commands.md) · [Safety](../reference/data-and-permissions.md)
4
+
5
+ `/bro grill-me` opens an independent decision interview in Bro's modal, without adding turns to Pi's main conversation.
6
+
7
+ ```text
8
+ /bro grill-me Should child agents communicate freely?
9
+ /bro grill-me
10
+ ```
11
+
12
+ With a topic, start a new interview. Without one, reopen the current interview or enter a topic inside the modal. A proposal prompts scrutiny; an open question prompts discovery. Bro offers reasoned pushback, then one question with lettered choices, including an open-ended alternative. Answer with a letter or your own words. Questions request a horizontal divider, a distinct **Question** heading, and exactly one **(Recommended)** option with a short reason. Recommendations are provisional; model adherence is not guaranteed.
13
+
14
+ ## How Bro works with you
15
+
16
+ Grill Me is a **context-rich thinking partner**, not a review pipeline. It can help you discover a position from an open question or test a proposal you already have. If you propose a solution before explaining the problem, Bro looks for the goal and constraints that matter; when those are already clear, it uses them rather than repeating an intake checklist.
17
+
18
+ Bro contributes options and reasons, asks about the most consequential choice still open, and may inspect relevant workspace material when its backend permits it. It should check available facts rather than guessing, ask *you* about preferences and trade-offs, and explain meaningful uncertainty. Good arguments can persuade Bro; it should not invent objections to prolong the interview.
19
+
20
+ As the discussion develops, Bro treats your **agreed choices and reasons** differently from untested assumptions and Bro's own suggestions. You can correct or change a constraint in normal conversation. Bro should carry that change forward and avoid reopening settled ground without a reason.
21
+
22
+ `/consolidate` captures the current position for a handoff, at whatever level of detail the topic warrants: goals, key constraints, endorsed decisions and why, material trade-offs, unresolved questions, and a next step. It does not promote Bro's recommendations into decisions you never made. You can consolidate early, then continue and consolidate again.
23
+
24
+ This takes inspiration from the context-rich **Elephant** in Google's [Elephant–Goldfish Model](https://github.com/google/elephant-goldfish-model). Grill Me does **not** dispatch Goldfish reviewers, require a design document, or impose review/approval stages. It remains one dialogue in Bro's modal.
25
+
26
+ ## Controls
27
+
28
+ | Command inside the modal | Effect |
29
+ | --- | --- |
30
+ | `/consolidate` | Generate a current decision brief. Does not end the interview or insert anything. |
31
+ | `/copy` | Copy the latest reply or consolidated brief to the clipboard. No model call or editor changes. |
32
+ | `/depth light` | Quick, focused questioning |
33
+ | `/depth balanced` | Default: material assumptions and trade-offs |
34
+ | `/depth exhaustive` | Deeper alternatives, evidence and failure cases |
35
+ | `/retry` | Retry the failed/cancelled operation, otherwise regenerate the latest reply. Never repeats copying. |
36
+ | `/new <topic>` | Start over after confirmation. Resets depth to balanced and access to inspection. |
37
+ | `/access inspect` | Request inspection tools; enforcement depends on backend |
38
+ | `/access full` | Request full permissions; requires typing `yes` after a warning |
39
+ | `/help` | Show commands on demand; **Esc returns to the interview** |
40
+ | Esc | Close and cancel active work; preserve completed discussion |
41
+
42
+ Type `/` to see matching commands; keep typing to narrow suggestions and press **Tab** to complete the first match. Completion never submits. From help, Esc returns to the discussion; a second Esc closes the modal.
43
+
44
+ For confirmation prompts, type `yes` to proceed; anything else cancels. Depth can change between replies without losing the discussion. There are no question quotas or finished/locked states. Consolidate whenever useful, inspect the brief, then copy it or continue talking. The brief includes the current position, reasons, objections, unresolved questions and next actions. Copy never edits or submits the Pi draft.
45
+
46
+ The old `/finish`, `/copy-all`, `/insert`, `/insert-all`, `/insert-last-message`, `/clear`, and entry depth flags are not supported. Use `/copy` for the latest reply or brief; paste it where you choose. BTW also uses copy-only handoffs.
47
+
48
+ Grill Me uses the **BTW model/backend/effort** selection from `/bro config`, but has its own independent thread. The header shows depth and effective access; `/help` keeps the footer short. Full access and Agy write risks remain visible in the header even when another notice is shown.
49
+
50
+ While Bro works, the footer shows the current stage and elapsed seconds. When the backend reports tools, it shows only the tool name/type. The timer confirms the request is still pending, not that the backend is making progress. Progress disappears on completion or cancellation and never enters saved replies or copies.
51
+
52
+ ## Access, privacy and limits
53
+
54
+ - Inspection uses the Guided Review backend path in your current workspace. Claude, Muse and Pi have file-only tools. Codex and Grok have read-only sandboxes with shell access. **Agy inspection can still write project files.** No-edit prompts are not security controls.
55
+ - Full access can read, edit and execute commands. Bro instructs the model not to make changes, but cannot enforce that instruction. There is no automatic escalation.
56
+ - Each turn makes a fresh backend call replaying the complete interview. Long interviews cost more and may exceed context limits; there is no hidden truncation or fallback.
57
+ - The provider receives your topic, interview history, Bro preferences and up to eight recent main-session user/assistant text turns (40,000 characters). Captured context excludes tool calls/results, hidden reasoning and images. Backend tools can inspect additional workspace content.
58
+ - Bro stores completed interview turns, depth, access choice and drafts in private Pi session entries. The current Pi session restores them after reload or resume; a new session starts fresh, and forks diverge after inheriting earlier choices. Backend/provider retention is separate; see [backend retention](../reference/data-and-permissions.md#backends-access-and-retention).
59
+ - Closing discards partial output, preserves completed replies, and restores cancelled input unless a newer draft exists. Retry preserves the previous reply until replacement succeeds. Cancellation cannot undo backend changes; descendant cleanup on Windows and abrupt host shutdown are not guaranteed.
60
+
61
+ ## Comparison
62
+
63
+ BTW is for side questions. Elevate improves an assignment. Grill Me tests a decision through dialogue. Its advantage over a standalone questioning skill is modal isolation and explicit return to Pi, not a claim of smarter questioning.
64
+
65
+ See the [evaluation record](https://github.com/tranhoangnguyen03/pi-bro/blob/main/docs/plans/grill-me-evaluation.md). Historical live results predate the command redesign and multiple-choice guidance; they do not validate the revised experience.
@@ -0,0 +1,150 @@
1
+ # Guided Review
2
+
3
+ **Understand and evaluate a PR, without turning your main Pi conversation into a review transcript.**
4
+
5
+ The normal journey is: **open a PR → read and investigate → leave when satisfied.** Bro automatically prepares both an explanation and a quality assessment. Asking questions is optional. You do not need to copy findings, mark progress or submit feedback to finish.
6
+
7
+ ## Open a review
8
+
9
+ Requirements: local Pi interactive mode, Git, authenticated GitHub CLI (`gh`), and a configured review backend (Claude, Muse, or Pi is recommended for untrusted PRs). Run `gh auth status` to check GitHub authentication; `/bro doctor` checks Bro's selected backend setup and shows an advisory when the review backend uses a shell-capable sandbox, without proving GitHub access or model connectivity.
10
+
11
+ ```text
12
+ /bro guided-review https://github.com/OWNER/REPO/pull/123
13
+ ```
14
+
15
+ A URL works even when your current workspace belongs to a different repository. A PR number alone uses the current GitHub repository:
16
+
17
+ ```text
18
+ /bro guided-review 123
19
+ ```
20
+
21
+ A **new** review captures the PR's base/head commits outside your working tree and automatically makes one model request. Subsequent questions each make another request. Calls use your selected backend CLI's account and billing—not Pi's model account. Bro does not automatically retry a failed generation or switch backends.
22
+
23
+ Opening the **same PR again** restores its saved review without another model call. Bare `/bro guided-review` lists saved reviews; `/bro guided-review resume` remains an alias for that list.
24
+
25
+ **Reopening keeps the captured code.** It does not fetch a new comparison when the author pushes commits. Opening by URL/number checks current metadata and reports newer source, but continues the saved capture. The saved-review picker does not check freshness. Reviewing newer revisions is not implemented.
26
+
27
+ ## Read and investigate
28
+
29
+ Contents is on the left; reading and contextual actions are on the right. Narrow terminals show one pane at a time. The supported minimum is 36×18; smaller terminals show resize guidance with a working exit.
30
+
31
+ | Destination | What you get |
32
+ | --- | --- |
33
+ | Overview | Purpose, main concerns and overall assessment |
34
+ | Topics | Short explanations with captured code and related findings |
35
+ | Findings | Ranked concerns, author questions, suggested fixes/checks and evidence |
36
+ | Across the change | Findings that do not belong to one topic, when present |
37
+ | Coverage and limitations | Reported inspection, uncited files, omissions and unverified execution |
38
+ | Changed files | The full changed-file list and one actual diff at a time |
39
+ | Your questions | Private discussions and unsent drafts, including earlier context |
40
+
41
+ A finding is a proposal, not a proven defect or an applied patch. **No findings is not approval.** Source blocks and diffs come from captured Git objects, not model quotations. Valid citations establish locations; they do not certify the reasoning or complete inspection. Coverage paths and access explanations are model-reported. Suggested tests have not been independently executed by Bro.
42
+
43
+ The preparation prompt investigates the whole change and relevant unchanged callers/tests before organizing topics. It supplies the first 100,000 diff characters, with an omission marker for larger changes; the backend can inspect the captured checkout beyond that seed. Follow-up questions include at most the latest 12 relevant turns and disclose older omitted discussion. A saved guide without an assessment is explicitly labelled unassessed. Prototype formats are not supported; unreadable files are left unchanged.
44
+
45
+ The generation header shows observable application stages and elapsed time—not a percentage or invented model checklist.
46
+
47
+ ### Controls
48
+
49
+ | Control | Behavior |
50
+ | --- | --- |
51
+ | ↑ / ↓ | Select entries or scroll the focused reading area |
52
+ | Page Up / Page Down | Page the focused pane |
53
+ | Enter | Read a destination, open a list item, or focus contextual actions |
54
+ | Enter on a highlighted action | Activate it |
55
+ | Tab / Shift+Tab | Move focus in screen order |
56
+ | Esc | Return to where you came from; from Contents, close |
57
+ | Close | Save automatically and leave |
58
+ | Stop and close | Stop active work, await cancellation, save partial work, then leave |
59
+
60
+ The wheel scrolls the pane under the pointer without moving its list selection or keyboard focus, in regular and fullscreen mode. Reading an active answer pauses following; deliberately returning to the bottom resumes it. In regular terminal mode, Bro captures the mouse while the review is open (as its other windows do), so terminal scrollback and mouse text selection return when you close it; use the copy actions meanwhile.
61
+
62
+ ## Ask privately, if needed
63
+
64
+ Choose Ask from a topic, finding, file or Overview. Type in the composer below the discussion. **Enter in the composer sends the question**; leaving without sending retains the draft. Stop response cancels an answer. Stop preparation/regeneration cancels the corresponding guide request.
65
+
66
+ Back restores the originating screen. Failed/stopped questions offer Edit and resend; it restores the question only if the current draft is empty. Resending is explicit and makes a new call. Nothing enters the main Pi conversation or is posted to GitHub.
67
+
68
+ Capture fetches only the head and GitHub-reported merge-base trees (depth 1). Source/diff/evidence remain available offline; ancestry, log and blame history are not captured. Fetch has a ten-minute bound; metadata and other commands have two-minute bounds. Very large trees can still exceed time/output/disk limits; retries reuse the managed store rather than intentionally deleting it.
69
+
70
+ ## Optional conveniences
71
+
72
+ ### Your work is remembered
73
+
74
+ There is no separate Save step. Bro saves the guide, questions, drafts and reading position automatically. Close waits for a successful save. If saving fails, the window stays open with a readable error and Retry saving; fix the reported filesystem problem and retry. Do not force-quit if unsaved work matters.
75
+
76
+ ### Copy finding
77
+
78
+ Copy finding copies a finding's text, evidence references and suggested fix/check to the **system clipboard**. Nothing is submitted, inserted into Pi or applied to source. Your OS or clipboard manager may retain the copied text. Remote clipboard forwarding depends on your host and terminal; a failure is shown in the review.
79
+
80
+ ### Regenerate guide
81
+
82
+ Use Overview → Regenerate guide only when you want a fresh explanation/assessment. Confirmation identifies the captured revision and the model call. **It reuses the same captured source; it is not an update fetch.** Successful output replaces one current guide. Failure/cancellation keeps the current guide. Questions and nonempty drafts retain their original context under Your questions; there is no guide-version picker. A replacement that fails to save remains in memory with retry controls.
83
+
84
+ ### Delete a saved review
85
+
86
+ Use **Overview → Delete review** inside a saved review, or run
87
+ `/bro guided-review delete` to choose from your saved reviews. For a specific
88
+ record, use `/bro guided-review delete <PR number or URL>`. Deletion reads
89
+ only local saved records: no GitHub access or model call is required. A bare
90
+ PR number must match exactly one saved review across all repositories, regardless
91
+ of your current working directory. In contrast, opening a PR by number uses
92
+ the current repository. Use the full PR URL if multiple saved reviews share
93
+ that number. If none are saved, Bro says there is nothing to delete.
94
+ Pressing Esc cancels silently.
95
+ Bro shows the target and asks for confirmation before removing its JSON record,
96
+ private questions/drafts and captured Git source. Closing the picker or declining
97
+ the confirmation changes nothing. Close an open review first; an active writer
98
+ blocks deletion. This affects only the selected review, not your main working tree.
99
+ Deletion cannot be undone. There is no automatic cleanup.
100
+
101
+ ## Access, privacy and storage
102
+
103
+ Review never runs with full-access or bypass flags. **Claude, Muse, and Pi provide strict file-only inspection** and are recommended for untrusted PRs: Claude runs with `--restricted`, Read/Grep/Glob only, `dontAsk`, safe mode and no MCP; Muse disables write, shell and web tools, foreign personal context and native session logs, without trusting repository rules; Pi runs in-process with `read/grep/find/ls` only, no shell, and an isolated session. No model-run project tests, commands, Git or network tools are available on Claude, Muse, or Pi.
104
+
105
+ **Codex, Grok and Agy run with shell available inside their own sandbox**, and each sandbox is different: Codex and Grok apply a read-only sandbox (`codex exec --sandbox read-only --ephemeral`, `grok --sandbox read-only --permission-mode dontAsk`), while Agy's `--sandbox` only restricts terminal commands and still lets them write inside the project. All three inspect the captured checkout with a 10-minute review deadline, and **none is shell-free**. When one of these backends is selected for review, Bro shows an advisory during acquisition, in the live review workspace, and in `/bro doctor` (as a non-fatal informational note). Set the **review** override to Claude, Muse, or Pi in `/bro config` for untrusted PRs; saved reviews remain readable with any backend. Unsupported/older CLI flags fail visibly; there is no bypass fallback.
106
+
107
+ Captured evidence is read from pinned Git blobs, so a shell-capable backend that writes inside the checkout cannot alter the code shown as evidence — but it can still change what it later reads, so treat very large changes with suspicion when using Agy.
108
+
109
+ These controls reduce malicious-code execution/write risk, but repository content can still manipulate the model's conclusions. Captured content, questions and answers go to the provider; do not use review as a secrets boundary or approval certificate. CLI enforcement and managed host policies remain the backend's responsibility.
110
+
111
+ PR identity/description, diff, relevant saved discussion and your Bro preferences are sent to the selected backend. It can inspect the captured source. Main-session conversation is not automatically attached. Each request reconstructs context; review does not resume BTW/native sessions. Claude, Muse and Codex disable native session persistence where their CLIs support it; backend/provider retention policies still apply.
112
+
113
+ Records, private text and captured source remain under:
114
+
115
+ ```text
116
+ ${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}/bro-reviews/
117
+ ```
118
+
119
+ The implementation uses the host's `getAgentDir()`. Records are
120
+ `<review-id>.json`, captured source lives under `source/<review-id>/`,
121
+ including preserved incomplete recovery directories. Failed/corrupt records are
122
+ reported without overwriting them. There is no cross-machine sync or automatic
123
+ cleanup. Use the explicit deletion picker rather than editing these files by hand.
124
+ Cross-process writers are not locked, so close the same review in every Pi process
125
+ before deletion.
126
+
127
+ One open writer per review is supported within a Pi process. Concurrent editing of the same review from separate processes is unsupported.
128
+
129
+ ## If something goes wrong
130
+
131
+ | Problem | What to do |
132
+ | --- | --- |
133
+ | GitHub unavailable when reopening | Use bare `/bro guided-review` to choose a saved review; resume and deletion from local records do not fetch |
134
+ | Sandboxed shell review backend (Codex, Grok, Agy) | Advisory shown; choose Claude, Muse, or Pi in `/bro config` for strict file-only inspection on untrusted PRs |
135
+ | Git/gh authentication or fetch error | Read the acquisition error; check Git/`gh auth status`; retry explicitly |
136
+ | Invalid/failed preparation | Changed files remain available; use Prepare guide to retry when ready for another call |
137
+ | Failed regeneration | Current guide is kept; retry only if you want another call |
138
+ | Unavailable evidence | Treat it as unavailable; re-enter its topic/finding to retry transient reads |
139
+ | Binary/directory evidence | Not presented as source text; inspect the diff/inventory instead |
140
+ | Save error | Keep the window open; correct the reported cause and Retry saving or Close |
141
+ | Clipboard error | Read the notice; clipboard support depends on the host/platform |
142
+ | Author pushed new commits | Saved review remains on the captured revision; newer-revision review is not available |
143
+
144
+ ## Not available yet
145
+
146
+ Notes, explicit examination tracking, branch/PR discovery, newer-revision review
147
+ and feedback delivery into Pi/GitHub are not implemented. These were part of
148
+ the original [#104 scope](https://github.com/tranhoangnguyen03/pi-bro/issues/104);
149
+ no implementation sequence is agreed. They are not required steps in the
150
+ reading experience above.
@@ -0,0 +1,66 @@
1
+ # Overthink — private second look
2
+
3
+ Overthink gives Pi's work a small, skeptical second pass. It checks the direction, the evidence, the risks and the next move, without making a new agent or interrupting the original conversation. It is inspired by [pi-heads-up](https://github.com/Pringled/pi-extensions/tree/main/packages/pi-heads-up).
4
+
5
+ ## Normal use
6
+
7
+ Automatic checks are **off by default**. To enable them, go to `/bro config` → Features → Overthink. With automatic checks on, after a **fully settled substantial task** (currently at least three tool results across the run), Overthink sends one extra private assessment to the **same active Pi model, at the same thinking level**. A short note appears above the input only if there is something material to flag. If the reply already covered the issue, or there is nothing important to add, Overthink stays quiet. A question-only turn is not enough to trigger a check.
8
+
9
+ Run `/bro overthink` to **view** the latest assessment. Opening the modal makes **no model request**. The notes never enter Pi's user/assistant conversation and do not direct the agent to perform work.
10
+
11
+ ## Four factory questions
12
+
13
+ A new session starts with four questions:
14
+
15
+ 1. **Direction:** Are we solving the right problem and moving toward the intended outcome?
16
+ 2. **Evidence:** What important assumptions or conclusions might be wrong or insufficiently verified?
17
+ 3. **Risks:** What material risks, unintended changes, or needless complexity have we introduced?
18
+ 4. **Next move:** What correction, decision, or next step would most improve the outcome?
19
+
20
+ Bro still permits up to 32 custom questions and does **one same-model call for the entire list**. When nothing material is missed, the model should answer `NONE` and Overthink stays quiet. Otherwise it must return a brief 2–3-sentence summary followed by **one concise answer for each saved question**, in order, written in plain, everyday words for a tired reader. Saved [preferences](../reference/settings.md#preferences) (`bro-preferences.md`) can adjust tone or answer language on top, without overriding the JSON format, sentence limits, plain-language brevity or review rules. A question without a material concern can say so; it need not invent criticism.
21
+
22
+ **Existing saved global and per-session question lists do not change automatically.** To adopt the four new factory questions, reset the global defaults (Ctrl+D twice, Ctrl+S), then reset the session list (Ctrl+D twice, Ctrl+S). User-edited lists remain intact, even when they contain the former seven questions.
23
+
24
+ ## Viewer
25
+
26
+ The modal shows a compact check date/model/freshness line, followed by **Summary** and numbered question–answer sections. The original question wording is visible. For the four factory questions, the sections are labeled Direction, Evidence, Risks and Next move. Longer results scroll; short results no longer expand into a mostly empty frame. Earlier plain-text notes stay viewable without being misrepresented as answers to the new questions.
27
+
28
+ In the modal:
29
+
30
+ - **Ctrl+R** — force a fresh assessment (also works for smaller tasks). A check uses the **current** session context.
31
+ - **Ctrl+E** — edit the questions for **this Pi session**.
32
+ - **?** — show or hide help.
33
+ - **U** — show or hide full token/cache/estimated-cost usage details (hidden by default).
34
+ - **Ctrl+C** — copy the latest findings.
35
+ - **Esc** — close or leave Help.
36
+ - **↑/↓** — scroll.
37
+
38
+ If the last assessment found nothing, the modal says so. The note records the model-relevant session entry it assessed. When a later task (even a trivial turn), compaction, context edit, or branch move changes that position, the viewer explicitly marks the old note **OUTDATED**. Older notes without position metadata are marked **source position not recorded**. Editing questions also marks an existing note as using earlier questions.
39
+
40
+ ## Question editor
41
+
42
+ The same ordered, editable list is used in both places:
43
+
44
+ - **Global defaults:** `/bro config → Features → Overthink → Default questions`.
45
+ - **Automatic checks:** `/bro config → Features → Overthink → Automatic checks` toggles the global on/off switch. It starts **Off** unless you previously saved it as On. Turning it off does not delete questions or notes; the viewer and manual **Ctrl+R** still work.
46
+ - **Session questions:** `/bro overthink`, then **Ctrl+E**.
47
+
48
+ Use **↑/↓** to choose an entry; **Enter** to edit; **Ctrl+N** to add; **Ctrl+X** to delete; **Ctrl+↑/↓** to reorder; **Ctrl+S** to save; **Esc** to cancel. Saving an empty list disables checks. Unsaved changes are protected by a second-Esc warning.
49
+
50
+ **Ctrl+D** twice resets the editor draft. In the global editor it restores Bro's factory questions; in the session editor it restores the **current global defaults**. Press Ctrl+S to save that reset. A new session inherits the current global defaults once and can then be edited independently. Existing sessions do not change when the global defaults are updated.
51
+
52
+ ## Model, cache and privacy
53
+
54
+ Overthink **never** uses the BTW or Bro backend/model setting. It calls Pi's current `modelRegistry.streamSimple` using `buildSessionProjection()` plus a single appended private review instruction. It uses the active physical session model and reasoning level, makes **one call for all questions**, **never executes tools**, and does not add the assessment to the main model context. The request may still contain Pi's tool descriptions as part of the original context; the prompt tells the model to respond in text and not call tools. An unexpected tool-use response is treated as a failed check, not executed. The call sends the session context (including tool evidence exposed by Pi's projection) to that model's provider, under the provider's data policy.
55
+
56
+ This largely preserves the request prefix and **can** reuse provider prompt-cache input. The benefit varies by provider, model, elapsed time, tool/context changes, other extensions' context hooks, and prompt-cache policy. It does not replicate every live Pi context modification. In Pi 1.3 and 1.5, `context_with_system` can observe a prepared context just before a provider call, while `before_provider_request` can observe a provider-specific payload; neither provides a portable, complete, settled-session request that can simply be appended and replayed through `streamSimple`. A recorded pre-call context also lacks the final agent response that Overthink needs to review. Bro therefore keeps the explicit projection path until a real provider-side comparison shows a safe improvement. **A cached prefix is not free:** high thinking effort can add substantial reasoning tokens on top of the visible-output limit, and both output and reasoning can cost money. Press **U** in the viewer to show *provider-reported* input, cache-read, cache-write, output and reasoning tokens when available; the details are hidden during normal reading. It labels USD cost separately as **estimated cost** from Pi's model price table, not a provider-billed amount; subscription or OAuth users may pay differently. A reported cache-read value of **0** could mean no hit **or unsupported caching**; it is not proof that caching works. Some providers report no usage fields. Check actual billed cost before treating Overthink as cheap.
57
+
58
+ New structured assessments include the exact question snapshot used for that check, so later edits do not relabel earlier answers. Saved notes made by older versions remain plain text. Invalid or incomplete structured model outputs are rejected rather than shown under the wrong question.\n\nOverthink stores editable global defaults in `getAgentDir()/bro-overthink-defaults.json` and session questions plus the **latest** private check in Pi session `custom` entries (`bro-overthink`). Those entries are outside LLM prompts. Session forks inherit their branch's last state; later edits are independent. The viewer resolves only the **latest** note. Pi stores session custom entries by appending, so **each completed check adds another entry to the session file**, even though Bro does not provide a history browser or archive. This is a deliberate reuse of Pi's branch-aware persistence, not a claim that only one physical record exists. Keep this storage growth in mind for long sessions. It does not write to your project files.
59
+
60
+ ## Limits and verification
61
+
62
+ - The second look is self-criticism by the **same** model; it is not an independent external review. Use `bro_advisor` when a genuinely separate view matters.
63
+ - An automatic check can fail without an on-screen error; it must not disturb the main run. Force retry in the modal to see the error.
64
+ - Automatic work is triggered at Pi's `agent_settled` lifecycle event (supported from Pi 1.3), not `agent_end`. The earlier event collects tool-use evidence; only a normal final settlement, without queued messages, may start the check. A new agent turn, model change, question edit or session navigation cancels or invalidates stale checks. A returned note is not proof that every listed concern is true.
65
+ - Running Heads-up and Overthink together can cause **two extra calls** after a substantive turn. Disable one if that cost is not wanted.
66
+ - Host events and cache accounting vary. See [manual qualification](https://github.com/tranhoangnguyen03/pi-bro/blob/main/docs/TESTING.md) before claiming live TUI, PiG or cache-cost behavior.
@@ -0,0 +1,92 @@
1
+ # Remember Me
2
+
3
+ [Docs home](../README.md) · [Commands](../reference/commands.md) · [Preferences](../reference/settings.md#preferences)
4
+
5
+ Use `/bro remember-me` to browse your approved personal memories, or `/bro remember-me <thought>` to start drafting from your words and recent Pi conversation.
6
+
7
+ ## Write through conversation
8
+
9
+ Bro reviews your statement and existing memories. It may ask one material question, flag a competing entry, or propose a short statement with deeper background. **Nothing saves until you type `/save`.** You can reply normally to refine a proposal. When you correct it, the old draft remains visible but cannot be approved until Bro returns a revised proposal. Questions and failed model calls never silently re-enable `/save`.
10
+
11
+ A proposed memory always has:
12
+ - **Subject:** a distinct topic, such as Testing or Delegation
13
+ - **Short statement:** active, clear and usable on its own; include qualifications that change its meaning
14
+ - **Expanded background:** context, explanations and original wording; optional scope, exceptions, source context, uncertainty and whether wording reflects a user statement or user-approved interpretation
15
+
16
+ Use the same vocabulary across related memories. Put useful distinguishing words first. Never convert “prefers lean tests” into “dislikes tests,” or “autonomy within an approved plan” into “unrestricted autonomy.” Summaries and expanded content must agree.
17
+
18
+ If the user hasn't resolved a conflict, don't pretend it is settled. Bro shows a potential conflict in the proposal. The user decides whether to revise it, update an existing memory or save a qualified entry.
19
+
20
+ ## Controls
21
+
22
+ | Input | Action |
23
+ | --- | --- |
24
+ | Free text | Continue clarifying or refining |
25
+ | `/save` | Approve and persist the current proposal |
26
+ | `/list [page|all]` | Page through the current search (20 per page), or use `/list all` to return to all memories; preserve the proposal |
27
+ | `/search <words>` | Start a filtered search; `/list 2` continues its second page without dropping the proposal |
28
+ | `/expand <id>` | Show background, source, scope, exceptions and uncertainty |
29
+ | `/edit <id>` | Edit an existing memory while keeping its stable ID |
30
+ | `/delete <id>` | Delete after typing yes |
31
+ | `/context show|on|off` | See or omit the captured Pi context before transmitting |
32
+ | `/confirm-revision` | Approve after comparing a stale proposal with changed memories |
33
+ | `/new` | Discard the draft without changing saved memories |
34
+ | `/help` | Explain commands and boundaries |
35
+
36
+ Before the first model call, Bro identifies the selected model/backend, the captured main-session context, and that related saved memories and legacy style preferences will be sent. The initial thought is prefilled but not sent until the user presses Enter. Use `/context show` to inspect what was captured or `/context off` to omit it.
37
+
38
+ Browsing and failed saves preserve the proposal. If the store changed after the proposal was reviewed, `/save` compares the original and current target (and related entries) and **does not save**. An explicit `/confirm-revision` approves against that exact new revision; if it changes again, another review is required. Durable drafts across restarts are not implemented.
39
+
40
+ During a draft or revision, the footer shows the current stage and elapsed seconds even if the model is quiet. It does not show the raw draft JSON, and progress is not saved as a memory. Elapsed time means the call remains pending, not that the model has made progress.
41
+
42
+ Esc closes the modal and cancels an active model call. The draft conversation is not durable; **approved saved memories are durable**. Saved entries survive Pi restarts and project changes.
43
+
44
+ ## Agent access
45
+
46
+ The main Pi agent gets a read-only `about_user` tool:
47
+
48
+ ```text
49
+ about_user() → short statements and IDs
50
+ about_user({query:"testing"}) → matching summaries
51
+ about_user({offset:20,limit:20}) → next page of memories
52
+ about_user({expand:["m-..."]}) → approved background for an ID
53
+ ```
54
+
55
+ The agent can scan a summary before deciding what to unfold. The reader performs no new model call. It does not mutate stored entries. The user's current request wins over a standing memory.
56
+
57
+ ## Boundaries
58
+
59
+ Stored memories live in `~/.pi/agent/bro-memories.json` (or under `$PI_CODING_AGENT_DIR`), not project Git repos. Files are personal: keep private backups and avoid sharing them in logs. Selected model providers receive the words you provide to Remember Me, recent session text captured at opening, and existing memory statements for conflict checking. Read-only `about_user` returns only the requested summaries/expansions to the calling main Pi agent; that agent may send returned content to its model provider.
60
+
61
+ **Agent access is currently the registered main Pi tool only.** External CLIs and isolated Bro sessions do not receive it automatically. The existing `/bro preferences` file remains unchanged; no automatic migration or conflict reconciliation is claimed.
62
+
63
+ Remember Me uses **the backend and model selected for BTW**. Every valid BTW backend is supported through Bro's existing restricted **explain** execution path. It never silently changes provider or model. Restricted means different things across backends, not a universal promise of no tools or no side effects:
64
+
65
+ | Backend | Current restricted drafting behavior |
66
+ | --- | --- |
67
+ | Agy (default) | `--sandbox`, temporary working directory. Sandbox limits shell actions; it is **not** a no-tools or no-write guarantee. |
68
+ | Codex | `--sandbox read-only`, ephemeral execution and temporary working directory; read-only sandbox, **not** no-tools. |
69
+ | Claude | CLI tools disabled with `--tools ""`, strict empty MCP config, temporary working directory, no session persistence. |
70
+ | Pi | Fresh SDK session with no tools, extensions, skills, or project context files, using the **selected configured physical model**. |
71
+ | Muse | Write and shell disabled, approvals disabled, temporary working directory. Do not infer that all other abilities are disabled. |
72
+ | Grok | A restricted **prompt request**, but CLI sandbox off and permissions bypassed; it is **not** a technical tool/write boundary. |
73
+
74
+ The modal shows a backend-specific notice before sending data. Bro's `/save` gate controls **only writes to its approved memory store**. It does not prevent any action that the selected backend's own permissions might allow. See [execution configuration](../reference/settings.md) for backend details.
75
+
76
+ Live model behavior and the actual backend installation are separate from controlled-response tests.
77
+
78
+ **Coexistence policy:** `/bro preferences` remains active as a legacy *answer-style* file for older Bro features. `about_user` reads only approved Remember Me memories. Current user instructions take precedence. If an approved memory conflicts with legacy preferences, the approved memory is the source for the personal fact or lasting rule; do not treat two conflicting stores as equally authoritative. Bro should surface the disagreement during drafting. There is no silent migration or overwrite; a reviewed migration remains a separate task.
79
+
80
+ ## Examples
81
+
82
+ **Short:** `Testing: Seek sufficient confidence at the lowest reasonable maintenance cost; do not optimize for raw test count.`
83
+
84
+ **Expanded:** The user values tests that protect meaningful behavior and rejects needless duplication. This does **not** mean the user dislikes tests. Scope: project test strategy. Source: explicit user preference.
85
+
86
+ **Short:** `Delegation: Allow agents to act independently within an approved coordination plan; reserve consequential scope changes for human approval.`
87
+
88
+ **Expanded:** The user wants strong initiative after authorizing the plan, not unrestricted delegation. An agent can coordinate approved subtasks but should return for approval when changing agreed goals or major commitments.
89
+
90
+ **Short:** `Answer length: Lead with a short answer; give enough detail for consequential design reviews. [Apparent tension: brevity versus depth depends on task.]`
91
+
92
+ **Expanded:** “Keep answers concise” and “go deep on important trade-offs” are not necessarily conflicting. Their scope differs: routine replies versus material design decisions. Preserve that distinction rather than deciding the user dislikes detailed work.
@@ -4,14 +4,11 @@
4
4
 
5
5
  ## Bro show
6
6
 
7
- Where the explanation modes rewrite dense prose in simpler words, `/bro show`
8
- changes the form: it draws what you and the assistant said in the last few
7
+ Inside [Simplify](explain.md), run `/show` to understand recent conversation as a diagram or outline instead of a plain-language explanation. It draws what you and the assistant said in the last few
9
8
  session turns as a shape instead of paragraphs. Capture keeps only user and
10
9
  assistant conversation text, including every intermediate assistant message in
11
10
  a turn — tool calls, tool results, reasoning, and images never leave the
12
- session. It runs the same backend-specific model call and shows the result
13
- in the same modal, never touching your conversation. `/bro show` uses its own
14
- draw prompt; the explanation modes do not affect it. Your
11
+ session. The drawing replaces the previous Simplify result without touching your conversation. Show keeps its own backend settings and draw prompt; explanation modes do not affect it. Your
15
12
  [preferences](../reference/settings.md#preferences) can change only its wording and language, never
16
13
  which shapes it draws or its rules.
17
14
 
@@ -33,29 +30,27 @@ one Mermaid `sequenceDiagram`. The modal keeps its source visible with
33
30
  `[Diagram saved — press O to render]`; **O** opens a page that draws it with
34
31
  the Mermaid copy bundled in Bro. Any other Mermaid stays plain text.
35
32
 
36
- Pressing **R** redraws the same captured turns; running `/bro show` again
37
- captures the latest turns afresh. `/bro show <n-turns>` overrides the default turn
38
- count for a single run.
33
+ Pressing **R** redraws the same captured turns; running `/show` again captures recent turns afresh. `/show <n-turns>` overrides the default turn count. Outside the modal, the direct form is `/bro simplify show [n-turns] [query]`.
39
34
 
40
35
  Add a query to steer what the shapes focus on, either after a turn count or on
41
- its own: `/bro show what changed in the auth flow`, or `/bro show 3 what
36
+ its own: `/show what changed in the auth flow`, or `/show 3 what
42
37
  changed in the auth flow`. The query is used as a lens on the captured turns,
43
38
  not as additional evidence, and its casing is preserved as typed. Pressing
44
39
  **R** retries with the same turn count and query.
45
40
 
46
41
  Any leading whitespace-delimited word that looks like a number is treated as the
47
- requested turn count: for example, `/bro show 3 what changed` captures 3 turns
48
- and steers on "what changed", while `/bro show 404 handler` parses "404" as the
42
+ requested turn count: for example, `/show 3 what changed` captures 3 turns
43
+ and steers on "what changed", while `/show 404 handler` parses "404" as the
49
44
  turn count and "handler" as the steering query. To steer on a phrase that starts
50
45
  with digits while choosing a turn count, specify the turn count explicitly
51
- first: `/bro show 1 404 handler` captures 1 turn and steers on "404 handler".
46
+ first: `/show 1 404 handler` captures 1 turn and steers on "404 handler".
52
47
  If the first word is not a number, the whole input is treated as the steering
53
48
  query using the saved `showTurns` default.
54
49
 
55
50
  ### A slow session-create, traced
56
51
 
57
52
  The agent followed a two-second delay from the handler down to the worker.
58
- `/bro show` drew the chain:
53
+ `/show` drew the chain:
59
54
 
60
55
  ```text
61
56
  handleCreateSession(req)
@@ -70,8 +65,7 @@ handleCreateSession(req)
70
65
 
71
66
  ### The shape of code before it exists
72
67
 
73
- A design discussion agreed on the data model ahead of implementation. `/bro
74
- show` kept just the shape:
68
+ A design discussion agreed on the data model ahead of implementation. `/show` kept just the shape:
75
69
 
76
70
  ```typescript
77
71
  interface Item { id: ItemId; parentId: ItemId | null }
@@ -4,7 +4,7 @@ Pi-bro helps you understand agent replies, ask side questions, and review work w
4
4
 
5
5
  ## 1. Install
6
6
 
7
- You need **Pi**, Node.js 22.19.0 or later, and one supported backend already installed and signed in (Agy, Claude, Grok, Codex, or Muse) — or the built-in **Pi** backend, which uses your Pi session's own models and needs no extra CLI. See [requirements](../README.md#requirements).
7
+ You need **Pi** and Node.js 22.19.0 or later. Select a physical model in Pi to use Bro without another CLI. On first use, Bro saves that model as its default. If none is selected, Bro starts with the Agy preset; choose a backend in `/bro config`. See [requirements](../README.md#requirements).
8
8
 
9
9
  ```sh
10
10
  pi install npm:pi-bro
@@ -23,7 +23,7 @@ Restart Pi (or run `/reload`). Then run:
23
23
  Copy this complete command into Pi:
24
24
 
25
25
  ```text
26
- /bro text A request limit means a service allows only a certain number of calls in a given time.
26
+ /bro simplify text A request limit means a service allows only a certain number of calls in a given time.
27
27
  ```
28
28
 
29
29
  **Expected:** A Bro window opens and explains the sentence in simpler words. The exact answer depends on the backend. Use the arrow keys to scroll, **C** to copy, or **Esc** to close. Bro doesn't insert this result into your main agent's context.
@@ -36,9 +36,9 @@ This step makes a **real model call**, which may use your backend account's quot
36
36
  | --- | --- |
37
37
  | Understand the last agent answer | Open `/bro`, then run `/simplify` inside |
38
38
  | Ask a side question | `/bro btw What is a race condition?` |
39
- | Visualize what we discussed | `/bro show` (after at least one user turn) |
40
- | Explain a local file | `/bro file docs/my-report.md` (**replace with an existing path**) |
41
- | Explain an actual public webpage | `/bro url https://your-public-page.example` (**replace with a real URL**) |
39
+ | Visualize what we discussed | `/bro simplify show` (after at least one user turn) |
40
+ | Explain a local file | `/bro simplify file docs/my-report.md` (**replace with an existing path**) |
41
+ | Explain an actual public webpage | `/bro simplify url https://your-public-page.example` (**replace with a real URL**) |
42
42
 
43
43
  See the [docs home](README.md) for detailed workflows.
44
44
 
package/docs/grill-me.md CHANGED
@@ -1,65 +1,19 @@
1
1
  # Grill Me (experimental)
2
2
 
3
- [Docs home](README.md) · [Commands](reference/commands.md) · [Safety](reference/data-and-permissions.md)
4
-
5
- `/bro grill-me` opens an independent decision interview in Bro's modal, without adding turns to Pi's main conversation.
6
-
7
- ```text
8
- /bro grill-me Should child agents communicate freely?
9
- /bro grill-me
10
- ```
11
-
12
- With a topic, start a new interview. Without one, reopen the current interview or enter a topic inside the modal. A proposal prompts scrutiny; an open question prompts discovery. Bro offers reasoned pushback, then one question with lettered choices, including an open-ended alternative. Answer with a letter or your own words. Questions request a horizontal divider, a distinct **Question** heading, and exactly one **(Recommended)** option with a short reason. Recommendations are provisional; model adherence is not guaranteed.
3
+ This guide moved to [Grill Me](features/grill-me.md). The links below take you to the corresponding sections.
13
4
 
14
5
  ## How Bro works with you
15
6
 
16
- Grill Me is a **context-rich thinking partner**, not a review pipeline. It can help you discover a position from an open question or test a proposal you already have. If you propose a solution before explaining the problem, Bro looks for the goal and constraints that matter; when those are already clear, it uses them rather than repeating an intake checklist.
17
-
18
- Bro contributes options and reasons, asks about the most consequential choice still open, and may inspect relevant workspace material when its backend permits it. It should check available facts rather than guessing, ask *you* about preferences and trade-offs, and explain meaningful uncertainty. Good arguments can persuade Bro; it should not invent objections to prolong the interview.
19
-
20
- As the discussion develops, Bro treats your **agreed choices and reasons** differently from untested assumptions and Bro's own suggestions. You can correct or change a constraint in normal conversation. Bro should carry that change forward and avoid reopening settled ground without a reason.
21
-
22
- `/consolidate` captures the current position for a handoff, at whatever level of detail the topic warrants: goals, key constraints, endorsed decisions and why, material trade-offs, unresolved questions, and a next step. It does not promote Bro's recommendations into decisions you never made. You can consolidate early, then continue and consolidate again.
23
-
24
- This takes inspiration from the context-rich **Elephant** in Google's [Elephant–Goldfish Model](https://github.com/google/elephant-goldfish-model). Grill Me does **not** dispatch Goldfish reviewers, require a design document, or impose review/approval stages. It remains one dialogue in Bro's modal.
7
+ [How Bro works with you](features/grill-me.md#how-bro-works-with-you)
25
8
 
26
9
  ## Controls
27
10
 
28
- | Command inside the modal | Effect |
29
- | --- | --- |
30
- | `/consolidate` | Generate a current decision brief. Does not end the interview or insert anything. |
31
- | `/copy` | Copy the latest reply or consolidated brief to the clipboard. No model call or editor changes. |
32
- | `/depth light` | Quick, focused questioning |
33
- | `/depth balanced` | Default: material assumptions and trade-offs |
34
- | `/depth exhaustive` | Deeper alternatives, evidence and failure cases |
35
- | `/retry` | Retry the failed/cancelled operation, otherwise regenerate the latest reply. Never repeats copying. |
36
- | `/new <topic>` | Start over after confirmation. Resets depth to balanced and access to inspection. |
37
- | `/access inspect` | Request inspection tools; enforcement depends on backend |
38
- | `/access full` | Request full permissions; requires typing `yes` after a warning |
39
- | `/help` | Show commands on demand; **Esc returns to the interview** |
40
- | Esc | Close and cancel active work; preserve completed discussion |
41
-
42
- Type `/` to see matching commands; keep typing to narrow suggestions and press **Tab** to complete the first match. Completion never submits. From help, Esc returns to the discussion; a second Esc closes the modal.
43
-
44
- For confirmation prompts, type `yes` to proceed; anything else cancels. Depth can change between replies without losing the discussion. There are no question quotas or finished/locked states. Consolidate whenever useful, inspect the brief, then copy it or continue talking. The brief includes the current position, reasons, objections, unresolved questions and next actions. Copy never edits or submits the Pi draft.
45
-
46
- The old `/finish`, `/copy-all`, `/insert`, `/insert-all`, `/insert-last-message`, `/clear`, and entry depth flags are not supported. Use `/copy` for the latest reply or brief; paste it where you choose. BTW also uses copy-only handoffs.
47
-
48
- Grill Me uses the **BTW model/backend/effort** selection from `/bro config`, but has its own independent thread. The header shows depth and effective access; `/help` keeps the footer short. Full access and Agy write risks remain visible in the header even when another notice is shown.
49
-
50
- While Bro works, the footer shows the current stage and elapsed seconds. When the backend reports tools, it shows only the tool name/type. The timer confirms the request is still pending, not that the backend is making progress. Progress disappears on completion or cancellation and never enters saved replies or copies.
11
+ [Controls](features/grill-me.md#controls)
51
12
 
52
13
  ## Access, privacy and limits
53
14
 
54
- - Inspection uses the Guided Review backend path in your current workspace. Claude, Muse and Pi have file-only tools. Codex and Grok have read-only sandboxes with shell access. **Agy inspection can still write project files.** No-edit prompts are not security controls.
55
- - Full access can read, edit and execute commands. Bro instructs the model not to make changes, but cannot enforce that instruction. There is no automatic escalation.
56
- - Each turn makes a fresh backend call replaying the complete interview. Long interviews cost more and may exceed context limits; there is no hidden truncation or fallback.
57
- - The provider receives your topic, interview history, Bro preferences and up to eight recent main-session user/assistant text turns (40,000 characters). Captured context excludes tool calls/results, hidden reasoning and images. Backend tools can inspect additional workspace content.
58
- - Bro stores completed interview turns, depth, access choice and drafts in private Pi session entries. The current Pi session restores them after reload or resume; a new session starts fresh, and forks diverge after inheriting earlier choices. Backend/provider retention is separate; see [backend retention](reference/data-and-permissions.md#backends-access-and-retention).
59
- - Closing discards partial output, preserves completed replies, and restores cancelled input unless a newer draft exists. Retry preserves the previous reply until replacement succeeds. Cancellation cannot undo backend changes; descendant cleanup on Windows and abrupt host shutdown are not guaranteed.
15
+ [Access, privacy and limits](features/grill-me.md#access-privacy-and-limits)
60
16
 
61
17
  ## Comparison
62
18
 
63
- BTW is for side questions. Elevate improves an assignment. Grill Me tests a decision through dialogue. Its advantage over a standalone questioning skill is modal isolation and explicit return to Pi, not a claim of smarter questioning.
64
-
65
- See the [evaluation record](plans/grill-me-evaluation.md). Historical live results predate the command redesign and multiple-choice guidance; they do not validate the revised experience.
19
+ [Comparison](features/grill-me.md#comparison)