# The store: Recent's file, and this session's closed panes > We should have some persistent state that is bounded (a houndred or so > MiB at most) stored on the fs and shared among all pardes windows. It will > store stuff for like the recent files picker. We should also have a panes > picker and this should include panes from the current session that were > deleted/closed. ## The decision (2026-11-05) **Recent is a file of at most 200 lines**, `$XDG_STATE_HOME/pardes/recent` (else `~/.local/state/pardes/recent`), a line a file, the newest first: ` `. Every session reads it at start, and again on use (Recent, `/recent`) when a stat of it says another session wrote it since. A step that changed the list writes it at its end: `flock` on the file (held by another session: the next step tries again, so a frame never waits for one; at exit the lock is waited for), the file read again with this session's changes put over it (`recent.List.merge`) when another session wrote it since, and the whole list written over it in place. A line that is no entry is passed over: a missing, unreadable or foreign file is an empty list, a reader meeting a write half done reads it again once its stat moves on, a line a crash tore is one entry fewer, and pardes always starts. A rename of a new file over it (atomic) cost twice the write in Debug for nothing the lenient read does not already give. **Closed panes are this session's, in memory**: the newest 64, within 64 MiB together, each a one-pane dump (`dump.savePane`, at most 8 MiB; a terminal past it is kept without its history, any other pane is not kept) and where it was. Panes lists them after the open panes, `(closed)`; Enter, or a Look at `@pN`, brings one back beside the pane that took its rows. Restore keeps them; the session's end drops them. ## What went, and why The store this replaced (2026-10-24, Store.zig 1,135 lines) was one append-only log of CRC-framed records (`@h`, `@r`, `@c`, `@x`) under flock, with a resync past torn or garbage records, a compaction by rename, a 100 MiB cap, and each closed pane a self-describing dump in the file, read back at its offset. Closed panes were only ever listed by the session that closed them, so only the file and its bound were shared: an in-memory list is the same behaviour for far less code and no format (the position the store's own note held least firmly). Recent needs no log: 200 lines rewritten whole under the lock is a few kilobytes a step that opens or closes a file. What a user loses: the closed panes of other sessions, which the log kept on disk until a compaction and nothing ever listed. The first session of a build with this reads the old `store` once more, when it is newer than `recent`: its `@r` records' bodies are this file's lines. The old file is left in place for an older pardes still running. ## Tests Store.zig: two windows share Recent (each reads the other's writes on use; a lock held by a third party delays a write, never loses it); the file holds the newest 200, newest first; a foreign file's Recent lines are read and the next write mends it; the old store read once, its newest records first; a session keeps its newest 64 closed panes; a closed pane comes back where it was, its rows from the pane that took them, listed `(closed)` in Panes and unlisted once back, and another session lists none. recent.zig: a merge puts this session's changes over the file's list. test/process/other_files.zig: a file opened and closed is in `/recent` closed and still is in the next session; two sessions share Recent, and a Del'd pane comes back from `@p` only where it was. test/behaviour/ other_files.zig: `/recent` and Recent's rows.