ralph-loop plugin: multi-line prompts fail with newline security error
Resolved 💬 6 comments Opened Jan 8, 2026 by bigph00t Closed Mar 17, 2026
Bug Description
The ralph-loop plugin in claude-plugins-official fails when users provide multi-line prompts. Claude Code blocks the command with:
Command contains newlines that could separate multiple commands
Root Cause
The command file (plugins/ralph-loop/commands/ralph-loop.md) uses a `! bash block:
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS
When $ARGUMENTS contains newlines (common for detailed task descriptions), the substituted command has literal newlines, triggering Claude Code's security check.
Reproduction
- Install ralph-loop plugin
- Run:
/ralph-loop:ralph-loopwith a multi-line prompt like:
````
Build an API.
Make sure it has authentication.
Add rate limiting.
- Error:
Command contains newlines that could separate multiple commands
Suggested Fix
Change from `! auto-execute to an instructional approach where Claude:
- Parses the arguments directly (no shell involved)
- Runs
mkdir -p .claudeto ensure directory exists - Creates
.claude/ralph-loop.local.mdstate file using Write tool
This avoids passing user input through bash entirely.
Working command file:
---
description: "Start Ralph Loop in current session"
argument-hint: "PROMPT [--max-iterations N] [--completion-promise TEXT]"
allowed-tools: ["Bash", "Write"]
hide-from-slash-command-tool: "true"
---
# Start Ralph Loop
Parse these arguments: `$ARGUMENTS`
Extract:
- `--max-iterations N` (default: 0 = unlimited)
- `--completion-promise TEXT` (default: null)
- Everything else is the PROMPT
First run: `mkdir -p .claude`
Then create `.claude/ralph-loop.local.md` with this format:
` ` `
---
active: true
iteration: 1
max_iterations: [N or 0]
completion_promise: [TEXT in quotes, or null]
started_at: "[current UTC timestamp]"
---
[THE PROMPT TEXT]
` ` `
After creating the file, output:
` ` `
🔄 Ralph loop activated!
Iteration: 1
Max iterations: [N or unlimited]
Completion promise: [TEXT or none]
When you try to exit, the SAME PROMPT feeds back. To complete (if promise set), output: <promise>TEXT</promise>
` ` `
Then begin working on the prompt task.
Related Issues
- #16037
- #15708
- #12170
Environment
- Claude Code CLI
- ralph-loop plugin from claude-plugins-official
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗