Proposal: TokenPilot support for pi
LightRSI supports Claude Code, Codex, OpenClaw and DeepSeek Harness. Two other popular open-source coding agents are:
- OpenCode: the shared eviction core is merged (#95) and the adapter is in review (#96).
- pi (
@earendil-works/pi-coding-agent): this issue proposes adding it.
How it would plug in. pi has an in-process extension API, so no proxy is needed. The adapter would reuse the shared code from #95 and #96:
| TokenPilot feature | pi hook |
|---|---|
| Stable prefix | before_agent_start system-prompt sections |
| Reduction | the request-local context hook |
| Eviction (opt-in) | turn_end context edits, applied before pi's own compaction |
| Recovery | a native memory_fault_recover tool, since pi has no MCP |
Early numbers. I ran a 4-turn coding session with llama-server, Qwen3-1.7B and a 32k context window, on a prototype. Prompt tokens processed went from 37,465 to 4,994 (−87%). Without the adapter, pi had to compact the conversation; with it, it didn't. I'll re-measure on the final code and put the results in the PR.
Plan: one PR, once #96 has merged. Would you be happy to take it?
Thanks @boxabirds — yes, absolutely, we'd be happy to take it. #96 is already merged, so the shared eviction core and the OpenCode adapter are both in main now.
It's great to see pi in the works too — an in-process integration with no proxy would be a first for us. Just open the PR whenever it's ready, and don't worry about the repo-side chores (CI wiring, docs, README host list) — we can handle those on our end.
Thanks again for the continued contributions, it's been a pleasure reviewing them.