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.0.tar.gz (548.8 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.0-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: claugs-0.6.0.tar.gz
  • Upload date:
  • Size: 548.8 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.0.tar.gz
Algorithm Hash digest
SHA256 bbd243739940670bb4ebf27dc542e838d57affb87d537c32495dd89170dc5b52
MD5 31e4181c52f76dcf8e5f06a931e7517f
BLAKE2b-256 e76415bd2a852cb09d90ee8335d3fc82849ee77c68cf7b5805967726b42a8812

See more details on using hashes here.

File details

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

File metadata

  • Download URL: claugs-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 30.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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 300e709c56f109caefd98b2dc49d7e2f917284c16f7a23de13ce599f4d91803f
MD5 d92d5c1e0ad51fd948a7aba5b357a4ef
BLAKE2b-256 9577958ecfd99117f364325daa72ceb7169f19c0faa667bd729f52b38b48a486

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