Skip to content

Search

aichat search provides super-fast full-text search across all your Claude Code and Codex CLI sessions, powered by a Rust/Tantivy search engine. It offers a pleasant TUI for interactive browsing and a --json mode for agent consumption.

Session chains get long. You might have 50+ sessions in a lineage, each with thousands of lines. Grepping through JSONL files does not scale. aichat-search uses Tantivy (the engine behind Quickwit) to index sessions on first run, then returns results in milliseconds. The index updates incrementally on every aichat command.

The search engine is a separate Rust binary. Pick one method:

Terminal window
# Homebrew (macOS / Linux)
brew install pchalasani/tap/aichat-search
# Cargo (any platform with Rust toolchain)
cargo install aichat-search

aichat-search demo

Launch the TUI with an optional pre-filled query:

Terminal window
# Open TUI, type query interactively
aichat search
# Pre-fill a query
aichat search "langroid agent"

Inside the TUI you can refine the query, scroll results, and select a session to perform actions such as resume, export, or view.

FlagDescription
-g, --globalSearch all projects (not just current directory)
--dir PATHFilter to a specific directory (overrides -g)
--branch NAMEFilter to a specific git branch
-n, --num-results NLimit number of results
--agent claude|codex|allFilter by agent type
--after DATESessions modified after date
--before DATESessions modified before date
--min-lines NOnly sessions with at least N lines
--no-originalExclude original sessions
--no-trimmedExclude trimmed sessions
--no-rolloverExclude rollover sessions
--sub-agentInclude sub-agent sessions
--liveShow only currently running sessions
--by-timeSort by last-modified (default: relevance)
--jsonJSONL output for agents

Date formats: YYYYMMDD, YYYY-MM-DD, MM/DD/YY, MM/DD/YYYY. Optional time suffix: T16:45:23, T16:45, T16.

The search engine indexes JSONL session files from:

  • ~/.claude/projects/ — Claude Code sessions
  • ~/.codex/ — Codex CLI sessions

Custom locations can be set with --claude-home and --codex-home flags, or the CLAUDE_CONFIG_DIR and CODEX_HOME environment variables.

Terminal window
# Global search, recent sessions only
aichat search -g --after 01/15/26
# Filter to a specific project directory
aichat search --dir ~/Git/myproject
# Only Claude sessions with at least 50 lines
aichat search --agent claude --min-lines 50
# JSONL output sorted by time
aichat search --json --by-time "refactor"