HookStack
Back to catalogue
WorkflowPermissionRequest· ExitPlanMode

Automatic ExitPlanMode approval

Plans proceed without the extra approval click

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

What does the Automatic ExitPlanMode approval hook do?

Automatic ExitPlanMode approval is a Claude Code PermissionRequest hook matching ExitPlanMode. It fires automatically at that lifecycle event — outside the model, so it can't be skipped or forgotten. Plans proceed without the extra approval click.

As a PermissionRequest hook it runs before the action completes, so it can block or adjust what Claude is about to do. Because it is a deterministic Node.js script, it executes on every matching event without relying on the model to remember — the guarantee that makes agentic workflows safe to automate.

Use cases

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

Tags

#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
// @hookstack permission-request-auto-allow-exit-plan
// Auto-autorise la sortie du mode plan (PermissionRequest)
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node: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));
}

Learn more

Related hooks