README.md

 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[![npm](https://img.shields.io/npm/v/@amolith/pi-handoff)](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, a session query tool, and make the extraction model configurable
34> via `PI_HANDOFF_MODEL`.
35
36### `@amolith/pi-answer`
37
38[![npm](https://img.shields.io/npm/v/@amolith/pi-answer)](https://www.npmjs.com/package/@amolith/pi-answer)
39
40See that Pi spit a bunch of Markdown at you with some embedded questions, use
41`/answer` to have a lightweight subagent extract those questions so you can
42answer them in a nice form instead of mentally parsing all that LLM-speak. For
43best results, give a good description of `/answer what you want to turned into questions for answering`.
44
45```sh
46pi install npm:@amolith/pi-answer
47```
48
49> Based on [answer.ts](https://github.com/mitsuhiko/agent-stuff/blob/main/pi-extensions/answer.ts)
50> by Armin Ronacher, licensed Apache-2.0 accordingly. Reworked so the subagent
51> calls a tool instead of expecting it to produce well-formed JSON, rewrote the
52> system prompt with few-shot examples, added a notes editor (Alt+N) and
53> fallback extraction with the current model when the preferred model is
54> unavailable.
55
56### `@amolith/pi-questionnaire`
57
58[![npm](https://img.shields.io/npm/v/@amolith/pi-questionnaire)](https://www.npmjs.com/package/@amolith/pi-questionnaire)
59
60Have Pi construct on-the-fly questionnaires to ask you stuff before it goes off
61and does the wrong thing.
62
63```sh
64pi install npm:@amolith/pi-questionnaire
65```
66
67> Based on [questionnaire.ts](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/examples/extensions/questionnaire.ts)
68> by Mario Zechner, licensed MIT accordingly. Added a free-text notes editor,
69> word wrapping for long prompts, and custom answers are sent as a steering
70> user message so the user can go back and edit them later.
71
72### `@amolith/pi-personality`
73
74[![npm](https://img.shields.io/npm/v/@amolith/pi-personality)](https://www.npmjs.com/package/@amolith/pi-personality)
75
76Drop markdown files in `$PI_CODING_AGENT_DIR/personalities/` and switch between
77them with `/personality`. Lets your agent be a grumpy senior today and a patient
78tutor tomorrow. The active personality gets injected into the system prompt and
79persists across sessions until you change it.
80
81```sh
82pi install npm:@amolith/pi-personality
83```
84
85> All mine :)
86
87## Development
88
89Prerequisites: [mise](https://mise.jdx.dev/) (installs bun automatically).
90
91```sh
92# Install dependencies
93bun install
94
95# Format, lint, and type-check everything
96mise run check
97```