Codex Chat Search
Overview
Search only local Codex history under ~/.codex.
Prioritize fast narrowing by date and thread_name, then inspect matching session files to produce a simple answer.
The bundled script is offline-only and should not send conversation contents outside the machine.
Workflow
- Infer as many search hints as possible from the current conversation before asking anything.
- Treat
today,yesterday, and similar phrases as exact calendar dates before searching. - Search
session_index.jsonlfirst. - Use session JSONL files under
sessions/andarchived_sessions/to enrich or recover candidates when the index is insufficient. - Prefer evidence from user messages over diffs, logs, long code blocks, and developer instructions.
- Return the best matches in a simple format with:
- conversation name
- date and time
- date and time of the last user message
- short description
Ask Only When Needed
Ask the user one concise question about what the conversation was about only if the current thread does not already provide enough usable hints such as:
- approximate date
- remembered phrase
- topic
- file, tool, or repo mentioned
If you ask, request the smallest missing clue.
Output Rules
Keep the final answer simple. For each candidate, provide:
NombreFechaUltimo mensaje usuarioDescripcion
Include the local file path only when it materially helps disambiguate or when the user asks for it.
Use script --verbose output when path, score, or match reasons are needed for disambiguation.
Quick Start
Use the bundled script first:
python scripts/find_codex_conversations.py --query "reescalar imagenes" --date 2026-04-21 --json
Useful variations:
python scripts/find_codex_conversations.py --query "assembly" --max-results 5 --json
python scripts/find_codex_conversations.py --date 2026-04-21 --query "raw" --query "imagen" --json
python scripts/find_codex_conversations.py --date-from 2026-04-20 --date-to 2026-04-21 --query "resume" --json
python scripts/find_codex_conversations.py --query "imagenes" --verbose
Search Heuristics
- Give the highest weight to exact phrase matches in
thread_name. - Next prefer exact phrase matches in user-authored messages.
- Then use token matches in
thread_name, first user message, and later user messages. - Treat accented and unaccented text as equivalent for search matching.
- Use date filters early to reduce noise.
- If the user says the chat was from Codex, do not search outside local Codex history.
Resources
scripts/
scripts/find_codex_conversations.py: searchsession_index.jsonlandsessions/**/*.jsonl, score candidates, and emit structured results.
references/
references/codex-history-layout.md: local history locations and file roles.references/search-playbook.md: fallback tactics for weak or ambiguous search hints.