pi-curated-tools
v1.0.0
Published
Intent-driven read and bash output curation with durable token savings and cost tracking for Pi
Maintainers
Readme
Pi Curated Tools Extension
A high-signal, context-saving extension for pi.
Overview
Large file reads (read) and verbose terminal outputs (bash) are the biggest contributors to context bloat and degradation over long agent sessions.
This extension wraps the built-in tools (read, bash) with an Intent-Driven Sub-Agent Curator:
- Mandatory
intentparameter: Requires the LLM agent to specify what exact information or outcome it is looking for. - Sub-Agent Curation Step: A fast sub-model extracts only relevant code snippets (preserving line numbers), error traces, and matching answers before passing them into the main agent's context.
- Dual Token Tracking:
- Context Saved: Tracks how many cumulative tokens were prevented from entering the main agent's long-term context window.
- Sub-Agent Cost: Tracks the exact one-off tokens (input and output) spent by the sub-agent model call.
Outputs shorter than 250 characters bypass the curator and are returned directly.
Installation
The extension is installed globally at:
~/.pi/agent/extensions/curated-tools/
It auto-loads on startup or can be reloaded in an active session with /reload.
Commands
/curator-model
Interactively select from a compact shortlist of the active and fast models. Use/curator-model <provider/model-or-pattern>to choose any other registered model (e.g.claude-3-5-haiku,gemini-2.0-flash, orgpt-4o-mini). The default is OpenRouter'sopenai/gpt-5.6-luna, requested with reasoning disabled and a dedicated final-output budget./curation-stats
Show a detailed lifetime and current-session breakdown of:- Total tool calls
- Context tokens saved vs. curated tokens injected
- Sub-agent token consumption (one-off input + output)
- Cached tokens, measured curator cost, and the immediate token-price break-even ratio
- Per-tool stats (
read,bash)
Usage is durably recorded across Pi sessions in ~/.pi/agent/curated-tools/token-usage.jsonl.
Set PI_CURATION_STATS_PATH to store the append-only ledger elsewhere.
Live Status Widget
While running, the extension continuously updates a bottom widget:
🌿 Context Saved: ~48.2k tokens (74% reduction) | Sub-agent spent: ~14.1k tokens across 14 calls