cd /news/developer-tools/session-indexer-giving-claude-code-a… · home topics developer-tools article
[ARTICLE · art-47735] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

session-indexer: giving Claude Code a memory that doesn't die with the project next door

A developer built session-indexer, a Go tool that indexes Claude Code session transcripts into a per-project SQLite database for semantic memory retrieval. The tool avoids centralized memory stores by keeping an append-only database inside each project's .claude/ directory, using bge-m3 embeddings via Ollama with automatic fallback to FTS5 keyword search. It injects relevant context from past sessions into new sessions based on git branch and commit messages.

read3 min views1 publishedJul 4, 2026

I come back to a project after a week off, and the first ten minutes always go the same way: scrolling through old sessions, trying to remember what we actually decided about X.

A simple rolling log — "here's what we did yesterday" — solves half of that. It doesn't solve "what have we discussed about this topic, across every session, ever?"

session-indexer

is my attempt at the second half.

It's a small Go tool that indexes Claude Code session transcripts for each project into a local SQLite database and retrieves relevant chunks by semantic similarity when a new session starts.

Tools like mempalace or agentmemory keep one shared store across every project and every agent. That architecture has one fatal flaw: **if the central store dies, everything dies. **** A corrupted vector index or a crashed MCP server takes down memory for every project you have, simultaneously, and recovery is not trivial.

session-indexer

does the opposite. .claude/sessions.db

lives inside the project's own .claude/

directory. Append-only. If one project's DB gets corrupted, the fix is to delete it and rerun mine

on the JSONL transcripts already on disk. Nothing else is affected.

Two hooks, wired into Claude Code's lifecycle:

session-index.sh

) — when a session ends, mines the JSONL transcript into .claude/sessions.db

, embedding each chunk via bge-m3

(Ollama) if it's available.session-recall.sh

) — when a new session opens, derives a search query from the current git branch name and recent commit messages, searches the index, and injects the top matching chunks as context. No manual query needed — it just knows roughly what you're about to work on.Manual search works too, any time:

session-indexer search "config validation approach" --db .claude/sessions.db
/recall config validation approach
session-indexer mine   <jsonl-path> --db .claude/sessions.db
session-indexer search <query>      --db .claude/sessions.db [--limit N] [--json]
session-indexer embed               --db .claude/sessions.db
session-indexer stats               --db .claude/sessions.db

mine

runs with a 50-second deadline — storage is fast and unconditional; embedding respects the deadline, so it never blows past Claude Code's Stop-hook timeout. Chunks that miss the deadline are stored but flagged for backfill via embed

— nothing silently disappears.

When Ollama + bge-m3

are available, search ranks by cosine similarity over 1024-dimension multilingual embeddings — English and Ukrainian both score well, which matters when half my sessions are in one language and half in the other.

When Ollama isn't running, or the store has zero embeddings yet, search automatically falls back to FTS5 BM25 keyword matching. No configuration, no hard dependency on an external service that might not be running.

modernc.org/sqlite

, pure Go, no CGO) — one file per project

go install ./cmd/session-indexer

Full hook-wiring steps are in the README — it's a few JSON entries in settings.local.json

, nothing exotic.

Most AI coding assistants either forget everything the moment the session ends, or bolt on a centralized memory service that becomes a single point of failure for your entire workflow. I wanted the boring option: per-project, append-only SQLite. The same architectural instinct that makes Git itself reliable — if it breaks, it breaks alone, and it heals by re-mining transcripts that are already on disk.

Open source, MIT licensed.

GitHub: https://github.com/valpere/session-indexer

If you're already piling up weeks of Claude Code sessions per project and re-deriving the same decisions from scratch every time you come back, this might save you the ten minutes of scrolling.

Valentyn Solomko — Ukrainian software engineer

── more in #developer-tools 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/session-indexer-givi…] indexed:0 read:3min 2026-07-04 ·