Compare commits

..

1 Commits

Author SHA1 Message Date
Claude
411f17c228 feat: Add accept-with-feedback plugin
Add a new plugin that allows users to approve permission requests while
providing guidance to Claude. This addresses the request for an "accept
with feedback" option (similar to the existing "reject with feedback"
for plans).

The plugin includes:
- PermissionRequest hook to intercept permission prompts
- /accept-feedback command for one-time feedback
- /configure-feedback command for persistent rules
- Configuration file support for automated feedback rules

Users can now provide context like "make sure to add error handling"
when approving operations, and Claude receives this as guidance.
2025-12-14 16:13:27 +00:00
14 changed files with 561 additions and 151 deletions

View File

@@ -1,71 +1,5 @@
# Changelog
## 2.0.74
- Added LSP (Language Server Protocol) tool for code intelligence features like go-to-definition, find references, and hover documentation
- Added `/terminal-setup` support for Kitty, Alacritty, Zed, and Warp terminals
- Added ctrl+t shortcut in `/theme` to toggle syntax highlighting on/off
- Added syntax highlighting info to theme picker
- Added guidance for macOS users when Alt shortcuts fail due to terminal configuration
- Fixed skill `allowed-tools` not being applied to tools invoked by the skill
- Fixed Opus 4.5 tip incorrectly showing when user was already using Opus
- Fixed a potential crash when syntax highlighting isn't initialized correctly
- Fixed visual bug in `/plugins discover` where list selection indicator showed while search box was focused
- Fixed macOS keyboard shortcuts to display 'opt' instead of 'alt'
- Improved `/context` command visualization with grouped skills and agents by source, slash commands, and sorted token count
- [Windows] Fixed issue with improper rendering
- [VSCode] Added gift tag pictogram for year-end promotion message
## 2.0.73
- Added clickable `[Image #N]` links that open attached images in the default viewer
- Added alt-y yank-pop to cycle through kill ring history after ctrl-y yank
- Added search filtering to the plugin discover screen (type to filter by name, description, or marketplace)
- Added support for custom session IDs when forking sessions with `--session-id` combined with `--resume` or `--continue` and `--fork-session`
- Fixed slow input history cycling and race condition that could overwrite text after message submission
- Improved `/theme` command to open theme picker directly
- Improved theme picker UI
- Improved search UX across resume session, permissions, and plugins screens with a unified SearchBox component
- [VSCode] Added tab icon badges showing pending permissions (blue) and unread completions (orange)
## 2.0.72
- Added Claude in Chrome (Beta) feature that works with the Chrome extension (https://claude.ai/chrome) to let you control your browser directly from Claude Code
- Reduced terminal flickering
- Added scannable QR code to mobile app tip for quick app downloads
- Added loading indicator when resuming conversations for better feedback
- Fixed `/context` command not respecting custom system prompts in non-interactive mode
- Fixed order of consecutive Ctrl+K lines when pasting with Ctrl+Y
- Improved @ mention file suggestion speed (~3x faster in git repositories)
- Improved file suggestion performance in repos with `.ignore` or `.rgignore` files
- Improved settings validation errors to be more prominent
- Changed thinking toggle from Tab to Alt+T to avoid accidental triggers
## 2.0.71
- Added /config toggle to enable/disable prompt suggestions
- Added `/settings` as an alias for the `/config` command
- Fixed @ file reference suggestions incorrectly triggering when cursor is in the middle of a path
- Fixed MCP servers from `.mcp.json` not loading when using `--dangerously-skip-permissions`
- Fixed permission rules incorrectly rejecting valid bash commands containing shell glob patterns (e.g., `ls *.txt`, `for f in *.png`)
- Bedrock: Environment variable `ANTHROPIC_BEDROCK_BASE_URL` is now respected for token counting and inference profile listing
- New syntax highlighting engine for native build
## 2.0.70
- Added Enter key to accept and submit prompt suggestions immediately (tab still accepts for editing)
- Added wildcard syntax `mcp__server__*` for MCP tool permissions to allow or deny all tools from a server
- Added auto-update toggle for plugin marketplaces, allowing per-marketplace control over automatic updates
- Added `current_usage` field to status line input, enabling accurate context window percentage calculations
- Fixed input being cleared when processing queued commands while the user was typing
- Fixed prompt suggestions replacing typed input when pressing Tab
- Fixed diff view not updating when terminal is resized
- Improved memory usage by 3x for large conversations
- Improved resolution of stats screenshots copied to clipboard (Ctrl+S) for crisper images
- Removed # shortcut for quick memory entry (tell Claude to edit your CLAUDE.md instead)
- Fix thinking mode toggle in /config not persisting correctly
- Improve UI for file creation permission dialog
## 2.0.69
- Minor bugfixes

View File

@@ -6,7 +6,7 @@
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows -- all through natural language commands. Use it in your terminal, IDE, or tag @claude on Github.
**Learn more in the [official documentation](https://code.claude.com/docs/en/overview)**.
**Learn more in the [official documentation](https://docs.anthropic.com/en/docs/claude-code/overview)**.
<img src="./demo.gif" />
@@ -56,7 +56,7 @@ When you use Claude Code, we collect feedback, which includes usage data (such a
### How we use your data
See our [data usage policies](https://code.claude.com/docs/en/data-usage).
See our [data usage policies](https://docs.anthropic.com/en/docs/claude-code/data-usage).
### Privacy safeguards

View File

@@ -12,6 +12,7 @@ Learn more in the [official plugins documentation](https://docs.claude.com/en/do
| Name | Description | Contents |
|------|-------------|----------|
| [accept-with-feedback](./accept-with-feedback/) | Accept permission requests with feedback - provide guidance to Claude when approving operations | **Commands:** `/accept-feedback`, `/configure-feedback` - Set one-time or persistent feedback<br>**Hook:** PermissionRequest - Intercepts permissions to add user guidance |
| [agent-sdk-dev](./agent-sdk-dev/) | Development kit for working with the Claude Agent SDK | **Command:** `/new-sdk-app` - Interactive setup for new Agent SDK projects<br>**Agents:** `agent-sdk-verifier-py`, `agent-sdk-verifier-ts` - Validate SDK applications against best practices |
| [claude-opus-4-5-migration](./claude-opus-4-5-migration/) | Migrate code and prompts from Sonnet 4.x and Opus 4.1 to Opus 4.5 | **Skill:** `claude-opus-4-5-migration` - Automated migration of model strings, beta headers, and prompt adjustments |
| [code-review](./code-review/) | Automated PR code review using multiple specialized agents with confidence-based scoring to filter false positives | **Command:** `/code-review` - Automated PR review workflow<br>**Agents:** 5 parallel Sonnet agents for CLAUDE.md compliance, bug detection, historical context, PR history, and code comments |

View File

@@ -0,0 +1,9 @@
{
"name": "accept-with-feedback",
"version": "1.0.0",
"description": "Accept permission requests with feedback - provide guidance to Claude when approving operations",
"author": {
"name": "Anthropic",
"email": "support@anthropic.com"
}
}

View File

@@ -0,0 +1,151 @@
# Accept with Feedback
A Claude Code plugin that lets you approve operations while providing guidance to Claude. Instead of just accepting or rejecting permission requests, you can accept *with feedback* - approving the operation while giving Claude additional context or instructions.
## Why?
Sometimes you want to approve an operation but also want to guide Claude's behavior:
- "Yes, edit that file, but make sure to add error handling"
- "Okay to run those tests, but skip the slow integration tests"
- "Go ahead and commit, but use conventional commit format"
This plugin bridges the gap between simple approval and rejection-with-feedback.
## Installation
This plugin is included in the Claude Code repository. Enable it in your settings or use:
```bash
claude /plugin install accept-with-feedback
```
## Usage
### One-time feedback
Use the `/accept-feedback` command to queue feedback for the next permission request:
```
/accept-feedback Make sure to preserve backwards compatibility
```
When Claude next asks for permission (e.g., to edit a file), the operation will be automatically approved and Claude will receive your guidance as a system message.
### Persistent feedback rules
Create rules that automatically provide feedback for certain types of operations. Add configuration to `.claude/accept-feedback.json`:
```json
{
"rules": [
{
"matcher": "Edit|Write",
"conditions": {
"file_path": ".py"
},
"feedback": "Follow PEP 8 style and add type hints to all functions."
},
{
"matcher": "Bash",
"conditions": {
"command": "npm"
},
"feedback": "Use --legacy-peer-deps if you encounter peer dependency issues."
}
]
}
```
Use `/configure-feedback` for an interactive configuration experience.
## Configuration
### Rule properties
| Property | Description | Example |
|----------|-------------|---------|
| `matcher` | Tool name pattern | `"Edit"`, `"Write\|Edit"`, `"*"` |
| `conditions` | Optional filters on tool input | `{"file_path": ".ts"}` |
| `feedback` | Guidance message for Claude | `"Add JSDoc comments"` |
### Configuration locations
- **User-level**: `~/.claude/accept-feedback.json`
- **Project-level**: `.claude/accept-feedback.json` (takes precedence)
## Commands
| Command | Description |
|---------|-------------|
| `/accept-feedback <message>` | Queue feedback for the next permission request |
| `/configure-feedback` | Interactive configuration of persistent rules |
## How it works
1. The plugin uses a `PermissionRequest` hook to intercept permission requests
2. When a permission request occurs:
- If there's pending feedback (from `/accept-feedback`), approve with that feedback
- If a configured rule matches, approve with the rule's feedback
- Otherwise, let the normal permission flow proceed
3. Feedback is sent to Claude as a system message, providing guidance for the operation
## Examples
### Example 1: One-time guidance
```
You: /accept-feedback Please add comprehensive error handling
Claude: I'll edit src/api.ts to add the new endpoint...
[Permission automatically approved with your feedback]
Claude: I've added the endpoint with try-catch blocks and proper error responses...
```
### Example 2: Persistent Python style rules
`.claude/accept-feedback.json`:
```json
{
"rules": [
{
"matcher": "Edit|Write",
"conditions": {
"file_path": ".py"
},
"feedback": "Use Google-style docstrings and add type hints to all function signatures."
}
]
}
```
Every time Claude edits a Python file, it receives this style guidance.
### Example 3: Git workflow rules
```json
{
"rules": [
{
"matcher": "Bash",
"conditions": {
"command": "git commit"
},
"feedback": "Use conventional commit format: type(scope): description"
}
]
}
```
## Tips
- Use specific matchers to avoid unnecessary approvals
- Conditions use substring matching - `".py"` matches any path containing `.py`
- Combine with other permission management for a comprehensive workflow
- Feedback is visible in the conversation, so Claude can reference it
## Related
- Rejecting with feedback: Built into Claude Code's plan rejection flow
- Permission hooks: See the [hook development guide](../plugin-dev/skills/hook-development/SKILL.md)

View File

@@ -0,0 +1,63 @@
---
description: Set feedback to provide when accepting the next permission request
argument_name: feedback
---
# Accept with Feedback
You are helping the user set feedback that will be automatically provided to Claude when the next permission request is approved.
## What the user wants
The user wants to approve an upcoming operation but also provide guidance or feedback to Claude. This feedback will:
1. Automatically approve the next permission request
2. Send the feedback message to Claude as guidance
## Instructions
1. Parse the user's feedback from the argument: `$ARGUMENTS`
2. If feedback was provided, save it for the next permission request:
- Create/update the file `~/.claude/pending-accept-feedback.json`
- Store the feedback with the current session ID
3. Confirm to the user that their feedback has been queued
## Saving the feedback
Use this Python code to save the pending feedback:
```python
import json
import os
from pathlib import Path
feedback = """$ARGUMENTS"""
session_id = os.environ.get("CLAUDE_SESSION_ID", "default")
pending_file = Path.home() / ".claude" / "pending-accept-feedback.json"
pending_file.parent.mkdir(parents=True, exist_ok=True)
try:
existing = json.loads(pending_file.read_text()) if pending_file.exists() else {}
except:
existing = {}
existing[session_id] = {
"message": feedback,
"one_time": True
}
pending_file.write_text(json.dumps(existing, indent=2))
print(f"Feedback queued for next permission request.")
```
## Example usage
User runs: `/accept-feedback Make sure to add error handling`
Then when Claude asks for permission to edit a file, the operation is automatically approved and Claude receives the guidance: "Make sure to add error handling"
## Response
After saving, confirm: "Your feedback has been queued. The next permission request will be automatically approved, and Claude will receive your guidance."

View File

@@ -0,0 +1,80 @@
---
description: Configure persistent feedback rules for accept-with-feedback
---
# Configure Accept-with-Feedback Rules
You are helping the user configure persistent feedback rules that automatically provide guidance to Claude when certain operations are approved.
## Configuration file location
Rules are stored in `.claude/accept-feedback.json` in either:
- User's home directory (`~/.claude/accept-feedback.json`) for global rules
- Project directory (`.claude/accept-feedback.json`) for project-specific rules
Project rules take precedence over user rules.
## Configuration format
```json
{
"rules": [
{
"matcher": "Edit|Write",
"conditions": {
"file_path": ".py"
},
"feedback": "Ensure all Python code follows PEP 8 style guidelines and includes type hints."
},
{
"matcher": "Bash",
"conditions": {
"command": "git"
},
"feedback": "Use conventional commit format for commit messages."
},
{
"matcher": "*",
"feedback": "Please explain your reasoning before making changes."
}
]
}
```
## Rule properties
- **matcher**: Tool name pattern (e.g., "Edit", "Write|Edit", "*" for all)
- **conditions**: Optional key-value pairs to match against tool input
- **feedback**: The guidance message to send to Claude when this rule matches
## Instructions
1. Ask the user what kind of feedback rules they want to configure
2. Help them create appropriate rules based on their needs
3. Save the configuration to the appropriate location
## Common use cases
1. **Code style guidance**: Provide style guidelines when editing specific file types
2. **Git workflow**: Add commit message format requirements for git operations
3. **Safety reminders**: Add warnings when working with sensitive files
4. **Project conventions**: Enforce project-specific patterns and practices
## Example interaction
User: "I want to always remind Claude to add tests when editing Python files"
You would create:
```json
{
"rules": [
{
"matcher": "Edit|Write",
"conditions": {
"file_path": ".py"
},
"feedback": "Remember to add or update tests for any code changes."
}
]
}
```

View File

@@ -0,0 +1,152 @@
#!/usr/bin/env python3
"""
Accept with Feedback Hook for Claude Code
This hook intercepts permission requests and allows users to provide feedback
when accepting operations. The feedback is passed to Claude as a system message,
giving users a way to provide guidance while still approving the operation.
Usage:
1. Set pending feedback: /accept-feedback "your guidance here"
2. When a permission prompt appears, if pending feedback exists:
- The operation is automatically approved
- Your feedback is sent to Claude as guidance
3. Or configure always-on feedback rules in .claude/accept-feedback.json
"""
import json
import os
import sys
from datetime import datetime
from pathlib import Path
def get_config_paths():
"""Get paths for config and state files."""
claude_dir = Path.home() / ".claude"
project_dir = Path(os.environ.get("CLAUDE_PROJECT_DIR", "."))
return {
"user_config": claude_dir / "accept-feedback.json",
"project_config": project_dir / ".claude" / "accept-feedback.json",
"pending_feedback": claude_dir / "pending-accept-feedback.json",
}
def load_json_file(path):
"""Load JSON from file, return empty dict if not found."""
try:
if path.exists():
with open(path, "r") as f:
return json.load(f)
except (json.JSONDecodeError, IOError):
pass
return {}
def get_pending_feedback(session_id):
"""Get pending feedback for this session and clear it."""
paths = get_config_paths()
pending_file = paths["pending_feedback"]
pending = load_json_file(pending_file)
# Check for session-specific pending feedback
if session_id in pending:
feedback = pending[session_id]
# Clear the pending feedback after use
del pending[session_id]
try:
if pending:
with open(pending_file, "w") as f:
json.dump(pending, f)
else:
pending_file.unlink(missing_ok=True)
except IOError:
pass
return feedback.get("message"), feedback.get("one_time", True)
return None, True
def get_configured_feedback(tool_name, tool_input):
"""Get feedback configured for this tool type."""
paths = get_config_paths()
# Load both user and project configs
user_config = load_json_file(paths["user_config"])
project_config = load_json_file(paths["project_config"])
# Project config takes precedence
config = {**user_config, **project_config}
rules = config.get("rules", [])
for rule in rules:
# Check if rule matches this tool
matcher = rule.get("matcher", "*")
if matcher == "*" or tool_name in matcher.split("|"):
# Check conditions if specified
conditions = rule.get("conditions", {})
matches = True
for key, pattern in conditions.items():
value = str(tool_input.get(key, ""))
if pattern not in value:
matches = False
break
if matches:
return rule.get("feedback")
return None
def main():
"""Main hook function."""
# Read input from stdin
try:
raw_input = sys.stdin.read()
input_data = json.loads(raw_input)
except json.JSONDecodeError:
# Can't parse input, don't interfere
sys.exit(0)
session_id = input_data.get("session_id", "default")
tool_name = input_data.get("tool_name", "")
tool_input = input_data.get("tool_input", {})
# Check for pending feedback first (from /accept-feedback command)
pending_message, _ = get_pending_feedback(session_id)
if pending_message:
# We have pending feedback - approve with the feedback as system message
result = {
"hookSpecificOutput": {
"permissionDecision": "allow"
},
"systemMessage": f"[User Feedback on Approval]: {pending_message}"
}
print(json.dumps(result))
sys.exit(0)
# Check for configured feedback rules
configured_feedback = get_configured_feedback(tool_name, tool_input)
if configured_feedback:
# We have configured feedback for this tool type
result = {
"hookSpecificOutput": {
"permissionDecision": "allow"
},
"systemMessage": f"[User Guidance]: {configured_feedback}"
}
print(json.dumps(result))
sys.exit(0)
# No feedback configured - don't interfere with the normal permission flow
sys.exit(0)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,17 @@
{
"description": "Accept with feedback - allows users to provide guidance when approving tool permissions",
"hooks": {
"PermissionRequest": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/accept_with_feedback.py",
"timeout": 300
}
]
}
]
}
}

View File

@@ -22,29 +22,23 @@ Performs automated code review on a pull request using multiple specialized agen
- **Agent #4**: Analyze git blame/history for context-based issues
5. Scores each issue 0-100 for confidence level
6. Filters out issues below 80 confidence threshold
7. Outputs review (to terminal by default, or as PR comment with `--comment` flag)
7. Posts review comment with high-confidence issues only
**Usage:**
```bash
/code-review [--comment]
/code-review
```
**Options:**
- `--comment`: Post the review as a comment on the pull request (default: outputs to terminal only)
**Example workflow:**
```bash
# On a PR branch, run locally (outputs to terminal):
# On a PR branch, run:
/code-review
# Post review as PR comment:
/code-review --comment
# Claude will:
# - Launch 4 review agents in parallel
# - Score each issue for confidence
# - Output issues ≥80 confidence (to terminal or PR depending on flag)
# - Skip if no high-confidence issues found
# - Post comment with issues ≥80 confidence
# - Skip posting if no high-confidence issues found
```
**Features:**
@@ -120,23 +114,17 @@ This plugin is included in the Claude Code repository. The command is automatica
### Standard PR review workflow:
```bash
# Create PR with changes
# Run local review (outputs to terminal)
/code-review
# Review the automated feedback
# Make any necessary fixes
# Optionally post as PR comment
/code-review --comment
# Merge when ready
```
### As part of CI/CD:
```bash
# Trigger on PR creation or update
# Use --comment flag to post review comments
/code-review --comment
# Automatically posts review comments
# Skip if review already exists
```

View File

@@ -1,5 +1,5 @@
---
allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*), Bash(gh pr list:*), mcp__github_inline_comment__create_inline_comment
allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*), Bash(gh pr list:*)
description: Code review a pull request
---
@@ -11,7 +11,7 @@ To do this, follow these steps precisely:
- The pull request is closed
- The pull request is a draft
- The pull request does not need code review (e.g. automated PR, trivial change that is obviously correct)
- Claude has already commented on this PR (check `gh pr view <PR> --comments` for comments left by claude)
- You have already submitted a code review on this pull request
If any condition is true, stop and do not proceed.
@@ -52,30 +52,12 @@ Note: Still review Claude generated PR's.
6. Filter out any issues that were not validated in step 5. This step will give us our list of high signal issues for our review.
7. If issues were found, skip to step 8 to post inline comments directly.
If NO issues were found, post a summary comment using `gh pr comment` (if `--comment` argument is provided):
"No issues found. Checked for bugs and CLAUDE.md compliance."
8. Post inline comments for each issue using `mcp__github_inline_comment__create_inline_comment`:
- `path`: the file path
- `line` (and `startLine` for ranges): select the buggy lines so the user sees them
- `body`: Brief description of the issue (no "Bug:" prefix). For small fixes (up to 5 lines changed), include a committable suggestion:
```suggestion
corrected code here
```
**Suggestions must be COMPLETE.** If a fix requires additional changes elsewhere (e.g., renaming a variable requires updating all usages), do NOT use a suggestion block. The author should be able to click "Commit suggestion" and have a working fix - no followup work required.
For larger fixes (6+ lines, structural changes, or changes spanning multiple locations), do NOT use suggestion blocks. Instead:
1. Describe what the issue is
2. Explain the suggested fix at a high level
3. Include a copyable prompt for Claude Code that the user can use to fix the issue, formatted as:
```
Fix [file:line]: [brief description of issue and suggested fix]
```
**IMPORTANT: Only post ONE comment per unique issue. Do not post duplicate comments.**
7. Finally, comment on the pull request.
When writing your comment, follow these guidelines:
a. Keep your output brief
b. Avoid emojis
c. Link and cite relevant code, files, and URLs for each issue
d. When citing CLAUDE.md violations, you MUST quote the exact text from CLAUDE.md that is being violated (e.g., CLAUDE.md says: "Use snake_case for variable names")
Use this list when evaluating issues in Steps 4 and 5 (these are false positives, do NOT flag):
@@ -90,18 +72,40 @@ Notes:
- Use gh CLI to interact with GitHub (e.g., fetch pull requests, create comments). Do not use web fetch.
- Create a todo list before starting.
- You must cite and link each issue in inline comments (e.g., if referring to a CLAUDE.md, include a link to it).
- If no issues are found, post a comment with the following format:
- You must cite and link each issue (e.g., if referring to a CLAUDE.md, include a link to it).
- For your final comment, follow the following format precisely (assuming for this example that you found 3 issues):
---
## Code review
Found 3 issues:
1. <brief description of bug> (CLAUDE.md says: "<exact quote from CLAUDE.md>")
<link to file and line with full sha1 + line range for context, eg. https://github.com/anthropics/claude-code/blob/1d54823877c4de72b2316a64032a54afc404e619/README.md#L13-L17>
2. <brief description of bug> (some/other/CLAUDE.md says: "<exact quote from CLAUDE.md>")
<link to file and line with full sha1 + line range for context>
3. <brief description of bug> (bug due to <file and code snippet>)
<link to file and line with full sha1 + line range for context>
---
- Or, if you found no issues:
---
## Auto code review
No issues found. Checked for bugs and CLAUDE.md compliance.
---
- When linking to code in inline comments, follow the following format precisely, otherwise the Markdown preview won't render correctly: https://github.com/anthropics/claude-code/blob/c21d3c10bc8e898b7ac1a2d745bdc9bc4e423afe/package.json#L10-L15
- When linking to code, follow the following format precisely, otherwise the Markdown preview won't render correctly: https://github.com/anthropics/claude-code/blob/c21d3c10bc8e898b7ac1a2d745bdc9bc4e423afe/package.json#L10-L15
- Requires full git sha
- You must provide the full sha. Commands like `https://github.com/owner/repo/blob/$(git rev-parse HEAD)/foo/bar` will not work, since your comment will be directly rendered in Markdown.
- Repo name must match the repo you're code reviewing

View File

@@ -1,18 +1,26 @@
---
description: "Cancel active Ralph Wiggum loop"
allowed-tools: ["Bash(test -f .claude/ralph-loop.local.md:*)", "Bash(rm .claude/ralph-loop.local.md)", "Read(.claude/ralph-loop.local.md)"]
allowed-tools: ["Bash"]
hide-from-slash-command-tool: "true"
---
# Cancel Ralph
To cancel the Ralph loop:
```!
if [[ -f .claude/ralph-loop.local.md ]]; then
ITERATION=$(grep '^iteration:' .claude/ralph-loop.local.md | sed 's/iteration: *//')
echo "FOUND_LOOP=true"
echo "ITERATION=$ITERATION"
else
echo "FOUND_LOOP=false"
fi
```
1. Check if `.claude/ralph-loop.local.md` exists using Bash: `test -f .claude/ralph-loop.local.md && echo "EXISTS" || echo "NOT_FOUND"`
Check the output above:
2. **If NOT_FOUND**: Say "No active Ralph loop found."
1. **If FOUND_LOOP=false**:
- Say "No active Ralph loop found."
3. **If EXISTS**:
- Read `.claude/ralph-loop.local.md` to get the current iteration number from the `iteration:` field
- Remove the file using Bash: `rm .claude/ralph-loop.local.md`
- Report: "Cancelled Ralph loop (was at iteration N)" where N is the iteration value
2. **If FOUND_LOOP=true**:
- Use Bash: `rm .claude/ralph-loop.local.md`
- Report: "Cancelled Ralph loop (was at iteration N)" where N is the ITERATION value from above.

View File

@@ -1,7 +1,7 @@
---
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:*)"]
allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh)"]
hide-from-slash-command-tool: "true"
---
@@ -11,6 +11,36 @@ Execute the setup script to initialize the Ralph loop:
```!
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS
# Extract and display completion promise if set
if [ -f .claude/ralph-loop.local.md ]; then
PROMISE=$(grep '^completion_promise:' .claude/ralph-loop.local.md | sed 's/completion_promise: *//' | sed 's/^"\(.*\)"$/\1/')
if [ -n "$PROMISE" ] && [ "$PROMISE" != "null" ]; then
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "CRITICAL - Ralph Loop Completion Promise"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "To complete this loop, output this EXACT text:"
echo " <promise>$PROMISE</promise>"
echo ""
echo "STRICT REQUIREMENTS (DO NOT VIOLATE):"
echo " ✓ Use <promise> XML tags EXACTLY as shown above"
echo " ✓ The statement MUST be completely and unequivocally TRUE"
echo " ✓ Do NOT output false statements to exit the loop"
echo " ✓ Do NOT lie even if you think you should exit"
echo ""
echo "IMPORTANT - Do not circumvent the loop:"
echo " Even if you believe you're stuck, the task is impossible,"
echo " or you've been running too long - you MUST NOT output a"
echo " false promise statement. The loop is designed to continue"
echo " until the promise is GENUINELY TRUE. Trust the process."
echo ""
echo " If the loop should stop, the promise statement will become"
echo " true naturally. Do not force it by lying."
echo "═══════════════════════════════════════════════════════════"
fi
fi
```
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.

View File

@@ -174,30 +174,3 @@ if [[ -n "$PROMPT" ]]; then
echo ""
echo "$PROMPT"
fi
# Display completion promise requirements if set
if [[ "$COMPLETION_PROMISE" != "null" ]]; then
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "CRITICAL - Ralph Loop Completion Promise"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "To complete this loop, output this EXACT text:"
echo " <promise>$COMPLETION_PROMISE</promise>"
echo ""
echo "STRICT REQUIREMENTS (DO NOT VIOLATE):"
echo " ✓ Use <promise> XML tags EXACTLY as shown above"
echo " ✓ The statement MUST be completely and unequivocally TRUE"
echo " ✓ Do NOT output false statements to exit the loop"
echo " ✓ Do NOT lie even if you think you should exit"
echo ""
echo "IMPORTANT - Do not circumvent the loop:"
echo " Even if you believe you're stuck, the task is impossible,"
echo " or you've been running too long - you MUST NOT output a"
echo " false promise statement. The loop is designed to continue"
echo " until the promise is GENUINELY TRUE. Trust the process."
echo ""
echo " If the loop should stop, the promise statement will become"
echo " true naturally. Do not force it by lying."
echo "═══════════════════════════════════════════════════════════"
fi