Longhand memory tool silently dropped a 2,526-line Claude Code session
Nate Nelson discovered his MCP-based memory tool, Longhand, returned "No session history found" for a project despite a 2,526-line Claude Code transcript sitting on disk — exposing two distinct ingestion bugs that led to two new releases.
Score breakdown
Developers building MCP-based memory or context tools for Claude Code should audit their ingestion pipelines for silent hook failures and first-event-only `cwd` assumptions, both of which can cause entire sessions to vanish from recall without any visible error.
- 01Longhand is a local-only Python CLI + MCP server that indexes Claude Code JSONL transcripts into SQLite and ChromaDB for semantic recall — no API calls required.
- 02A `recall_project_status("bsoi-mesh-kit")` call returned "No session history found" despite a 2,526-line transcript sitting on disk from the same day.
- 03The largest session (823dd358) was never ingested because a Claude Code `SessionEnd` hook silently failed with no retry or error logging.
Nate Nelson's Longhand is a local-only Python CLI and MCP server that reads Claude Code's session transcripts, indexes every tool call, file edit, and thinking block into SQLite and ChromaDB, and exposes semantic recall via MCP tools — with no API calls required. When he invoked `recall_project_status("bsoi-mesh-kit")`, the tool returned "No session history found," despite four JSONL transcripts existing on disk for that project, including an 823dd358 session with 2,526 lines from earlier that day in which he had shipped three version bumps, invited a collaborator, and patched a Pantheon Slicer config bug.
First, the 2,526-line session was entirely absent from the `sessions` table — it had never been ingested.
Querying SQLite directly revealed two distinct bugs. First, the 2,526-line session was entirely absent from the `sessions` table — it had never been ingested. Longhand relies on a Claude Code `SessionEnd` hook running `longhand ingest-session`, but the hook silently failed with no retry, no log, and no detection mechanism. Second, two shorter sessions that *were* ingested had `project_id = NULL` and `project_path` set to `/Users/natenelson` (the home directory) rather than the actual project path. This happened because Longhand's ingest pipeline only read the `cwd` from the first transcript event, and those sessions had been launched from the home directory before the user `cd`'d into the project. Since `recall_project_status` filters `WHERE project_id = ?`, NULL-attributed rows were invisible to queries.
The fixes shipped in two releases. For the attribution bug, Nelson introduced mode-of-cwd project inference: the pipeline now tallies every event's `cwd`, filters out `$HOME` and paths lacking a project marker (`.git`, `pyproject.toml`, `package.json`, etc.), and picks the most frequent valid root — correctly attributing multi-repo sessions to whichever project saw the most activity. For the silent-drop bug, a backfill mechanism was added so missed sessions can be detected and recovered rather than lost indefinitely. Longhand is available on PyPI via `pip install longhand`.
Key facts
- 01Longhand is a local-only Python CLI + MCP server that indexes Claude Code JSONL transcripts into SQLite and ChromaDB for semantic recall — no API calls required.
- 02A `recall_project_status("bsoi-mesh-kit")` call returned "No session history found" despite a 2,526-line transcript sitting on disk from the same day.
- 03The largest session (823dd358) was never ingested because a Claude Code `SessionEnd` hook silently failed with no retry or error logging.
- 04Two shorter sessions were ingested but had `project_id = NULL` because Longhand only read the `cwd` from the first transcript event, which pointed to the home directory.