Skip to main content

Discover and inspect local AI coding agent sessions

Project description

agent-sessions

PyPI Tests Python 3.11+ License: MIT

Discover and inspect local AI coding agent sessions (Claude Code, Codex, OpenCode, Pi).

Looking for a ready-made supervision tool? Check out Tether.

Install

pip install agent-sessions

Usage

from agent_sessions import discover_sessions, get_session_detail, RunnerType

# Find all recent sessions
sessions = discover_sessions()
for s in sessions:
    print(f"{s.runner_type.value}: {s.directory} ({s.message_count} messages)")

# Filter by agent type
claude_sessions = discover_sessions(runner_type=RunnerType.CLAUDE_CODE)

# Filter by project directory
project_sessions = discover_sessions(directory="/home/user/my-project")

# Load full message history
detail = get_session_detail(sessions[0].id, sessions[0].runner_type)
for msg in detail.messages:
    print(f"[{msg.role}] {msg.content[:80]}")

Supported agents

Agent Session location Format
Claude Code ~/.claude/projects/ JSONL per session
Codex ~/.codex/sessions/ JSONL rollout files
OpenCode ~/.local/share/opencode/opencode.db SQLite database
Pi ~/.pi/agent/sessions/ JSONL per session

Each provider also detects whether sessions are currently running by inspecting the process table.

Configuration

All providers support environment variables to override default paths:

Variable Provider Default
CLAUDE_HOME Claude Code ~/.claude
CODEX_HOME Codex ~/.codex
XDG_DATA_HOME OpenCode ~/.local/share
PI_SESSIONS_DIR Pi ~/.pi/agent/sessions

OpenCode uses a centralized database at $XDG_DATA_HOME/opencode/opencode.db (defaults to ~/.local/share/opencode/opencode.db).

Status

Beta. The API may change between minor versions until 1.0.

License

MIT

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

agent_sessions-0.2.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

agent_sessions-0.2.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file agent_sessions-0.2.0.tar.gz.

File metadata

  • Download URL: agent_sessions-0.2.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agent_sessions-0.2.0.tar.gz
Algorithm Hash digest
SHA256 36d2b6c97bc5883eb99ed08b43a4334ab6c3e0d6a80ea9bf92bedec766b50327
MD5 ddcf1f5f8f802a184e51b11d278f5506
BLAKE2b-256 342bc23a060bb100678a2a7f46ff1588ecdba33ced7c7ae0af4e3094a6a33c06

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_sessions-0.2.0.tar.gz:

Publisher: publish.yml on larsderidder/agent-sessions

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_sessions-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: agent_sessions-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agent_sessions-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 196bff0ed5a28e038e2949323d7179a5df16b8cb3ee128fb0bbfcededbc36bd6
MD5 19392bc369c2f817e00eb5c6c42c77e3
BLAKE2b-256 5bf063768e5c70504217dee513e24c83e962057baff8e23cf63c5c872f63c9e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_sessions-0.2.0-py3-none-any.whl:

Publisher: publish.yml on larsderidder/agent-sessions

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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