You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/07/18 22:37:20 UTC

(superset) branch claude_ghas created (now 602a5390b6)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a change to branch claude_ghas
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 602a5390b6 feat: Add Claude Code GitHub Actions integration

This branch includes the following new commits:

     new 602a5390b6 feat: Add Claude Code GitHub Actions integration

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: feat: Add Claude Code GitHub Actions integration

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch claude_ghas
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 602a5390b6437013cc575221616a2662412e9528
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Fri Jul 18 15:35:16 2025 -0700

    feat: Add Claude Code GitHub Actions integration
    
    Enable AI-assisted development through @claude mentions in PR/issue comments.
    Includes security controls, fork protection, and ASF compliance features.
    
    - Add workflows for PR and issue comment handling
    - Implement permission checking with allowlist support
    - Add fork PR security with maintainer approval flow
    - Create reusable actions for Claude execution and logging
    - Include comprehensive documentation
    
    Requires PRESET_SPONSORED_ANTHROPIC_API_KEY secret and
    ALLOWED_CLAUDE_CONTRIBUTORS variable to be configured.
    
    ## Summary
    
    This PR introduces a comprehensive GitHub Actions integration for Claude Code, enabling AI-assisted development workflows for Apache Superset. Contributors can now use @claude mentions in PR and issue comments to request automated assistance with code fixes, improvements, and issue resolution.
    
    ## Key Features
    
    ### Core Functionality
    - PR Comments: '@claude please fix the linting issues on this PR'
    - Issue Comments: '@claude please fix this issue and open a PR'
    - Context-Aware: Automatically uses CLAUDE.md and LLMS.md for project context
    - Full Claude Code Capabilities: All features available while maintaining security
    
    ### Security Model
    - User-Based Authorization: Checks the commenter's permissions, not the PR author
    - Allowlist System: Configurable via ALLOWED_CLAUDE_CONTRIBUTORS variable
    - Fork Protection: External fork PRs require explicit maintainer approval
    - Audit Trail: Comprehensive usage logging for compliance and billing
    
    ### ASF Compliance
    - No Direct Merges: Claude creates PRs, never merges directly
    - Proper Attribution: All commits attributed correctly with co-author metadata
    - Branch Protection: Respects all existing branch protection rules
    - Transparent Operations: All actions logged and visible
    
    ## Implementation Details
    
    ### Workflows Created
    - claude-pr-comment.yml - Handles PR comment triggers
    - claude-issue-comment.yml - Handles issue comment triggers
    - claude-fork-handler.yml - Special security for fork PRs
    - claude-maintainer-approval.yml - Maintainer approval processing
    
    ### Reusable Actions
    - check-claude-permission - Validates user permissions
    - execute-claude-code - Runs Claude Code with proper configuration
    - log-claude-usage - Tracks all usage for audit/billing
    
    ## Setup Requirements
    
    1. Add Secret: PRESET_SPONSORED_ANTHROPIC_API_KEY (to be added by ASF infra)
    2. Add Variable: ALLOWED_CLAUDE_CONTRIBUTORS with comma-separated GitHub usernames
    3. Optional: Set CLAUDE_USAGE_TRACKING_ISSUE for centralized usage tracking
    
    ## Usage Examples
    
    ### Internal Contributors
    @claude please fix the linting issues on this PR
    @claude please add type annotations to this file
    @claude please help me refactor this component
    
    ### External Contributors
    Same commands, but requires maintainer approval:
    1. Comment with @claude request
    2. Maintainer reviews security issue
    3. Maintainer approves with /approve-claude
    4. Claude executes with restrictions
    
    ## Security Considerations
    
    - External contributors cannot execute without maintainer approval
    - Fork PRs have additional security restrictions
    - All executions are logged with full context
    - API keys are never exposed in logs or comments
    
    ## Documentation
    
    Comprehensive documentation included in .github/workflows/README-claude-integration.md covering:
    - Architecture overview
    - Configuration details
    - Usage examples
    - Security model
    - Troubleshooting guide
    - Best practices
    
    ## Related
    
    - Depends on PR #34194 for CLAUDE.md and LLMS.md context files
    - Follows GitHub Actions best practices for security
    - Compatible with existing CI/CD workflows
    
    This integration will significantly improve developer productivity by automating routine tasks while maintaining the security and compliance standards required by the Apache Software Foundation.
---
 .github/actions/check-claude-permission/action.yml |  69 +++++
 .github/actions/execute-claude-code/action.yml     | 146 ++++++++++
 .github/actions/log-claude-usage/action.yml        | 111 ++++++++
 .github/workflows/README-claude-integration.md     | 186 +++++++++++++
 .github/workflows/claude-fork-handler.yml          | 217 +++++++++++++++
 .github/workflows/claude-issue-comment.yml         | 296 +++++++++++++++++++++
 .github/workflows/claude-maintainer-approval.yml   | 214 +++++++++++++++
 .github/workflows/claude-pr-comment.yml            | 253 ++++++++++++++++++
 .gitignore                                         |   2 +
 9 files changed, 1494 insertions(+)

diff --git a/.github/actions/check-claude-permission/action.yml b/.github/actions/check-claude-permission/action.yml
new file mode 100644
index 0000000000..d605935ec5
--- /dev/null
+++ b/.github/actions/check-claude-permission/action.yml
@@ -0,0 +1,69 @@
+name: 'Check Claude Permission'
+description: 'Check if user has permission to use Claude Code'
+inputs:
+  github-token:
+    description: 'GitHub token for API access'
+    required: true
+  commenter:
+    description: 'Username of the person who made the comment'
+    required: true
+  allowed-users:
+    description: 'Comma-separated list of allowed users'
+    required: true
+outputs:
+  has-permission:
+    description: 'Whether the user has permission'
+    value: ${{ steps.check.outputs.has-permission }}
+  is-maintainer:
+    description: 'Whether the user is a maintainer'
+    value: ${{ steps.check.outputs.is-maintainer }}
+  is-external:
+    description: 'Whether the request is from an external contributor'
+    value: ${{ steps.check.outputs.is-external }}
+runs:
+  using: 'composite'
+  steps:
+    - name: Check permissions
+      id: check
+      shell: bash
+      env:
+        GITHUB_TOKEN: ${{ inputs.github-token }}
+        COMMENTER: ${{ inputs.commenter }}
+        ALLOWED_USERS: ${{ inputs.allowed-users }}
+      run: |
+        echo "Checking permissions for user: $COMMENTER"
+
+        # Check if user is in allowed list
+        IFS=',' read -ra ALLOWED_ARRAY <<< "$ALLOWED_USERS"
+        HAS_PERMISSION="false"
+        for user in "${ALLOWED_ARRAY[@]}"; do
+          user=$(echo "$user" | xargs)  # Trim whitespace
+          if [[ "$user" == "$COMMENTER" ]]; then
+            HAS_PERMISSION="true"
+            break
+          fi
+        done
+
+        # Check if user is a maintainer
+        IS_MAINTAINER="false"
+        RESPONSE=$(gh api repos/${{ github.repository }}/collaborators/$COMMENTER/permission 2>/dev/null || echo "{}")
+        PERMISSION=$(echo "$RESPONSE" | jq -r '.permission // "none"')
+        if [[ "$PERMISSION" == "admin" ]] || [[ "$PERMISSION" == "maintain" ]]; then
+          IS_MAINTAINER="true"
+          HAS_PERMISSION="true"
+        fi
+
+        # Determine if this is an external contributor
+        IS_EXTERNAL="true"
+        if [[ "$HAS_PERMISSION" == "true" ]] || [[ "$IS_MAINTAINER" == "true" ]]; then
+          IS_EXTERNAL="false"
+        fi
+
+        echo "has-permission=$HAS_PERMISSION" >> $GITHUB_OUTPUT
+        echo "is-maintainer=$IS_MAINTAINER" >> $GITHUB_OUTPUT
+        echo "is-external=$IS_EXTERNAL" >> $GITHUB_OUTPUT
+
+        echo "Permission check complete:"
+        echo "  - Has permission: $HAS_PERMISSION"
+        echo "  - Is maintainer: $IS_MAINTAINER"
+        echo "  - Is external: $IS_EXTERNAL"
diff --git a/.github/actions/execute-claude-code/action.yml b/.github/actions/execute-claude-code/action.yml
new file mode 100644
index 0000000000..34fb2ae1f5
--- /dev/null
+++ b/.github/actions/execute-claude-code/action.yml
@@ -0,0 +1,146 @@
+name: 'Execute Claude Code'
+description: 'Execute Claude Code with proper context and configuration'
+inputs:
+  api-key:
+    description: 'Anthropic API key'
+    required: true
+  prompt:
+    description: 'The prompt/command to execute'
+    required: true
+  working-directory:
+    description: 'Working directory for Claude Code'
+    required: false
+    default: '.'
+  context-files:
+    description: 'Additional context files to include'
+    required: false
+    default: ''
+  max-tokens:
+    description: 'Maximum tokens for Claude response'
+    required: false
+    default: '4096'
+outputs:
+  changes-made:
+    description: 'Whether changes were made'
+    value: ${{ steps.execute.outputs.changes-made }}
+  output-log:
+    description: 'Path to the output log file'
+    value: ${{ steps.execute.outputs.output-log }}
+runs:
+  using: 'composite'
+  steps:
+    - name: Setup environment
+      shell: bash
+      run: |
+        echo "Setting up Claude Code environment..."
+
+        # Ensure npm is available
+        if ! command -v npm &> /dev/null; then
+          echo "Error: npm is not installed"
+          exit 1
+        fi
+
+    - name: Install Claude Code
+      shell: bash
+      run: |
+        echo "Installing Claude Code CLI..."
+        npm install -g @anthropic-ai/claude-code
+
+    - name: Configure git
+      shell: bash
+      run: |
+        git config --global user.name "Claude Code"
+        git config --global user.email "claude-code[bot]@anthropic.com"
+
+    - name: Prepare context
+      id: context
+      shell: bash
+      working-directory: ${{ inputs.working-directory }}
+      run: |
+        echo "Preparing context files..."
+
+        # Build context flags
+        CONTEXT_FLAGS=""
+
+        # Check for default context files
+        if [ -f "CLAUDE.md" ]; then
+          echo "Found CLAUDE.md"
+          CONTEXT_FLAGS="$CONTEXT_FLAGS --context CLAUDE.md"
+        fi
+
+        if [ -f "LLMS.md" ]; then
+          echo "Found LLMS.md"
+          CONTEXT_FLAGS="$CONTEXT_FLAGS --context LLMS.md"
+        fi
+
+        # Add any additional context files
+        if [ -n "${{ inputs.context-files }}" ]; then
+          IFS=',' read -ra FILES <<< "${{ inputs.context-files }}"
+          for file in "${FILES[@]}"; do
+            file=$(echo "$file" | xargs)  # Trim whitespace
+            if [ -f "$file" ]; then
+              echo "Adding context file: $file"
+              CONTEXT_FLAGS="$CONTEXT_FLAGS --context $file"
+            else
+              echo "Warning: Context file not found: $file"
+            fi
+          done
+        fi
+
+        echo "context-flags=$CONTEXT_FLAGS" >> $GITHUB_OUTPUT
+
+    - name: Execute Claude Code
+      id: execute
+      shell: bash
+      working-directory: ${{ inputs.working-directory }}
+      env:
+        ANTHROPIC_API_KEY: ${{ inputs.api-key }}
+      run: |
+        echo "Executing Claude Code..."
+
+        # Create a unique log file
+        LOG_FILE="claude-output-${{ github.run_id }}-${{ github.run_attempt }}.log"
+
+        # Execute Claude Code
+        set +e  # Don't exit on error
+        claude-code \
+          --prompt "${{ inputs.prompt }}" \
+          ${{ steps.context.outputs.context-flags }} \
+          --max-tokens ${{ inputs.max-tokens }} \
+          --yes \
+          --no-interactive \
+          > "$LOG_FILE" 2>&1
+
+        CLAUDE_EXIT_CODE=$?
+        set -e
+
+        # Check exit code
+        if [ $CLAUDE_EXIT_CODE -ne 0 ]; then
+          echo "Claude Code exited with code: $CLAUDE_EXIT_CODE"
+          cat "$LOG_FILE"
+        fi
+
+        # Check if there are changes
+        if [[ -n $(git status -s) ]]; then
+          echo "changes-made=true" >> $GITHUB_OUTPUT
+        else
+          echo "changes-made=false" >> $GITHUB_OUTPUT
+        fi
+
+        echo "output-log=$LOG_FILE" >> $GITHUB_OUTPUT
+
+    - name: Summarize execution
+      if: always()
+      shell: bash
+      working-directory: ${{ inputs.working-directory }}
+      run: |
+        echo "Claude Code execution summary:"
+        echo "- Changes made: ${{ steps.execute.outputs.changes-made }}"
+        echo "- Output log: ${{ steps.execute.outputs.output-log }}"
+
+        if [ -f "${{ steps.execute.outputs.output-log }}" ]; then
+          echo ""
+          echo "Output preview (last 50 lines):"
+          echo "================================"
+          tail -n 50 "${{ steps.execute.outputs.output-log }}"
+        fi
diff --git a/.github/actions/log-claude-usage/action.yml b/.github/actions/log-claude-usage/action.yml
new file mode 100644
index 0000000000..e311f5d54b
--- /dev/null
+++ b/.github/actions/log-claude-usage/action.yml
@@ -0,0 +1,111 @@
+name: 'Log Claude Usage'
+description: 'Log Claude Code usage for tracking and compliance'
+inputs:
+  event-type:
+    description: 'Type of event (pr-comment, issue-comment, fork-request, etc.)'
+    required: true
+  user:
+    description: 'User who triggered the event'
+    required: true
+  command:
+    description: 'Command that was executed'
+    required: true
+  pr-number:
+    description: 'PR number if applicable'
+    required: false
+    default: ''
+  issue-number:
+    description: 'Issue number if applicable'
+    required: false
+    default: ''
+  changes-made:
+    description: 'Whether changes were made'
+    required: false
+    default: 'unknown'
+  status:
+    description: 'Execution status (success, failure, denied)'
+    required: false
+    default: 'success'
+  additional-info:
+    description: 'Additional information in JSON format'
+    required: false
+    default: '{}'
+runs:
+  using: 'composite'
+  steps:
+    - name: Log usage
+      shell: bash
+      env:
+        GITHUB_TOKEN: ${{ github.token }}
+      run: |
+        # Create usage log entry
+        TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
+
+        # Build log entry
+        LOG_ENTRY=$(cat << EOF
+        {
+          "timestamp": "$TIMESTAMP",
+          "repository": "${{ github.repository }}",
+          "event_type": "${{ inputs.event-type }}",
+          "user": "${{ inputs.user }}",
+          "command": "${{ inputs.command }}",
+          "pr_number": "${{ inputs.pr-number }}",
+          "issue_number": "${{ inputs.issue-number }}",
+          "changes_made": "${{ inputs.changes-made }}",
+          "status": "${{ inputs.status }}",
+          "workflow_run_id": "${{ github.run_id }}",
+          "workflow_run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
+          "additional_info": ${{ inputs.additional-info }}
+        }
+        EOF
+        )
+
+        # Log to workflow output
+        echo "Claude Code Usage Log:"
+        echo "$LOG_ENTRY" | jq .
+
+        # Create a comment in a tracking issue (if configured)
+        if [ -n "${{ vars.CLAUDE_USAGE_TRACKING_ISSUE }}" ]; then
+          echo "Logging to tracking issue #${{ vars.CLAUDE_USAGE_TRACKING_ISSUE }}"
+
+          COMMENT_BODY="### Claude Code Usage Entry
+
+        \`\`\`json
+        $(echo "$LOG_ENTRY" | jq .)
+        \`\`\`"
+
+          gh issue comment "${{ vars.CLAUDE_USAGE_TRACKING_ISSUE }}" \
+            --body "$COMMENT_BODY" \
+            --repo "${{ github.repository }}" || true
+        fi
+
+        # Create artifact for audit trail
+        mkdir -p claude-usage-logs
+        echo "$LOG_ENTRY" > "claude-usage-logs/usage-${{ github.run_id }}-${{ github.run_attempt }}.json"
+
+    - name: Upload usage logs
+      uses: actions/upload-artifact@v4
+      with:
+        name: claude-usage-log-${{ github.run_id }}
+        path: claude-usage-logs/
+        retention-days: 90
+
+    - name: Create usage summary
+      shell: bash
+      run: |
+        echo "## Claude Code Usage Summary" >> $GITHUB_STEP_SUMMARY
+        echo "" >> $GITHUB_STEP_SUMMARY
+        echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
+        echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
+        echo "| User | @${{ inputs.user }} |" >> $GITHUB_STEP_SUMMARY
+        echo "| Event Type | ${{ inputs.event-type }} |" >> $GITHUB_STEP_SUMMARY
+        echo "| Command | \`${{ inputs.command }}\` |" >> $GITHUB_STEP_SUMMARY
+        echo "| Status | ${{ inputs.status }} |" >> $GITHUB_STEP_SUMMARY
+        echo "| Changes Made | ${{ inputs.changes-made }} |" >> $GITHUB_STEP_SUMMARY
+        if [ -n "${{ inputs.pr-number }}" ]; then
+          echo "| PR | #${{ inputs.pr-number }} |" >> $GITHUB_STEP_SUMMARY
+        fi
+        if [ -n "${{ inputs.issue-number }}" ]; then
+          echo "| Issue | #${{ inputs.issue-number }} |" >> $GITHUB_STEP_SUMMARY
+        fi
+        echo "| Workflow Run | [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) |" >> $GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/README-claude-integration.md b/.github/workflows/README-claude-integration.md
new file mode 100644
index 0000000000..71bc2dbb30
--- /dev/null
+++ b/.github/workflows/README-claude-integration.md
@@ -0,0 +1,186 @@
+# Claude Code GitHub Actions Integration
+
+This directory contains GitHub Actions workflows and reusable actions for integrating Claude Code with the Apache Superset repository. These workflows enable team members to use `@claude` comments on PRs and issues to get AI assistance.
+
+## Overview
+
+The Claude Code integration allows contributors to:
+- Request automated fixes for linting issues on PRs
+- Request Claude to analyze and fix issues by creating PRs
+- Get AI assistance with code reviews and improvements
+
+## Architecture
+
+### Workflows
+
+1. **claude-pr-comment.yml** - Handles `@claude` mentions in PR comments
+2. **claude-issue-comment.yml** - Handles `@claude` mentions in issue comments  
+3. **claude-fork-handler.yml** - Special security handling for PRs from forks
+4. **claude-maintainer-approval.yml** - Processes maintainer approvals for external requests
+
+### Reusable Actions
+
+1. **check-claude-permission** - Validates user permissions
+2. **execute-claude-code** - Runs Claude Code with proper configuration
+3. **log-claude-usage** - Tracks usage for audit and billing
+
+## Configuration
+
+### Required Secrets
+
+- `PRESET_SPONSORED_ANTHROPIC_API_KEY` - Anthropic API key (managed by ASF infra)
+- `GITHUB_TOKEN` - Automatically provided by GitHub Actions
+
+### Required Variables
+
+- `ALLOWED_CLAUDE_CONTRIBUTORS` - Comma-separated list of GitHub usernames allowed to use Claude
+- `CLAUDE_USAGE_TRACKING_ISSUE` (optional) - Issue number for usage tracking
+
+## Usage
+
+### For Internal Contributors
+
+If you're on the allowed contributors list, simply comment on a PR or issue:
+
+```
+@claude please fix the linting issues on this PR
+```
+
+```
+@claude please try to fix this current issue and open a PR
+```
+
+### For External Contributors
+
+External contributors can use the same commands, but their requests require maintainer approval:
+
+1. Comment with your `@claude` request
+2. A maintainer will review and approve if appropriate
+3. Claude Code will execute once approved
+
+### For Maintainers
+
+To approve an external Claude request:
+1. Review the automatically created security issue
+2. Comment `/approve-claude` to approve
+3. Comment `/deny-claude [reason]` to deny
+
+## Security Model
+
+### Permission Levels
+
+1. **Allowed Contributors** - Direct access to Claude Code
+2. **Maintainers** - Direct access + can approve external requests
+3. **External Contributors** - Require maintainer approval
+
+### Key Security Features
+
+- Authorization based on commenter, not PR author
+- Fork PRs have additional restrictions
+- All usage is logged for audit trail
+- No direct commits to protected branches
+- Proper commit attribution
+
+## Common Commands
+
+### PR Comments
+
+- `@claude please fix the linting issues on this PR`
+- `@claude please review this PR and suggest improvements`
+- `@claude please add tests for the new functions`
+
+### Issue Comments
+
+- `@claude please fix this issue and open a PR`
+- `@claude please investigate this bug and propose a solution`
+
+## Workflow Details
+
+### PR Comment Flow
+
+1. User comments with `@claude` mention
+2. Workflow checks user permissions
+3. If authorized, Claude Code executes on PR branch
+4. Changes are committed with proper attribution
+5. Results are commented back on PR
+
+### Issue Comment Flow
+
+1. User comments with `@claude` mention
+2. Workflow checks user permissions
+3. If authorized, Claude Code creates new branch
+4. Fix is implemented and PR is created
+5. PR link is commented on original issue
+
+### Fork Security Flow
+
+1. External user comments with `@claude` mention
+2. Security check identifies fork PR
+3. Approval issue is created for maintainers
+4. Maintainer reviews and approves/denies
+5. If approved, Claude executes with restrictions
+
+## Troubleshooting
+
+### Claude Code Not Responding
+
+1. Check if `@claude` is properly mentioned
+2. Verify you're on the allowed contributors list
+3. Check workflow runs in Actions tab
+
+### Permission Denied
+
+1. External contributors need maintainer approval
+2. Check if your username is in `ALLOWED_CLAUDE_CONTRIBUTORS`
+3. Maintainers have automatic access
+
+### No Changes Made
+
+1. Claude may not find issues to fix
+2. Check the output in PR comments
+3. Review Claude's analysis for insights
+
+## Best Practices
+
+1. **Be Specific** - Clear commands get better results
+2. **Review Changes** - Always review Claude's changes before merging
+3. **Use for Automation** - Best for repetitive tasks like linting
+4. **Provide Context** - Include relevant details in your request
+
+## Compliance
+
+All Claude Code usage is:
+- Logged for audit trail
+- Attributed properly in commits
+- Subject to ASF policies
+- Tracked for billing purposes
+
+## Maintenance
+
+### Adding Contributors
+
+Update the `ALLOWED_CLAUDE_CONTRIBUTORS` variable in repository settings:
+```
+Settings → Secrets and variables → Actions → Variables
+```
+
+### Monitoring Usage
+
+- Check workflow runs in Actions tab
+- Review usage logs in artifacts
+- Track via `CLAUDE_USAGE_TRACKING_ISSUE` if configured
+
+### Updating Workflows
+
+1. Test changes in a fork first
+2. Ensure backwards compatibility
+3. Update this documentation
+4. Communicate changes to team
+
+## Support
+
+For issues or questions:
+1. Check existing workflow runs
+2. Review this documentation
+3. Ask in project discussions
+4. File an issue with details
diff --git a/.github/workflows/claude-fork-handler.yml b/.github/workflows/claude-fork-handler.yml
new file mode 100644
index 0000000000..1b22ebb3ac
--- /dev/null
+++ b/.github/workflows/claude-fork-handler.yml
@@ -0,0 +1,217 @@
+name: Claude Code Fork Handler
+
+on:
+  issue_comment:
+    types: [created]
+  pull_request_review_comment:
+    types: [created]
+
+permissions:
+  contents: read
+  issues: write
+  pull-requests: write
+
+jobs:
+  check-fork-trigger:
+    if: |
+      (github.event.issue.pull_request || github.event.pull_request) &&
+      contains(github.event.comment.body, '@claude')
+    runs-on: ubuntu-latest
+    outputs:
+      should-run: ${{ steps.check.outputs.should-run }}
+      is-fork: ${{ steps.fork-check.outputs.is-fork }}
+      has-permission: ${{ steps.permission.outputs.has-permission }}
+      is-maintainer: ${{ steps.permission.outputs.is-maintainer }}
+      command: ${{ steps.parse.outputs.command }}
+      pr-number: ${{ steps.pr-info.outputs.pr-number }}
+    steps:
+      - name: Get PR info
+        id: pr-info
+        uses: actions/github-script@v7
+        with:
+          script: |
+            let prNumber;
+            if (context.eventName === 'issue_comment') {
+              prNumber = context.issue.number;
+            } else {
+              prNumber = context.payload.pull_request.number;
+            }
+            core.setOutput('pr-number', prNumber);
+
+      - name: Check if from fork
+        id: fork-check
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const pr = await github.rest.pulls.get({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              pull_number: ${{ steps.pr-info.outputs.pr-number }}
+            });
+
+            const isFork = pr.data.head.repo.fork ||
+                          pr.data.head.repo.full_name !== pr.data.base.repo.full_name;
+
+            core.setOutput('is-fork', isFork);
+            console.log(`PR is from fork: ${isFork}`);
+
+      - name: Check if comment mentions @claude
+        id: check
+        run: |
+          if [[ "${{ github.event.comment.body }}" =~ @claude ]]; then
+            echo "should-run=true" >> $GITHUB_OUTPUT
+          else
+            echo "should-run=false" >> $GITHUB_OUTPUT
+          fi
+
+      - name: Parse command
+        id: parse
+        if: steps.check.outputs.should-run == 'true'
+        run: |
+          COMMENT="${{ github.event.comment.body }}"
+          # Extract the command after @claude
+          COMMAND=$(echo "$COMMENT" | sed -n 's/.*@claude[[:space:]]*\(.*\)/\1/p' | head -1)
+          echo "command=$COMMAND" >> $GITHUB_OUTPUT
+          echo "Parsed command: $COMMAND"
+
+      - name: Checkout repository
+        if: steps.check.outputs.should-run == 'true'
+        uses: actions/checkout@v4
+
+      - name: Check permissions
+        id: permission
+        if: steps.check.outputs.should-run == 'true'
+        uses: ./.github/actions/check-claude-permission
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          commenter: ${{ github.event.comment.user.login }}
+          allowed-users: ${{ vars.ALLOWED_CLAUDE_CONTRIBUTORS }}
+
+  handle-fork-request:
+    needs: check-fork-trigger
+    if: |
+      needs.check-fork-trigger.outputs.should-run == 'true' &&
+      needs.check-fork-trigger.outputs.is-fork == 'true' &&
+      needs.check-fork-trigger.outputs.has-permission == 'false'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Comment on security policy
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const comment = `🔒 **Security Notice**
+
+            Hi @${{ github.event.comment.user.login }}, thank you for your Claude Code request on this forked PR!
+
+            For security reasons, Claude Code execution on PRs from forks requires explicit approval from a project maintainer.
+
+            **Why this restriction?**
+            - Forked PRs can execute code in our CI environment
+            - We need to ensure the changes are safe before running automated tools
+            - This protects both the project and our CI resources
+
+            **Next steps:**
+            1. A maintainer will review your request
+            2. If approved, they will trigger Claude Code manually
+            3. You'll be notified when the process completes
+
+            **Request details:**
+            - Commenter: @${{ github.event.comment.user.login }}
+            - Command: \`${{ needs.check-fork-trigger.outputs.command }}\`
+            - PR: #${{ needs.check-fork-trigger.outputs.pr-number }} (from fork)
+
+            **Maintainers:** To approve this request, please use the maintainer approval workflow or manually trigger Claude Code with appropriate permissions.`;
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: ${{ needs.check-fork-trigger.outputs.pr-number }},
+              body: comment
+            });
+
+      - name: Create approval issue
+        uses: actions/github-script@v7
+        with:
+          script: |
+            // Create an issue for tracking fork approvals
+            const issue = await github.rest.issues.create({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              title: `Claude Code Fork Approval Required - PR #${{ needs.check-fork-trigger.outputs.pr-number }}`,
+              body: `## Claude Code Approval Request
+
+            **PR:** #${{ needs.check-fork-trigger.outputs.pr-number }}
+            **Requested by:** @${{ github.event.comment.user.login }}
+            **Command:** \`${{ needs.check-fork-trigger.outputs.command }}\`
+            **Timestamp:** ${new Date().toISOString()}
+
+            ### Security Checklist for Maintainers
+
+            Before approving, please verify:
+            - [ ] The PR changes look safe and reasonable
+            - [ ] The Claude Code command is appropriate
+            - [ ] The requesting user appears legitimate
+            - [ ] No suspicious patterns in the PR or request
+
+            ### How to Approve
+
+            1. Review the PR thoroughly
+            2. If safe, close this issue with the comment: \`/approve-claude\`
+            3. Claude Code will then execute on the PR
+
+            ### How to Deny
+
+            Close this issue with the comment: \`/deny-claude [reason]\`
+
+            ---
+            *This issue was automatically created for security review.*`,
+              labels: ['claude-code', 'security-review', 'fork-pr']
+            });
+
+            console.log(`Created approval issue: ${issue.data.html_url}`);
+
+  notify-maintainer-override:
+    needs: check-fork-trigger
+    if: |
+      needs.check-fork-trigger.outputs.should-run == 'true' &&
+      needs.check-fork-trigger.outputs.is-fork == 'true' &&
+      needs.check-fork-trigger.outputs.is-maintainer == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Comment on maintainer override
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const comment = `✅ **Maintainer Override Detected**
+
+            @${{ github.event.comment.user.login }}, as a project maintainer, you have permission to execute Claude Code on this forked PR.
+
+            However, please note:
+            - This PR is from a fork: extra caution is advised
+            - Ensure you've reviewed the PR changes before proceeding
+            - Claude Code will execute with your permissions
+
+            The standard Claude Code workflow will now proceed.
+
+            **Command:** \`${{ needs.check-fork-trigger.outputs.command }}\``;
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: ${{ needs.check-fork-trigger.outputs.pr-number }},
+              body: comment
+            });
+
+      - name: Trigger standard workflow
+        uses: actions/github-script@v7
+        with:
+          script: |
+            // Log that maintainer override is being used
+            console.log(JSON.stringify({
+              event: 'claude-code-maintainer-override',
+              pr_number: ${{ needs.check-fork-trigger.outputs.pr-number }},
+              maintainer: '${{ github.event.comment.user.login }}',
+              command: '${{ needs.check-fork-trigger.outputs.command }}',
+              timestamp: new Date().toISOString(),
+              repository: context.repo.owner + '/' + context.repo.repo
+            }));
diff --git a/.github/workflows/claude-issue-comment.yml b/.github/workflows/claude-issue-comment.yml
new file mode 100644
index 0000000000..863bb68ac4
--- /dev/null
+++ b/.github/workflows/claude-issue-comment.yml
@@ -0,0 +1,296 @@
+name: Claude Code Issue Comment Handler
+
+on:
+  issue_comment:
+    types: [created]
+
+permissions:
+  contents: write
+  issues: write
+  pull-requests: write
+
+jobs:
+  check-trigger:
+    if: |
+      !github.event.issue.pull_request &&
+      contains(github.event.comment.body, '@claude')
+    runs-on: ubuntu-latest
+    outputs:
+      should-run: ${{ steps.check.outputs.should-run }}
+      has-permission: ${{ steps.permission.outputs.has-permission }}
+      is-external: ${{ steps.permission.outputs.is-external }}
+      command: ${{ steps.parse.outputs.command }}
+    steps:
+      - name: Check if comment mentions @claude
+        id: check
+        run: |
+          if [[ "${{ github.event.comment.body }}" =~ @claude ]]; then
+            echo "should-run=true" >> $GITHUB_OUTPUT
+          else
+            echo "should-run=false" >> $GITHUB_OUTPUT
+          fi
+
+      - name: Parse command
+        id: parse
+        if: steps.check.outputs.should-run == 'true'
+        run: |
+          COMMENT="${{ github.event.comment.body }}"
+          # Extract the command after @claude
+          COMMAND=$(echo "$COMMENT" | sed -n 's/.*@claude[[:space:]]*\(.*\)/\1/p' | head -1)
+          echo "command=$COMMAND" >> $GITHUB_OUTPUT
+          echo "Parsed command: $COMMAND"
+
+      - name: Checkout repository
+        if: steps.check.outputs.should-run == 'true'
+        uses: actions/checkout@v4
+
+      - name: Check permissions
+        id: permission
+        if: steps.check.outputs.should-run == 'true'
+        uses: ./.github/actions/check-claude-permission
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          commenter: ${{ github.event.comment.user.login }}
+          allowed-users: ${{ vars.ALLOWED_CLAUDE_CONTRIBUTORS }}
+
+  request-approval:
+    needs: check-trigger
+    if: |
+      needs.check-trigger.outputs.should-run == 'true' &&
+      needs.check-trigger.outputs.has-permission == 'false'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Comment requesting approval
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const comment = `👋 @${{ github.event.comment.user.login }}, thank you for your Claude Code request!
+
+            Since you're an external contributor, this request requires approval from a project maintainer for security reasons.
+
+            **Maintainers**: Please review this request and if approved, add a 👍 reaction to the original comment to trigger Claude Code execution.
+
+            **Request details:**
+            - Commenter: @${{ github.event.comment.user.login }}
+            - Command: \`${{ needs.check-trigger.outputs.command }}\`
+            - Issue: #${{ github.event.issue.number }}`;
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: comment
+            });
+
+  execute-claude:
+    needs: check-trigger
+    if: |
+      needs.check-trigger.outputs.should-run == 'true' &&
+      needs.check-trigger.outputs.has-permission == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          fetch-depth: 0
+
+      - name: Setup Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.10'
+
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: '18'
+
+      - name: Install Claude Code
+        run: |
+          npm install -g @anthropic-ai/claude-code
+
+      - name: Acknowledge request
+        uses: actions/github-script@v7
+        with:
+          script: |
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: `🤖 Claude Code is now working on issue #${{ github.event.issue.number }}: \`${{ needs.check-trigger.outputs.command }}\`\n\nI'll create a pull request with my proposed solution shortly.`
+            });
+
+      - name: Execute Claude Code
+        id: claude
+        env:
+          ANTHROPIC_API_KEY: ${{ secrets.PRESET_SPONSORED_ANTHROPIC_API_KEY }}
+        run: |
+          # Configure git
+          git config --global user.name "Claude Code"
+          git config --global user.email "claude-code[bot]@anthropic.com"
+
+          # Create a new branch for the fix
+          BRANCH_NAME="claude-fix-issue-${{ github.event.issue.number }}-${{ github.run_id }}"
+          git checkout -b "$BRANCH_NAME"
+
+          # Prepare context
+          ISSUE_CONTEXT="Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }}
+
+          ${{ github.event.issue.body }}
+
+          Additional context from comment:
+          ${{ needs.check-trigger.outputs.command }}"
+
+          # Prepare context files
+          CONTEXT_FILES=""
+          if [ -f "CLAUDE.md" ]; then
+            CONTEXT_FILES="$CONTEXT_FILES --context CLAUDE.md"
+          fi
+          if [ -f "LLMS.md" ]; then
+            CONTEXT_FILES="$CONTEXT_FILES --context LLMS.md"
+          fi
+
+          # Execute Claude Code with the issue context
+          echo "Executing Claude Code to fix issue #${{ github.event.issue.number }}"
+
+          claude-code \
+            --prompt "$ISSUE_CONTEXT" \
+            $CONTEXT_FILES \
+            --yes \
+            --no-interactive \
+            > claude-output.log 2>&1 || true
+
+          # Check if there are changes to commit
+          if [[ -n $(git status -s) ]]; then
+            git add -A
+            git commit -m "Fix issue #${{ github.event.issue.number }}
+
+            ${{ github.event.issue.title }}
+
+            Requested by: @${{ github.event.comment.user.login }}
+            Fixes: #${{ github.event.issue.number }}
+
+            Co-authored-by: ${{ github.event.comment.user.login }} <${{ github.event.comment.user.id }}+${{ github.event.comment.user.login }}@users.noreply.github.com>"
+
+            git push origin "$BRANCH_NAME"
+            echo "changes-made=true" >> $GITHUB_OUTPUT
+            echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
+          else
+            echo "changes-made=false" >> $GITHUB_OUTPUT
+          fi
+
+      - name: Create Pull Request
+        if: steps.claude.outputs.changes-made == 'true'
+        id: pr
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const pr = await github.rest.pulls.create({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              title: `Fix: ${context.payload.issue.title} (#${context.issue.number})`,
+              body: `## Summary
+
+            This PR addresses issue #${context.issue.number} using Claude Code.
+
+            **Original issue:** ${context.payload.issue.title}
+            **Requested by:** @${context.payload.comment.user.login}
+            **Command:** \`${{ needs.check-trigger.outputs.command }}\`
+
+            ## Changes
+
+            Claude Code has analyzed the issue and implemented a fix. Please review the changes carefully.
+
+            ## Testing
+
+            - [ ] Code changes have been tested
+            - [ ] All tests pass
+            - [ ] No regressions introduced
+
+            Fixes #${context.issue.number}
+
+            ---
+            *This PR was automatically generated by Claude Code in response to a comment on issue #${context.issue.number}*`,
+              head: '${{ steps.claude.outputs.branch-name }}',
+              base: context.payload.repository.default_branch
+            });
+
+            core.setOutput('pr-number', pr.data.number);
+            core.setOutput('pr-url', pr.data.html_url);
+
+      - name: Log usage
+        if: always()
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const fs = require('fs');
+            let claudeOutput = '';
+            try {
+              claudeOutput = fs.readFileSync('claude-output.log', 'utf8');
+            } catch (e) {
+              claudeOutput = 'No output captured';
+            }
+
+            // Log usage for tracking
+            console.log(JSON.stringify({
+              event: 'claude-code-execution',
+              issue_number: context.issue.number,
+              pr_number: '${{ steps.pr.outputs.pr-number }}' || null,
+              commenter: '${{ github.event.comment.user.login }}',
+              command: '${{ needs.check-trigger.outputs.command }}',
+              timestamp: new Date().toISOString(),
+              changes_made: '${{ steps.claude.outputs.changes-made }}',
+              repository: context.repo.owner + '/' + context.repo.repo
+            }));
+
+      - name: Comment result
+        if: always()
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const fs = require('fs');
+            let message;
+
+            if ('${{ steps.claude.outputs.changes-made }}' === 'true' && '${{ steps.pr.outputs.pr-url }}') {
+              message = `✅ Claude Code has created a pull request to fix this issue!
+
+              **Pull Request:** ${{ steps.pr.outputs.pr-url }}
+              **Command executed:** \`${{ needs.check-trigger.outputs.command }}\`
+
+              Please review the changes in the PR. The fix has been implemented based on the issue description and context.`;
+            } else {
+              let claudeOutput = '';
+              try {
+                claudeOutput = fs.readFileSync('claude-output.log', 'utf8');
+                // Truncate if too long
+                if (claudeOutput.length > 3000) {
+                  claudeOutput = claudeOutput.substring(0, 3000) + '\n... (output truncated)';
+                }
+              } catch (e) {
+                claudeOutput = 'No output captured';
+              }
+
+              message = `â„šī¸ Claude Code analyzed the issue but couldn't create a fix automatically.
+
+              **Command executed:** \`${{ needs.check-trigger.outputs.command }}\`
+
+              This might be because:
+              - The issue requires more context or clarification
+              - The fix is too complex for automated resolution
+              - No code changes were needed
+
+              <details>
+              <summary>Claude Code output</summary>
+
+              \`\`\`
+              ${claudeOutput}
+              \`\`\`
+              </details>`;
+            }
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: message
+            });
diff --git a/.github/workflows/claude-maintainer-approval.yml b/.github/workflows/claude-maintainer-approval.yml
new file mode 100644
index 0000000000..152a9b0fda
--- /dev/null
+++ b/.github/workflows/claude-maintainer-approval.yml
@@ -0,0 +1,214 @@
+name: Claude Code Maintainer Approval
+
+on:
+  issue_comment:
+    types: [created]
+  pull_request_review:
+    types: [submitted]
+
+permissions:
+  contents: write
+  issues: write
+  pull-requests: write
+
+jobs:
+  check-approval:
+    if: |
+      (github.event.issue &&
+       contains(github.event.issue.labels.*.name, 'claude-code') &&
+       contains(github.event.issue.labels.*.name, 'security-review') &&
+       (contains(github.event.comment.body, '/approve-claude') ||
+        contains(github.event.comment.body, '/deny-claude'))) ||
+      (github.event.review &&
+       github.event.review.state == 'approved' &&
+       contains(github.event.review.body, '@claude'))
+    runs-on: ubuntu-latest
+    outputs:
+      is-approved: ${{ steps.check.outputs.is-approved }}
+      is-denied: ${{ steps.check.outputs.is-denied }}
+      denial-reason: ${{ steps.check.outputs.denial-reason }}
+      pr-number: ${{ steps.extract.outputs.pr-number }}
+      original-command: ${{ steps.extract.outputs.original-command }}
+    steps:
+      - name: Check if maintainer
+        id: maintainer
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const user = context.payload.comment?.user.login || context.payload.review?.user.login;
+
+            // Check if user is a maintainer
+            const response = await github.rest.repos.getCollaboratorPermissionLevel({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              username: user
+            });
+
+            const permission = response.data.permission;
+            const isMaintainer = permission === 'admin' || permission === 'maintain';
+
+            if (!isMaintainer) {
+              core.setFailed(`User ${user} is not a maintainer`);
+            }
+
+            return isMaintainer;
+
+      - name: Parse approval
+        id: check
+        if: steps.maintainer.outcome == 'success'
+        run: |
+          COMMENT="${{ github.event.comment.body || github.event.review.body }}"
+
+          if [[ "$COMMENT" =~ /approve-claude ]]; then
+            echo "is-approved=true" >> $GITHUB_OUTPUT
+            echo "is-denied=false" >> $GITHUB_OUTPUT
+          elif [[ "$COMMENT" =~ /deny-claude ]]; then
+            echo "is-approved=false" >> $GITHUB_OUTPUT
+            echo "is-denied=true" >> $GITHUB_OUTPUT
+            # Extract denial reason
+            REASON=$(echo "$COMMENT" | sed -n 's:.*/deny-claude[[:space:]]*\(.*\):\1:p')
+            echo "denial-reason=$REASON" >> $GITHUB_OUTPUT
+          else
+            echo "is-approved=false" >> $GITHUB_OUTPUT
+            echo "is-denied=false" >> $GITHUB_OUTPUT
+          fi
+
+      - name: Extract PR info
+        id: extract
+        if: steps.maintainer.outcome == 'success' && github.event.issue
+        uses: actions/github-script@v7
+        with:
+          script: |
+            // Parse PR number from issue title
+            const title = context.payload.issue.title;
+            const prMatch = title.match(/PR #(\d+)/);
+            if (prMatch) {
+              core.setOutput('pr-number', prMatch[1]);
+            }
+
+            // Extract original command from issue body
+            const body = context.payload.issue.body;
+            const commandMatch = body.match(/\*\*Command:\*\* `([^`]+)`/);
+            if (commandMatch) {
+              core.setOutput('original-command', commandMatch[1]);
+            }
+
+  process-approval:
+    needs: check-approval
+    if: needs.check-approval.outputs.is-approved == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Close approval issue
+        if: github.event.issue
+        uses: actions/github-script@v7
+        with:
+          script: |
+            await github.rest.issues.update({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              state: 'closed'
+            });
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: `✅ Approved by @${context.payload.comment.user.login}. Triggering Claude Code execution on PR #${{ needs.check-approval.outputs.pr-number }}.`
+            });
+
+      - name: Trigger Claude execution
+        uses: actions/github-script@v7
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          script: |
+            // Add a comment to the PR to trigger Claude
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: ${{ needs.check-approval.outputs.pr-number }},
+              body: `🔓 **Maintainer Approval Granted**
+
+            @${context.payload.comment.user.login} has approved the Claude Code execution for this PR.
+
+            Proceeding with the original request: \`${{ needs.check-approval.outputs.original-command }}\`
+
+            Claude Code will now execute with elevated permissions.`
+            });
+
+      - name: Dispatch Claude workflow
+        uses: actions/github-script@v7
+        with:
+          script: |
+            // Create a repository dispatch event to trigger Claude execution
+            await github.rest.repos.createDispatchEvent({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              event_type: 'claude-approved-execution',
+              client_payload: {
+                pr_number: '${{ needs.check-approval.outputs.pr-number }}',
+                command: '${{ needs.check-approval.outputs.original-command }}',
+                approved_by: context.payload.comment.user.login,
+                approval_issue: context.issue.number
+              }
+            });
+
+  process-denial:
+    needs: check-approval
+    if: needs.check-approval.outputs.is-denied == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Close approval issue
+        if: github.event.issue
+        uses: actions/github-script@v7
+        with:
+          script: |
+            await github.rest.issues.update({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              state: 'closed'
+            });
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: `❌ Denied by @${context.payload.comment.user.login}.
+
+            Reason: ${{ needs.check-approval.outputs.denial-reason || 'No reason provided' }}
+
+            Claude Code will not be executed on PR #${{ needs.check-approval.outputs.pr-number }}.`
+            });
+
+      - name: Notify PR
+        uses: actions/github-script@v7
+        with:
+          script: |
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: ${{ needs.check-approval.outputs.pr-number }},
+              body: `đŸšĢ **Claude Code Request Denied**
+
+            A maintainer has denied the Claude Code execution request for this PR.
+
+            **Denied by:** @${context.payload.comment.user.login}
+            **Reason:** ${{ needs.check-approval.outputs.denial-reason || 'No specific reason provided' }}
+
+            If you believe this was in error, please discuss with the project maintainers.`
+            });
+
+      - name: Log denial
+        uses: ./.github/actions/log-claude-usage
+        with:
+          event-type: 'maintainer-denial'
+          user: ${{ github.event.comment.user.login }}
+          command: ${{ needs.check-approval.outputs.original-command }}
+          pr-number: ${{ needs.check-approval.outputs.pr-number }}
+          status: 'denied'
+          additional-info: |
+            {
+              "denial_reason": "${{ needs.check-approval.outputs.denial-reason }}",
+              "denied_by": "${{ github.event.comment.user.login }}"
+            }
diff --git a/.github/workflows/claude-pr-comment.yml b/.github/workflows/claude-pr-comment.yml
new file mode 100644
index 0000000000..6c9917ecf8
--- /dev/null
+++ b/.github/workflows/claude-pr-comment.yml
@@ -0,0 +1,253 @@
+name: Claude Code PR Comment Handler
+
+on:
+  issue_comment:
+    types: [created]
+
+permissions:
+  contents: write
+  issues: write
+  pull-requests: write
+
+jobs:
+  check-trigger:
+    if: |
+      github.event.issue.pull_request &&
+      contains(github.event.comment.body, '@claude')
+    runs-on: ubuntu-latest
+    outputs:
+      should-run: ${{ steps.check.outputs.should-run }}
+      has-permission: ${{ steps.permission.outputs.has-permission }}
+      is-external: ${{ steps.permission.outputs.is-external }}
+      command: ${{ steps.parse.outputs.command }}
+    steps:
+      - name: Check if comment mentions @claude
+        id: check
+        run: |
+          if [[ "${{ github.event.comment.body }}" =~ @claude ]]; then
+            echo "should-run=true" >> $GITHUB_OUTPUT
+          else
+            echo "should-run=false" >> $GITHUB_OUTPUT
+          fi
+
+      - name: Parse command
+        id: parse
+        if: steps.check.outputs.should-run == 'true'
+        run: |
+          COMMENT="${{ github.event.comment.body }}"
+          # Extract the command after @claude
+          COMMAND=$(echo "$COMMENT" | sed -n 's/.*@claude[[:space:]]*\(.*\)/\1/p' | head -1)
+          echo "command=$COMMAND" >> $GITHUB_OUTPUT
+          echo "Parsed command: $COMMAND"
+
+      - name: Checkout repository
+        if: steps.check.outputs.should-run == 'true'
+        uses: actions/checkout@v4
+
+      - name: Check permissions
+        id: permission
+        if: steps.check.outputs.should-run == 'true'
+        uses: ./.github/actions/check-claude-permission
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          commenter: ${{ github.event.comment.user.login }}
+          allowed-users: ${{ vars.ALLOWED_CLAUDE_CONTRIBUTORS }}
+
+  request-approval:
+    needs: check-trigger
+    if: |
+      needs.check-trigger.outputs.should-run == 'true' &&
+      needs.check-trigger.outputs.has-permission == 'false'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Comment requesting approval
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const comment = `👋 @${{ github.event.comment.user.login }}, thank you for your Claude Code request!
+
+            Since you're an external contributor, this request requires approval from a project maintainer for security reasons.
+
+            **Maintainers**: Please review this request and if approved, add a 👍 reaction to the original comment to trigger Claude Code execution.
+
+            **Request details:**
+            - Commenter: @${{ github.event.comment.user.login }}
+            - Command: \`${{ needs.check-trigger.outputs.command }}\`
+            - PR: #${{ github.event.issue.number }}`;
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: comment
+            });
+
+  execute-claude:
+    needs: check-trigger
+    if: |
+      needs.check-trigger.outputs.should-run == 'true' &&
+      needs.check-trigger.outputs.has-permission == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Get PR details
+        id: pr
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const pr = await github.rest.pulls.get({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              pull_number: context.issue.number
+            });
+
+            core.setOutput('head-ref', pr.data.head.ref);
+            core.setOutput('head-sha', pr.data.head.sha);
+            core.setOutput('base-ref', pr.data.base.ref);
+            core.setOutput('is-fork', pr.data.head.repo.fork);
+            core.setOutput('clone-url', pr.data.head.repo.clone_url);
+
+      - name: Checkout PR
+        uses: actions/checkout@v4
+        with:
+          ref: ${{ steps.pr.outputs.head-ref }}
+          token: ${{ secrets.GITHUB_TOKEN }}
+          fetch-depth: 0
+
+      - name: Setup Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.10'
+
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: '18'
+
+      - name: Install Claude Code
+        run: |
+          npm install -g @anthropic-ai/claude-code
+
+      - name: Acknowledge request
+        uses: actions/github-script@v7
+        with:
+          script: |
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: `🤖 Claude Code is now working on your request: \`${{ needs.check-trigger.outputs.command }}\`\n\nI'll update this PR shortly with my changes.`
+            });
+
+      - name: Execute Claude Code
+        id: claude
+        env:
+          ANTHROPIC_API_KEY: ${{ secrets.PRESET_SPONSORED_ANTHROPIC_API_KEY }}
+        run: |
+          # Configure git
+          git config --global user.name "Claude Code"
+          git config --global user.email "claude-code[bot]@anthropic.com"
+
+          # Prepare context files
+          CONTEXT_FILES=""
+          if [ -f "CLAUDE.md" ]; then
+            CONTEXT_FILES="$CONTEXT_FILES --context CLAUDE.md"
+          fi
+          if [ -f "LLMS.md" ]; then
+            CONTEXT_FILES="$CONTEXT_FILES --context LLMS.md"
+          fi
+
+          # Execute Claude Code with the command
+          echo "Executing Claude Code with command: ${{ needs.check-trigger.outputs.command }}"
+
+          claude-code \
+            --prompt "${{ needs.check-trigger.outputs.command }}" \
+            $CONTEXT_FILES \
+            --yes \
+            --no-interactive \
+            > claude-output.log 2>&1 || true
+
+          # Check if there are changes to commit
+          if [[ -n $(git status -s) ]]; then
+            git add -A
+            git commit -m "Apply Claude Code suggestions
+
+            Requested by: @${{ github.event.comment.user.login }}
+            Command: ${{ needs.check-trigger.outputs.command }}
+
+            Co-authored-by: ${{ github.event.comment.user.login }} <${{ github.event.comment.user.id }}+${{ github.event.comment.user.login }}@users.noreply.github.com>"
+
+            git push origin ${{ steps.pr.outputs.head-ref }}
+            echo "changes-made=true" >> $GITHUB_OUTPUT
+          else
+            echo "changes-made=false" >> $GITHUB_OUTPUT
+          fi
+
+      - name: Log usage
+        if: always()
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const fs = require('fs');
+            let claudeOutput = '';
+            try {
+              claudeOutput = fs.readFileSync('claude-output.log', 'utf8');
+            } catch (e) {
+              claudeOutput = 'No output captured';
+            }
+
+            // Log usage for tracking
+            console.log(JSON.stringify({
+              event: 'claude-code-execution',
+              pr_number: context.issue.number,
+              commenter: '${{ github.event.comment.user.login }}',
+              command: '${{ needs.check-trigger.outputs.command }}',
+              timestamp: new Date().toISOString(),
+              changes_made: '${{ steps.claude.outputs.changes-made }}',
+              repository: context.repo.owner + '/' + context.repo.repo
+            }));
+
+      - name: Comment result
+        if: always()
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const fs = require('fs');
+            let message;
+
+            if ('${{ steps.claude.outputs.changes-made }}' === 'true') {
+              message = `✅ Claude Code has successfully applied changes to this PR based on your request.
+
+              **Command executed:** \`${{ needs.check-trigger.outputs.command }}\`
+
+              The changes have been pushed to the PR branch. Please review the changes and run any necessary tests.`;
+            } else {
+              let claudeOutput = '';
+              try {
+                claudeOutput = fs.readFileSync('claude-output.log', 'utf8');
+                // Truncate if too long
+                if (claudeOutput.length > 3000) {
+                  claudeOutput = claudeOutput.substring(0, 3000) + '\n... (output truncated)';
+                }
+              } catch (e) {
+                claudeOutput = 'No output captured';
+              }
+
+              message = `â„šī¸ Claude Code completed the request but no changes were needed.
+
+              **Command executed:** \`${{ needs.check-trigger.outputs.command }}\`
+
+              <details>
+              <summary>Claude Code output</summary>
+
+              \`\`\`
+              ${claudeOutput}
+              \`\`\`
+              </details>`;
+            }
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              body: message
+            });
diff --git a/.gitignore b/.gitignore
index 2f649d941f..4a2c4b24c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,3 +127,5 @@ docker/*local*
 test-report.html
 superset/static/stats/statistics.html
 .aider*
+
+CLAUDE.local.md