Collection
How Memex collects conversation data from AI CLI tools
Memex reads directly from AI CLI source files — JSONL or JSON, depending on the tool. No modification to original data.
Supported Tools
Default paths on macOS:
| Tool | Data Path | Format |
|---|---|---|
| Claude Code | ~/.claude/projects/ | JSONL |
| Codex CLI | ~/.codex/ | JSONL |
| OpenCode | ~/.local/share/opencode/ | JSON |
| Gemini CLI | ~/.gemini/tmp/ | JSON |
Each tool has a dedicated adapter via ai-cli-session-collector. Paths can be customized via environment variables — see Configuration.
How Collection Works
Real-time (FileWatcher)
Monitors session directories for file changes. When a file is modified:
- Debounce (2 seconds)
- Collect only that file
- Trigger vector indexing for new messages
- Trigger Compact if new user prompt detected
Scheduled
- Startup: initial full collection
- Daily 02:30: full collection
See Scheduler for details.
Incremental Collection
Memex tracks the latest message timestamp per session. Only messages newer than the last known timestamp are imported.
First run imports everything; subsequent runs import only new messages.