sessions
Search and memory across your AI coding sessions.
One index over Claude Code, Codex, Pi, and OpenCode — fuzzy-find and resume past sessions from the CLI, give agents recall over prior work via MCP, and see where your tokens go.
Why
Every AI coding session leaves a transcript behind. Claude Code buries them in ~/.claude/projects/, Codex and Pi have their own layouts, OpenCode keeps everything in a SQLite database — and everything in them (what you tried, what you decided, what broke) is effectively write-only.
sessions builds a full-text search index over all of it and makes that history useful in three ways:
- Search & resume (CLI) — fuzzy-find any past session across all four tools, ranked by relevance, and jump back in.
- Agent memory (MCP) — agents search your history, pull a repo-scoped context primer when you return to a codebase, and answer "what did I do last week?" via bundled skills.
- Usage reports — a token/cost dashboard across tools, models, and projects.
Install
Homebrew
brew install nicknisi/formulae/sessions
Or, equivalently:
brew tap nicknisi/formulae
brew install sessions
npm (macOS, Linux, Windows)
npm install -g @nicknisi/sessions
Or run one-off without installing:
npx @nicknisi/sessions wrapped
From source
git clone https://github.com/nicknisi/sessions && cd sessions
bun install && bun run build
The compiled binary is at dist/sessions. Requires Bun when building from source. The Homebrew install is a standalone binary — no runtime needed.
Dependencies
- fzf (optional but recommended) — used for fuzzy selection. If fzf is not installed, a built-in numbered list selector is used as a fallback. Install with
brew install fzf.
- Ollama (optional) — enables semantic recall (see below). If Ollama is not running, search stays purely lexical. Install from ollama.com.
Semantic recall
Search is lexical by default (full-text ranking over titles, paths, commands, and messages). When an embedding endpoint is available, sessions adds an optional semantic lane that fuses with — never replaces — the lexical results, so a paraphrase like "flaky tests" can surface a session about "intermittent CI failures".
- Providers: the lane defaults to Ollama on
http://localhost:11434 (override with SESSIONS_OLLAMA_URL) using nomic-embed-text (override with SESSIONS_OLLAMA_MODEL; ollama pull nomic-embed-text to install it). Set SESSIONS_EMBED_PROVIDER to opt into a remote endpoint instead: openai for any OpenAI-compatible /embeddings API (default https://api.openai.com/v1, model text-embedding-3-small) or tei for Text Embeddings Inference (default http://localhost:8080, model read from its /info). SESSIONS_EMBED_URL, SESSIONS_EMBED_MODEL (openai only) and SESSIONS_EMBED_API_KEY (sent as Authorization: Bearer) configure the remote providers; the key is required only for the real OpenAI endpoint, where OPENAI_API_KEY is used as a fallback.
- Absence is first-class: no endpoint, an unreachable server, the model not pulled, an unknown
SESSIONS_EMBED_PROVIDER, or a malformed URL all degrade to identical lexical behavior. Nothing is contacted unless a provider is detected or named — there is no flag.
- Threshold:
SESSIONS_EMBED_THRESHOLD (a number in (0, 1)) overrides the cosine floor below which a nearest-vector match is ignored; the default is 0.45. Cosine values are model-specific. With intfloat/multilingual-e5-small, unrelated sessions already score about 0.77–0.88, so 0.45 filters nothing. On two small mixed Korean/English corpora I measured, the true paraphrase hit ranked first every time but beat the best unrelated session by only 0.02–0.08, and the bands overlapped across the two corpora, so no single floor separated them (0.84 missed a true hit on both). Treat it as a per-corpus value to measure for your own model, not a recommended setting.