Capture and replay Claude Code's companion (/buddy) speech bubble messages.
The companion's insights are normally ephemeral — they appear briefly in a speech bubble and vanish. buddy-log captures them from the terminal output, logs them per-project and per-session, and optionally auto-injects them into your conversation as context.
claude-logwraps your Claude Code session withscript(or taps into a tmux session viapipe-pane) to capture all terminal rendering- A background watcher parses the raw output for ink round-border boxes (
╭╮╰╯│─) — the companion's speech bubbles - Messages are deduplicated (ink re-renders frequently) and saved to a per-session log
- A UserPromptSubmit hook checks for new messages on every prompt and injects them as context
The companion's name is detected automatically from your Claude Code session data.
git clone https://github.com/bashctrl/buddy-log.git
cd buddy-log
bash install.shThen add the hook to ~/.claude/settings.json (the installer prints the exact JSON).
Add to your shell rc:
alias claude-log='~/.claude/scripts/claude-log.sh'
alias buddy-log='~/.claude/scripts/buddy-log.sh'claude-log # Launches Claude Code with companion captureclaude-log --tap myapp # Start capturing in background
claude-log --tmux myapp # Tap + attach
claude-log --untap myapp # Stop capturing
claude-log --status # Show active tapsbuddy-log # This session's messages
buddy-log --today # All of today's messages
buddy-log --all # All messages for this project
buddy-log --tail # Follow new messages in real-timeIf auto-injection is not configured, you can manually inject companion messages inside a Claude Code session:
! buddy-log --contribute # Inject last message
! buddy-log --contribute -n 3 # Inject last 3 messages
With the UserPromptSubmit hook configured, new companion messages are automatically included as context on your next prompt. No action needed — just work normally and your companion's observations will appear when relevant.
~/.claude/
scripts/
buddy-extract.py # Core: terminal parser + message extractor
buddy-log.sh # CLI for viewing messages
claude-log.sh # Session wrapper + tmux tap manager
hooks/
buddy-contribute.sh # UserPromptSubmit hook for auto-injection
~/.claude/projects/<project>/logs/
session-<id>.raw # Raw terminal capture
buddy-<id>.log # Extracted companion messages
current.raw # Symlink to active session's raw log
.buddy-cursor # Tracks last injected message position
.tap-<tmux>.meta # Tap state for tmux sessions
- Claude Code with a
/buddycompanion configured - Python 3.10+
scriptcommand (standard on Linux/macOS)tmux(optional, for tapping existing sessions)
Claude Code's companion bubble is rendered by ink using a Box component with borderStyle: "round" — Unicode box-drawing characters ╭╮╰╯│─. The text is word-wrapped at 30 characters with a max box width of 34.
The parser strips ANSI escape codes from the raw terminal capture, then matches these box patterns to extract the text content. Consecutive duplicate messages (from ink's frequent re-renders) are deduplicated.
A heuristic filter excludes UI elements (trust prompts, menu items) that also use box-drawing characters.
MIT