Discover and inspect local AI coding agent sessions
Project description
agent-sessions
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36d2b6c97bc5883eb99ed08b43a4334ab6c3e0d6a80ea9bf92bedec766b50327
|
|
| MD5 |
ddcf1f5f8f802a184e51b11d278f5506
|
|
| BLAKE2b-256 |
342bc23a060bb100678a2a7f46ff1588ecdba33ced7c7ae0af4e3094a6a33c06
|
Provenance
The following attestation bundles were made for agent_sessions-0.2.0.tar.gz:
Publisher:
publish.yml on larsderidder/agent-sessions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_sessions-0.2.0.tar.gz -
Subject digest:
36d2b6c97bc5883eb99ed08b43a4334ab6c3e0d6a80ea9bf92bedec766b50327 - Sigstore transparency entry: 991422601
- Sigstore integration time:
-
Permalink:
larsderidder/agent-sessions@ce415be2c7b83404dc2f511a1a21c5b1e2b12273 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/larsderidder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce415be2c7b83404dc2f511a1a21c5b1e2b12273 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
196bff0ed5a28e038e2949323d7179a5df16b8cb3ee128fb0bbfcededbc36bd6
|
|
| MD5 |
19392bc369c2f817e00eb5c6c42c77e3
|
|
| BLAKE2b-256 |
5bf063768e5c70504217dee513e24c83e962057baff8e23cf63c5c872f63c9e0
|
Provenance
The following attestation bundles were made for agent_sessions-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on larsderidder/agent-sessions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_sessions-0.2.0-py3-none-any.whl -
Subject digest:
196bff0ed5a28e038e2949323d7179a5df16b8cb3ee128fb0bbfcededbc36bd6 - Sigstore transparency entry: 991422602
- Sigstore integration time:
-
Permalink:
larsderidder/agent-sessions@ce415be2c7b83404dc2f511a1a21c5b1e2b12273 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/larsderidder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce415be2c7b83404dc2f511a1a21c5b1e2b12273 -
Trigger Event:
release
-
Statement type: