Skip to content

Live/monitor mode fails with text output format - build_claude_command not called #164

@SimonHeistermann

Description

@SimonHeistermann

Bug Description

When using CLAUDE_OUTPUT_FORMAT="text" in .ralphrc combined with --live or --monitor flags, Ralph fails with:

stdbuf: unrecognized option '--verbose'

Root Cause

In ralph_loop.sh lines 1047-1057, build_claude_command() is only called when CLAUDE_OUTPUT_FORMAT="json":

if [[ "$CLAUDE_OUTPUT_FORMAT" == "json" ]]; then
    if build_claude_command "$PROMPT_FILE" "$loop_context" "$session_id"; then
        use_modern_cli=true
    fi
else
    log_status "INFO" "Using legacy CLI mode (text output)"
fi
However, when LIVE_OUTPUT=true (lines 1065+), the code still tries to use CLAUDE_CMD_ARGS which is empty/uninitialized for text mode. This results in stdbuf -oL receiving --verbose as its first argument instead of the claude command.

Steps to Reproduce
Set .ralphrc: CLAUDE_OUTPUT_FORMAT="text"
Run: ralph --live or ralph --monitor
Observe error: stdbuf: unrecognized option '--verbose'
Expected Behavior
Either:

Call build_claude_command() for text mode too, OR
Disable live/monitor mode when text format is used, OR
Build LIVE_CMD_ARGS independently for text mode
Environment
Ralph version: v0.11.4
macOS with GNU coreutils
Claude Code CLI: 2.1.32

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority: P1High - Core features

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions