repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

docs: refresh release readmes

958e2ab195b6291bd5c34536542505f3ad0e8038

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (22)

+212 / −135 text lines

Diff layout

README.md

Modified

+34 / −31 text lines

55## Install
7Use `pi install`. Not `pi ext install`. That corpse stays buried.
8
79All extensions via git, pinned:
911```bash
5153- `prompts`: load only matching prompt templates; `[]` loads none.
5254- `themes`: load only matching themes; `[]` loads none.
5355- Omit a key to load all resources of that type exported by the package manifest.
54- Filters are package-root paths/patterns layered on top of the root manifest. They narrow. They do not resurrect junk outside the manifest.
56- Values are package-root paths/globs. `!pattern` excludes; `+path` and `-path` force exact include/exclude.
57- Filters narrow the root manifest. They do not resurrect junk outside it.
5659## Extensions
5861| Extension slug | Short explanation | README |
5962|---|---|---|
60| `angel` | Structured advisor and shell-command guardrail for configured model pairs. | [README](extensions/angel/README.md) |
61| `builtin-tools` | Toggle Pi builtin `find`, `ls`, and `grep` tools. | [README](extensions/builtin-tools/README.md) |
62| `context-size` | Context-window token usage footer/status telemetry. | [README](extensions/context-size/README.md) |
63| `cost` | Model, token, turn/session/monthly spend telemetry. | [README](extensions/cost/README.md) |
64| `ctx` | Compacts oversized builtin `read` results into head/tail views. | [README](extensions/ctx/README.md) |
65| `cwd` | Switch Pi cwd without leaving the session. | [README](extensions/cwd/README.md) |
66| `devil` | Devil's-advocate debate command for stress-testing ideas. | [README](extensions/devil/README.md) |
67| `diff-review` | Browser UI for reviewing git diffs and returning findings to Pi. | [README](extensions/diff-review/README.md) |
68| `footer` | Shared stable footer renderer for extension status segments. | [README](extensions/footer/README.md) |
63| `angel` | Structured advisor and command guardrail for configured Pi model pairs. | [README](extensions/angel/README.md) |
64| `builtin-tools` | Toggle Pi builtin file-search tools. | [README](extensions/builtin-tools/README.md) |
65| `context-size` | Context-window usage telemetry for Pi. | [README](extensions/context-size/README.md) |
66| `cost` | Pi model, token, and spend telemetry. | [README](extensions/cost/README.md) |
67| `ctx` | Compacts oversized Pi `read` results before they hit context. | [README](extensions/ctx/README.md) |
68| `cwd` | Switch Pi cwd without leaving current session. | [README](extensions/cwd/README.md) |
69| `devil` | Structured `/devil` debate for stress-testing ideas. | [README](extensions/devil/README.md) |
70| `diff-review` | Browser UI for reviewing git diffs and sending findings back to Pi. | [README](extensions/diff-review/README.md) |
71| `footer` | Shared stable footer renderer for Pi. | [README](extensions/footer/README.md) |
6972| `ghost` | Background Pi agent overlay for side-channel prompts. | [README](extensions/ghost/README.md) |
70| `git-safe` | Hardened `git_clone_safe` tool with hook, symlink, LFS, and disk checks. | [README](extensions/git-safe/README.md) |
71| `goal` | Persistent `/goal` loop with criteria tracking and completion/blocker tool. | [README](extensions/goal/README.md) |
72| `llmiterate` | Comment-marker bridge from editor saves to background Pi edits. | [README](extensions/llmiterate/README.md) |
73| `git-safe` | Hardened git clone tool for Pi. | [README](extensions/git-safe/README.md) |
74| `goal` | Persistent `/goal` loop for Pi. | [README](extensions/goal/README.md) |
75| `llmiterate` | Manual editor-save bridge from comment markers to background Pi edits. | [README](extensions/llmiterate/README.md) |
7376| `neko` | Tiny animated editor cat. Pointless. Correct. | [README](extensions/neko/README.md) |
74| `nu-bang` | Runs Pi `!` and `!!` shell input through Nushell. | [README](extensions/nu-bang/README.md) |
75| `prompt-autopsy` | Dumps live generated system prompt into `$VISUAL`. | [README](extensions/prompt-autopsy/README.md) |
76| `prune` | Deterministic compactor with raw-session recall search. | [README](extensions/prune/README.md) |
77| `pulse` | Living docs sync after workspace changes or periodic checks. | [README](extensions/pulse/README.md) |
78| `q` | Follow-up question fork helper. | [README](extensions/q/README.md) |
79| `quota` | Subscription quota dashboard for model providers. | [README](extensions/quota/README.md) |
80| `runtime` | Project runtime version telemetry. | [README](extensions/runtime/README.md) |
81| `session-rename` | Automatic short session names, with manual override. | [README](extensions/session-rename/README.md) |
82| `ssh-tools` | SSH mode plus remote shell/file tools. | [README](extensions/ssh-tools/README.md) |
83| `terminal-notifier` | Terminal/native notifications when Pi finishes work. | [README](extensions/terminal-notifier/README.md) |
84| `terminal-signals` | Terminal lifecycle escape signals for busy/idle state. | [README](extensions/terminal-signals/README.md) |
85| `terse` | Injects compact no-fluff response protocol. | [README](extensions/terse/README.md) |
77| `nu-bang` | Nushell bang-command bridge for Pi. | [README](extensions/nu-bang/README.md) |
78| `prompt-autopsy` | System-prompt autopsy command for Pi. | [README](extensions/prompt-autopsy/README.md) |
79| `prune` | Deterministic Pi session compaction with searchable recall. | [README](extensions/prune/README.md) |
80| `pulse` | Living documentation sync for Pi. | [README](extensions/pulse/README.md) |
81| `q` | Follow-up question fork helper for Pi. | [README](extensions/q/README.md) |
82| `quota` | Subscription quota dashboard for Pi providers. | [README](extensions/quota/README.md) |
83| `runtime` | Runtime detection telemetry for Pi footer/status. | [README](extensions/runtime/README.md) |
84| `session-rename` | Automatic short session names for Pi. | [README](extensions/session-rename/README.md) |
85| `ssh-tools` | SSH mode plus remote read/write/edit/bash tools. | [README](extensions/ssh-tools/README.md) |
86| `terminal-notifier` | Terminal notification bridge for Pi completion and extension events. | [README](extensions/terminal-notifier/README.md) |
87| `terminal-signals` | Terminal lifecycle signals for Pi. | [README](extensions/terminal-signals/README.md) |
88| `terse` | Terse response protocol injector for Pi. | [README](extensions/terse/README.md) |
8689| `tps` | Tokens-per-second footer telemetry. | [README](extensions/tps/README.md) |
87| `usage` | Local usage stats from Pi session JSONL files. | [README](extensions/usage/README.md) |
88| `vcs-status` | Workspace cwd and Git/jj status telemetry. | [README](extensions/vcs-status/README.md) |
89| `web` | Web fetch, search, and image-understanding tools. | [README](extensions/web/README.md) |
90| `usage` | Local usage statistics dashboard for Pi. | [README](extensions/usage/README.md) |
91| `vcs-status` | Pi workspace VCS telemetry for Git and Jujutsu. | [README](extensions/vcs-status/README.md) |
92| `web` | Web fetch, search, and image-analysis tools for Pi. | [README](extensions/web/README.md) |
9194## Resources
111114---
113Cute demons eat bloat
114Pi laughs under dead tokens
115Sharp cats guard the dark
116Bloat begs. Cats bite.
117Pi drinks dead token night.
118Small tools grin in ash.

extensions/angel/README.md

Modified

+6 / −5 text lines

33Structured advisor and command guardrail for configured Pi model pairs.
5Angel runs only when the active executor model matches a configured executor/advisor pair and the advisor model resolves. It builds a context packet, asks the paired advisor model for JSON advice, can inject advice after tool errors, and can block dangerous shell commands once.
5Angel is available only when the active executor model matches a configured executor/advisor pair and the advisor model is registered. It builds a context packet, asks the paired advisor model for JSON advice, injects advice after tool errors, and blocks selected dangerous shell commands once.
77## Install / load
3131### Commands
33- `/angel <question>`: manual advisor consult. Requires UI. Opens full advice in editor.
33- `/angel <question>`: manual advisor consult. Requires UI and a non-empty question. Opens full advice in editor.
3434- `/angel-policy`: show latest enforceable policy in editor, or print it without UI.
3636### Hooks
3838- `session_start`: resets call/error/gate counters, restores latest `angel-advice`, syncs tool availability.
3939- `model_select`: syncs tool availability for the selected executor model.
40- `tool_call`: blocks dangerous `bash` commands once when `policyGate` is `block`.
40- `tool_call`: blocks selected dangerous `bash` commands once when `policyGate` is `block`.
4141- `tool_result`: auto-consults after every `autoOnErrors`-th failed non-`angel` tool result.
4343### Settings
9292- Falls back to low-confidence advisory text when the advisor response is not valid JSON.
9393- Persists advice as `angel-advice` entries with packet summary metadata.
9494- Injects formatted advice into the agent loop after configured failed tool-result intervals.
95- Stores the latest enforceable policy for `/angel-policy`.
9596- Keeps semantic guidance in `advisoryOnly`; only dangerous-command detection is mechanical.
9697- Tool render marks low-confidence advice as `consider-devil`; formatted advice marks `Devil` as recommended when confidence is below 50%.
100101No popups. When `policyGate` is `block`:
1021. Executor attempts dangerous `bash`: `sudo`, `rm -rf`, `git push`, `npm publish`, `pnpm publish`, `bun publish`, recursive `chmod`/`chown`, `dd if=`/`dd of=`, `mkfs`, `curl|sh`, `curl|bash`, `wget|sh`, `wget|bash`, or fork bomb syntax.
1031. Executor attempts selected dangerous `bash`: `sudo`, `rm -rf`, `git push`, `npm publish`, `pnpm publish`, `bun publish`, recursive `chmod`/`chown`, `dd if=`/`dd of=`, `mkfs`, `curl|sh`, `curl|bash`, `wget|sh`, `wget|bash`, or fork bomb syntax.
1031042. Angel blocks that exact command once.
1041053. Angel consults the advisor and returns formatted advice in the block reason.
1051064. Executor may retry the same command if still correct. Angel will not block that exact command again in the session.
107The gate is skipped when Angel is disabled, `policyGate` is `off`, no executor/advisor binding exists, advisor auth is missing, or the session call budget is exhausted.
108The gate is skipped when Angel is disabled, `policyGate` is `off`, the command does not match the dangerous-command pattern, no executor/advisor binding exists, advisor auth is missing, or the session call budget is exhausted.
109110## Difference from devil

extensions/cost/README.md

Modified

+11 / −5 text lines

1515Settings: none.
1717Hooks:
18- `session_start`: reads current-month session files, resets counters, publishes first snapshot when UI exists.
18- `session_start`: records UI availability, reads current-month session files, resets counters, publishes first snapshot when UI exists.
1919- `agent_start`, `agent_end`, `tool_execution_end`: refresh telemetry.
2020- `model_select`, `session_compact`: clears snapshot signature, then refreshes telemetry.
2121- `session_shutdown`: clears published status/footer segments.
3131Shows current model id, last assistant-turn token usage, turn cost, session cost, and current-month cost.
33Uses provider-reported `usage.cost.total` when present. If reported cost is zero, estimates cost only for built-in `zai` and `minimax` pricing rows. Unknown provider/model prices produce `$0` estimated cost.
33Model label uses the last `/`-separated model id segment. Missing model becomes `no-model`.
35Session cost is summed from assistant messages in the active branch. Monthly cost is summed from `.jsonl` session files whose names start with the current `YYYY-MM`, scanning the current session root and one directory level below it.
35Token label uses input, output, and cache-read counts. Cache reads use `◐` and `` with cache percentage when mixed with uncached input. No token usage shows `↑0`.
37Token label uses input/output counts and cache-read counts. Cost label is hidden when all costs are zero.
37Uses provider-reported `usage.cost.total` when present and greater than zero. If reported cost is zero or missing, estimates cost only for built-in `zai` and `minimax` pricing rows. Unknown provider/model prices produce `$0` estimated cost.
39Telemetry is best-effort. Read/parse/update errors are swallowed so the agent loop keeps running.
39Session cost is summed from assistant messages in the active branch. Turn cost is the increase since the previous telemetry sync.
41Monthly cost is summed from `.jsonl` session files whose names start with the current `YYYY-MM`, scanning `dirname(getSessionDir())` and its direct child directories.
43Cost label shows turn cost, `Σ` session cost, and `` monthly cost. Monthly cost is shown only when it is greater than session cost. Cost label is hidden when all costs are zero.
45Telemetry publishes only when UI exists. Duplicate snapshots are skipped by signature. Read/parse/update errors are swallowed so the agent loop keeps running.
4147## Demo

extensions/ctx/README.md

Modified

+11 / −6 text lines

1313Pi tools: none.
15Hooks:
15Pi hooks:
1717- `tool_result`: watches builtin `read` results and may replace large full-file reads with a bounded head/tail view.
3232`ctx` does one thing:
34341. watches `read` tool results
352. ignores errors and bounded reads with `limit`
363. if full read output exceeds the threshold, returns:
352. ignores errors and bounded reads with `limit` or `l`
363. compares UTF-8 byte length against threshold
374. if full read output exceeds threshold, returns:
3738 - first 8 lines
3839 - `[ctx compacted read: ...]` marker
3940 - grep/read-offset instruction
4041 - last 32 lines
414. leaves `bash`, `grep`, `find`, `ls`, and all other tools untouched
425. leaves `bash`, `grep`, `find`, `ls`, and all other tools untouched
43No SQLite. No search tool. No replacement tools. No workspace writes.
44Default threshold: `20000` bytes.
46Invalid env values fall back to default. `0` compacts any non-empty full read.
48No DB. No search tool. No replacement tools. No workspace writes.
4550Agents can recover hidden middle content with normal builtin tools:
4954read path offset=120 limit=40
5055```
52Patch metadata adds:
57Patch metadata preserves existing details and adds:
5459```json
5560{ "ctxCompactedRead": true }

extensions/devil/README.md

Modified

+2 / −1 text lines

7474| Sub-agents | Load normal Pi settings/resources/extensions unless `devil.extensionMode` is `off`. |
7575| Sub-agent tools | All available tools except `write` and `edit`. |
7676| Rounds | Devil challenges, Defense responds, transcript accumulates, synthesis produces final verdict. |
77| Stop: `consensus` | Stops after enough consecutive resolved Defense responses, using `concessionThreshold`, or after `maxRounds`. |
77| Stop: `consensus` | Stops after 2 consecutive resolved Defense responses using `concessionThreshold`, or after `maxRounds`. |
7878| Stop: `blocking_found` | Stops when a Devil round raises zero blocking issues, or after `maxRounds`. |
7979| Stop: `max_rounds` | Runs until `maxRounds`. |
80| Live review keys | `↑↓/j/k` scroll, `PgUp/Ctrl+u` and `PgDown/Ctrl+d` page, `g/G` top/end. |
8081| Cancel | `q`, `Esc`, or `Ctrl+C` cancels the live review. |
8182| Failure | Failed review stays open until closed. Timeout message suggests `/compact`, then retry. Closing a failed review restores `/devil <idea>` in the editor. |
8283| Results | Edited verdict is appended as `devil-result`; main agent receives advisory handoff and must wait for the next user reply before execution. |

extensions/diff-review/README.md

Modified

+2 / −2 text lines

55## Install / load
7Loaded through the root pi-ext package. See [../../README.md](../../README.md).
7Loaded through the root pi-ext package. See [root README](../../README.md).
99## Commands / tools / settings
3232- Requires interactive Pi UI.
3333- Runs from Pi cwd inside a git repo.
3434- Waits for Pi idle before collecting diff.
35- Default source: working-tree diff.
35- Default source: unstaged working-tree diff.
3636- `--staged`: reviews staged diff.
3737- `--base <ref>`: reviews `<ref>...HEAD`.
3838- `--staged` and `--base` are mutually exclusive.

extensions/footer/README.md

Modified

+7 / −3 text lines

2525- lines 1-2: `llm` segments, flow layout, overflow on line 2.
2626- line 3: extension statuses from `footerData.getExtensionStatuses()`.
28`footer:segment` payloads use `id`, `text`, and `zone` (`workspace` or `llm`). Optional fields: `icon`, `color`, `bar`, `suffix`, `order`.
28`footer:segment` payloads use `id`, `text`, and `zone` (`workspace` or `llm`). Optional fields: `variants`, `icon`, `color`, `bar`, `suffix`, `order`.
3030Send `{ id, text: undefined }` to remove a segment.
32Segments sort by `order`; default is `50`. Render requests are coalesced. Status text is collapsed to one line. Footer lines are width-truncated with side padding.
32Segments sort by `order`; default is `50`. Current session name is inserted in the `workspace` zone with order `0.5`.
34Progress bars render 10 discrete block cells. Bar values clamp to `0..100`.
34Render requests are coalesced. Segments received before footer mount retry until the footer is available. Branch changes trigger rerender.
36Display text strips ANSI/control characters, collapses whitespace, and stays single-line. Footer lines are side-padded and width-truncated.
38Progress bars render 10 block cells on a dim track. Bar values clamp to `0..100`.
3640Publishes capability state at `Symbol.for("@bugabinga/pi-ext-footer")`: `{ version: 1, loaded: true }`. On quit/reload shutdown, `loaded` becomes `false`.

extensions/ghost/README.md

Modified

+1 / −0 text lines

1313- `/ghost` opens the ghost overlay. If it is already open, it focuses it.
1414- `/ghost <prompt>` opens the overlay if needed and sends `<prompt>` to the ghost session. If the overlay is already open, it sends the prompt to the existing session.
15- `/ghost` requires interactive mode.
1617Shortcuts:

extensions/goal/README.md

Modified

+17 / −8 text lines

99## Commands
1111```text
12/goal
1213/goal <objective>
1314/goal status
1415/goal pause
3334update_goal({ status: "complete" | "blocked", reason: string })
3435```
36Marks the active goal complete or blocked. Active only after at least one judge review. Disabled again when the goal is complete, blocked, paused, cleared, or resumed into a fresh 0-turn state. Errors when no active goal exists or when the goal belongs to another session.
37Marks the active goal complete or blocked. Active only after at least one judge review. Hidden before review, and hidden again when the goal is complete, blocked, paused, cleared, or resumed into a fresh 0-turn state. Errors when no active goal exists, the goal has not been judged, or the goal belongs to another session.
3839## Settings
6465## Behavior
66- `/goal <objective>` creates an active goal with empty criteria, current session ownership, and the configured turn budget.
67- `/goal` and `/goal status` print current goal status.
68- `/goal <objective>` creates an active goal with empty criteria, current session ownership, and the configured turn budget. It sends a kickoff prompt immediately.
69- New goals require an idle agent. Subcommands can run while the agent is busy.
6770- Goal state is stored as append-only custom `goal-state` entries. Replay scans backward; newest valid state or clear tombstone wins.
68- `before_agent_start` injects the active goal and criteria into the system prompt.
69- After each agent turn, the extension writes a `goal-judge` start entry, sets status to `goal judging N/M`, notifies `Goal judge running: turn N/M · <objective>`, then asks a judge model for strict JSON: done, blocked, reason.
71- `before_agent_start` injects the active goal and criteria into the system prompt for the owning session.
72- After each owned active goal turn, the extension writes a `goal-judge` start entry, sets status to `goal judging N/M`, notifies `Goal judge running: turn N/M · ...`, then asks a judge model for strict JSON: `done`, `blocked`, `reason`.
73- The judge sees the objective, criteria, and tail of the latest assistant response.
7074- Judge completion writes a `goal-judge` verdict entry and notifies `Goal judge verdict: complete|blocked|continue · <reason>`.
71- Done verdict marks the goal complete. Blocked verdict marks it blocked.
75- Done verdict marks the goal complete and clears persistent status. Blocked verdict marks it blocked and keeps `goal blocked` status.
7276- Incomplete verdict increments `turnsUsed`; exhausted budget pauses the goal.
73- `update_goal` is hidden until the first judge review, then hidden again for terminal or paused goals.
74- If still active, continuation is sent when the session becomes idle.
75- `/goal resume` rebinds a goal to the current session and resets `turnsUsed`.
77- If still active, continuation is sent when the session becomes idle. Retry window: 20 attempts, 250 ms apart after the immediate attempt.
78- `update_goal` is hidden until the first continue verdict increments `turnsUsed`, then hidden again for terminal or paused goals.
79- `/goal pause` only pauses active owned goals.
80- `/goal resume` rebinds a goal to the current session, sets it active, resets `turnsUsed`, and schedules continuation.
81- `/goal complete [reason]` is a user override. Default reason: `marked complete by user`.
7682- `/goal clear` writes a clear tombstone and removes status.
83- `/goal add`, `/goal remove`, and `/goal clear-criteria` edit criteria on the current owned goal.
7784- UI status key: `goal` for active, paused, and blocked goals. Complete/cleared goals clear status and notify instead.
85- Goals owned by another session show `owned by another session`; mutating commands require `/goal resume` first.
86- `PI_GOAL_PROBE=1` adds `/goal-probe` and writes custom `goal-probe` entries for continuation scheduling checks.
7988## Demo

extensions/llmiterate/README.md

Modified

+4 / −3 text lines

137137queued | running | done | failed
138138```
140Duplicate saves do not start duplicate queued/running jobs. Failed markers remain retryable on next save or scan. Queued/running markers from a previous Pi process are reset to failed on state load. A marker becomes `done` only after the worker finishes and the marker no longer exists.
140Duplicate saves do not start duplicate queued/running jobs. Failed markers remain retryable on next save or scan. Queued/running markers from a previous Pi process are reset to failed on state load. A marker becomes `done` after the worker finishes and the original same-line/same-hash marker no longer exists.
142142UI channels:
199199.md/.mdx/.html/.htm/.xml <!-- -->
200200.sql/.lua/.hs --
201201.lisp/.el/.clj/.scm ; ;; ;;;
202.tex/.erl % %%
202.tex % %%
203.erl %
203204.f/.f90 !
204205```
231232Before a job starts, llmiterate rechecks that the marker still exists at the same line with the same prompt hash. If it changed, the job is failed as stale and skipped.
233After the worker finishes, llmiterate scans again. If the marker is still present, the job is marked failed. If the marker is gone, the job is marked done.
234After the worker finishes, llmiterate rechecks the file. If the same marker is still present at the same line with the same prompt hash, the job is marked failed. Otherwise that job is marked done.
235236## Demo

extensions/nu-bang/README.md

Modified

+8 / −3 text lines

1818## Behavior
20- `user_bash` strips leading `!` or `!!` and runs the command with `nu -l --no-history --error-style fancy --table-mode none -c`.
20- `user_bash` replaces Pi shell operations with Nushell execution for the Pi-provided command.
21- Commands run as `nu -l --no-history --error-style fancy --table-mode none -c <command>`.
2122- Stdout and stderr stream back through Pi shell execution.
22- Abort and timeout send `SIGTERM`, then `SIGKILL` after 250 ms if the process group is still alive.
23- Execution receives Pi cwd, env, abort signal, and timeout.
2324- Working directory is checked before execution and completion.
25- Abort and timeout send `SIGTERM`, then `SIGKILL` after 250 ms if the process group is still alive.
2426- `session_start` wraps the current autocomplete provider.
25- Bang input completion uses `nu -l --no-history --error-style fancy -I <cwd> --ide-complete <offset> <temp>/command.nu`.
27- Bang completion strips leading `!` or `!!` before asking Nushell for completions.
28- Bang completion uses `nu -l --no-history --error-style fancy -I <cwd> --ide-complete <offset> <temp>/command.nu`.
2629- Completion temp files live in `pi-nu-bang-*` temp dirs and are removed after use.
2730- Non-bang completion delegates to the existing provider.
2831- Bang completion failures fall back to the existing provider unless the request was aborted.
2932- Completion prefix detection handles pipes, spaces, cell paths, quoted paths, and escaped-space paths.
3033- Completion application replaces the current Nushell token and removes a stale closing quote when needed.
34- Bang input always allows file-completion triggering; non-bang input delegates that decision.
35- Completion JSON accepts Nushell's normal output and salvages malformed quoted list items.
3136- `session_shutdown` removes temporary completion dirs still tracked by the extension.
3338## Demo

extensions/prompt-autopsy/README.md

Modified

+1 / −1 text lines

1717## Behavior
19Writes the current generated system prompt to `/tmp/sysprompt-autopsy.md` and opens it in `$VISUAL`, `$EDITOR`, then `vi`.
19Writes the current generated system prompt to `/tmp/sysprompt-autopsy.md` and opens it with `$VISUAL`, else `$EDITOR`, else `vi`.
2121`before_agent_start` captures Pi's `BuildSystemPromptOptions`. `agent_start` replaces the captured prompt with the final prompt after all `before_agent_start` edits.

extensions/prune/README.md

Modified

+20 / −12 text lines

1313| Command | Description |
1414| --- | --- |
15| `/prune` | Start Pi compaction. The `session_before_compact` hook writes the prune summary when enabled. |
16| `/prune-recall <query> [all]` | Search session history. Default scope is current branch lineage. Use trailing `all` to search all entries. |
15| `/prune` | Starts Pi compaction through `ctx.compact()`. With `prune.overrideDefault` enabled, `session_before_compact` supplies the prune summary. Command args are not read. |
16| `/prune-recall <query> [all]` | Searches session history and shows formatted matches. Default scope is current branch lineage. A trailing `all` searches all entries. Command limit is `10`. |
1818Tool:
2020| Tool | Arguments | Behavior |
2121| --- | --- | --- |
22| `prune_recall` | `query: string`, `scope?: "lineage" \| "all"`, `limit?: number`, `expand?: number[]` | Searches session entries and returns scored matches. Default scope: `lineage`. Default limit: `5`. |
22| `prune_recall` | `query: string`, `scope?: "lineage" \| "all"`, `limit?: number`, `expand?: number[]` | Searches session entries and returns scored matches. Default scope: `lineage`. Default limit: `5`. `limit` max: `20`. |
2424`prune_recall` is registered at load time, but it is active for the agent only after a prune compaction exists in the current branch.
3434| Hook | Behavior |
3535| --- | --- |
36| `session_before_compact` | Replaces default compaction when `prune.overrideDefault` is true. |
36| `session_before_compact` | Returns prune compaction when `prune.overrideDefault` is true. Includes `firstKeptEntryId`, `tokensBefore`, and details `{ kind: "prune", version: 1, sourceEntriesProcessed, tailKept }`. |
3737| `session_start` | Enables/disables `prune_recall` from current branch state. |
3838| `session_tree` | Enables/disables `prune_recall` from current branch state. |
39| `session_compact` | Enables `prune_recall` after a prune compaction and notifies UI when present. |
39| `session_compact` | Enables `prune_recall` after a prune compaction, logs in debug mode, and notifies UI when present. |
4141Settings:
4343| Setting | Default | Behavior |
4444| --- | ---: | --- |
4545| `prune.overrideDefault` | `true` | Return prune compaction from `session_before_compact`. |
46| `prune.sectionLimit` | `8` | Max extracted lines per structured section. |
46| `prune.sectionLimit` | `8` | Max lines per structured section in formatted output. |
4747| `prune.transcriptLimit` | `120` | Max transcript lines kept in summary tail. |
4848| `prune.toolCapPerTurn` | `8` | Loaded setting; not currently applied by source. |
4949| `prune.debug` | `false` | Log prune stats, skipped roles, and compaction status. |
5151## Behavior
53- Compaction is local and deterministic. No LLM summary call is made by `prune`.
54- Input messages are normalized from Pi roles: `user`, `assistant`, `tool`, `toolResult`, `bashExecution`, `branchSummary`, `compactionSummary`. `custom` is skipped.
53- With `prune.overrideDefault` enabled, compaction is local and deterministic. The prune hook does not call an LLM.
54- `/prune` starts normal Pi compaction; the hook replaces the default summary only when enabled.
55- Settings are read once from `settingsManager.getSettings().prune` when the extension loads.
56- Pi roles mapped for compaction: `user`, `assistant`, `tool`, `toolResult`, `bashExecution`, `branchSummary`, `compactionSummary`. `custom` is skipped.
57- Assistant `thinking` and `image` parts are skipped during compaction. Assistant `toolCall` parts become transcript tool lines.
5558- Extracted sections:
56 - `[Session Goal]`: initial user goals plus later scope changes.
57 - `[Files And Changes]`: files inferred from read/write/edit tool args and some bash commands.
59 - `[Session Goal]`: first user task lines plus later scope changes.
60 - `[Files And Changes]`: paths inferred from read/write/edit tool args and simple bash path matches.
5861 - `[Outstanding Context]`: tool errors and recent blocker/failure lines.
5962 - `[User Preferences]`: explicit user preference lines.
60- Transcript entries keep stable `#N` source refs.
61- Tool calls render as `* tool "arg" (#N)` when a command/path is available.
63- Empty structured sections are omitted.
64- Transcript entries keep stable `#N` source refs from the compaction input order.
65- Tool calls render as `* tool "arg" (#N)` when a command/path is available, otherwise `* tool (#N)`.
66- Bash tool commands are shortened: leading `cd ... &&` is removed, and a trailing simple pipe such as `tail`/`head` is removed.
6267- Tool errors render as `[tool_error] [ERROR] tool (#N)`.
6368- Existing prune summaries are merged with fresh summaries. Goals/preferences/files are deduped, context is refreshed, transcript keeps previous entries before fresh entries.
69- Prune compactions are detected by `details.kind === "prune"`; older hook summaries are also detected when they contain the prune recall note.
6470- Recall searches current branch lineage by default. `scope: "all"` searches all session entries.
6571- Recall includes message entries, compaction summaries, and `custom_message` content.
72- Recall message text includes text parts, tool call names/args, and thinking parts. Images are ignored.
6673- Regex-looking query strings are tried as case-insensitive regex. Invalid regex falls back to term matching.
74- Regex matches score `10`; term matches score by matched-term count.
6775- `expand` returns exact `#N` entries even when the query does not match.
6977## Output Format

extensions/pulse/README.md

Modified

+19 / −5 text lines

2727- `/pulse resume`
2828- `/pulse config`
30Completions:
32- subcommand names
33- file names for `/pulse add`
34- directory names for `/pulse add-dir`
35- tracked doc paths for `/pulse remove`
3037Tools: none.
3239Hooks:
6976- `/pulse init` creates `.pi/pulse.json`; it tracks root `README*` files and `AGENTS.md` when present.
7077- `/pulse add` requires an existing file.
71- `/pulse add-dir` requires an existing directory and explicit bounded glob.
72- `/pulse add-glob` stores a bounded glob pattern.
78- `/pulse add-dir` requires an existing directory and explicit glob.
79- `/pulse add-glob` stores an explicit glob pattern.
80- `/pulse remove` accepts a tracked path or zero-based index.
81- `/pulse force` runs a manual check unless paused.
82- `/pulse pause` stops timer-driven checks. `/pulse resume` restarts them.
83- `/pulse config` opens `.pi/pulse.json` in an editor.
7384- Absolute paths and `..` path escapes are rejected. Existing symlinks resolving outside the workspace are rejected or skipped.
74- Invalid persisted document specs are dropped while loading config.
85- Invalid config fields make the config unloadable. Invalid persisted document specs are dropped while loading config.
7586- Dir and glob specs expand to sorted files; duplicate paths are ignored.
76- Automatic checks wait for a quiet window after mutations and a cooldown after the last update.
77- The model receives tracked docs plus recent conversation messages. It gets no tools.
87- Automatic checks wait for Pi idle, a quiet window after mutations, and a cooldown after the last update.
88- Periodic checks use `interval`; dirty checks also run after workspace-changing tools settle.
89- Bash output is not parsed. Bash only marks the workspace maybe dirty; Pulse compares `git status --porcelain=v1 -z --untracked-files=all` when available.
90- The model receives tracked docs plus the last 50 conversation messages. It gets no tools.
7891- Model output must be JSON updates for allowed paths only. Unknown paths, duplicate paths, invalid JSON, and unchanged content are rejected or skipped.
92- Invalid JSON gets correction retries before the check fails.
7993- `auto` writes validated updates. `confirm` asks before writing. `review` opens each proposed file in an editor before writing.
8094- Writes are refused if a tracked file changed between load and apply.
8195- `.pi/pulse.json` is watched and reloaded after changes.

extensions/quota/README.md

Modified

+12 / −10 text lines

1212- Tools: none.
1313- Settings: none.
1414- Hooks/events:
15 - `session_start` — clear stale footer/status state, fetch quota data, publish current status.
15 - `session_start` — clear stale footer/status state, hide widget, start the refresh timer, fetch active-provider quota, publish current status.
1616 - `agent_start` — republish footer/status from cached data.
17 - `agent_end` — force refresh, then republish footer/status.
18 - `model_select` — republish footer/status for the active provider.
17 - `agent_end` — refresh when cache is expired, then republish footer/status.
18 - `model_select` — force refresh quota for the active provider, then republish footer/status.
1919 - `session_shutdown` — stop refresh timer; clear widget, footer, and status state.
2020 - Emits `footer:segment` when `@bugabinga/pi-ext-footer` is loaded.
2222## Behavior
24Supports Anthropic, OpenAI Codex, MiniMax, Zai, and Kimi.
24Supports Anthropic, OpenAI Codex, GitHub Copilot, Gemini CLI, MiniMax, MiniMax CN, Zai, and Kimi.
26Provider auth is read through Pi model registry auth storage. Providers without configured auth are skipped. Failed provider fetches become empty rows and are not shown.
26Only the active model provider is fetched. Provider auth is read through Pi model registry auth storage. Providers without configured auth are skipped.
28Quota data is cached for 60s outside forced refreshes. The `/quota` widget refreshes every 5s while visible and writes to widget id `usage`.
28Quota data is cached for 5 minutes outside forced refreshes. Fetch failures keep the last cached row for that provider when available; otherwise no row is shown.
30Footer behavior:
30The `/quota` command writes details to widget id `usage`. When visible, the widget updates after a forced refresh and on the 5-minute refresh timer.
32- With `@bugabinga/pi-ext-footer`: emits one segment per visible provider into the `llm` zone with `order: 4`.
32Footer/status behavior:
34- With `@bugabinga/pi-ext-footer`: emits one segment for the active visible provider into the `llm` zone with `order: 4`.
3335- Without it: writes compact Pi status text under status id `quota`.
34- Fallback status text is filtered to the active model provider when possible.
35- Footer segments include all visible providers and mark the active provider.
36- Footer and fallback status text are filtered to the active model provider.
37- Footer segment id: `quota:${providerName}`.
3638- Active provider marker: `●`; inactive marker: `◌`.
3840OpenAI Codex needs both an auth token and an account id. The account id is read from Pi auth storage first, then `~/.codex/auth.json`.

extensions/session-rename/README.md

Modified

+10 / −7 text lines

1818## Behavior
2020- Generates 1–3 word session names from current branch activity.
21- Runs after session load and after turns, with idle delay.
22- Cancels pending work when input or agent activity starts.
23- Requires meaningful activity: user text plus assistant text or tool calls.
24- Uses current model via Pi model registry; skips when no model/API key exists.
21- Runs 700 ms after session load and 10 s after turn end.
22- Cancels pending work when input, turn, or agent activity starts.
23- Requires meaningful branch activity: user text plus assistant text or tool calls.
24- Uses current model through Pi model registry; skips when no model or API key exists.
2525- Preserves manual names. Automatic renames stop after user-set or cleared names.
26- Refines only extension-generated names. Cooldown grows with user turns to reduce churn.
26- Refines only extension-generated names.
27- Cooldown grows with user turns: 1 turn early, then 2, then 5.
2728- Records `session-rename` custom entries for auto-title revisions and user locks.
28- Normalizes generated names: lowercase ASCII-ish words, no punctuation, max 3 words.
29- Rejects generic one-word names and tiny edit-distance changes.
29- Builds naming context from current name, initial user goals, recent summaries, recent messages, and tool calls.
30- Normalizes generated names: lowercase words, no punctuation, max 3 words.
31- Rejects generic one-word names, tiny edit-distance changes, and previous auto names.
32- Shows temporary UI status while naming. Manual command generation notifies on rename.
3134## Demo

extensions/ssh-tools/README.md

Modified

+8 / −7 text lines

11# ssh-tools
3SSH mode and remote file/shell tools for Pi.
4
5Toggles a remote SSH target and exposes remote read/write/edit/bash tools.
3SSH mode for Pi; toggles one remote target and exposes remote read/write/edit/bash tools.
75## Install / load
119## Commands
1311- `/ssh` — pick a target from `~/.ssh/config`; includes `off` when SSH mode is active.
14- `/ssh status` — show current target or `SSH off`.
12- `/ssh status` — show current target, or `SSH off`.
1513- `/ssh off` — disable SSH mode and remove SSH tools from active tools.
16- `/ssh <host>[:/path]` — enable SSH mode for a host string. Profile names from `~/.ssh/config` win over `host:path` parsing.
14- `/ssh <host>[:/path]` — enable SSH mode for a host string. Exact profile names from `~/.ssh/config` win over `host:path` parsing.
1816## Tools
3432## Behavior
3634- Reads `~/.ssh/config` for non-wildcard `Host` aliases; uses them for completions and picker choices.
35- Caches parsed SSH config until file mtime changes.
3736- Uses local `ssh` executable for all remote operations.
3837- Enabling SSH mode runs `pwd` on the remote and uses that output as cwd.
3938- `host:path` is accepted, but activation still uses remote `pwd` as cwd.
4039- SSH tools are registered at load, then added to active tools only while SSH mode is on.
40- Direct remote-tool calls while SSH mode is off fail with `SSH mode off. Use /ssh <host> first.`
4141- Remote file tools use active cwd as tool root.
42- `ssh_read` uses `cat`; `ssh_write` uses `cat >`; `ssh_write` mkdir uses `mkdir -p`.
42- `ssh_read` uses `cat`; access check uses `test -r`.
43- `ssh_write` uses `cat >`; mkdir uses `mkdir -p`.
4344- `ssh_edit` requires both remote read and write access.
4445- `ssh_bash` runs scripts through remote bash with stdin prefixed by `cd <cwd>`.
45- Remote image MIME detection recognizes `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`.
46- Remote image MIME detection recognizes `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp` extensions case-insensitively.
4748## Demo

extensions/terminal-notifier/README.md

Modified

+2 / −2 text lines

11# terminal-notifier
3Terminal/native notification bridge for Pi agent completion and extension events.
3Terminal notification bridge for Pi agent completion and extension events.
55## Install / load
2929## Behavior
31Uses DECSET `?1004` focus reports when stdin/stdout are TTYs.
31Uses DECSET `?1004` focus reports when stdin/stdout are TTYs. Focus state is shared through `globalThis` and reference-counted.
3333Suppresses agent completion notifications while terminal is focused.

extensions/terminal-signals/README.md

Modified

+22 / −13 text lines

2222## Behavior
24Emits terminal escape sequences to expose Pi agent state:
24Emits terminal escape sequences on Pi lifecycle hooks.
26- `session_start`
27 - enables terminal focus reporting via `DECSET ?1004` when stdin/stdout are TTYs
28 - sets `PI_STATE=idle`
29 - clears progress for `new`, `resume`, and `fork` sessions
2631- `agent_start`
27 - sets `PI_STATE=busy` on WezTerm/iTerm2-compatible terminals
32 - clears any pending completion signal
33 - sets `PI_STATE=busy`
2834 - emits `OSC 133;C`
2935 - starts indeterminate progress with `OSC 9;4;3`
3137- `agent_end`
32 - maps assistant stop reason:
33 - `aborted` → exit code `130`, state `aborted`
34 - `error` → exit code `1`, state `error`
35 - otherwise → exit code `0`, state `done`
38 - reads the last assistant message stop reason
39 - maps `aborted` → exit code `130`, `PI_STATE=aborted`
40 - maps `error` → exit code `1`, `PI_STATE=error`
41 - maps anything else → exit code `0`, `PI_STATE=done`
3642 - clears progress with `OSC 9;4;0`
37 - emits `OSC 133;D;<exit-code>` only when terminal is unfocused
38 - defers completion signal until focus leaves if terminal is focused
40- `session_start`
41 - enables terminal focus reporting via `DECSET ?1004`
42 - sets `PI_STATE=idle`
43 - clears progress for new/resume/fork sessions
43 - emits `OSC 133;D;<exit-code>` immediately when terminal is unfocused
44 - defers `OSC 133;D;<exit-code>` until focus leaves when terminal is focused
4546- `session_shutdown`
4647 - removes focus listener
4748 - disables focus reporting
4849 - clears progress
4950 - sets `PI_STATE=idle`
51 - clears pending completion signal
53Terminal user vars use `OSC 1337;SetUserVar=PI_STATE=<base64>`.
54They are emitted only for WezTerm or iTerm2 detection:
56- `WEZTERM_PANE` set
57- `TERM_PROGRAM=WezTerm`
58- `TERM_PROGRAM=iTerm.app`
5160Focus tracking is shared through `globalThis`.

extensions/terse/README.md

Modified

+5 / −3 text lines

1616## Behavior
18Injects `## Response Protocol — terse` into agent system prompts.
18On `before_agent_start`, rewrites the agent system prompt with `injectTerseBlock`.
20- no duplicate injection when block already exists
20- injects `## Response Protocol — terse`
21- skips injection when prompt already contains that title
2122- inserts before Pi SDK `Current date:` footer when present
2223- appends to prompt when footer is absent
2324- keeps code, tool args, file contents, quoted errors exact
24- favors terse output; clarity wins for security, destructive ops, user confusion
25- pushes terse output: no preamble, no recap, no hedging
26- allows clarity over compression for security, destructive ops, user confusion
2628## Demo

extensions/vcs-status/README.md

Modified

+1 / −1 text lines

2222## Behavior
24Shows current working directory and VCS identity/status in UI sessions.
24Shows current working directory and VCS identity/status in UI sessions. The cwd label collapses `$HOME` to `~`.
2626Detection:

extensions/web/README.md

Modified

+9 / −7 text lines

11# web
3Web fetch, search, and image tools for Pi.
3Web fetch, search, and image-analysis tools for Pi.
55## Install / load
1515- `web_fetch`
1616 - `url`: URL to fetch.
1717 - `format`: optional; `markdown` default, or `text`, `html`, `json`, `raw`.
18 - `maxChars`: optional; default `100000`.
19 - `timeout`: optional; default `120000` ms.
18 - `maxChars`: optional; default `100000`, min `100`, max `1000000`.
19 - `timeout`: optional; declared by schema. Current `web_fetch` execution uses the Pi/tool abort signal and does not pass this value to `fetchUrlStream`.
2020- `web_search`
2121 - `query`: search query.
2222 - `count`: optional; default `5`, max `20`.
2323 - `format`: optional; `text` default, or `json`.
24 - `timeout`: optional; default `120000` ms.
24 - `timeout`: optional; default `120000` ms, min `5000`, max `600000`.
2525- `understand_image`
2626 - `prompt`: image question or extraction request.
2727 - `image_source`: HTTP/HTTPS URL, local path, `@`-prefixed local path, or data URL.
3737- `pandoc`: HTML conversion; DOCX/ODT/EPUB/RTF extraction.
3838- `pdftotext`: PDF extraction.
39- `identify`: image metadata.
40- `ffprobe`: audio/video metadata.
39- `identify`: image metadata. Missing/failing binary returns fallback metadata text.
40- `ffprobe`: audio/video metadata. Missing/failing binary returns fallback metadata text.
4242Provider/env config read by source:
5858 - Images: writes temp file, returns metadata from `identify`, plus inline image content.
5959 - Audio/video: writes temp file, returns summary and `ffprobe` JSON.
6060 - Other binary: writes temp file and returns path plus content type.
61- `web_fetch` `raw` format skips conversion, decodes the body as UTF-8, and truncates to `maxChars`.
6162- HTML cleanup removes comments, scripts, styles, iframes, objects, templates, noscript blocks, embeds, hidden inputs, long meta content, hidden/visually-hidden elements, and non-image `aria-label`/`alt`/`title` attrs.
6263- Main-content extraction prefers `<article>`, `#mw-content-text`, `#docContent`, `#content`, `<main>`, then `role="main"`; fallback is full page.
63- Fetched and searched text returned to the model is wrapped as untrusted external data.
64- Converted fetch text, raw fetch text, and search output are wrapped as untrusted external data. Image, media, and binary early-return paths are not wrapped by the current implementation.
6465- `web_search` provider order: Z.AI Coding Plan MCP when configured, then MiniMax search when configured, then DuckDuckGo HTML.
66- Z.AI calls MCP tool `web_search_prime`; `ZAI_SEARCH_FRESHNESS` accepts `day`, `week`, `month`, `year`, or no-limit values.
6567- DuckDuckGo fallback throttles requests to at least 2 seconds apart and reports captcha/dedup diagnostics.
6668- `understand_image` sends the prompt and image data to MiniMax VLM. It accepts HTTP/HTTPS URLs, data URLs, and local files. Local file data is base64 encoded before the request.