pi-sessions
A terminal UI to browse, preview, resume and manage your pi coding agent sessions: every project on your machine, every session, and the conversation, without opening pi.
Based on a fork of ccsessions by Marek Miśkiewicz, which does the same for Claude Code.
Features
- Project & session browser — every pi project on your machine, newest first, with recently-active indicators (●), fork markers (⑂), message counts, token usage and cost
- Conversation preview — the tail of the active branch, rendered with
roles, Markdown for pi's replies, tool calls (⚙),
!commands (⌘) and compaction markers, without opening pi - One-key resume —
rreplaces the TUI withpi --session <file>in the session's working directory;ccopies the command to the clipboard (OSC 52) - Archive & delete — move sessions out of
pi --resume(reversibly) or delete them for good, per session or per project, with confirmation dialogs - Resizable panes — drag the borders between panes with the mouse; sizes
are remembered per layout across runs (
~/.config/pi-sessions/settings.json) - Export — Markdown with YAML front matter (ready for Quarto/Pandoc) or the raw JSONL, never overwriting an existing file
- Live document —
lkeeps_session_<id>.mdin sync with a running session, so a live-reloading renderer can show it with LaTeX rendered - Update check — on launch, a newer PyPI release is shown in the header
with its upgrade command; nothing is installed for you. Disable with
"check_updates": falsein~/.config/pi-sessions/settings.json;pisessions --versionprints the installed version - Fast — session metadata is cached per file (mtime + size), scanning runs off the UI thread, previews read only the tail of large files
Install
pipx install pi-sessions-tui # or: uv tool install pi-sessions-tui
git clone https://github.com/psychobarge/pi-sessions && pip install -e pi-sessions
Each installs the pisessions command. To run it without installing, use uv:
uvx --from pi-sessions-tui pisessions
Needs Python ≥ 3.10 on macOS or Linux; pi on your PATH only for resuming.
Use
pisessions # launch
pisessions --version # show version
| Key | Action |
|---|---|
j / k / arrows |
Move within the focused pane |
Tab / Shift+Tab |
Switch panes |
r |
Resume the selected session (in place) |
c |
Copy the resume command to the clipboard |
a |
Archive ↔ restore session · archive ↔ restore project |
d |
Delete session / project (with confirmation) |
n |
Rename session (as pi's /name) · rename project (display alias) |
e |
Export the session (Markdown or raw JSONL) |
l |
Follow the session in a live Markdown document |
/ |
Filter the focused list (projects or sessions) |
p |
Command palette (main menu : settings, change theme, reset, etc...) |
Ctrl+R |
Rescan now (a rescan also runs automatically) |
q |
Quit |
a and d act on the session when the Sessions pane is focused and on
the whole project when the Projects pane is focused.
On a narrow terminal (half a screen) the panes stack instead:
Use as a picker
A terminal application can open the same browser and handle the session itself:
pisessions --select --output /path/to/new-selection.json
Press Enter or r to select an unarchived session without launching Pi.
The output file must not already exist. On selection it contains the absolute
JSONL path as a JSON string on one line (local to this machine, without
PI_SESSIONS_RESUME_ROOT remapping). Press Escape or q to cancel without
creating the file. Escape first closes an open side panel or clears an active
filter.
Management actions stay available, and cancelling does not undo them. Close any affected Pi sessions before archiving, deleting, or renaming: the browser checks file recency, so an idle but open session can appear inactive. A Live Doc stops updating when the picker exits and leaves its Markdown file in place.
Settings
| Variable | Default | Purpose |
|---|---|---|
PI_SESSIONS_ROOT |
pi's own (PI_CODING_AGENT_SESSION_DIR, $PI_CODING_AGENT_DIR/sessions, ~/.pi/agent/sessions) |
Where to read sessions |
PI_SESSIONS_PI_BIN |
pi |
Command used to resume |
PI_SESSIONS_RESUME_ROOT |
— | Rewrite the sessions root in resume commands, for a pi that sees it elsewhere (container) |
PI_SESSIONS_LIVE_SECONDS |
120 |
Recently-active threshold |
PI_SESSIONS_TRASH |
0 |
Delete through the trash command |
PI_SESSIONS_LIVE_DIR |
session cwd | Where live documents go (use a plain directory for Quarto projects) |
PI_SESSIONS_REFRESH_SECONDS |
10 |
Auto-refresh interval, 0 disables |
PI_SESSIONS_THEME |
saved choice, else ansi-dark |
Textual theme |
PI_SESSIONS_CODE_THEME |
follows the theme | Pygments style for code blocks |
PI_SESSIONS_NERD_FONT, PI_SESSIONS_EYE, PI_SESSIONS_EYE_OFF |
— | Live-document glyphs |
Settings and project aliases live in ~/.config/pi-sessions/, the cache in
~/.cache/pi-sessions/.
The foxberry light theme is by
miskiewiczm (MIT).
pi in a container
If pi runs in Docker with its agent directory in a named volume, the host
cannot see the sessions. Bind-mount a host directory over the container's
sessions directory (e.g. -v ~/.pi/agent/sessions:/root/.pi/agent/sessions),
then set PI_SESSIONS_RESUME_ROOT=/root/.pi/agent/sessions so resume
commands use the path pi sees.
How it works
pi stores each session as <sessions root>/--<encoded cwd>--/<timestamp>_<id>.jsonl:
a header line, then entries linked into a tree. pi-sessions reads those files
and never modifies them. Archiving a session moves it into an archived/
subdirectory, which pi does not list. Archiving a project moves its directory
to sessions-archive/ next to the sessions root. Everything happens locally;
no network requests.
Develop
pip install -e . --group dev
pytest
python docs/screenshots.py # regenerate the README screenshots from fake sessions
Known limitations
- "Running" is a guess. pi keeps no record of running sessions and writes to the session file only when something happens, so ● means modified in the last
PI_SESSIONS_LIVE_SECONDSseconds (default 120). Sessions marked this way cannot be archived, deleted or renamed. A session still open in pi but idle past that delay shows as stopped, and nothing stops you from archiving, deleting or renaming it: close it in pi first (renaming an open session leaves the name on a dead branch, so pi ignores it).
Changelog
See CHANGELOG.md for version history and the changes from ccsessions.
My pi extensions
| Extension | What it does | Install |
|---|---|---|
| pi-spec-mode | Writes feature specs with the agent and keeps them true to the code | pi install npm:pi-spec-mode |
| pi-deepseek-peak | Shows DeepSeek peak-hour status and corrects session prices | pi install npm:pi-deepseek-peak |
| pi-deepseek-vision | Gives DeepSeek vision through a local or remote vision LLM | pi install npm:pi-deepseek-vision |
License
MIT
Metadata
Release files for pi-sessions-tui 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pi_sessions_tui-1.0.0.tar.gz | 102.6 kB | With provenance | Details for pi_sessions_tui-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pi_sessions_tui-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pi_sessions_tui-1.0.0-py3-none-any.whl |
Total release size: 151.6 kB
Release files / pi_sessions_tui-1.0.0.tar.gz
| Download URL | pi_sessions_tui-1.0.0.tar.gz |
|---|---|
| Size | 102.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f904c4c20da6e90624ed35a6b9596ed04463c9e65cd8a5081d3780fca018ccb6
|
|
BLAKE2b-256 checksum How to use checksums |
6484f4cda12766465cf560644c2a402feb2445e93c657ce85c3820bf0f99a664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / pi_sessions_tui-1.0.0-py3-none-any.whl
| Download URL | pi_sessions_tui-1.0.0-py3-none-any.whl |
|---|---|
| Size | 48.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
306e41085aac52cc6138cd03ea6bb486cc4da869c2bfaf937d91fb69324e494f
|
|
BLAKE2b-256 checksum How to use checksums |
1111c53ce086d0ee3f6e966ef26fa9fe4b4f0113ffea04eabeb2d742efb3c4e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for pi-sessions-tui 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pi_sessions_tui-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.