Longhand

v1.3.2
io.github.Wynelson94/longhand Checked 15 hours ago Published 8 days ago

Local memory for Claude Code: 13 MCP tools for semantic recall, file replay, and git history.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_sessions List Indexed Sessions

List recent Claude Code sessions that Longhand has indexed. Returns session ID, project path, start/end timestamps, event count, and outcome (shipped/fixed/stuck/exploratory) for each session. Use this to orient before drilling into a specific session — e.g., 'which sessions touched this project last week?' Filter by project path substring to narrow results. NOT for searching content — use `search` or `recall` for that. NOT for cross-session git history — use `find_commits`. Pass project_id (with optional since/until) for a project's session timeline enriched with outcomes — the old ge…

ParameterTypeDescription
limitintegerMax results (default 50, capped at 1000)
projectstringFilter by project path substring (e.g. 'longhand', 'bsoi')
project_idstringExact project_id — returns that project's session timeline enriched with outcomes
sincestringISO date — only sessions after this (with project_id)
untilstringISO date — only sessions before this (with project_id)

get_session_timeline Session Event Timeline

Get a chronological timeline of events in a session. Supports session id prefix match. Use 'tail' to get only the last N events — how a session ended, the latest user message, the most recent tool call (this replaces get_latest_events). Use 'offset' to paginate through long sessions. NOT for searching — if you're looking for something specific in a session, use search with session_id and context_events instead of paginating this tool in a loop.

ParameterTypeDescription
session_id *string
event_typestringFilter to a single event type
include_thinkingboolean
limitintegerMax events to return (default 100, capped at 1000)
max_charsintegerMax total output characters
offsetintegerSkip first N events (for pagination)
summary_onlybooleanReturn only event_type, timestamp, tool_name, file_path — no content. Great for scanning long sessions.
tailintegerReturn only the last N events of the session

replay_file Reconstruct File State at a Point in Time

Reconstruct the exact state of a file at any point in a past session. Applies every Write/Edit event verbatim from the session JSONL in order — no summarization, no approximation. Returns the full file content as it existed at that moment. Use when you need to see 'what did this file look like after that refactor?' or 'what was the state before it broke?' Pass at_event_id to stop replay at a specific event; omit it to get the final state at session end. NOT for browsing every change to a file — use `get_file_history` for an edit-by-edit log instead. NOT for finding which session edited a f…

ParameterTypeDescription
file_path *stringExact file path to reconstruct (must match the path the session used)
session_id *stringSession ID (prefix match — first 8 chars usually enough)
at_event_idstringOptional: stop replay at this event ID to get mid-session state. Omit for final state at session end.

get_file_history Edit Log for a File Across Sessions

Get every edit ever made to a file across all sessions, in chronological order. Returns session ID, timestamp, event type (Write/Edit), old and new content for each change. Use this to answer 'how has this file evolved?' or 'which session edited this file last?' across your entire history. Optionally scope to a single session. NOT for reconstructing a file's state at a moment in time — use `replay_file` for that. NOT for content search inside the file body — use `search` with `file_path_contains` instead.

ParameterTypeDescription
file_path *stringExact file path to look up
session_idstringOptional: limit to a single session (prefix match)

get_stats Storage Statistics

Returns a flat key-value snapshot of Longhand's local SQLite + Chroma store: total sessions, events, tool_calls, file_edits, thinking_blocks, vectors_indexed, projects, episodes (resolved + unresolved), and the data_dir path. Use as a health check after a fresh upgrade, to verify ingest is keeping up with on-disk transcripts, or to answer 'how much have I indexed?' NOT for searching session content — `search` and `recall` are the tools for that. NOT for per-project counts — call `list_projects` for that. Takes no parameters; output is a single flat object.

recall Proactive Recall (Episodes + Narrative)

PROACTIVE MEMORY — START HERE for any 'do you remember...' question. Handles fuzzy time references ('a couple months ago'), project matching ('that game project'), and retrieval in ONE call. Returns a prebuilt markdown narrative from conversation segments and session timelines, plus matched projects and — when the work left clean problem→fix evidence — high-precision episodes with diffs, verbatim thinking blocks, and reconstructed file states. Do NOT manually search and paginate — use this tool first.

ParameterTypeDescription
query *stringNatural language question
max_charsintegerMax total output characters
max_episodesintegerMax episodes to return

recall_project_status Pick Up Where You Left Off (Project Status)

Get the current status of a project — where you left off, recent commits, unresolved issues, and latest conversation context. Takes a project name (fuzzy match) and returns a structured summary with git history, linked episodes, and conversation segments. Use this when someone says 'pick up where we left off on X', 'what's the status of X', or 'where did we end on X'.

ParameterTypeDescription
project *stringProject name, alias, or ID (fuzzy match)
max_charsintegerMax output characters
max_commitsintegerMax recent commits to show
max_episodesintegerMax recent episodes

reconcile Re-ingest Missing Transcripts (Disk ↔ DB)

Bridge disk↔DB drift from inside an MCP session. Re-ingests any on-disk Claude Code transcripts that are missing from the sessions table, have NULL project_id, or grew after their last full ingest and have been quiet for 30+ minutes (a turn the session's own hooks never captured), using current project-inference logic. Call this when another tool surfaces `stale: true` with a `stale_reason` pointing at reconcile, or when `recall_project_status` reports `session_count_on_disk > session_count_indexed`. Returns counts of fully-indexed, null-project, missing, changed, still-being-written (settli…

ParameterTypeDescription
fixbooleanApply the repairs: re-ingest missing, null-project, partially indexed, and changed transcripts. Defaults to false, which returns a dry-run summary.

find_episodes Find Problem→Fix Episodes

Structured search for problem→fix episodes. Filters: project_ids, time range, keyword, has_fix. Returns raw episode rows. Pass episode_id instead for FULL detail on one episode — referenced events, diff, and post-fix file state (the old get_episode). NOT for narrative recall — use `recall` for that.

ParameterTypeDescription
episode_idstringDetail mode: return full detail for exactly this episode (all other filters ignored)
has_fixbooleanIf True, return only episodes that have a resolved fix
keywordstringSubstring match against episode summary text
limitintegerMax results (default 20, capped at 1000)
min_confidencenumberMinimum extraction confidence (0-1). Low-confidence episodes are noise-prone probes; pass 0 to include all.
project_idsarrayOptional: filter to one or more project_ids
sincestringISO timestamp — only episodes after this date
untilstringISO timestamp — only episodes before this date

find_commits Find Commits Across Sessions

Search git history captured from sessions. With a query: match commits across all sessions by message, hash prefix, or branch name. Without a query but with a session_id: every git operation in that session in chronological order (the old get_session_commits).

ParameterTypeDescription
limitintegerMax results (default 20, capped at 1000)
max_charsintegerMax output characters
operation_typestringFilter by operation type (default: all)
querystringOptional: commit message substring, hash prefix, or branch name. Omit (with session_id) to list a session's git operations chronologically.
session_idstringOptional: scope to a single session (prefix match)

list_projects List Inferred Projects

Browse all projects Longhand has inferred from your session history. Returns project ID, display name, canonical path, category (cli tool / web app / library / etc.), and session count. Filter by keyword (matches name, path, aliases) or category. Pass match for fuzzy matching with scored reasons — 'which project did you mean?' (the old match_project). Use this to find a project_id before calling recall_project_status or list_sessions(project_id=...). Set verbose=true for full metadata (aliases, languages, keywords arrays).

ParameterTypeDescription
categorystringFilter: e.g. 'cli tool', 'web app', 'library'
keywordstringFilter: matches project name, path, or aliases
limitintegerMax results (default 20, capped at 1000)
matchstringFuzzy-match mode: partial name/category/description → scored candidates with reasons
verbosebooleanReturn full project rows including aliases, keywords, languages JSON

list_plans List Plan Writes

Every Write/Edit ever made to a `~/.claude/plans/*.md` file across all ingested sessions. Returned newest-first with session_id and the exact event_id of each write — pair with replay_file to reconstruct an early version of a plan that was later overwritten. Use when the user asks 'what was the original plan' or 'what did I plan for X.'

ParameterTypeDescription
limitintegerMax plans to return (default 50, capped at 1000)