spacehub

surshar / claude-code

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.

Built by Anthropic · github.com/anthropics

feat: Add accept-with-feedback pluginBrowse files
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.
Claude authored on Dec 14, 2025 parent eb87245 · commit 411f17c2284a
7 changed files+473 -0compared with eb87245
Mplugins/README.md
Aplugins/accept-with-feedback/.claude-plugin/plugin.json
Aplugins/accept-with-feedback/README.md
Aplugins/accept-with-feedback/commands/accept-feedback.md
Aplugins/accept-with-feedback/commands/configure-feedback.md
Aplugins/accept-with-feedback/hooks/accept_with_feedback.py
Aplugins/accept-with-feedback/hooks/hooks.json
@@ -12,6 +12,7 @@
1212
1313 | Name | Description | Contents |
1414 |------|-------------|----------|
15+| [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 |
1516 | [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 |
1617 | [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 |
1718 | [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 |
@@ -1,0 +1,9 @@
1+{
2+ "name": "accept-with-feedback",
3+ "version": "1.0.0",
4+ "description": "Accept permission requests with feedback - provide guidance to Claude when approving operations",
5+ "author": {
6+ "name": "Anthropic",
7+ "email": "support@anthropic.com"
8+ }
9+}
@@ -1,0 +1,151 @@
1+# Accept with Feedback
2+
3+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.
4+
5+## Why?
6+
7+Sometimes you want to approve an operation but also want to guide Claude's behavior:
8+
9+- "Yes, edit that file, but make sure to add error handling"
10+- "Okay to run those tests, but skip the slow integration tests"
11+- "Go ahead and commit, but use conventional commit format"
12+
13+This plugin bridges the gap between simple approval and rejection-with-feedback.
14+
15+## Installation
16+
17+This plugin is included in the Claude Code repository. Enable it in your settings or use:
18+
19+```bash
20+claude /plugin install accept-with-feedback
21+```
22+
23+## Usage
24+
25+### One-time feedback
26+
27+Use the `/accept-feedback` command to queue feedback for the next permission request:
28+
29+```
30+/accept-feedback Make sure to preserve backwards compatibility
31+```
32+
33+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.
34+
35+### Persistent feedback rules
36+
37+Create rules that automatically provide feedback for certain types of operations. Add configuration to `.claude/accept-feedback.json`:
38+
39+```json
40+{
41+ "rules": [
42+ {
43+ "matcher": "Edit|Write",
44+ "conditions": {
45+ "file_path": ".py"
46+ },
47+ "feedback": "Follow PEP 8 style and add type hints to all functions."
48+ },
49+ {
50+ "matcher": "Bash",
51+ "conditions": {
52+ "command": "npm"
53+ },
54+ "feedback": "Use --legacy-peer-deps if you encounter peer dependency issues."
55+ }
56+ ]
57+}
58+```
59+
60+Use `/configure-feedback` for an interactive configuration experience.
61+
62+## Configuration
63+
64+### Rule properties
65+
66+| Property | Description | Example |
67+|----------|-------------|---------|
68+| `matcher` | Tool name pattern | `"Edit"`, `"Write\|Edit"`, `"*"` |
69+| `conditions` | Optional filters on tool input | `{"file_path": ".ts"}` |
70+| `feedback` | Guidance message for Claude | `"Add JSDoc comments"` |
71+
72+### Configuration locations
73+
74+- **User-level**: `~/.claude/accept-feedback.json`
75+- **Project-level**: `.claude/accept-feedback.json` (takes precedence)
76+
77+## Commands
78+
79+| Command | Description |
80+|---------|-------------|
81+| `/accept-feedback <message>` | Queue feedback for the next permission request |
82+| `/configure-feedback` | Interactive configuration of persistent rules |
83+
84+## How it works
85+
86+1. The plugin uses a `PermissionRequest` hook to intercept permission requests
87+2. When a permission request occurs:
88+ - If there's pending feedback (from `/accept-feedback`), approve with that feedback
89+ - If a configured rule matches, approve with the rule's feedback
90+ - Otherwise, let the normal permission flow proceed
91+3. Feedback is sent to Claude as a system message, providing guidance for the operation
92+
93+## Examples
94+
95+### Example 1: One-time guidance
96+
97+```
98+You: /accept-feedback Please add comprehensive error handling
99+
100+Claude: I'll edit src/api.ts to add the new endpoint...
101+[Permission automatically approved with your feedback]
102+
103+Claude: I've added the endpoint with try-catch blocks and proper error responses...
104+```
105+
106+### Example 2: Persistent Python style rules
107+
108+`.claude/accept-feedback.json`:
109+```json
110+{
111+ "rules": [
112+ {
113+ "matcher": "Edit|Write",
114+ "conditions": {
115+ "file_path": ".py"
116+ },
117+ "feedback": "Use Google-style docstrings and add type hints to all function signatures."
118+ }
119+ ]
120+}
121+```
122+
123+Every time Claude edits a Python file, it receives this style guidance.
124+
125+### Example 3: Git workflow rules
126+
127+```json
128+{
129+ "rules": [
130+ {
131+ "matcher": "Bash",
132+ "conditions": {
133+ "command": "git commit"
134+ },
135+ "feedback": "Use conventional commit format: type(scope): description"
136+ }
137+ ]
138+}
139+```
140+
141+## Tips
142+
143+- Use specific matchers to avoid unnecessary approvals
144+- Conditions use substring matching - `".py"` matches any path containing `.py`
145+- Combine with other permission management for a comprehensive workflow
146+- Feedback is visible in the conversation, so Claude can reference it
147+
148+## Related
149+
150+- Rejecting with feedback: Built into Claude Code's plan rejection flow
151+- Permission hooks: See the [hook development guide](../plugin-dev/skills/hook-development/SKILL.md)
@@ -1,0 +1,63 @@
1+---
2+description: Set feedback to provide when accepting the next permission request
3+argument_name: feedback
4+---
5+
6+# Accept with Feedback
7+
8+You are helping the user set feedback that will be automatically provided to Claude when the next permission request is approved.
9+
10+## What the user wants
11+
12+The user wants to approve an upcoming operation but also provide guidance or feedback to Claude. This feedback will:
13+1. Automatically approve the next permission request
14+2. Send the feedback message to Claude as guidance
15+
16+## Instructions
17+
18+1. Parse the user's feedback from the argument: `$ARGUMENTS`
19+
20+2. If feedback was provided, save it for the next permission request:
21+ - Create/update the file `~/.claude/pending-accept-feedback.json`
22+ - Store the feedback with the current session ID
23+
24+3. Confirm to the user that their feedback has been queued
25+
26+## Saving the feedback
27+
28+Use this Python code to save the pending feedback:
29+
30+```python
31+import json
32+import os
33+from pathlib import Path
34+
35+feedback = """$ARGUMENTS"""
36+session_id = os.environ.get("CLAUDE_SESSION_ID", "default")
37+
38+pending_file = Path.home() / ".claude" / "pending-accept-feedback.json"
39+pending_file.parent.mkdir(parents=True, exist_ok=True)
40+
41+try:
42+ existing = json.loads(pending_file.read_text()) if pending_file.exists() else {}
43+except:
44+ existing = {}
45+
46+existing[session_id] = {
47+ "message": feedback,
48+ "one_time": True
49+}
50+
51+pending_file.write_text(json.dumps(existing, indent=2))
52+print(f"Feedback queued for next permission request.")
53+```
54+
55+## Example usage
56+
57+User runs: `/accept-feedback Make sure to add error handling`
58+
59+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"
60+
61+## Response
62+
63+After saving, confirm: "Your feedback has been queued. The next permission request will be automatically approved, and Claude will receive your guidance."
@@ -1,0 +1,80 @@
1+---
2+description: Configure persistent feedback rules for accept-with-feedback
3+---
4+
5+# Configure Accept-with-Feedback Rules
6+
7+You are helping the user configure persistent feedback rules that automatically provide guidance to Claude when certain operations are approved.
8+
9+## Configuration file location
10+
11+Rules are stored in `.claude/accept-feedback.json` in either:
12+- User's home directory (`~/.claude/accept-feedback.json`) for global rules
13+- Project directory (`.claude/accept-feedback.json`) for project-specific rules
14+
15+Project rules take precedence over user rules.
16+
17+## Configuration format
18+
19+```json
20+{
21+ "rules": [
22+ {
23+ "matcher": "Edit|Write",
24+ "conditions": {
25+ "file_path": ".py"
26+ },
27+ "feedback": "Ensure all Python code follows PEP 8 style guidelines and includes type hints."
28+ },
29+ {
30+ "matcher": "Bash",
31+ "conditions": {
32+ "command": "git"
33+ },
34+ "feedback": "Use conventional commit format for commit messages."
35+ },
36+ {
37+ "matcher": "*",
38+ "feedback": "Please explain your reasoning before making changes."
39+ }
40+ ]
41+}
42+```
43+
44+## Rule properties
45+
46+- **matcher**: Tool name pattern (e.g., "Edit", "Write|Edit", "*" for all)
47+- **conditions**: Optional key-value pairs to match against tool input
48+- **feedback**: The guidance message to send to Claude when this rule matches
49+
50+## Instructions
51+
52+1. Ask the user what kind of feedback rules they want to configure
53+2. Help them create appropriate rules based on their needs
54+3. Save the configuration to the appropriate location
55+
56+## Common use cases
57+
58+1. **Code style guidance**: Provide style guidelines when editing specific file types
59+2. **Git workflow**: Add commit message format requirements for git operations
60+3. **Safety reminders**: Add warnings when working with sensitive files
61+4. **Project conventions**: Enforce project-specific patterns and practices
62+
63+## Example interaction
64+
65+User: "I want to always remind Claude to add tests when editing Python files"
66+
67+You would create:
68+```json
69+{
70+ "rules": [
71+ {
72+ "matcher": "Edit|Write",
73+ "conditions": {
74+ "file_path": ".py"
75+ },
76+ "feedback": "Remember to add or update tests for any code changes."
77+ }
78+ ]
79+}
80+```
@@ -1,0 +1,152 @@
1+#!/usr/bin/env python3
2+"""
3+Accept with Feedback Hook for Claude Code
4+
5+This hook intercepts permission requests and allows users to provide feedback
6+when accepting operations. The feedback is passed to Claude as a system message,
7+giving users a way to provide guidance while still approving the operation.
8+
9+Usage:
10+1. Set pending feedback: /accept-feedback "your guidance here"
11+2. When a permission prompt appears, if pending feedback exists:
12+ - The operation is automatically approved
13+ - Your feedback is sent to Claude as guidance
14+3. Or configure always-on feedback rules in .claude/accept-feedback.json
15+"""
16+
17+import json
18+import os
19+import sys
20+from datetime import datetime
21+from pathlib import Path
22+
23+
24+def get_config_paths():
25+ """Get paths for config and state files."""
26+ claude_dir = Path.home() / ".claude"
27+ project_dir = Path(os.environ.get("CLAUDE_PROJECT_DIR", "."))
28+
29+ return {
30+ "user_config": claude_dir / "accept-feedback.json",
31+ "project_config": project_dir / ".claude" / "accept-feedback.json",
32+ "pending_feedback": claude_dir / "pending-accept-feedback.json",
33+ }
34+
35+
36+def load_json_file(path):
37+ """Load JSON from file, return empty dict if not found."""
38+ try:
39+ if path.exists():
40+ with open(path, "r") as f:
41+ return json.load(f)
42+ except (json.JSONDecodeError, IOError):
43+ pass
44+ return {}
45+
46+
47+def get_pending_feedback(session_id):
48+ """Get pending feedback for this session and clear it."""
49+ paths = get_config_paths()
50+ pending_file = paths["pending_feedback"]
51+
52+ pending = load_json_file(pending_file)
53+
54+ # Check for session-specific pending feedback
55+ if session_id in pending:
56+ feedback = pending[session_id]
57+ # Clear the pending feedback after use
58+ del pending[session_id]
59+ try:
60+ if pending:
61+ with open(pending_file, "w") as f:
62+ json.dump(pending, f)
63+ else:
64+ pending_file.unlink(missing_ok=True)
65+ except IOError:
66+ pass
67+ return feedback.get("message"), feedback.get("one_time", True)
68+
69+ return None, True
70+
71+
72+def get_configured_feedback(tool_name, tool_input):
73+ """Get feedback configured for this tool type."""
74+ paths = get_config_paths()
75+
76+ # Load both user and project configs
77+ user_config = load_json_file(paths["user_config"])
78+ project_config = load_json_file(paths["project_config"])
79+
80+ # Project config takes precedence
81+ config = {**user_config, **project_config}
82+
83+ rules = config.get("rules", [])
84+
85+ for rule in rules:
86+ # Check if rule matches this tool
87+ matcher = rule.get("matcher", "*")
88+ if matcher == "*" or tool_name in matcher.split("|"):
89+ # Check conditions if specified
90+ conditions = rule.get("conditions", {})
91+ matches = True
92+
93+ for key, pattern in conditions.items():
94+ value = str(tool_input.get(key, ""))
95+ if pattern not in value:
96+ matches = False
97+ break
98+
99+ if matches:
100+ return rule.get("feedback")
101+
102+ return None
103+
104+
105+def main():
106+ """Main hook function."""
107+ # Read input from stdin
108+ try:
109+ raw_input = sys.stdin.read()
110+ input_data = json.loads(raw_input)
111+ except json.JSONDecodeError:
112+ # Can't parse input, don't interfere
113+ sys.exit(0)
114+
115+ session_id = input_data.get("session_id", "default")
116+ tool_name = input_data.get("tool_name", "")
117+ tool_input = input_data.get("tool_input", {})
118+
119+ # Check for pending feedback first (from /accept-feedback command)
120+ pending_message, _ = get_pending_feedback(session_id)
121+
122+ if pending_message:
123+ # We have pending feedback - approve with the feedback as system message
124+ result = {
125+ "hookSpecificOutput": {
126+ "permissionDecision": "allow"
127+ },
128+ "systemMessage": f"[User Feedback on Approval]: {pending_message}"
129+ }
130+ print(json.dumps(result))
131+ sys.exit(0)
132+
133+ # Check for configured feedback rules
134+ configured_feedback = get_configured_feedback(tool_name, tool_input)
135+
136+ if configured_feedback:
137+ # We have configured feedback for this tool type
138+ result = {
139+ "hookSpecificOutput": {
140+ "permissionDecision": "allow"
141+ },
142+ "systemMessage": f"[User Guidance]: {configured_feedback}"
143+ }
144+ print(json.dumps(result))
145+ sys.exit(0)
146+
147+ # No feedback configured - don't interfere with the normal permission flow
148+ sys.exit(0)
149+
150+
151+if __name__ == "__main__":
152+ main()
@@ -1,0 +1,17 @@
1+{
2+ "description": "Accept with feedback - allows users to provide guidance when approving tool permissions",
3+ "hooks": {
4+ "PermissionRequest": [
5+ {
6+ "matcher": "*",
7+ "hooks": [
8+ {
9+ "type": "command",
10+ "command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/accept_with_feedback.py",
11+ "timeout": 300
12+ }
13+ ]
14+ }
15+ ]
16+ }
17+}