Skip to content

Repository files navigation

🧹 Claude Clean

CI Release Go Version License: MIT

Transform messy Claude Code JSON logs into beautiful terminal output. ✨


⚑ Quick Start

Install:

curl -fsSL https://raw.githubusercontent.com/ariel-frischer/claude-clean/main/install.sh | sh

Use it:

claude -p "your prompt" --verbose --output-format stream-json | cclean

That's it! πŸŽ‰


πŸ€” Why?

Claude Code's stream-json output is unreadable:

{"type":"assistant","message":{"content":[{"type":"text","text":"Hello!"}],"usage":{"input_tokens":150,"output_tokens":45}}}

With cclean, you get beautiful output in multiple styles:

Default (-s default) β€” boxed with box-drawing characters:

β”Œβ”€ SYSTEM [init]
β”‚ Model: claude-sonnet-4-20250514
β”‚ Claude Code: v1.0.12
β”‚ Tools: 12 available
└─

β”Œβ”€ ASSISTANT
β”‚ I'll check the project structure first.
└─

β”Œβ”€ TOOL: Bash
β”‚ Input:
β”‚   command: ls src/
└─

β”Œβ”€ TOOL RESULT
β”‚ index.ts
β”‚ utils.ts
β”‚ config.ts
└─

β”Œβ”€ ASSISTANT
β”‚ Found the source files. Let me read the config.
└─

β”Œβ”€ TOOL: Read
β”‚ Input:
β”‚   file_path: src/config.ts
└─

β”Œβ”€ RESULT: SUCCESS
β”‚ Turns: 4
β”‚ Duration: 12.35s (API: 8.21s)
β”‚ Cost: $0.0142
β”‚ Tokens: in=1250 out=380
└─

Compact (-s compact) β€” single-line summaries for quick scanning:

AST Hello! I can help you with that.
TOOL[Bash] echo "hello world"
RES hello world

Minimal (-s minimal) β€” clean and readable, no box-drawing:

ASSISTANT
  Hello! I can help you with that.

TOOL USE [Bash]
  echo "hello world"

Plain (-s plain) β€” no colors or formatting, ideal for piping/logs:

ASSISTANT
  Hello! I can help you with that.

TOOL USE [Bash]
  echo "hello world"

RESULT
  hello world

Bonus: Using -p with --output-format stream-json bypasses Claude's interactive UI, avoiding segfault issues some users experience.


πŸ“¦ Installation

πŸš€ One-liner (recommended)

curl -fsSL https://raw.githubusercontent.com/ariel-frischer/claude-clean/main/install.sh | sh

πŸ“₯ Manual Download

Download the appropriate binary for your platform from the latest release.

# After downloading, make it executable and move to PATH
chmod +x cclean-* && sudo mv cclean-* /usr/local/bin/cclean

πŸ”§ Build from source

git clone https://github.com/ariel-frischer/claude-clean && cd claude-clean
make install

πŸ—‘οΈ Uninstall

cclean --uninstall

🎯 Usage

# πŸ“‘ Live streaming (most common)
claude -p "your prompt" --verbose --output-format stream-json | cclean

# πŸ“„ From a file
cclean logs.jsonl

# πŸ“₯ From stdin
cat logs.jsonl | cclean

🎨 Output Styles

Style Flag Best For
Default -s default πŸ“¦ Boxed, colorful, easy to read
Compact -s compact πŸ“Š Single-line, quick scanning
Minimal -s minimal πŸ“ No boxes, still colored
Plain -s plain πŸ“‹ No colors, great for logs
cclean -s compact logs.jsonl  # Try different styles!

πŸ”§ Options

Flag Description
-s, --style Output style (default/compact/minimal/plain)
-v, --verbose Show system reminders
-l, --line-numbers Show source line numbers
-t Show elapsed time per message
-V, --usage Show token usage stats

🌈 What Gets Parsed

Type Color Description
πŸ”§ SYSTEM Cyan Init, config, session info
πŸ’¬ ASSISTANT Green Claude's responses
πŸ› οΈ TOOL Yellow Tool calls (Bash, Read, Write...)
βœ… RESULT Gray Tool output
❌ ERROR Red Tool errors
πŸ“Š USAGE Magenta Token stats & costs

πŸ“š Documentation


πŸ—‘οΈ Uninstall

cclean --uninstall

πŸ“œ License

MIT Β© Ariel Frischer

About

Beautiful terminal parser for Claude Code's streaming JSON output

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

15 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages