Parse, index, name, and compress AI agent sessions from Claude Code, Codex, Gemini, and beyond.
Project description
pk-session-manager
Parse, index, name, and compress AI agent sessions from Claude Code, Codex, Gemini, and pluggable adapters.
Provides:
- A unified Python API and SQLite index over heterogeneous session sources
- A
smCLI for listing, viewing, renaming, describing, and compressing sessions - A Textual TUI for browsing sessions across all agents
- Optional LLMLingua-2 token-aware compression for feeding a past session back into a model
- Optional OpenRouter-powered auto-naming via
openai/gpt-oss-120b - An optional PyWebView desktop shell
Install
pip install pk-session-manager
Optional extras:
pip install 'pk-session-manager[compress]' # LLMLingua-2 semantic compression
pip install 'pk-session-manager[desktop]' # PyWebView desktop shell
pip install 'pk-session-manager[dev]' # pytest + ruff
Dev install (editable)
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .
For semantic compression: pip install -e ".[compress]". For the desktop shell: pip install -e ".[desktop]".
Quick start
sm index # discover and index sessions from all known sources
sm list # show indexed sessions
sm show <id|name> # render a session's turns
sm compress <id> # write a token-compressed bundle to stdout
sm-tui # launch the Textual TUI
Storage
State lives under ~/.session-manager/:
sessions.db— SQLite + FTS5 index (sessions, turns, tool calls, names)config.toml— user config (sources, compression target, OpenRouter key location)models/— LLMLingua-2 model cache (downloaded lazily on first compression)
Sources
Out of the box:
- Claude Code —
~/.claude/projects/<encoded-cwd>/<uuid>.jsonl - Codex —
~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonland~/.codex/archived_sessions/ - Gemini —
~/.gemini/tmp/<project>/chats/session-*.jsonl - Generic JSONL — point a YAML at any path and provide a field mapping
Auto-naming
If OPENROUTER_API_KEY is set, sm describe <id> will call openai/gpt-oss-120b via OpenRouter and store a short title + 1-sentence description. Heuristic names (first user prompt + cwd) are generated for free at index time.
Project details
Release history Release notifications | RSS feed
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 pk_session_manager-0.1.0.tar.gz.
File metadata
- Download URL: pk_session_manager-0.1.0.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47f177515ecf3e58f90dc5015fdc5d0cc11cf80f1e567099d49a089540957425
|
|
| MD5 |
346b97f449a254dd659324d80e37a52a
|
|
| BLAKE2b-256 |
32f0e490b1c78d7171d7d89ffd57b41c9ed394d4ad519618aad984c53d9b710f
|
File details
Details for the file pk_session_manager-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pk_session_manager-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d02c274687791a3adb0dc791bdb060b02074a92a5decdc6fce2752bb70bc3536
|
|
| MD5 |
67fcdf80d43db7b8edba2afc7adde946
|
|
| BLAKE2b-256 |
260387926f7749b31656dd88bd49967fbee1b4978855c1d19c0f18acb83c6cd4
|