Analysis of Claude Code's Permission and Auto Mode
Key point
This analyzes how Claude Code's permission decision pipeline and LLM-based auto mode classifier work.
Details
This provides a detailed analysis of the structure of the permission decision pipeline and auto mode classifier, among the internal workings of Claude Code.
Permission Decision Pipeline Stages:
- Rule Check: Checks tool-specific permissions, safety settings (.git, .vscode, etc.), and whether bypassPermissions mode is active.
- Mode Conversion:
dontAskmode rejects the request, whileautomode runs the classifier. - Classifier: Tools on the allow list, such as Read and Grep, are executed immediately. For others, a 2-stage XML classifier is used. Stage 1 makes a quick judgment, and if necessary, Stage 2 performs an in-depth judgment via Chain-of-Thought.
- Interaction: When user confirmation is needed, the conversation is handled through various coordinator and worker models.
Classifier Input Composition:
The classifier combines the CLAUDE.md content, user messages, the assistant's tool-use blocks, and system prompts to generate the basis for its judgment.
Hook System:
Various hooks are provided to control behavior before and after tool execution (PreToolUse, PostToolUse). Hook types include Shell commands, LLM prompts, HTTP requests, and agent-level verification.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.