session-ls
List and search session history across all coding agents on your machine: pi, codex, claude, cursor.
$ session-ls -n 3
AGENT STARTED LAST CWD TITLE
codex 2026-07-29T00:03:17 2026-07-29T00:21:15 /home/alice/projects/website fix the login redirect loop
pi 2026-07-17T14:42:45 2026-07-18T08:45:13 /home/alice/projects/backend tune the postgres connection pool
claude 2026-06-15T03:08:57 2026-06-15T03:31:55 /home/alice/dotfiles migrate to starship prompt
Sessions are read directly from each agent's local store, newest first. The
title of a session is its first real user message (injected context such as
codex <recommended_plugins> or AGENTS.md instructions is skipped).
Design
- Fast. Metadata is cached in
~/.cache/session_ls_cache.json, keyed by file size + mtime; unchanged files are never re-read. Listing ~1000 sessions takes milliseconds. Full-text search usesripgrepwhen available (fallback:grep). - Plain search, no semantics. No index, no embeddings, no network. Matching is literal substring comparison. Decide what's relevant yourself - or hand the file paths to an LLM.
- Lightweight, zero dependencies. Pure stdlib, one module.
- Extensible. Adding another agent is one
REGISTRYentry plus two small functions (see below).
Install
pip install . # from a checkout
pipx install . # recommended: isolated environment
Requires Python >= 3.9. A man page (session-ls(1)) is installed alongside;
on macOS venvs, point MANPATH at the venv's share/man to see it.
Usage
session-ls [KEYWORD] [OPTIONS]
| Option | Meaning |
|---|---|
KEYWORD |
search titles (first user message), case-insensitive substring |
-f, --full |
search full session content instead of titles (slow, uses rg/grep) |
-a, --agent |
only this agent: pi, codex, claude, cursor |
-c, --cwd |
only sessions under a cwd substring |
--since DATE |
started on/after (YYYY-MM-DD) |
--until DATE |
last active on/before (YYYY-MM-DD) |
-n, --limit N |
show only the N newest |
-l, --list |
print file paths only (for piping) |
--json |
JSON Lines output (keys: agent, cwd, started, last, title, file) |
Examples
session-ls -n 10 # ten most recent sessions
session-ls websocket # title search
session-ls "immich 2283" -f # full-content search
session-ls -a pi -c nemo --since 2026-08-01 # filters combine
session-ls websocket -l | xargs head -1 # inspect raw matches
session-ls websocket --json | jq -r .file # feed paths to other tools
Supported agents
| Agent | Store | Timestamps |
|---|---|---|
| pi | ~/.pi/agent/sessions/<encoded-cwd>/*.jsonl |
in file |
| codex | ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl (+ archived_sessions/) |
in file |
| claude | ~/.claude/projects/<encoded-cwd>/*.jsonl |
in file |
| cursor | ~/.cursor/projects/*/agent-transcripts/<id>/<id>.jsonl |
file mtime (none in file) |
Adding an agent
Append an entry to REGISTRY in src/session_ls/__init__.py:
- a glob of session files
meta_parser(f, head) -> (cwd, started_iso) | Noneuser_text(line) -> first real user text | ''(drives the early-exit read)
REGISTRY = [
# (name, glob, meta-parser, user-text-extractor)
("myagent", os.path.join(HOME, ".myagent/sessions/*.jsonl"),
_myagent_meta, _myagent_user),
]
Development
python -m pytest tests/ # plain asserts, also runnable via pytest
python -m session_ls ... # run from a checkout
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file session_ls-0.1.0.tar.gz.
File metadata
- Download URL: session_ls-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57987b27e4d91fd48aca34809339850c3b18066fe20cb17837c1aba891154a24
|
|
| MD5 |
0329c8b9c2a617e9f091a19478169bb2
|
|
| BLAKE2b-256 |
59c0ba0d8c10c23c1ec830810f0181d42fb579afddf292ec651d261811cc39a2
|
File details
Details for the file session_ls-0.1.0-py3-none-any.whl.
File metadata
- Download URL: session_ls-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51683ab1b19aedd0218c1812607c114f75d14d00c096285e77f69ad62e6d2f65
|
|
| MD5 |
e1911979acd9f84e40d594f3c0488d3b
|
|
| BLAKE2b-256 |
76238b67cf05c72ee8a72096448a4811116b0f069a6b6a42266b35cc87d4a09f
|