Coding agents now run for hours instead of minutes, consuming ever‑growing amounts of token traffic and driving up API costs. Every edit, test run and log read is fed back into the model’s context, making long sessions expensive and slow. Teams need a way to trim token usage without sacrificing the agent’s ability to solve problems.
SoL‑Pi addresses this by targeting the harness—the layer that manages tool calls, context, observations and delegation—rather than trying to speed up token generation itself. An automated research loop explored hundreds of harness modifications, kept only those that preserved core performance while improving at least one efficiency metric, and froze four mechanisms that together cut recorded token traffic by 44.7 % to 49.0 % and lower API cost by roughly one‑third on the EdgeBench benchmark.
The four mechanisms are:
- Action Fusion – merges a file edit with its follow‑up test/build/run command into a single tool request, eliminating an extra model round‑trip.
- Online Context Compact – after each completed plan step, the harness estimates remaining requests and triggers the model’s native context compaction only when the projected input savings outweigh the cost of rewriting the prompt cache.
- ObservationPack – archives large tool outputs (>10 KiB) locally; the model receives the full output for the next two calls, then sees a stable handle plus a short head/tail excerpt, with random‑access retrieval still possible.
- Evidence‑Preserving Reducer – sends big build/test logs (≥4 KiB) to a cheaper model that writes a compact receipt; a deterministic verifier checks the receipt, falling back to the original log only if verification fails, credentials are suspect, or the receipt isn’t smaller.
SoL‑Pi ships as an MIT‑licensed extension that works with an unmodified Pi release (tested with Pi 0.85.1 and Node.js 22.19+). Installation is a simple command, after which the agent automatically gains the token‑saving harness improvements. The result is faster, cheaper coding sessions without losing the quality of the agent’s solutions.