https://github.com/nicosuave/memex
Claude Code & Codex CLI transcript search for both humans & agents. bm-25 or hybrid search with on-decide embeddings.
https://github.com/nicosuave/memex
bm25 claude-code codex-cli hybrid-search rag tantivy
Last synced: 7 days ago
JSON representation
Claude Code & Codex CLI transcript search for both humans & agents. bm-25 or hybrid search with on-decide embeddings.
- Host: GitHub
- URL: https://github.com/nicosuave/memex
- Owner: nicosuave
- License: mit
- Created: 2026-01-01T20:32:00.000Z (19 days ago)
- Default Branch: main
- Last Pushed: 2026-01-05T00:32:19.000Z (16 days ago)
- Last Synced: 2026-01-07T07:57:47.924Z (13 days ago)
- Topics: bm25, claude-code, codex-cli, hybrid-search, rag, tantivy
- Language: Rust
- Homepage:
- Size: 2.21 MB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# memex
Fast local history search for Claude and Codex logs. Uses BM-25 and optionally embeds your transcripts locally and layers on hybrid search.
Mostly intended for agents to use via skill. Intended workflow is to ask agent about a previous session & then it can narrow things down & retrieve history as needed.
Includes a TUI for browsing, finding and resumign both Claude Code & Codex CLI sessions.

## Install
```bash
brew install nicosuave/tap/memex
```
Or
```bash
curl -fsSL https://raw.githubusercontent.com/nicosuave/memex/main/scripts/setup.sh | sh
```
Then run setup to install the skill/prompt:
```bash
memex setup
```
Restart Claude/Codex after setup.
## Quickstart
Index (incremental):
```
memex index
```
Search (JSONL default):
```
memex search "your query" --limit 20
```
TUI:
```
memex tui
```
Notes:
- Embeddings are enabled by default.
- Searches run an incremental reindex by default (configurable).
Full transcript:
```
memex session
```
Single record:
```
memex show
```
Human output:
```
memex search "your query" -v
```
## Build from source
```
cargo build --release
```
Binary:
```
./target/release/memex
```
## Setup (manual)
If you built from source, run setup to install:
```bash
memex setup
```
This detects which tools are installed (Claude/Codex) and presents an interactive menu to select which to configure.
## Search modes
| Need | Command |
| --- | --- |
| Exact terms | `search "exact term"` |
| Fuzzy concepts | `search "concept" --semantic` |
| Mixed | `search "term concept" --hybrid` |
## Common filters
- `--project `
- `--role `
- `--tool `
- `--session `
- `--source claude|codex`
- `--since ` / `--until `
- `--limit `
- `--min-score `
- `--sort score|ts`
- `--top-n-per-session `
- `--unique-session`
- `--fields score,ts,doc_id,session_id,snippet`
- `--json-array`
## Background index service (macOS launchd)
Enable:
```
memex index-service enable
memex index-service enable --continuous
```
Disable:
```
memex index-service disable
```
`index-service` reads config defaults (mode, interval, log paths). Flags override.
## Embeddings
Disable:
```
memex index --no-embeddings
```
Recommended when embeddings are on (especially non-`potion` models): run the background
index service or `index --watch`, and consider setting `auto_index_on_search = false`
to keep searches fast.
## Embedding model
Select via `--model` flag or `MEMEX_MODEL` env var:
| Model | Dims | Speed | Quality |
|-------|------|-------|---------|
| minilm | 384 | Fastest | Good |
| bge | 384 | Fast | Better |
| nomic | 768 | Moderate | Good |
| gemma | 768 | Slowest | Best |
| potion | 256 | Fastest (tiny) | Lowest (default) |
```
memex index --model minilm
# or
MEMEX_MODEL=minilm memex index
```
## Config (optional)
Create `~/.memex/config.toml` (or `/config.toml` if you use `--root`):
```toml
embeddings = true
auto_index_on_search = true
model = "potion" # minilm, bge, nomic, gemma, potion
scan_cache_ttl = 3600 # seconds (default 1 hour)
index_service_mode = "interval" # interval or continuous
index_service_interval = 3600 # seconds (ignored when mode = "continuous")
index_service_poll_interval = 30 # seconds
claude_resume_cmd = "claude --resume {session_id}"
codex_resume_cmd = "codex resume {session_id}"
```
Service logs and the plist live under `~/.memex` by default.
`scan_cache_ttl` controls how long auto-indexing considers scans fresh.
Resume command templates accept `{session_id}`, `{project}`, `{source}`, `{source_path}`, `{source_dir}`, `{cwd}`.
The skill/prompt definitions are bundled in `skills/`.