Longhand
v1.3.2Local 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.
search Search Session Events (Semantic)
Semantic search across all stored Claude Code session events. Returns events matching a natural language query, with optional filters by event type, session, project, tool, or file path. IMPORTANT: Always pass session_id when you know which session to search — unscoped search returns noisy results. To read matches WITH their surrounding conversation, pass context_events (requires session_id): each match comes back with N events before and after it.
| Parameter | Type | Description |
|---|---|---|
query * | string | Natural language query |
context_events | integer | With session_id: return each match wrapped in N surrounding events (the old search_in_context) |
event_type | string | Filter: user_message, assistant_text, assistant_thinking, tool_call, tool_result |
file_path_contains | string | Filter to events with an explicit file_path containing this string (tool_call/tool_result events only — user messages won't have file_path metadata) |
limit | integer | Max results (default 10, capped at 1000) |
max_chars | integer | Max total output characters (default 12000). Set higher if you need full content. |
project_id | string | Scope search to a project by project_id |
project_name | string | Scope search to a project by name substring (e.g. 'gonzo') |
session_id | string | Scope search to a single session (prefix match — first 8 chars usually enough) |
tool_name | string | Filter by tool name (Edit, Bash, Read, etc.) |
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…
| Parameter | Type | Description |
|---|---|---|
limit | integer | Max results (default 50, capped at 1000) |
project | string | Filter by project path substring (e.g. 'longhand', 'bsoi') |
project_id | string | Exact project_id — returns that project's session timeline enriched with outcomes |
since | string | ISO date — only sessions after this (with project_id) |
until | string | ISO 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.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | |
event_type | string | Filter to a single event type |
include_thinking | boolean | |
limit | integer | Max events to return (default 100, capped at 1000) |
max_chars | integer | Max total output characters |
offset | integer | Skip first N events (for pagination) |
summary_only | boolean | Return only event_type, timestamp, tool_name, file_path — no content. Great for scanning long sessions. |
tail | integer | Return 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…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Exact file path to reconstruct (must match the path the session used) |
session_id * | string | Session ID (prefix match — first 8 chars usually enough) |
at_event_id | string | Optional: 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.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Exact file path to look up |
session_id | string | Optional: 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.
| Parameter | Type | Description |
|---|---|---|
query * | string | Natural language question |
max_chars | integer | Max total output characters |
max_episodes | integer | Max 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'.
| Parameter | Type | Description |
|---|---|---|
project * | string | Project name, alias, or ID (fuzzy match) |
max_chars | integer | Max output characters |
max_commits | integer | Max recent commits to show |
max_episodes | integer | Max 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…
| Parameter | Type | Description |
|---|---|---|
fix | boolean | Apply 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.
| Parameter | Type | Description |
|---|---|---|
episode_id | string | Detail mode: return full detail for exactly this episode (all other filters ignored) |
has_fix | boolean | If True, return only episodes that have a resolved fix |
keyword | string | Substring match against episode summary text |
limit | integer | Max results (default 20, capped at 1000) |
min_confidence | number | Minimum extraction confidence (0-1). Low-confidence episodes are noise-prone probes; pass 0 to include all. |
project_ids | array | Optional: filter to one or more project_ids |
since | string | ISO timestamp — only episodes after this date |
until | string | ISO 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).
| Parameter | Type | Description |
|---|---|---|
limit | integer | Max results (default 20, capped at 1000) |
max_chars | integer | Max output characters |
operation_type | string | Filter by operation type (default: all) |
query | string | Optional: commit message substring, hash prefix, or branch name. Omit (with session_id) to list a session's git operations chronologically. |
session_id | string | Optional: 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).
| Parameter | Type | Description |
|---|---|---|
category | string | Filter: e.g. 'cli tool', 'web app', 'library' |
keyword | string | Filter: matches project name, path, or aliases |
limit | integer | Max results (default 20, capped at 1000) |
match | string | Fuzzy-match mode: partial name/category/description → scored candidates with reasons |
verbose | boolean | Return 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.'
| Parameter | Type | Description |
|---|---|---|
limit | integer | Max plans to return (default 50, capped at 1000) |