0387GitHub
pi-fast-jev-compaction
Pi extension that prunes stale tool history and leaves summary compaction to Pi when pruning is insufficient.
joelhooks/pi-fast-jev-compactionREADME ↗
# `@joelhooks/pi-fast-jev-compaction`
A stock [Pi](https://github.com/badlogic/pi-mono) 0.85.1 extension that keeps conversation text verbatim while pruning stale tool history with [TypeSafe Jev](https://docs.typesafe.ai/docs/system-one/overview).
This is deliberately **layer 1 only**. It does not summarize, rewrite, or create memory. When pruning cannot free enough context, Pi's built-in summary compaction takes over.
## What it does
- Sends a compact representation of tool calls and surrounding conversation to TypeSafe's `/v1/systemone` endpoint.
- Asks two `noul` questions per eligible tool call: keep the call and keep its result.
- Keeps the first message and recent messages pinned.
- Applies three monotonic decisions:
- `keep`: preserve the pair.
- `drop_result`: preserve the tool call and a deterministic head of its result.
- `drop_call`: remove the call and its matching result.
- Stores decisions as append-only `fast-jev-decisions` custom session entries.
- Rebuilds the ledger from the current session branch after startup, reload, resume, fork, or tree navigation.
- Filters only the context sent to the model. It never rewrites the JSONL session file.
User text, assistant text, thinking blocks, images outside pruned tool results, custom messages, and relative message order remain unchanged.
## Install
```bash
pi install git:github.com/joelhooks/pi-fast-jev-compaction
```
For one run without installing:
```bash
pi -e git:github.com/joelhooks/pi-fast-jev-compaction
```
The package targets Node 24.18 and Pi 0.85.1.
## API key
Set the runtime environment variable before starting Pi:
```bash
export TYPESAFE_API_KEY='...'
```
Or configure a command that prints the key to stdout:
```json
{
"fastJevCompaction": {
"apiKeyCommand": "your-key-helpe