Skip to content

Architecture

nathan nelson edited this page Apr 13, 2026 · 1 revision

Architecture

How Longhand turns a directory of JSONL files into sub-second semantic recall over your entire Claude Code history.

The pipeline

JSONL files (~/.claude/projects/)
    ↓
Parser (longhand/parser.py)
    ↓
Extractors (errors, file refs, topics, git)
    ↓
Per-session analysis (project inference, episode extraction, segment clustering, outcomes)
    ↓
Storage (SQLite + ChromaDB)
    ↓
Recall layer (time parsing, project matching, ranking, narrative)
    ↓
CLI + MCP server

Core modules

Parser

Extractors

Analysis

Storage

Replay

Recall

MCP server


Key invariants

  • Everything is local. SQLite and ChromaDB live in ~/.longhand/. No network calls during recall.
  • No summarization. Events are stored verbatim. The AI is never the gatekeeper of its own memory.
  • Deterministic analysis. Rules-based, reproducible, same input → same output.
  • Fail-open hooks. Claude Code proceeds even if Longhand crashes. Memory layer failure never blocks work.
  • Parameterized SQL everywhere. No string concatenation, no command injection surface.

Where it lives on disk

Extending Longhand

Clone this wiki locally