@grrrck/pi-clear

Pi extension that starts a fresh session with /clear while keeping your current model and thinking level

Packages

Package details

extension

Install @grrrck/pi-clear from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@grrrck/pi-clear
Package
@grrrck/pi-clear
Version
0.6.0
Published
Nov 9, 2026
Downloads
1,038/mo · 324/wk
Author
grrrck
License
MIT
Types
extension
Size
15.8 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-clear

A pi extension that adds /clear: start a fresh session without losing your model or thinking level.

Previously used /hand-off? It has moved to pi-hand-off.

Why?

Unlike pi's built-in /new, /clear keeps the model and thinking level you chose in the current session when you start a fresh one.

Install

pi install npm:@grrrck/pi-clear

Or try it without installing:

pi -e npm:@grrrck/pi-clear

To install straight from GitHub instead of npm (the latest main, or pin a tag or commit after @):

pi install git:github.com/gadenbuie/pi-clear
pi install git:github.com/gadenbuie/pi-clear@main

Usage

/clear

If the agent is busy, /clear lets you know and waits for it to finish. It then starts a fresh session with your current model and thinking level. If the model can no longer be restored (for example, its auth was removed), you'll see a warning. When the new session is saved, the restored model and thinking level also survive /resume.

Notes

  • /clear creates no separate handoff file or persisted state of its own; it simply starts a new conversation.
  • Like /new, /clear does not carry over conversation history, compaction summaries, or session name. It doesn't delete the prior conversation; previously saved sessions remain available via /resume.

Moving to pi-hand-off

Versions up to 0.5.0 also shipped /hand-off. To keep using it, install @grrrck/pi-hand-off:

pi install npm:@grrrck/pi-hand-off

Optional notes:

  • You can remove @grrrck/pi-clear if you no longer want /clear; the two packages can be installed side by side.
  • If you type /hand-off while no /hand-off command is installed, pi-clear shows a notice pointing to the new package instead of sending the text to the model.
  • pi-hand-off still reads settings from <agent-dir>/pi-clear.json when pi-hand-off.json doesn't exist. You can rename the file. The agent directory defaults to ~/.pi/agent and can be changed with PI_CODING_AGENT_DIR.

How it works

The model and thinking level handoff is temporary and in-process. The new session consumes it exactly once; if pi exits first, it is discarded.

Development

Load the extension directly for local testing:

pi -e ./index.ts
node --test scripts/clear.test.mjs   # offline, mocked pi APIs
python3 scripts/rpc-smoke-test.py    # end-to-end via pi in RPC mode

The RPC smoke test needs at least two models with configured auth; it only drives local RPC state and makes no model requests. The node --test script needs neither auth nor a pi process.

Related extensions

License

MIT