Package Exports
- @udx/sessions
- @udx/sessions/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@udx/sessions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sessions
Search, browse, and export Claude Code session transcripts from the command line.
Sessions reads the JSONL transcript files stored by Claude Code in ~/.claude/projects/ and provides full-text search, filtering, and export across every conversation you have had.
Installation
npm install -g @udx/sessionsCommands
List sessions
sessions list
sessions list -p my-project -n 10
sessions list --since 2026-01-01 --fullSearch transcripts
sessions search "authentication bug"
sessions search "refactor" -p my-project -C 2
sessions search "deploy" --since 2026-05-01The -C flag shows surrounding conversation messages for context (not text lines within a message). Each context message is labeled [you] or [claude] so you can follow the conversation flow.
Show a session
sessions show a1b2c3d4
sessions show a1b2c3d4 --preview
sessions show a1b2c3d4 --assistant-only
sessions show a1b2c3d4 --no-tools -n 20The --preview flag shows a compact list of the first few prompts, useful for quickly understanding what a session was about. Combine with --assistant-only to preview Claude's responses instead.
List projects
sessions projectsExport a session
sessions export a1b2c3d4
sessions export a1b2c3d4 -f json -o transcript.json
sessions export a1b2c3d4 -f textBrowse prompt history
sessions history
sessions history -s "deploy" -n 50Options
All commands support --json for machine-readable output.
| Option | Commands | Description |
|---|---|---|
-p, --project <path> |
list, search | Filter by project path (substring match) |
-n, --limit <n> |
list, search, show, history | Max results to display |
--since <date> |
list, search | Only sessions modified after this date |
--full |
list | Include full message counts (slower) |
-C, --context <n> |
search | Surrounding conversation messages to show |
--preview |
show | Show first few prompts as a compact overview |
--user-only |
show | Show only user messages |
--assistant-only |
show | Show only assistant messages |
--no-tools |
show | Hide tool-use blocks |
--offset <n> |
show | Skip first N messages |
-f, --format <fmt> |
export | Output format: md, json, text |
-o, --output <file> |
export | Write to file instead of stdout |
-s, --search <query> |
history | Filter history by prompt text |
JSON output
The --json flag on list includes a display field (the first user prompt) for easy pipeline usage:
sessions list -n 5 --json | jq '.[].display'Search results include contextMessages with type, text, and position fields when using -C.
Changelog
1.2.1
- Fixed
--preview --assistant-onlyconflict (preview no longer forces user-only) - Fixed
cleanSnippetregex that corrupted search results for markdown-heavy content - Simplified match count display to
(N matches in session)
1.2.0
- Added
--previewflag for quick session overviews - Redesigned
-Ccontext to show surrounding conversation messages (not text lines) - Added
displayfield tolist --jsonoutput - Improved search snippet quality (strips markdown noise)
- Improved occurrence count display per session
1.1.0
- Fixed history command showing
(empty)instead of prompt text - Fixed
--no-toolsleaving blank message shells - Fixed
--assistant-onlyshowing tool calls instead of text responses - Fixed export producing empty blocks for tool-only messages
- Added
--sincedate filter to search command - Added per-session hit counts in search results
How it works
Claude Code stores each session as a JSONL file under ~/.claude/projects/<encoded-project>/. Sessions streams these files line by line, so it handles large transcripts without loading everything into memory. Project paths are resolved from the session metadata back to human-readable directory names.
License
MIT