1<!--
2SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
3
4SPDX-License-Identifier: CC0-1.0
5-->
6
7# pi-extensions
8
9A collection of [Pi](https://github.com/badlogic/pi-mono) extensions. They're
10all quite rough currently, having just been imported to this repo from ad-hoc,
11vibed individual scripts created by saying "go change
12`~/.config/pi/extensions/foo.ts` so it bars".
13
14## Packages
15
16### `@amolith/pi-handoff`
17
18[](https://www.npmjs.com/package/@amolith/pi-handoff)
19
20Get to the end of the thing you're doing, then use a lightweight subagent to
21extract particular bits from the current session and create a new one from those
22bits with `/handoff thorough goal description`. You can also tell Pi to hand
23something off (it has a tool).
24
25```sh
26pi install npm:@amolith/pi-handoff
27```
28
29> Based on [handoff.ts](https://github.com/pasky/pi-amplike/blob/main/extensions/handoff.ts)
30> and [session-query.ts](https://github.com/pasky/pi-amplike/blob/main/extensions/session-query.ts)
31> by Petr Baudis, licensed MIT accordingly. Reworked so the subagent calls a
32> tool instead of expecting it to produce well-formed JSON, added an auto-submit
33> countdown, and make the extraction model configurable via `PI_HANDOFF_MODEL`.
34
35### `@amolith/pi-answer`
36
37[](https://www.npmjs.com/package/@amolith/pi-answer)
38
39See that Pi spit a bunch of Markdown at you with some embedded questions, use
40`/answer` to have a lightweight subagent extract those questions so you can
41answer them in a nice form instead of mentally parsing all that LLM-speak. For
42best results, give a good description of `/answer what you want to turned into questions for answering`.
43
44```sh
45pi install npm:@amolith/pi-answer
46```
47
48> Based on [answer.ts](https://github.com/mitsuhiko/agent-stuff/blob/main/pi-extensions/answer.ts)
49> by Armin Ronacher, licensed Apache-2.0 accordingly. Reworked so the subagent
50> calls a tool instead of expecting it to produce well-formed JSON, rewrote the
51> system prompt with few-shot examples, added a notes editor (Alt+N) and
52> fallback extraction with the current model when the preferred model is
53> unavailable.
54
55### `@amolith/pi-questionnaire`
56
57[](https://www.npmjs.com/package/@amolith/pi-questionnaire)
58
59Have Pi construct on-the-fly questionnaires to ask you stuff before it goes off
60and does the wrong thing.
61
62```sh
63pi install npm:@amolith/pi-questionnaire
64```
65
66> Based on [questionnaire.ts](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/examples/extensions/questionnaire.ts)
67> by Mario Zechner, licensed MIT accordingly. Added a free-text notes editor,
68> word wrapping for long prompts, and custom answers are sent as a steering
69> user message so the user can go back and edit them later.
70
71### `@amolith/pi-personas`
72
73[](https://www.npmjs.com/package/@amolith/pi-personas)
74
75Drop markdown files in `$PI_CODING_AGENT_DIR/personas/` and switch between them
76with `/persona`. Lets your agent be a grumpy senior today and a patient tutor
77tomorrow. The active persona gets injected into the system prompt and persists
78across sessions until you change it.
79
80```sh
81pi install npm:@amolith/pi-personas
82```
83
84> All mine :)
85
86## Development
87
88Prerequisites: [mise](https://mise.jdx.dev/) (installs bun automatically).
89
90```sh
91# Install dependencies
92bun install
93
94# Format, lint, and type-check everything
95mise run check
96```