原始内容
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
pi install npm:pi-scratch
Usage
# 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./scratchis a per-command switch inside any session.pi-ephemeral(npm) — toggles persistence on the current session file./scratchalways opens a brand-new isolated folder.- Claude Code
/btw— a side-question that overlays onto your current session./scratchopens 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)