Chat Log Search
Search local Codex, Claude Code, and Cursor chat logs with layered source and detail controls.
Scripts
| Script | Scope |
|---|---|
scripts/chat_log_search.py | All providers |
scripts/codex_log_search.py | Codex only |
scripts/claude_log_search.py | Claude Code only |
scripts/cursor_log_search.py | Cursor only |
Source Layers (--source)
history— fast prompt index (~/.codex/history.jsonl,~/.claude/history.jsonl)sessions— full session / transcript logsboth— history index plus session logs
Cursor has no history index; use --source sessions for Cursor.
Detail Layers (--detail)
prompts— user prompts onlymessages— user + assistant text, no tools or thinkingfinal— user prompts + final assistant reply per turn (no intermediate tool-step chatter)tools— tool inputs and outputs onlyfull— all extractable events (text, tools, reasoning, raw session events)
Quick Start
Fast user prompt search (all providers with history indexes):
bashpython3 skills/mem/chat-log-search/scripts/chat_log_search.py "linear ticket" --source history --detail prompts --limit 20
Codex clean transcript (user + final assistant replies):
bashpython3 skills/mem/chat-log-search/scripts/codex_log_search.py "memory system" --source sessions --detail final --limit 50
Claude tool audit:
bashpython3 skills/mem/chat-log-search/scripts/claude_log_search.py "posthog" --source sessions --detail tools --limit 50
Cursor full session dump search:
bashpython3 skills/mem/chat-log-search/scripts/cursor_log_search.py "paywall" --source sessions --detail full --limit 50
Everything across history + sessions:
bashpython3 skills/mem/chat-log-search/scripts/chat_log_search.py "sentry" --source both --detail full --limit 50
JSON output:
bashpython3 skills/mem/chat-log-search/scripts/claude_log_search.py "council" --source both --detail messages --json
Workflow
- Start with
--source history --detail promptsto find candidate sessions quickly. - Re-run the matching session with
--source sessions --detail finalfor a readable transcript. - Use
--detail toolswhen debugging agent behavior or MCP/tool usage. - Use
--detail fullwhen you need reasoning, raw events, or complete context. - Narrow noisy results with
--after,--before, or--session-id. - Add
--exclude-approval-reviewwhen mining user conversations or recurring patterns so Guardian assessment sessions do not duplicate injected transcripts.
Output
- Human-readable default:
timestamp | provider | source | detail | kind | role | session_id | snippet - JSON records include:
provider,source,detail,kind,role,session_id,timestamp,text,file,meta
Recency & limits
- Default:
--limit 50 --order recent→ 50 newest matching records - All matches:
--allor--limit 0 - Scan depth:
--recent-window N→ only search last N raw lines/records per file/session - Turn-based limit:
--detail final --limit-units turns --limit N
Full option reference: references/search_api.md
Notes
- Read-only. Do not modify files under
~/.codex,~/.claude, or~/.cursor. - Codex archived sessions are included by default; pass
--no-archivedon Codex/all scripts. - Codex/all-provider scripts support
--exclude-approval-review. It skips Guardian approval-review session logs from session metadata while preserving normal tasks, normal subagents, and history-index prompts. - Cursor prefers
agent-transcripts; pass--include-store-dbon Cursor/all scripts only if needed. - Log locations and formats:
references/log_locations.md - Detail layer reference:
references/search_layers.md


