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.6.1.tar.gz (550.2 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.6.1-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for claugs-0.6.1.tar.gz
Algorithm Hash digest
SHA256 bab96ae7192f770f24c0675adf9c4e2736ee8344e704419b81e836610064ac7e
MD5 bc0c84d3b0b776b1f4511cadbe8726d8
BLAKE2b-256 d5b244f62f2434934574c6e76394e851426c4b8e7898ac8734ff55b83707e121

See more details on using hashes here.

File details

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

File metadata

  • Download URL: claugs-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 32.2 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.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cef7bdd71187f3a031ac85b42ccd509aac63c6da07fab1c0e4cfb1e2c20d144c
MD5 5da704fc5f9f23ec47deaea56d7e8a0e
BLAKE2b-256 77aac76f5d6a4b2665035ee24b0676c091e0bc472c03c662c7473d2f6f2a6910

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