Skip to main content

pk-session-manager

PyPI Python

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 sm CLI 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-*.jsonl and ~/.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.

Release files for pk-session-manager 0.1.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 pk-session-manager 0.1.0
File Size Uploaded
pk_session_manager-0.1.0.tar.gz 31.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pk-session-manager 0.1.0
File Interpreter ABI Platform
pk_session_manager-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.1 kB

Release files / pk_session_manager-0.1.0.tar.gz

Download URL pk_session_manager-0.1.0.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
47f177515ecf3e58f90dc5015fdc5d0cc11cf80f1e567099d49a089540957425
BLAKE2b-256 checksum
How to use checksums
32f0e490b1c78d7171d7d89ffd57b41c9ed394d4ad519618aad984c53d9b710f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / pk_session_manager-0.1.0-py3-none-any.whl

Download URL pk_session_manager-0.1.0-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d02c274687791a3adb0dc791bdb060b02074a92a5decdc6fce2752bb70bc3536
BLAKE2b-256 checksum
How to use checksums
260387926f7749b31656dd88bd49967fbee1b4978855c1d19c0f18acb83c6cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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