Skip to main content

Parse, index, name, and compress AI agent sessions from Claude Code, Codex, Gemini, and beyond.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pk_session_manager-0.1.0.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pk_session_manager-0.1.0-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

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

Hashes for pk_session_manager-0.1.0.tar.gz
Algorithm Hash digest
SHA256 47f177515ecf3e58f90dc5015fdc5d0cc11cf80f1e567099d49a089540957425
MD5 346b97f449a254dd659324d80e37a52a
BLAKE2b-256 32f0e490b1c78d7171d7d89ffd57b41c9ed394d4ad519618aad984c53d9b710f

See more details on using hashes here.

File details

Details for the file pk_session_manager-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pk_session_manager-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d02c274687791a3adb0dc791bdb060b02074a92a5decdc6fce2752bb70bc3536
MD5 67fcdf80d43db7b8edba2afc7adde946
BLAKE2b-256 260387926f7749b31656dd88bd49967fbee1b4978855c1d19c0f18acb83c6cd4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page