Skip to main content

agent-chat-reader

Read and search Codex CLI and Claude Code chat history from the terminal.

Useful for AI agents that need to recall what was discussed or decided in past sessions, without manually parsing noisy JSONL files.

Install

uv tool install agent-chat-reader

Or for development:

git clone https://github.com/alik-git/agent-chat-reader
cd agent-chat-reader
uv sync --extra dev
uv run agent-chat-reader --help

Usage

List recent sessions (both Codex and Claude Code, sorted by recency):

agent-chat-reader --list

Search across all sessions for a keyword:

agent-chat-reader --find "sim2sim"
agent-chat-reader --find "policy_interface" --source codex
agent-chat-reader --find "side chat phrase" --source codex-side
agent-chat-reader --find collision friction --since 2026-07-01 --limit 10

Separate search arguments use AND logic across the whole session, so the words may occur in different messages. A quoted shell argument remains one literal phrase. Results show text around each match and keep distinct session IDs even when titles are identical.

The first search builds a disposable local SQLite index from the clean turns. Later searches refresh only appended JSONL records and new side-chat log rows. Delete ~/.cache/agent-chat-reader/search.sqlite3 at any time to rebuild it from the source histories.

Read a specific session by UUID prefix:

agent-chat-reader 019eaecb
agent-chat-reader 1bfc739b --verbose     # include tool call summaries
agent-chat-reader 019eaecb --tail 5      # last 5 user turns only
agent-chat-reader 019eaecb --hide-timestamps
agent-chat-reader 019eaecb --format json

What it filters out

The raw JSONL files are very noisy. This tool extracts only:

  • Codex: user_message / agent_message events, current item_completed user/agent messages, and text / output_text assistant response blocks. User response items containing injected context or replayed history are excluded. Guardian/subagent sessions (auto-approval bots) are hidden by default.
  • Codex side chats: user submissions and assistant text reconstructed from the local Codex runtime log database. Known internal helper sessions are hidden by default.
  • Claude Code: real user turns (not tool-result carriers), and assistant text blocks (not thinking blocks or tool calls). Sidechain sub-agent turns are hidden by default.

Use --include-subagents to see everything.

Options

Flag Description
--list / -l List recent sessions from both sources
--find KEYWORD... / -f Search sessions; separate arguments use session-wide AND
--source codex|codex-side|claude Filter to one source. codex includes normal Codex sessions and side chats
--verbose / -v Include brief tool call summaries (Claude sessions)
--tail N / -n N Show only the last N user turns of a session
--include-subagents Include guardian/subagent sessions
--format text|json Output format for session reads
--hide-timestamps Hide message timestamps and elapsed-gap labels
--limit N Max sessions shown by --list or --find (default: 40)
--since DATE Search sessions active on or after an ISO date/timestamp

Session reads show timestamps by default. Elapsed labels use the current speaker's role, such as (agent took 8s) or (user took 4m), and only report the time since the previous visible message.

Use --format json when another agent or script needs stable structured fields instead of terminal separators. JSON turns include timestamp, local_time, elapsed_seconds, role, and text.

Session storage locations

Agent Path
Codex CLI ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
Codex side chats ~/.codex/logs_2.sqlite
Claude Code ~/.claude/projects/*/*.jsonl

The derived search index defaults to ~/.cache/agent-chat-reader/search.sqlite3. Set AGENT_CHAT_READER_CACHE_DIR to place it under a different cache root.

Codex side chats are log-backed rather than normal rollout transcripts, so the tool labels them as codex-side in list and search output. Both legacy UserInput and current TurnInput submissions are supported. Some Codex versions log only assistant message IDs, without the message text. That missing text cannot be recovered from these logs: reads/searches warn when such records are detected, and JSON reads include a warnings field. A search with no matches is not proof that a phrase was never said when this warning appears.

After upgrading from 0.1.6, the disposable search index automatically rebuilds once so chats skipped by the old parser become searchable. Source histories are never modified.

Development

uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pytest
uv build

Metadata

Release files for agent-chat-reader 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-chat-reader 0.1.7
File Size Uploaded Provenance
agent_chat_reader-0.1.7.tar.gz 62.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-chat-reader 0.1.7
File Interpreter ABI Platform
agent_chat_reader-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 90.8 kB

Release files / agent_chat_reader-0.1.7.tar.gz

Download URL agent_chat_reader-0.1.7.tar.gz
Size 62.8 kB
Tags Source
SHA-256 checksum
How to use checksums
77940db54ae4ee2e035d2c2a33828020b3fe9330c720ee6a08dfe1c4a39f83d3
BLAKE2b-256 checksum
How to use checksums
cc914a690e47eee041de1db18737295a1b3660564cd0f4509a99c04be612e8b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / agent_chat_reader-0.1.7-py3-none-any.whl

Download URL agent_chat_reader-0.1.7-py3-none-any.whl
Size 28.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
247419a04117ee5eacb6c8fdba270758618715bd9d9c214bf3f874906050e691
BLAKE2b-256 checksum
How to use checksums
c3ec313d5a3711d13c5a4a10fbac7e2ccd34798c769b6e06afd7da5046761574
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Security for agent-chat-reader 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agent_chat_reader-0.1.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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