HookStackGitHub
Back to catalogue
WorkflowPermissionRequest· ExitPlanModePermissionRequestOn permission request · can block⚡ blocking

Automatic ExitPlanMode approval

Automatically approves the ExitPlanMode permission request, removing the interactive dialog every time Claude finishes presenting a plan and asks to proceed.

Use cases

  • Planning workflows where manual approval is always granted
  • CI/CD automation with plan mode enabled
  • Reduce interruptions during intensive interactive sessions

Providers & tags

Claude Code
#permission#plan-mode#automation#approval

settings.json fragment

{
  "hooks": {
    "PermissionRequest": [
      {
        "hooks": [
          {
            "command": "node $CLAUDE_PROJECT_DIR/.claude/hooks/auto-allow-exit-plan.mjs",
            "type": "command"
          }
        ],
        "matcher": "ExitPlanMode"
      }
    ]
  }
}

Script · .claude/hooks/auto-allow-exit-plan.mjs

#!/usr/bin/env node
// Auto-autorise la sortie du mode plan (PermissionRequest)
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';

export function run(input) {
  const toolName = input.tool_name ?? input.tool ?? '';
  if (toolName !== 'exit_plan_mode') return null;
  return {
    hookSpecificOutput: {
      hookEventName: 'PermissionRequest',
      decision: { behavior: 'allow' },
    },
  };
}

/* v8 ignore next 5 */
if (process.argv[1] === fileURLToPath(import.meta.url)) {
  const input = JSON.parse(readFileSync(0, 'utf8'));
  const result = run(input);
  if (result) process.stdout.write(JSON.stringify(result));
}