Claude Code Agent
Integrate Anthropic's Claude Code CLI with Ralph TUI for AI-assisted coding.
Claude Code Agent
The Claude Code agent plugin integrates with Anthropic's claude CLI to execute AI coding tasks. It's the default agent for Ralph TUI and provides the richest feature set.
Claude Code supports subagent tracing - Ralph TUI can show nested tool calls (Read, Write, Task) in real-time as Claude works.
Prerequisites
Install Claude Code CLI:
Verify installation:
Basic Usage
Run with Claude
Use the --agent claude flag (or set as default in config):
Select a Model
Override the model with --model:
Enable Subagent Tracing
Press t in the TUI to cycle through tracing detail levels, or configure in config:
Configuration
Shorthand Config
The simplest configuration:
Full Config
For advanced control:
Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
model | string | - | Model variant: sonnet, opus, or haiku |
printMode | string | "text" | Output mode: text, json, or stream |
timeout | number | 0 | Execution timeout in ms (0 = no timeout) |
command | string | "claude" | Path to Claude CLI executable |
For simple configs, you can use the top-level command option instead of the [[agents]] array:
See Custom Command for details.
Models
Claude Code supports three model variants:
| Model | Description | Use Case |
|---|---|---|
sonnet | Balanced performance and cost | Most tasks (default) |
opus | Most capable, highest cost | Complex reasoning, architecture |
haiku | Fastest, lowest cost | Simple tasks, rapid iteration |
Select via CLI or config:
Subagent Tracing
Claude Code emits structured JSONL when running with --output-format stream-json. Ralph TUI parses this to display:
- Tool invocations (Read, Write, Bash, Task, etc.)
- Nested subagent calls and their output
- Duration and status of each operation
- Token usage and cost
Tracing Levels
| Level | Description |
|---|---|
off | No tracing, show raw output only |
minimal | Show start/complete events |
moderate | Events with description and duration |
full | Events with nested output and hierarchy |
Configure in config:
Or toggle in TUI:
- Press
tto cycle through levels - Press
T(Shift+T) to toggle the subagent tree panel - Press
uto toggle the subagent tracing panel
Subagent tracing requires Claude's streaming JSON output. Ralph TUI automatically adds the necessary flags (--verbose --output-format stream-json) when tracing is enabled.
Autonomous Operation
Ralph TUI runs Claude Code with --dangerously-skip-permissions for fully autonomous operation. This is required because ralph-tui cannot relay interactive prompts back to the agent.
Claude will execute file modifications, terminal commands, and more without asking for confirmation. Review tasks carefully before starting execution.
File Context
Claude Code supports adding directory context via --add-dir. Ralph TUI extracts directories from any file paths in your task and adds them automatically.
This helps Claude understand your project structure when working on related files.
How It Works
When Ralph TUI executes a task with Claude:
- Build command: Constructs
claude --print [options] - Pass prompt via stdin: Avoids shell escaping issues with special characters
- Stream output: Captures stdout/stderr in real-time
- Parse JSONL (if tracing enabled): Extracts structured tool call data
- Detect completion: Watches for
<promise>COMPLETE</promise>token - Handle exit: Reports success, failure, or timeout
CLI Arguments
Ralph TUI builds these arguments:
Rate Limit Handling
Configure fallback behavior for API rate limits:
When Claude hits rate limits:
- Retry with exponential backoff
- After
maxRetries, switch to first available fallback agent - Between iterations, attempt to recover to primary agent
Troubleshooting
"Claude CLI not found"
Ensure Claude is installed and in your PATH:
"Execution timeout"
Increase the timeout for complex tasks:
"Task not completing"
Ensure your prompt template includes instructions to output the completion token:
"Subagent tracing not showing"
- Ensure
subagentTracingDetailis not"off" - Press
uto toggle the tracing panel visibility - Check that Claude is outputting JSONL (run manually with
--verbose --output-format stream-json)
Next Steps
- OpenCode Agent - Multi-provider alternative
- Configuration - Full options reference
- Prompt Templates - Customize task prompts