mirror of
https://github.com/anthropics/claude-code.git
synced 2026-02-19 04:27:33 -08:00
Compare commits
1 Commits
v2.0.76
...
claude/sla
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cad2569360 |
@@ -102,6 +102,17 @@
|
||||
"source": "./plugins/learning-output-style",
|
||||
"category": "learning"
|
||||
},
|
||||
{
|
||||
"name": "mcp-context-warning",
|
||||
"description": "Warns users when MCP servers are consuming significant context (>20k tokens), helping prevent unexpected context exhaustion",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Anthropic",
|
||||
"email": "support@anthropic.com"
|
||||
},
|
||||
"source": "./plugins/mcp-context-warning",
|
||||
"category": "productivity"
|
||||
},
|
||||
{
|
||||
"name": "plugin-dev",
|
||||
"description": "Comprehensive toolkit for developing Claude Code plugins. Includes 7 expert skills covering hooks, MCP integration, commands, agents, and best practices. AI-assisted plugin creation and validation.",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(./scripts/comment-on-duplicates.sh:*)
|
||||
allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(gh api:*), Bash(gh issue comment:*)
|
||||
description: Find duplicate GitHub issues
|
||||
---
|
||||
|
||||
@@ -11,13 +11,28 @@ To do this, follow these steps precisely:
|
||||
2. Use an agent to view a Github issue, and ask the agent to return a summary of the issue
|
||||
3. Then, launch 5 parallel agents to search Github for duplicates of this issue, using diverse keywords and search approaches, using the summary from #1
|
||||
4. Next, feed the results from #1 and #2 into another agent, so that it can filter out false positives, that are likely not actually duplicates of the original issue. If there are no duplicates remaining, do not proceed.
|
||||
5. Finally, use the comment script to post duplicates:
|
||||
```
|
||||
./scripts/comment-on-duplicates.sh --base-issue <issue-number> --potential-duplicates <dup1> <dup2> <dup3>
|
||||
```
|
||||
5. Finally, comment back on the issue with a list of up to three duplicate issues (or zero, if there are no likely duplicates)
|
||||
|
||||
Notes (be sure to tell this to your agents, too):
|
||||
|
||||
- Use `gh` to interact with Github, rather than web fetch
|
||||
- Do not use other tools, beyond `gh` and the comment script (eg. don't use other MCP servers, file edit, etc.)
|
||||
- Do not use other tools, beyond `gh` (eg. don't use other MCP servers, file edit, etc.)
|
||||
- Make a todo list first
|
||||
- For your comment, follow the following format precisely (assuming for this example that you found 3 suspected duplicates):
|
||||
|
||||
---
|
||||
|
||||
Found 3 possible duplicate issues:
|
||||
|
||||
1. <link to issue>
|
||||
2. <link to issue>
|
||||
3. <link to issue>
|
||||
|
||||
This issue will be automatically closed as a duplicate in 3 days.
|
||||
|
||||
- If your issue is a duplicate, please close it and 👍 the existing issue instead
|
||||
- To prevent auto-closure, add a comment or 👎 this comment
|
||||
|
||||
🤖 Generated with [Claude Code](https://claude.ai/code)
|
||||
|
||||
---
|
||||
|
||||
50
CHANGELOG.md
50
CHANGELOG.md
@@ -1,54 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 2.0.76
|
||||
|
||||
- Fixed issue with macOS code-sign warning when using Claude in Chrome integration
|
||||
|
||||
## 2.0.75
|
||||
|
||||
- Minor bugfixes
|
||||
|
||||
## 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
|
||||
@@ -64,6 +15,7 @@
|
||||
- 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 `plan_mode_required` spawn parameter for teammates to require plan approval before implementing changes
|
||||
- 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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,14 @@ 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, output the review.
|
||||
- If the `--comment` argument is provided, post the review as a comment on the pull request using `gh pr comment`
|
||||
- Otherwise (default), output the review directly to the terminal for local viewing
|
||||
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 +74,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
|
||||
|
||||
9
plugins/mcp-context-warning/.claude-plugin/plugin.json
Normal file
9
plugins/mcp-context-warning/.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "mcp-context-warning",
|
||||
"version": "1.0.0",
|
||||
"description": "Warns users when MCP servers are consuming significant context (>20k tokens), helping prevent unexpected context exhaustion",
|
||||
"author": {
|
||||
"name": "Anthropic",
|
||||
"email": "support@anthropic.com"
|
||||
}
|
||||
}
|
||||
164
plugins/mcp-context-warning/hooks/check_mcp_context.py
Executable file
164
plugins/mcp-context-warning/hooks/check_mcp_context.py
Executable file
@@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
MCP Context Warning Hook for Claude Code
|
||||
|
||||
This hook runs at session start and warns users when their MCP servers
|
||||
are consuming significant context (>20k tokens). This helps users understand
|
||||
why they might be burning through context quickly.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Threshold in tokens for showing a warning
|
||||
TOKEN_WARNING_THRESHOLD = 20000
|
||||
|
||||
# Estimated tokens per MCP tool (based on real-world data:
|
||||
# Asana: ~836/tool, Gmail: ~833/tool, Google Calendar: ~1867/tool, Google Drive: ~1260/tool)
|
||||
# Using 1000 as a conservative average
|
||||
TOKENS_PER_TOOL_ESTIMATE = 1000
|
||||
|
||||
# Base overhead per MCP server (connection info, auth, etc.)
|
||||
BASE_TOKENS_PER_SERVER = 500
|
||||
|
||||
|
||||
def find_mcp_configs(cwd: str) -> list[tuple[str, dict]]:
|
||||
"""
|
||||
Find all MCP configuration files that might be loaded.
|
||||
|
||||
Returns list of (path, config) tuples.
|
||||
"""
|
||||
configs = []
|
||||
|
||||
# Check project-level .mcp.json
|
||||
project_mcp = Path(cwd) / ".mcp.json"
|
||||
if project_mcp.exists():
|
||||
try:
|
||||
with open(project_mcp) as f:
|
||||
configs.append((str(project_mcp), json.load(f)))
|
||||
except (json.JSONDecodeError, IOError):
|
||||
pass
|
||||
|
||||
# Check user-level MCP config (~/.claude/.mcp.json)
|
||||
user_mcp = Path.home() / ".claude" / ".mcp.json"
|
||||
if user_mcp.exists():
|
||||
try:
|
||||
with open(user_mcp) as f:
|
||||
configs.append((str(user_mcp), json.load(f)))
|
||||
except (json.JSONDecodeError, IOError):
|
||||
pass
|
||||
|
||||
return configs
|
||||
|
||||
|
||||
def count_servers_and_estimate_tools(configs: list[tuple[str, dict]]) -> tuple[dict, int]:
|
||||
"""
|
||||
Count MCP servers and estimate their tool counts.
|
||||
|
||||
Returns (server_info dict, total_estimated_tokens).
|
||||
"""
|
||||
server_info = {}
|
||||
|
||||
for path, config in configs:
|
||||
# MCP config format: {"mcpServers": {"server-name": {...}}}
|
||||
mcp_servers = config.get("mcpServers", {})
|
||||
|
||||
for server_name, server_config in mcp_servers.items():
|
||||
if server_name in server_info:
|
||||
continue # Skip duplicates
|
||||
|
||||
# Try to get tool count from config if available
|
||||
# Otherwise use a default estimate
|
||||
tool_count = server_config.get("toolCount", 10) # Default 10 tools
|
||||
|
||||
server_info[server_name] = {
|
||||
"source": path,
|
||||
"estimated_tools": tool_count,
|
||||
}
|
||||
|
||||
# Calculate total estimated tokens
|
||||
total_tokens = 0
|
||||
for server_name, info in server_info.items():
|
||||
server_tokens = BASE_TOKENS_PER_SERVER + (info["estimated_tools"] * TOKENS_PER_TOOL_ESTIMATE)
|
||||
info["estimated_tokens"] = server_tokens
|
||||
total_tokens += server_tokens
|
||||
|
||||
return server_info, total_tokens
|
||||
|
||||
|
||||
def format_warning_message(server_info: dict, total_tokens: int) -> str:
|
||||
"""Format a warning message about MCP context usage."""
|
||||
|
||||
# Build server breakdown table
|
||||
lines = [
|
||||
f"Your MCP servers are using an estimated ~{total_tokens:,} tokens of context.",
|
||||
"",
|
||||
"Server breakdown:",
|
||||
]
|
||||
|
||||
# Sort servers by token usage (highest first)
|
||||
sorted_servers = sorted(
|
||||
server_info.items(),
|
||||
key=lambda x: x[1]["estimated_tokens"],
|
||||
reverse=True
|
||||
)
|
||||
|
||||
for server_name, info in sorted_servers:
|
||||
tokens = info["estimated_tokens"]
|
||||
tools = info["estimated_tools"]
|
||||
lines.append(f" - {server_name}: ~{tokens:,} tokens ({tools} tools)")
|
||||
|
||||
lines.extend([
|
||||
"",
|
||||
"Consider disabling MCP servers you're not actively using to conserve context.",
|
||||
"You can manage MCP servers with `/mcp disable <server-name>` or by editing .mcp.json.",
|
||||
])
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def main():
|
||||
"""Main hook function."""
|
||||
# Read input from stdin
|
||||
try:
|
||||
raw_input = sys.stdin.read()
|
||||
input_data = json.loads(raw_input) if raw_input.strip() else {}
|
||||
except json.JSONDecodeError:
|
||||
# If we can't parse input, exit silently
|
||||
sys.exit(0)
|
||||
|
||||
# Get current working directory from hook input or environment
|
||||
cwd = input_data.get("cwd", os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd()))
|
||||
|
||||
# Find MCP configurations
|
||||
configs = find_mcp_configs(cwd)
|
||||
|
||||
if not configs:
|
||||
# No MCP configs found, nothing to warn about
|
||||
sys.exit(0)
|
||||
|
||||
# Count servers and estimate tokens
|
||||
server_info, total_tokens = count_servers_and_estimate_tools(configs)
|
||||
|
||||
if not server_info:
|
||||
# No servers configured
|
||||
sys.exit(0)
|
||||
|
||||
# Check if we're over the warning threshold
|
||||
if total_tokens >= TOKEN_WARNING_THRESHOLD:
|
||||
warning_message = format_warning_message(server_info, total_tokens)
|
||||
|
||||
# Output JSON with systemMessage for Claude to see
|
||||
output = {
|
||||
"continue": True,
|
||||
"systemMessage": warning_message
|
||||
}
|
||||
print(json.dumps(output))
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
17
plugins/mcp-context-warning/hooks/hooks.json
Normal file
17
plugins/mcp-context-warning/hooks/hooks.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"description": "Warns users when MCP servers consume significant context (>20k tokens)",
|
||||
"hooks": {
|
||||
"SessionStart": [
|
||||
{
|
||||
"matcher": "*",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/check_mcp_context.py",
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Comments on a GitHub issue with a list of potential duplicates.
|
||||
# Usage: ./comment-on-duplicates.sh --base-issue 123 --potential-duplicates 456 789 101
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO="anthropics/claude-code"
|
||||
BASE_ISSUE=""
|
||||
DUPLICATES=()
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--base-issue)
|
||||
BASE_ISSUE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--potential-duplicates)
|
||||
shift
|
||||
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do
|
||||
DUPLICATES+=("$1")
|
||||
shift
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate base issue
|
||||
if [[ -z "$BASE_ISSUE" ]]; then
|
||||
echo "Error: --base-issue is required" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ "$BASE_ISSUE" =~ ^[0-9]+$ ]]; then
|
||||
echo "Error: --base-issue must be a number, got: $BASE_ISSUE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate duplicates
|
||||
if [[ ${#DUPLICATES[@]} -eq 0 ]]; then
|
||||
echo "Error: --potential-duplicates requires at least one issue number" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${#DUPLICATES[@]} -gt 3 ]]; then
|
||||
echo "Error: --potential-duplicates accepts at most 3 issues" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for dup in "${DUPLICATES[@]}"; do
|
||||
if ! [[ "$dup" =~ ^[0-9]+$ ]]; then
|
||||
echo "Error: duplicate issue must be a number, got: $dup" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Validate that base issue exists
|
||||
if ! gh issue view "$BASE_ISSUE" --repo "$REPO" &>/dev/null; then
|
||||
echo "Error: issue #$BASE_ISSUE does not exist in $REPO" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate that all duplicate issues exist
|
||||
for dup in "${DUPLICATES[@]}"; do
|
||||
if ! gh issue view "$dup" --repo "$REPO" &>/dev/null; then
|
||||
echo "Error: issue #$dup does not exist in $REPO" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Build comment body
|
||||
COUNT=${#DUPLICATES[@]}
|
||||
if [[ $COUNT -eq 1 ]]; then
|
||||
HEADER="Found 1 possible duplicate issue:"
|
||||
else
|
||||
HEADER="Found $COUNT possible duplicate issues:"
|
||||
fi
|
||||
|
||||
BODY="$HEADER"$'\n\n'
|
||||
INDEX=1
|
||||
for dup in "${DUPLICATES[@]}"; do
|
||||
BODY+="$INDEX. https://github.com/$REPO/issues/$dup"$'\n'
|
||||
((INDEX++))
|
||||
done
|
||||
|
||||
BODY+=$'\n'"This issue will be automatically closed as a duplicate in 3 days."$'\n\n'
|
||||
BODY+="- If your issue is a duplicate, please close it and 👍 the existing issue instead"$'\n'
|
||||
BODY+="- To prevent auto-closure, add a comment or 👎 this comment"$'\n\n'
|
||||
BODY+="🤖 Generated with [Claude Code](https://claude.ai/code)"
|
||||
|
||||
# Post the comment
|
||||
gh issue comment "$BASE_ISSUE" --repo "$REPO" --body "$BODY"
|
||||
|
||||
echo "Posted duplicate comment on issue #$BASE_ISSUE"
|
||||
Reference in New Issue
Block a user