npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cc-session-export

v1.0.0

Published

Export Claude Code sessions to Word (.docx) and PDF documents

Downloads

91

Readme

cc-session-export

Export Claude Code session files to Word (.docx) and PDF formats with full-text search, filtering, and interactive browsing.

Installation

Install globally:

npm install -g cc-session-export

Or clone and link locally:

git clone <repo>
cd sessionexport
npm install
npm link

Quick Start

Open the interactive browser:

cc-session-export

This scans ~/.claude/projects/ for session .jsonl files and presents a numbered list. Use the commands below to navigate and export.

Interactive Browser Commands

When running cc-session-export without arguments:

  • Number (e.g., 1, 3, 10) — Export that session
  • Range (e.g., 1-5) — Export sessions 1 through 5. You'll be prompted to merge them into a single document
  • s — Search by text across all session content
  • f — Filter by project name (substring match)
  • a — Export all sessions
  • n — Next page
  • p — Previous page
  • r — Reset filters/search
  • q — Quit

The list shows project name, session age, file size, and a preview of the first few messages.

Command-Line Flags

# Export the 1 most recent session
cc-session-export --latest

# Export the 10 most recent sessions, merged into one document
cc-session-export --latest 10 --merge

# Filter by project name (substring match)
cc-session-export --project myapp

# Full-text search across all sessions
cc-session-export --search "user authentication"

# Export all sessions at once
cc-session-export --all

# Compact format: strips tool calls/results, conversation only
cc-session-export --compact

# Keep all message types but remove tool I/O blocks
cc-session-export --no-tools

# Export as PDF instead of docx
cc-session-export --pdf

# Custom output directory (default: ./cc-session-exports)
cc-session-export --output ~/my-exports

# Show help
cc-session-export --help

Flags combine freely:

cc-session-export --project myapp --compact --merge --latest 3 --pdf

This exports the 3 most recent sessions from the "myapp" project, strips tool I/O, merges them into a single PDF, and uses compact formatting.

What the Output Looks Like

Each exported document is professionally formatted with:

  • Color-coded sections: User messages in blue, assistant responses in green, tool calls in orange
  • Dark-themed code blocks: Syntax-highlighted code with a slate background for readability
  • Metadata tables: Timestamp, token counts, model, temperature, and other execution details
  • Headers and footers: Page numbers on every page
  • Clean typography: Proper heading hierarchy, readable font sizing, appropriate spacing

Documents are optimized for both screen viewing and printing.

How It Works

The tool scans your ~/.claude/projects/ directory for .jsonl session files (the format Claude Code uses to store conversation history). It parses each file, extracts messages with their roles (user, assistant, tool calls), metadata, and code execution results. The interactive browser lets you search, filter, and select sessions. When you choose to export, the tool formats everything into a structured .docx or .pdf document with color coding, tables for metadata, and proper typography. You can merge multiple sessions into one document for context-heavy exports.

Tips

  • Feeding to other AIs: Use --compact when exporting sessions to feed to ChatGPT, Gemini, or Claude. This strips tool calls and results, keeping only the conversation, which reduces token count and improves clarity.

  • Multi-session project context: Use --merge to combine multiple related sessions into one document. Useful for generating complete project documentation or context files.

  • Search before export: Use s in the interactive browser to find sessions containing specific keywords before exporting. Saves time when you have many sessions.

  • Filtering by project: Use f or --project to narrow down to a specific project folder, then export in batch with --latest 5 --merge.

  • PDF vs DOCX: Use --pdf when you need a format that can't be edited and distributes cleanly. Use .docx when you might want to edit or add notes to the export.

  • Preview before export: The interactive browser shows a preview of each session (first few messages) so you can confirm you're exporting the right one before committing.

Requirements

  • Node.js 18+
  • docx - Word document generation
  • pdfkit - PDF generation

License

MIT