Skip to content

Feature Request: Stream Claude output to log file in real-time #44

@mohsen1

Description

@mohsen1

Problem

When Ralph is running with --monitor, the logs/claude_output_*.log file remains empty (0 bytes) until Claude Code finishes execution. This makes it difficult to monitor what Claude is doing during long-running tasks.

Current Behavior

$ ls -la logs/
-rw-r--r--  1 user  staff     0 Jan  3 12:42 claude_output_2026-01-03_12-42-28.log

The log file shows 0 bytes even though Claude has been running for several minutes and making progress (visible via git diff or tmux).

Expected Behavior

The log file should stream Claude's output in real-time, similar to tee, so users can:

  • tail -f logs/claude_output_*.log to watch progress
  • Check logs without attaching to tmux session
  • Debug issues without interrupting the session

Suggested Implementation

Instead of capturing output at the end:

timeout ${TIMEOUT}s claude ... > "$LOG_FILE" 2>&1

Use unbuffered output or tee:

timeout ${TIMEOUT}s claude ... 2>&1 | tee "$LOG_FILE"
# or
script -q "$LOG_FILE" timeout ${TIMEOUT}s claude ...
# or use stdbuf
stdbuf -oL timeout ${TIMEOUT}s claude ... > "$LOG_FILE" 2>&1

Environment

  • Ralph version: 0.9.0
  • OS: macOS
  • Shell: fish/bash

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions