Skip to main content

Parse and prettify Claude Code JSONL session logs

Project description

claude-stream

PyPI version

Parse and prettify Claude Code JSONL stream output.

claude-stream output

Installation

pip install claude-stream

For file watching support:

pip install "claude-stream[watch]"

claude-stream watch mode

Usage

# Read from a file
claude-stream session.jsonl

# Show only last N lines
claude-stream session.jsonl -n 20

# Read from stdin
cat session.jsonl | claude-stream

# Parse the most recent session
claude-stream --latest
claude-stream --latest -n 50              # Last 50 lines

# Find and parse a session by UUID
claude-stream --session abc123

Watch Mode

Watch for new messages in real-time (like tail -f):

# Watch all Claude sessions
claude-stream --watch ~/.claude/projects/

# Watch from any project directory (auto-resolves to Claude path)
claude-stream --watch .
claude-stream --watch ~/myproject

# Watch with initial context (last N lines)
claude-stream --watch . -n 10

When given a directory outside ~/.claude, the path is automatically converted to Claude's project format (e.g., /home/user/project becomes ~/.claude/projects/-home-user-project).

Output Formats

# ANSI terminal colors (default for TTY)
claude-stream session.jsonl

# Markdown
claude-stream --format markdown session.jsonl > export.md

# Plain text (default when piped)
claude-stream session.jsonl | less

Output automatically switches to plain text when piped. Use --format ansi to force colors.

Filtering

# Show only specific message types
claude-stream --show-type assistant --show-type user session.jsonl

# Show only messages with specific tools
claude-stream --show-tool Bash --show-tool Read session.jsonl

# Grep for patterns
claude-stream --grep "error" session.jsonl

# Exclude patterns
claude-stream --exclude "thinking" session.jsonl

Display Options

# Hide thinking blocks
claude-stream --hide-thinking session.jsonl

# Hide tool results
claude-stream --hide-tool-results session.jsonl

# Show metadata (UUIDs, timestamps)
claude-stream --show-metadata session.jsonl

# Compact mode (hide thinking, tool results, metadata)
claude-stream --compact session.jsonl

# Show line numbers
claude-stream --line-numbers session.jsonl

Architecture

  • Pydantic models parse JSON into typed message structures
  • Messages produce RenderBlock lists (flexible rendering primitives)
  • Formatters convert RenderBlocks to output formats (ANSI, Markdown, Plain)

License

WTFPL

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claugs-0.5.0.tar.gz (533.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claugs-0.5.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file claugs-0.5.0.tar.gz.

File metadata

  • Download URL: claugs-0.5.0.tar.gz
  • Upload date:
  • Size: 533.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for claugs-0.5.0.tar.gz
Algorithm Hash digest
SHA256 93b9e4f8e2983551602c729ce57145a79a1a68745fe56e3371939f6160b76e23
MD5 666bbffb12fdb372dcf8b1769b58da70
BLAKE2b-256 d97e6ae1c113d1e784edfcac817157acef275ad36ed781a3a9f949686aca039c

See more details on using hashes here.

File details

Details for the file claugs-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: claugs-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for claugs-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2e59a5f15ac18ddc5e16450a52823fe8aaca77d495545e79e9a3da2f25ee9f8
MD5 5817ed45b306ef16bb0207ed837d10b8
BLAKE2b-256 80945f4fb6fc2e98073d922631295ed3218e8d1cfc60f9c3a53aafcad8fc02a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page