SuperAPI AI Directory

longhand

Persistent local memory for Claude Code: indexes all sessions verbatim into SQLite and ChromaDB for semantic recall across your history, with no API calls.

Open website

About this tool

Longhand is a lossless local memory tool for Claude Code. It stores every tool call, every file edit, and every thinking block from each Claude Code session verbatim on the local machine, searchable, replayable, and supporting semantic recall with fuzzy natural-language questions. The entire process involves zero API calls, zero summaries, and no AI deciding what is worth remembering.

Purpose and Core Philosophy Longhand targets the AI memory problem. Most approaches choose to expand the context window so the model carries more state; Longhand does the opposite: memory does not need to be carried by the model, but by disk. Claude Code itself already writes sessions event by event to disk as JSONL, and Longhand reads these files and builds an index locally, thereby providing semantic retrieval over the entire history without sending tokens to any third-party API.

Main Capabilities

  • Complete capture: every ordinary message, tool call, file edit, and thinking block is preserved verbatim. A small number of purely framework bookkeeping entries (such as queue markers, progress heartbeats, and usage and status snapshots) are identified and skipped. The attachment.prompt field among attachment types may carry queued follow-up prompts; Codex's encrypted reasoning and context compaction records are discarded directly.
  • Loss prevention: Claude Code rotates session files after several weeks. Longhand stores them in SQLite before the files disappear; once ingested, history is retained permanently, even if the source JSONL is deleted. Install early; the past that was not captured cannot be recovered.
  • Cross-session recall: if there are more than 20 sessions under ~/.claude/projects/, you can search across all fixes, decisions, and conversations in about 29 milliseconds.
  • Token-budget friendly: the most commonly used tools have output limits, and a full recall across more than 100 sessions returns about 4K tokens, whereas directly reading a single raw session JSONL costs 10–50 times more.
  • Real-time ingestion: longhand ingest-live is run by Claude Code's Stop hook to track the activity record between assistant turns, and in-progress sessions can immediately be queried through list_sessions, get_session_timeline/timeline, get_file_history, and replay_file; it writes only events and does not generate embeddings, so recalland semantic search still require the SessionEnd stage or the reconcile --fix stage.
  • Plan history: the longhand plans list command and the list_plans MCP tool can present all writes and edits to ~/.claude/plans/*.md in history, with plans extracted as independent entities alongside episodes.
  • Index self-healing: the reconcile MCP tool wraps longhand reconcile --fix, dry-run by default; staleness signals will include stale: true and stale_reason in search and list_sessions responses; an optional launchd task schedule install-reconciler periodically runs reconcile --fix (macOS only).
  • Script support: status --json and doctor --json facilitate scripting.

How to use Install via PyPI, or use as a Claude Code plugin. You can first run longhand demo for a 60-second walkthrough on a fabricated three-session sample corpus, without touching the real ~/.claude and ~/.longhand. The first backfill of a large history (a ~/.claude/projects larger than 1 GB) takes about 10–30 minutes on an M-series Mac, with most of the time spent on the embedding model; --skip-analysis can defer episode/segment extraction and project/session-level vectors, but event embedding always runs. Typical throughput is about 1–2 sessions per second (full analysis). LONGHAND_DATA_DIR can relocate storage as a whole (except for longhand config --set, which always writes to ~/.longhand/config.json).

Use cases and limitations Suitable for developers who use Claude Code heavily every day and need cross-session retrospective fixes and decisions. Storage usage: about 7.5GB for heavy users (792+ sessions, 269k+ events), and 200–400MB for typical users. Supports Python 3.10–3.14; CI gating is Linux only. Windows is not supported and requires WSL2. macOS is the author's daily-use and manual verification platform, but it is not independently verified in CI. chromadb is pinned to <1.0.

Version and compatibility The current version is v1.2.3 (stable, verified through daily use, no serious findings in security audit). v1.0 made five commitments: CLI and MCP are frozen within 1.x and are only removed in a major version after being warned one minor version in advance; databases from 0.11+ can be opened in any subsequent 1.x, with migrations automatic and without renumbering; hooks never throw errors, never go online, and never block prompts; unknown transcript entries are preserved and shown in doctor; metrics are real. Verified against 792 real sessions (786 Claude Code, 6 Codex) and 45 inferred projects (measured on 2026-09-27), with 617 unit tests passing. Full documentation is in the Longhand Wiki.