shipwithjev

Catalog / Tools & apps

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

Also filed under Tools & apps

  1. 0573

    Support chat: agent offered a human escalation path

    A frustrated customer hits a bot loop twice; the judge checks whether a human handoff was offered.

    everyai-com · Tools & apps

  2. 0572

    Subscription cancel: effective date is explicit

    An agent cancels a subscription; the judge checks the exact date the cancellation takes effect.

    everyai-com · Tools & apps

  3. 0571

    Sales quote: numbers match the official price list

    An agent quotes $29/seat against a price list; the judge checks the quote matches exactly.

    everyai-com · Tools & apps

  4. 0570

    Refund chat: agent stated the amount before issuing it

    A support agent issues a $42.50 refund; the judge checks the exact amount was stated before the refund was confirmed.

    everyai-com · Tools & apps