A wrapper for Anthropic's Claude CLI that automatically logs conversations, preserves color output, and summarizes conversations with intelligent file naming.
- Auto-logging: Logs all Claude CLI conversations to timestamped files
- Color support: Preserves Claude's colorized output in the terminal
- Terminal title integration: Uses the terminal window title in log filenames
- Clean logs: Strips ANSI color codes from log files for readability
-
Clone this repository:
git clone https://github.com/user/claude-logger.git cd claude-logger -
Make the script executable:
chmod +x claude-log
-
Move to a directory in your PATH:
# Option 1: Link to /usr/local/bin sudo ln -s "$(pwd)/claude-log" /usr/local/bin/claude-log # Option 2: Move to an existing bin directory cp claude-log ~/bin/
- Claude CLI installed and working
- Access to Anthropic's API
Simply use claude-log instead of claude:
claude-logAll arguments are passed directly to Claude:
claude-log --cwd /path/to/project-
--versionor-v: Display version informationclaude-log --version
-
--nolog: Run Claude without logging (just passes through to Claude CLI)claude-log --nolog
When you exit Claude, the wrapper will:
- Check if any meaningful conversation occurred (ignores sessions with just "exit" commands)
- If a real conversation happened, it will:
- Generate a 1-3 word summary of your conversation
- Rename the log file to include this summary
- Display the final log file path
All logs are saved in ~/claude-logs/ with filenames like:
claude-20250315-123456-project-refactoring.log
- Runs Claude CLI in a pseudo-TTY to preserve color output
- Captures all input and output to a log file, including ANSI escape sequences
- Extracts the window title that Claude set during the session
- Uses the extracted title in the log filename for context-aware naming
- Saves the log with ANSI color codes removed for readability
- Works across both macOS and Linux terminal environments
- 1.3.6: Improved window title extraction for both macOS and Linux
- 1.3.5: Enhanced terminal title detection with escape sequence parsing
- 1.3.0: Added terminal window title support for log filenames
- 1.2.1: Added cross-platform compatibility for macOS and Linux
- 1.2.0: Added direct color support, smart filtering for exit-only sessions, and
--nologoption - 1.0.0: Initial release
MIT License
- Terminal Title: This script uses your terminal window title to name log files. If your terminal automatically updates window titles based on conversation topics, this will create context-aware log filenames without any additional API calls.
- Anthropic - Creators of Claude