DEV Community

hiroshi yata
hiroshi yata

Posted on

Built CLI Tools to Browse AI Coding Assistant Logs (Claude Code & Codex CLI)

The Problem

If you're using AI coding assistants like Claude Code or OpenAI Codex CLI, you've probably had this experience:

"What was that solution Claude suggested last week?"
"How did I phrase that prompt that worked so well?"

Both tools store conversation logs locally, but finding past sessions is painful:

# Claude Code logs
~/.claude/projects/<project-hash>/*.jsonl

# Codex CLI logs  
~/.codex/sessions/YYYY/MM/DD/*.jsonl
Enter fullscreen mode Exit fullscreen mode

Navigating these nested directories manually? No thanks.

The Solution

I built two simple shell scripts that use fzf for interactive log browsing:

Each is a single file (~200 lines), requires only fzf and jq, and works out of the box.

Features

Both tools share the same command structure:

Command Description
(no args) Interactive mode - browse with fzf
list Show all projects/months
latest View the most recent session
tail Watch active session in real-time
status Check if CLI is running

Quick Demo

Interactive Mode

$ claude-logs
# → Select project with fzf
# → Select session with fzf
# → View formatted conversation
Enter fullscreen mode Exit fullscreen mode

Real-time Monitoring

$ claude-logs tail
# → Watch the active session live (Ctrl+C to exit)
Enter fullscreen mode Exit fullscreen mode

Status Check

$ claude-logs status
Claude Code is running (PID: 12345)

Recent sessions:
  2025-12-18 15:30 - my-project
  2025-12-18 14:00 - another-project
Enter fullscreen mode Exit fullscreen mode

Output Format

Raw JSONL logs are transformed into readable conversations:

━━━━━━━━━━ USER ━━━━━━━━━━
Fix the bug in this function

━━━━━━━━━━ CLAUDE ━━━━━━━━━━
I found the issue. The problem is...

🔧 [Tool: Edit file]
Enter fullscreen mode Exit fullscreen mode

For Codex CLI, you also get project path and git branch info:

=== rollout-xxx.jsonl ===
Project: /Users/me/my-project | Branch: main
Enter fullscreen mode Exit fullscreen mode

Installation

Prerequisites

brew install fzf jq
Enter fullscreen mode Exit fullscreen mode

Install claude-logs

git clone https://github.com/wondercoms/claude-logs.git
chmod +x claude-logs/claude-logs
cp claude-logs/claude-logs ~/.local/bin/
Enter fullscreen mode Exit fullscreen mode

Install codex-logs

git clone https://github.com/wondercoms/codex-logs.git
chmod +x codex-logs/codex-logs
cp codex-logs/codex-logs ~/.local/bin/
Enter fullscreen mode Exit fullscreen mode

Note: Make sure ~/.local/bin is in your PATH.

How It Works

The tools are straightforward:

  1. Scan the log directory structure
  2. Parse JSONL files with jq to extract messages
  3. Display options with fzf (with preview!)
  4. Format output with ANSI colors

The fzf preview feature is key - you can see conversation snippets before opening:

fzf --preview 'head -20 {} | jq -r "..."'
Enter fullscreen mode Exit fullscreen mode

Use Cases

1. Reference Past Solutions

Find how you solved a similar problem before.

2. Reuse Effective Prompts

Discover prompts that worked well and adapt them.

3. Daily Review

Review what you accomplished with AI assistance today.

4. Debugging

Check logs when the AI CLI behaves unexpectedly.

Current Limitations

  • macOS only (uses stat -f for timestamps)
  • Linux support would need stat --format - PRs welcome!

Links

Wrapping Up

If you're a heavy user of Claude Code or Codex CLI, give these tools a try. They're simple, dependency-light, and solve a real annoyance.

Found a bug? Want Linux support? Issues and PRs are welcome!


What tools do you use to manage your AI coding assistant workflows? Let me know in the comments!

Top comments (0)