---
slug: "pi-scratch"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/ishironin/pi-scratch@master/README.md"
repo: "https://github.com/ishironin/pi-scratch"
source_file: "README.md"
branch: "master"
---
# pi-scratch

**A Pi extension that opens an isolated `/scratch` session for side-questions, so quick asks don't pollute your main thread.**

A side-question — "what's the syntax for X?" or "is this lib Y or Z?" — shouldn't drag your main session off-topic. `/scratch` drops you into a brand-new session in its own timestamped folder; `/resume` brings you back.

## Install

```sh
pi install npm:pi-scratch
```

## Usage

```sh
# Each /scratch session lives in its own folder:
$ ls ~/.pi/scratch/
2026-06-23T19-02-44_7e8f9a0b/
2026-06-23T19-15-22_c3d4e5f6/
2026-06-23T19-32-11.612Z_a3f9b2c1/

# Hit a syntax question deep in a feature branch:
pi
> /scratch
you: how do I revoke a JWT before exp?
pi:  shortlist: blacklist, refresh-token rotation, short-lived tokens …
> /resume           # back to your real session, untouched
```

## How it works

`/scratch` creates a new session at `~/.pi/scratch/<timestamp>_<id>/` and switches to it. If composer text is present, `/scratch` asks before discarding it.

## Compared to

- `pi --no-session` (built-in flag) — disables persistence for the whole run. `/scratch` is a per-command switch inside any session.
- `pi-ephemeral` (npm) — toggles persistence on the current session file. `/scratch` always opens a brand-new isolated folder.
- Claude Code `/btw` — a side-question that overlays onto your current session. `/scratch` opens a full session with its own folder, so the side-question can be revisited later.

## Limitations

- Scratch sessions are real files — old ones stay on disk until you `rm -rf ~/.pi/scratch/*`
- No automatic naming or tagging (zero-config by design)

## License

[MIT](https://github.com/ishironin/pi-scratch/tree/HEAD/LICENSE)
