What each harness does when the conversation outgrows the context window: when it compacts, what it keeps, and how you can steer it.
When it happens
| Question | pichecked at 1.2.0 |
|---|---|
| Automatic compaction, and when | Yes. Pi compacts automatically when Right after a compaction, Pi ignores the old (pre-compaction) usage figures and estimates the rebuilt context from scratch until the next response arrives. |
| Change the trigger or turn it off | Set
Turning off auto-compaction also turns off automatic overflow recovery. Since 1.4.0, reserveTokens controls when compaction starts, not the summary output cap. Compaction and branch summaries use the model output limit; generateSummary/WithUsage retain but ignore the old reserveTokens argument. |
| Compact by hand | Run
1.4.0 fixes custom instructions being lost from split-turn summaries; publisher-reported fix, not a passing preservation probe. |
| See how full the context is | The interactive footer shows context use as |
What it does
| Question | pichecked at 1.2.0 |
|---|---|
| What replaces the conversation | Pi asks the current session model to write a structured checkpoint summary (Goal, Constraints & Preferences, Progress, Key Decisions, Next Steps, Critical Context, plus lists of files read and modified). It sends the older messages as serialized text with thinking blocks removed and each tool result cut to 2000 characters. Pi then appends a When a single long user turn exceeds the kept budget, Pi writes two summaries (earlier history and the start of that turn) and merges them. An extension can supply the summary instead, using any model it likes. 1.4.0 removes the old fixed summary output cap. The caller uses createSummarizationOptions without a reserve-derived maxTokens; inherited provider/model output limits apply. No model request was run. |
| What survives | The system prompt is kept in full: context files such as Skill bodies the model loaded during the conversation are ordinary messages, so older ones are summarised like anything else. Extension state stored in session entries follows the session tree and survives compaction. |
| Trimming without summarising | Partly Pi does not prune or clear old tool outputs on its own. The only automatic trimming is that tool results are cut to 2000 characters inside the text sent for summarisation. Extensions can trim without summarising by appending During overflow recovery, Pi itself appends |
| The full history afterwards | Yes. Sessions are append-only JSONL files under |
Shaping it
| Question | pichecked at 1.2.0 |
|---|---|
| Customise the summary or hook in | Yes, through extensions. The event payload includes |
| When a request overflows anyway | If the provider returns a context-overflow error, or a response stops early with Recovery is skipped when Custom providers with unusual overflow messages must map them to |