Files
innervoice/hooks/PermissionRequest.sh
RichardDillman 6dcb4a888c feat: add optional permission notification hook for AFK mode
Added optional hook that sends Telegram notifications when Claude
requests tool permissions, solving the issue where users in AFK mode
don't get notified about pending permission prompts.

Features:
- Self-contained hook in hooks/PermissionRequest.sh
- Easy installation script (scripts/install-hook.sh)
- Opt-in per project - users choose where to install
- Sends Telegram alert with tool name and description
- Shows ⏸️ warning icon for permission requests

Installation:
Users can now run ./scripts/install-hook.sh from any project to
enable permission notifications. The hook integrates with the
existing InnerVoice bridge.

Documentation:
- Added "Optional: Install Permission Notification Hook" section
- Includes installation and uninstallation instructions
- Example notification message format

This keeps InnerVoice self-contained while allowing users to opt-in
to enhanced AFK mode notifications.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 14:53:23 -05:00

22 lines
722 B
Bash

#!/bin/bash
# Hook that fires when Claude needs permission
# Sends a Telegram notification if AFK mode is enabled
# Get the hook input
INPUT=$(cat)
# Extract tool name and description
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // "unknown"')
DESCRIPTION=$(echo "$INPUT" | jq -r '.description // "N/A"')
# Send notification via InnerVoice bridge
curl -s -X POST http://localhost:3456/notify \
-H "Content-Type: application/json" \
-d "{
\"message\": \"⏸️ *Claude needs permission*\n\n**Tool:** \`$TOOL_NAME\`\n**Action:** $DESCRIPTION\n\nCheck your terminal to approve or deny.\",
\"priority\": \"warning\"
}" > /dev/null 2>&1
# Return empty response (don't block the permission request)
echo "{}"