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.1.tar.gz (532.7 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.1-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: claugs-0.5.1.tar.gz
  • Upload date:
  • Size: 532.7 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.1.tar.gz
Algorithm Hash digest
SHA256 1b1e6e2c4d7119d8cefe6d11a34cca6efca80405740ec59d9d443d542a31c7c6
MD5 0ad159bcedf6c2a944c6d2f7631f3246
BLAKE2b-256 4639b10aa66e8cd37f54f573d5be2604837e64e04475a65e6f2bceb891fefae8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: claugs-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 29.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea91eff20e53db3050451cb148fb414bc35082cb5e47a742135fffce5553b716
MD5 4d0d036cafa4e72ce14bb15fdd7106b3
BLAKE2b-256 ed25a49ebfa16dd7ae367489b72f4744612234de457e1d460e8d5dfc2a712d6d

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