📈 GH Trending Explorer 🎲 Surprise me

← all repos

ZiChuanLan / pi-purge

git clone https://github.com/ZiChuanLan/pi-purge.git

pi extension: /purge swaps pi's built-in assistant persona for your own prompt file

—
stars, 24h
+140
stars, 7 days · #381
+140
stars, 30 days · #1,707
140
★ total · +140% this week
41
forks · 0 open issues

Star history starts 2026-10-20; the chart appears after the second daily snapshot.

LanguageJavaScript
LicenseMIT
Created2026-10-18 (2d ago)
Last pushtoday
Watchers0
OwnerUser

Links

README excerpt
# pi-purge
English | 中文
A pi extension for system-prompt experiments: `/purge` switches which system prompt a session runs with — pi's stock prompt, a trimmed variant, or only a persona prompt.
It is meant for prompt engineering work: comparing how the same request behaves when the harness prompt is present, trimmed, or absent; regression-testing your own instructions; and studying instruction-following and prompt-injection robustness under controlled conditions.
With it off, nothing changes — no prompt rewrite, no disk reads. pi behaves exactly as if the extension were not installed.
## Install
 [code] 
Then, inside a session:
 [code] 
That is all. A short example prompt ships inside the package, so a fresh install works with no extra files. To run your own instructions instead:
 [code] 
`/purge source embedded` switches back to the bundled persona.
## Commands
| Command | Effect |
| --- | --- |
| `/purge` | Toggle on/off for this session |
| `/purge on` / `off` | Enable or disable the rewrite |
| `/purge status` | Mode, prompt source, loaded size, and what the previous turn actually changed |
| `/purge mode append\|replace\|strict` | Switch composition mode (default `strict`) |
| `/purge source ` | Change the prompt file, or go back to the bundled example; a failed switch rolls back |
| `/purge reload` | Re-read an external prompt file after editing it |
## Modes
| Mode | System prompt sent to the model | Use it when |
| --- | --- | --- |
| `append` | Your prompt prepended to pi's prompt, unchanged. | You want a control run: baseline behavior plus your instructions on top. |
| `replace` | Your prompt, then pi's prompt with its built-in assistant identity line and bundled documentation section removed. Tool list, guidelines, and project context stay. | You want to measure the effect of the harness framing without losing tool context. |
| `strict` | Your prompt plus `Current working directory: …` only. | You want to isolate your instructions as a single variable. This is the default. |
`replace` finds both sections by exact wording. If a pi update rewords them, it leaves the prompt intact rather than cutting the wrong text — `/purge status` then reports `身份段 未匹配` (identity line not found) and behavior falls back to `append`. `strict` does no matching at all, so it behaves the same across pi versions.
Tool schemas are passed through the API `tools` parameter rather than the system prompt, so tools keep working in every mode, including `strict`.
## Session scope and defaults
- Scope is the session. Every `session_start` — startup, `new`, `resume`, `reload` — begins **disabled**. Quitting pi always returns to stock behavior.
- Nothing is written to disk: there is no state file, no cache, no marker. Two pi processes cannot affect each other.
- The default prompt is the short example bundled inside `extensions/pi-purge.ts`. `/purge source ` points at your own file; `/purge source embedded` comes back.
- To start every process with your own file withou