Show HN: Pi-protokoll – Per-turn protocols for fast compaction in Pi A Pi extension called Pi-protokoll cuts compaction time for long local-model sessions by having the model write a short protocol block at the end of every turn, so compaction assembles a tiered summary from those blocks instead of re-summarizing the full history. In one session with Qwen3.x on a local OpenAI-compatible server (2× RTX 3090, 262k context window), the extension performed 22 compactions over 118 turns, each taking about 213,000 tokens down to 35,000 in about 30 seconds, with resumed sessions reading about 36,000–44,000 tokens. In a separate 12-day session, a cut reduced context from about 213,000 tokens to a median of about 67,000 in the next request, roughly 38,000 of which was the summary, while the server's prefix (KV) cache supplied 99.8% of prompt tokens in the median request between cuts. A Pi https://pi.dev extension that makes very long sessions possible with local models: the model writes a short protocol at the end of every turn, and compaction builds a bounded, tiered summary from those protocols instead of re-reading and summarizing the whole history. Deutsche Fassung: README.de.md https://github.com/sebion7125/pi-protokoll/blob/main/README.de.md Pi's built-in compaction sends the old history to the model and waits while it writes a summary. With a local model that is slow minutes on a long session , and the summary is written after the fact from an overfull context. Here the expensive part happens while working: each final answer ends with a protocol block, written while the model still has the full turn in view. At compaction time almost everything is ready; code assembles the summary and the model only updates a short overview. Measured in one session with Qwen3.x on a local OpenAI-compatible server 2× RTX 3090, 262k context window : - 22 compactions over 118 turns, each about 213,000 → 35,000 tokens in about 30 s - resuming the session reads about 36,000–44,000 tokens - every earlier turn stays reachable through tools In the 12-day session shown in the chart above, also with a local Qwen model, a cut takes the context from about 213,000 tokens to a median of about 67,000 in the next request; about 38,000 of those are the summary, the rest is the system prompt and what stays word for word. Between cuts the server's prefix KV cache holds: in the median request 99.8 % of the prompt tokens came from it. The request right after a cut has only the system prompt cached and re-reads about 62,000 tokens once. What the extension saves is the re-summarization pass, not that re-read. Practical example: 64kdemo https://github.com/sebion7125/64kdemo , a procedural forest landscape in C and OpenGL, with screenshots, a camera flight and the story of how it came about. Its first ten sessions ran without the extension and kept ending in context poisoning; with the extension, from the tree system on, it stayed a single session, the one measured above. A turn is one agent run: your message with all tool rounds up to the final answer. Messages you send while the model is working belong to the running turn. Answers a question tool delivers as a custom message the user's own input through a package, such as pi-web's ask user start the turn that works with them, and their text is kept verbatim with keepUserMessages . 1. System prompt. A fixed section asks the model to end every final answer with a