<!--
SPDX-FileCopyrightText: Amolith <amolith@secluded.site>

SPDX-License-Identifier: CC0-1.0
-->

# pi-extensions

[![Licensed under MutuaL-1.2](https://img.shields.io/badge/License-MutuaL--1.2-af2e1a?style=flat&labelColor=110402&link=https%3A%2F%2Fcodeberg.org%2FMutualism%2FMutualist-License)](https://codeberg.org/Mutualism/Mutualist-License)
[![REUSE status](https://api.reuse.software/badge/git.secluded.site/pi-extensions)](https://api.reuse.software/info/git.secluded.site/pi-extensions)
[![scratchanitch.dev badge](https://img.shields.io/badge/scratchanitch-dev-FFC4B5)](https://scratchanitch.dev)
[![Liberapay donation status](https://img.shields.io/liberapay/receives/Amolith.svg?logo=liberapay)](https://liberapay.com/Amolith/)

A collection of [Pi] extensions.

[Pi]: https://github.com/earendil-works/pi/

## `@amolith/pi-handoff`

[![pi-handoff on NPM](https://img.shields.io/npm/v/@amolith/pi-handoff)](https://www.npmjs.com/package/@amolith/pi-handoff)

Get to the end of the thing you're doing, then use a subagent to extract
relevant bits from the current session and create a new one from them with
`/handoff thorough goal description`. You can tell Pi to hand something off
because it has a handoff tool too.

After extraction, whether triggered by you or Pi, the draft handoff goes in the
new session's prompt editor and an auto-submit countdown starts that's cancelled
by pressing most any key.

```sh
pi install npm:@amolith/pi-handoff
```

More info in the package's [README](packages/handoff/README.md)

> Based on [handoff.ts] and [session-query.ts] by Petr Baudis, licensed MIT
> accordingly. Reworked so the subagent calls a tool instead of expecting it to
> produce well-formed JSON, added an auto-submit countdown, and made the
> extraction model configurable.

[handoff.ts]: https://github.com/pasky/pi-amplike/blob/main/extensions/handoff.ts
[session-query.ts]: https://github.com/pasky/pi-amplike/blob/main/extensions/session-query.ts

## `@amolith/pi-personas`

[![pi-personas on NPM](https://img.shields.io/npm/v/@amolith/pi-personas)](https://www.npmjs.com/package/@amolith/pi-personas)

Code with a grumpy senior today and work with a patient tutor tomorrow. Switch
between them with `/persona`. The active one persists across sessions until
changed. Setting a persona prior to startup appends it to the system prompt.
Changing it mid-session sends the persona content as a steering message.

```sh
pi install npm:@amolith/pi-personas
```

More info in the package's [README](packages/personas/README.md)

> All mine :)

## Development

Prerequisites: [mise] (installs Node and npm automatically).

[mise]: https://mise.jdx.dev/

```sh
# Install dependencies
npm install

# Format, lint, and type-check everything
mise run check
```

## Contributing

Patch requests are in [amolith/llm-projects] on [pr.pico.sh]. You don't need a
new account to contribute, you don't need to fork this repo, you don't need to
fiddle with `git send-email`, you don't need to faff with your email client to
get `git request-pull` working...

You just need:

- Git
- SSH
- An SSH key

```bash
# Clone this repo, make your changes, and commit them
# Create a new patch request with
git format-patch origin/main --stdout | ssh pr.pico.sh pr create amolith/llm-projects
# After potential feedback, submit a revision to an existing patch request with
git format-patch origin/main --stdout | ssh pr.pico.sh pr add {prID}
# List patch requests
ssh pr.pico.sh pr ls amolith/llm-projects
```

See "How do Patch Requests work?" on [pr.pico.sh]'s home page for a more
complete example workflow.

[amolith/llm-projects]: https://pr.pico.sh/r/amolith/llm-projects
[pr.pico.sh]: https://pr.pico.sh
