TLDR: It keeps ~20k tokens of recent conversations, then hands the rest of the conversation to another model with a special system & user prompt. This then fills out a template with relevant information.

See: https://github.com/earendil-works/pi/blob/main/packages/codi...

Can also be the same model. The main thing is that it uses a separate, clean context window.

Sounds just like opencode.