Skip to main content

pi-sessions

A fast terminal UI for browsing, previewing, resuming and managing pi coding agent sessions.

Based on a fork of ccsessions by Marek Miśkiewicz, which does the same for Claude Code. Changes from ccsessions are listed in CHANGELOG.md.

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 — r replaces the TUI with pi --session <file> in the session's working directory; c copies 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 — l keeps _session_<id>.md in sync with a running session, so a live-reloading renderer can show it with LaTeX rendered
  • Fast — session metadata is cached per file (mtime + size), scanning runs off the UI thread, previews read only the tail of large files

Requirements

  • Python ≥ 3.10
  • pi installed (pi on PATH — needed only for resuming)
  • macOS or Linux

Installation

pipx install pi-sessions-tui        # or: uv tool install pi-sessions-tui

Both install the pisessions command.

Or from a clone:

git clone https://github.com/psychobarge/pi-sessions
pip install -e pi-sessions

Usage

pisessions
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 project (set a 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 (change theme)
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.

pi keeps no record of running sessions, so ● means modified in the last PI_SESSIONS_LIVE_SECONDS seconds (default 120). Sessions marked this way cannot be archived or deleted.

Configuration

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/.

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.

Development

pip install -e . --group dev
pytest

License

MIT

Metadata

Release files for pi-sessions-tui 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pi-sessions-tui 0.2.0
File Size Uploaded Provenance Actions
pi_sessions_tui-0.2.0.tar.gz 74.4 kB With provenance Details for pi_sessions_tui-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pi-sessions-tui 0.2.0
File Interpreter ABI Platform Actions
pi_sessions_tui-0.2.0-py3-none-any.whl Python 3 none any Details for pi_sessions_tui-0.2.0-py3-none-any.whl

Total release size: 114.9 kB

Release files / pi_sessions_tui-0.2.0.tar.gz

Download URL pi_sessions_tui-0.2.0.tar.gz
Size 74.4 kB
Tags Source
SHA-256 checksum
How to use checksums
84cb424fdb2b2112c92ada4bdc3e9cee2000a377938108e6dddb44b68978772a
BLAKE2b-256 checksum
How to use checksums
e20f53c433ff514e3dc0d239e834ac25541e0b8fdfb739efb6ed335a96d2067b
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 18, 2026.

Transparency log

Release files / pi_sessions_tui-0.2.0-py3-none-any.whl

Download URL pi_sessions_tui-0.2.0-py3-none-any.whl
Size 40.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc71dc09f928009e36d75656576561e7a27e11c99acfb1847b8757c6facb22a9
BLAKE2b-256 checksum
How to use checksums
88b009bc7ba69db017a5fc9d4e873ca0935f440a02ad7c34ec8fd76c80b2573a
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 18, 2026.

Transparency log

Security for pi-sessions-tui 0.2.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.

Select from 2 files

Attestation for pi_sessions_tui-0.2.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 18, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page