Read and search Codex CLI and Claude Code chat history from the terminal.
Project description
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_messageevents,agent_messageevents, and fullresponse_itemassistant text. 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.
Development
uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pytest
uv build
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
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_chat_reader-0.1.6.tar.gz.
File metadata
- Download URL: agent_chat_reader-0.1.6.tar.gz
- Upload date:
- Size: 60.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
424b81a41d35232550bf72ab8eee02f8d3866a2ea79009e25732f1e2cc4cf699
|
|
| MD5 |
e7615614fc6a6f95a09c82d52950c4a2
|
|
| BLAKE2b-256 |
3e3ff583bdbc939300703ae636c2ff7d8c21aa09ca09be66de996131e1f36b70
|
Provenance
The following attestation bundles were made for agent_chat_reader-0.1.6.tar.gz:
Publisher:
release.yml on alik-git/agent-chat-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_chat_reader-0.1.6.tar.gz -
Subject digest:
424b81a41d35232550bf72ab8eee02f8d3866a2ea79009e25732f1e2cc4cf699 - Sigstore transparency entry: 2242011129
- Sigstore integration time:
-
Permalink:
alik-git/agent-chat-reader@b2def91dacb3558b89f26219a81a2d308abfe45e -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/alik-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2def91dacb3558b89f26219a81a2d308abfe45e -
Trigger Event:
release
-
Statement type:
File details
Details for the file agent_chat_reader-0.1.6-py3-none-any.whl.
File metadata
- Download URL: agent_chat_reader-0.1.6-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d3f7043f43a7cae4f66ea12b17eb4ac1a50bbbc1d8fd4e397ba255aa1493d6b
|
|
| MD5 |
502c9e5e8f77a1822a7a10451c6b809d
|
|
| BLAKE2b-256 |
2a013e2aaeb7388bd7e880b9850cad21168b91814d9a13ffa6ca4136c8e99e56
|
Provenance
The following attestation bundles were made for agent_chat_reader-0.1.6-py3-none-any.whl:
Publisher:
release.yml on alik-git/agent-chat-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_chat_reader-0.1.6-py3-none-any.whl -
Subject digest:
9d3f7043f43a7cae4f66ea12b17eb4ac1a50bbbc1d8fd4e397ba255aa1493d6b - Sigstore transparency entry: 2242011644
- Sigstore integration time:
-
Permalink:
alik-git/agent-chat-reader@b2def91dacb3558b89f26219a81a2d308abfe45e -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/alik-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2def91dacb3558b89f26219a81a2d308abfe45e -
Trigger Event:
release
-
Statement type: