Skip to content

[BUG] /ralph-wiggum:ralph-loop slash command fails permission check #16398

@wanderingnature

Description

@wanderingnature

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Summary

The /ralph-wiggum:ralph-loop slash command consistently fails with a bash permission error, even when valid permission patterns are configured. The command works when Claude falls back to calling the setup script directly via Bash().

Environment

  • Claude Code v2.0.76
  • Ralph Wiggum plugin (commit 15b07b46dab3)
  • Ubuntu Linux

Steps to Reproduce

  1. Configure .claude/settings.json with permission pattern:

    {
      "permissions": {
        "allow": [
          "Bash(:*/ralph-wiggum/:*)"
        ]
      }
    }
  2. Run the slash command:

    /ralph-wiggum:ralph-loop "Simple task" --completion-promise "DONE" --max-iterations 5
    
  3. Observe permission error

Expected Behavior

The slash command should execute the setup script with proper permission matching.

Actual Behavior

The command fails with:

Error: Bash command permission check failed for pattern "```!
"/home/nicholas/.claude/plugins/cache/claude-plugins-official/ralph-wiggum/15b07b46dab3/scripts/setup-ralph-loop.sh" "Simple task" --completion-promise "DONE" --max-iterations 5
```": This command requires approval

Note the triple backticks and ! wrapping the command in the error output. This suggests the plugin is formatting the bash command incorrectly before passing it to Claude Code's permission checker.

Workaround

When the slash command fails, Claude can retry by calling the script directly via Bash():

Bash("/home/nicholas/.claude/plugins/cache/claude-plugins-official/ralph-wiggum/15b07b46dab3/scripts/setup-ralph-loop.sh" "Simple task" --completion-promise "DONE" --max-iterations 5)

This works correctly and triggers the normal approval flow.

Root Cause

The issue is in commands/ralph-loop.md. The original file uses a ```! code block syntax to specify bash execution:

Original (broken):

---
description: "Start Ralph Wiggum loop in current session"
argument-hint: "PROMPT [--max-iterations N] [--completion-promise TEXT]"
allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh)"]
hide-from-slash-command-tool: "true"
---

# Ralph Loop Command

Execute the setup script to initialize the Ralph loop:

` ` `!
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS
` ` `

...

The ```! syntax appears to be intended as a plugin directive meaning "execute this command." However, Claude Code's permission system receives the literal string including the backticks and ! rather than just the command inside. The permission checker therefore sees:

```!
"/path/to/script.sh" "args"

Instead of:

"/path/to/script.sh" "args"


This causes all permission patterns to fail matching, regardless of how they're configured.

### Is This a Plugin Bug or Claude Code Bug?

**This is a plugin authoring bug**, not a Claude Code bug. The ` ```! ` syntax is either:
- Undocumented/unsupported
- Deprecated
- Never worked as intended

The correct approach is to instruct Claude to invoke the `Bash()` tool directly in the command body, which the plugin's `allowed-tools` frontmatter already permits.

## Tested Permission Patterns (All Failed with Original Plugin)

- `Bash(*/ralph-wiggum/*/scripts/*.sh:*)`
- `Bash(*/ralph-wiggum/*/scripts/*.sh *)`
- `Bash(:*setup-ralph-loop.sh:*)`
- `Bash(:*/ralph-wiggum/:*)`

None of these patterns match because the command string is malformed before reaching the permission checker.

## Fix

Replace the contents of `commands/ralph-loop.md` with:

```markdown
---
description: "Start Ralph Wiggum loop in current session"
argument-hint: "PROMPT [--max-iterations N] [--completion-promise TEXT]"
allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh:*)"]
hide-from-slash-command-tool: "true"
---

# Ralph Loop Command

Execute this bash command to initialize the Ralph loop:

Bash("${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS)

Please work on the task. When you try to exit, the Ralph loop will feed the SAME PROMPT back to you for the next iteration. You'll see your previous work in files and git history, allowing you to iterate and improve.

CRITICAL RULE: If a completion promise is set, you may ONLY output it when the statement is completely and unequivocally TRUE. Do not output false promises to escape the loop, even if you think you're stuck or should exit for other reasons. The loop is designed to continue until genuine completion.

Changes made:

  1. Removed ```! code block wrapper - this was being passed literally to the permission checker
  2. Added :* to allowed-tools pattern (Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh:*)) to permit any arguments to be passed to the script

Verified Working

After applying this fix, the slash command works correctly:

/ralph-wiggum:ralph-loop "Document the full generation process..." --completion-promise "GENERATION_DOCUMENTED" --max-iterations 8

The Ralph loop activates as expected without permission errors.

What Should Happen?

plugin should run

Error Messages/Logs

## Summary

The `/ralph-wiggum:ralph-loop` slash command consistently fails with a bash permission error, even when valid permission patterns are configured. The command works when Claude falls back to calling the setup script directly via `Bash()`.

## Environment

- Claude Code v2.0.76
- Ralph Wiggum plugin (commit 15b07b46dab3)
- Ubuntu Linux

## Steps to Reproduce

1. Configure `.claude/settings.json` with permission pattern:
   
   {
     "permissions": {
       "allow": [
         "Bash(:*/ralph-wiggum/:*)"
       ]
     }
   }
   

2. Run the slash command:
   
   /ralph-wiggum:ralph-loop "Simple task" --completion-promise "DONE" --max-iterations 5
   

3. Observe permission error

## Expected Behavior

The slash command should execute the setup script with proper permission matching.

## Actual Behavior

The command fails with:


Error: Bash command permission check failed for pattern "!
"/home/nicholas/.claude/plugins/cache/claude-plugins-official/ralph-wiggum/15b07b46dab3/scripts/setup-ralph-loop.sh" "Simple task" --completion-promise "DONE" --max-iterations 5
": This command requires approval


Note the **triple backticks and `!`** wrapping the command in the error output. This suggests the plugin is formatting the bash command incorrectly before passing it to Claude Code's permission checker.

## Workaround

When the slash command fails, Claude can retry by calling the script directly via `Bash()`:


Bash("/home/nicholas/.claude/plugins/cache/claude-plugins-official/ralph-wiggum/15b07b46dab3/scripts/setup-ralph-loop.sh" "Simple task" --completion-promise "DONE" --max-iterations 5)


This works correctly and triggers the normal approval flow.

## Root Cause

The issue is in `commands/ralph-loop.md`. The original file uses a ` ! ` code block syntax to specify bash execution:

**Original (broken):**

---
description: "Start Ralph Wiggum loop in current session"
argument-hint: "PROMPT [--max-iterations N] [--completion-promise TEXT]"
allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh)"]
hide-from-slash-command-tool: "true"
---

# Ralph Loop Command

Execute the setup script to initialize the Ralph loop:

` ` `!
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS
` ` `

...


The ` ! ` syntax appears to be intended as a plugin directive meaning "execute this command." However, Claude Code's permission system receives the **literal string including the backticks and `!`** rather than just the command inside. The permission checker therefore sees:


!
"/path/to/script.sh" "args"



Instead of:

"/path/to/script.sh" "args"


This causes all permission patterns to fail matching, regardless of how they're configured.

### Is This a Plugin Bug or Claude Code Bug?

**This is a plugin authoring bug**, not a Claude Code bug. The ` ! ` syntax is either:
- Undocumented/unsupported
- Deprecated
- Never worked as intended

The correct approach is to instruct Claude to invoke the `Bash()` tool directly in the command body, which the plugin's `allowed-tools` frontmatter already permits.

## Tested Permission Patterns (All Failed with Original Plugin)

- `Bash(*/ralph-wiggum/*/scripts/*.sh:*)`
- `Bash(*/ralph-wiggum/*/scripts/*.sh *)`
- `Bash(:*setup-ralph-loop.sh:*)`
- `Bash(:*/ralph-wiggum/:*)`

None of these patterns match because the command string is malformed before reaching the permission checker.

## Fix

Replace the contents of `commands/ralph-loop.md` with:


---
description: "Start Ralph Wiggum loop in current session"
argument-hint: "PROMPT [--max-iterations N] [--completion-promise TEXT]"
allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh:*)"]
hide-from-slash-command-tool: "true"
---

# Ralph Loop Command

Execute this bash command to initialize the Ralph loop:

Bash("${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS)

Please work on the task. When you try to exit, the Ralph loop will feed the SAME PROMPT back to you for the next iteration. You'll see your previous work in files and git history, allowing you to iterate and improve.

CRITICAL RULE: If a completion promise is set, you may ONLY output it when the statement is completely and unequivocally TRUE. Do not output false promises to escape the loop, even if you think you're stuck or should exit for other reasons. The loop is designed to continue until genuine completion.


**Changes made:**
1. Removed ` ! ` code block wrapper - this was being passed literally to the permission checker
2. Added `:*` to `allowed-tools` pattern (`Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh:*)`) to permit any arguments to be passed to the script

## Verified Working

After applying this fix, the slash command works correctly:


/ralph-wiggum:ralph-loop "Document the full generation process..." --completion-promise "GENERATION_DOCUMENTED" --max-iterations 8


The Ralph loop activates as expected without permission errors.

Steps to Reproduce

run a basic loop: /ralph-wiggum:ralph-loop "Document the full generation process in docs/GENERATION.md. COMPLETION: docs/GENERATION.md covers workflow from input to outputs, all API calls, and all retry/regeneration options. GOALS: Trace workflow input to output. Document each Gemini API call. Document all regenerate endpoints. Show data flow and what saves at each step. SELF-CORRECT: Verify against api/main.py and roadless/*.py. ESCAPE: If stuck after 8 iterations, document blockers. Output GENERATION_DOCUMENTED when complete." --completion-promise "GENERATION_DOCUMENTED" --max-iterations 8

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.76

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

fix provided

Metadata

Metadata

Assignees

Labels

area:toolsbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions