A previous release had provenance metadata, but this release does not. View details.
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 the first thing the person actually typed. Injected context
(plugin lists, AGENTS.md, environment blocks, image wrappers, slash-command
echoes) is skipped part by part, and wrapped requests are unwrapped: Codex desktop's
## My request:, a thread goal's <objective>, and chat bridges' <user_input>.
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 streams literal matches and decoded JSON Unicode text. A long-livedHistoryIndexrescans only what changed: unchanged directories keep their listings and unchanged files their records (every file is stilllstated). - 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: a legacy
session-lsCLI, and a versioned typed API (session_ls.api) for programs such as 4top. - Extensible. Adding another agent is one
REGISTRYentry plus two small functions (see below).
Install
uv tool install session-ls # or:
pipx install session-ls # isolated environment
pip install session-ls # into the current environment
pip install -e '.[dev]' # from a checkout, to work on it
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 (literal decoded-text scan) |
-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),
]
Agent skill
For AI agents (pi et al.), skills/session-ls/SKILL.md is a ready-to-install
skill: when to use session-ls, common flag combos, and how to pipe results
into a read of the underlying session files. Copy skills/session-ls into
your agent's skills directory to enable it.
Development
python -m pytest tests/ # plain asserts, also runnable via pytest
python -m session_ls ... # run from a checkout
License
MIT
0.2 API
session_ls.api exposes explicit Root, HistoryIndex, HistoryRecord,
search_full, and excerpt objects. Inject roots/cache/host identity rather than
changing process-global HOME. The legacy command still emits the same six JSON
fields. Package imports do not change SIGPIPE. No TUI dependencies are required.
HistoryRecord.subagent is true for a session another agent session started for
itself (Codex thread_spawn workers and the guardian approval reviewer), and
HistoryRecord.parent is the spawning session's native id when the child names it.
Both default to "not a subagent". HistoryRecord.scripted is true for a session
started with no person at a prompt (claude -p or the Claude Agent SDK, codex exec
or the Codex SDK; Pi records no such marker).
In the API, a first message too short to say anything (at most 8 terminal columns
once whitespace is collapsed: "hi", "pwd", "exit", or nothing) gives way to the
session's own name when it has one: Claude's latest rename, else its generated
title, else its agent name; Pi's session name; Codex's thread name from
session_index.jsonl. The session-ls command keeps the first message.
Metadata
Release files for session-ls 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| session_ls-0.2.4.tar.gz | 41.9 kB | Without provenance | Details for session_ls-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| session_ls-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for session_ls-0.2.4-py3-none-any.whl |
Total release size: 68.5 kB
Release files / session_ls-0.2.4.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | session_ls-0.2.4.tar.gz |
|---|---|
| Size | 41.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4aa024020155dfe892554c10d7866d40163967822de18a9b03c260c0b1ada3ae
|
|
BLAKE2b-256 checksum How to use checksums |
f72944bfa69968bff600f3fc961fe22714e6cc57dc182643ea5c264b5b5d4536
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / session_ls-0.2.4-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | session_ls-0.2.4-py3-none-any.whl |
|---|---|
| Size | 26.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a6f4bffe760033f0f6c8c6ad52ac628ceb65f65fd991af8c47574181efdc819
|
|
BLAKE2b-256 checksum How to use checksums |
bf78c93f795f24943348d745ee2c0d48109f11335d66b3d39c0ed43dd55d0127
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for session-ls 0.2.4
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.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 0.2.0 2 files With provenance
- Added 0.2.4 2 files Without provenance
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.