How peekme works
peekme sits between your terminal and the agent. It never changes what the agent draws. It only draws a box over a few rows while the box is open, and puts them back exactly as they were.
A second copy of your screen
The agent runs in a pseudo-terminal. Its output goes to your terminal unchanged, and the same
bytes also go to a terminal emulator in memory (alacritty_terminal), so peekme always knows
what is on your screen, cell by cell.
Finding the selection
The selection comes from the agent when it draws full screen. Claude Code, Copilot CLI and Kiro CLI copy it with an OSC 52 sequence, which peekme reads on its way to your terminal, and Codex highlights it, which peekme sees in its copy of the screen. Otherwise the selection comes from your terminal: X11 PRIMARY on Linux, or the clipboard on a Mac.
Drawing the box
peekme redraws only the rows next to the selection, with the box between them. Nothing is cleared and there is no switch to another screen, so there is no flicker. The agent's input line and status line keep updating while the box is open. On Esc peekme draws those rows again from its copy and sends the output it kept aside, so the terminal ends in the same state as if the box never existed. Tests check this cell by cell on real Claude Code, Codex, Copilot CLI and Kiro CLI output.
What the model gets
A few words alone are not enough ("Desktop app", which one?). The whole chat is too much and too slow. So the model gets small parts, each with a size limit:
- One line saying which agent this is and in which directory. This is enough for text from the agent itself, like the startup tips.
- The text around the selection, with the selection marked in place like
⟦this⟧. peekme finds it in the conversation by searching for the selection together with the words next to it on screen. This way it finds the right place when the same words appear many times. If the text is not in the conversation, it uses the screen. - Your request that this text answers, and one line for each of your earlier requests.
- The first places in the conversation where the same words were used before.
The conversation comes from Claude Code's session transcript in ~/.claude/projects, from
Codex's app-server, from Copilot CLI's session log in ~/.copilot/session-state, or from Kiro
CLI's session log in ~/.kiro/sessions/cli. peekme knows which session, because the agent
registers its process id there.
Usually this is 1 to 7 KB of text. When it is not enough, press Alt+P again and the model gets the whole conversation. A long chat can be 5 to 30 times bigger than a normal explanation, so above about 40k tokens peekme shows the size first and sends it only when you press Alt+P once more.
No API key
The explanation is generated by the agent's own CLI with your login: claude -p, Codex's
app-server, copilot --headless or kiro-cli acp, each without tools. See
Settings for the models.
The source is on GitHub, written in Rust.