> ## Documentation Index
> Fetch the complete documentation index at: https://exosphere-auto-translate-docs-20260623-1106.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Hook handler (internal)

> Tiến trình con mà Claude Code gọi tại mỗi sự kiện công cụ

```bash theme={null}
failproofai --hook <EventType>
```

Đây là lệnh được đăng ký trong `settings.json` của Claude Code bởi `failproofai policies --install`. Bình thường bạn không gọi lệnh này trực tiếp.

Đọc một payload JSON từ stdin, đánh giá tất cả các chính sách được bật, và thoát với một mã chỉ thị quyết định:

| Mã thoát | Quyết định | Hiệu ứng                                        |
| -------- | ---------- | ----------------------------------------------- |
| `0`      | `allow`    | Cho phép thực hiện hành động                    |
| `1`      | `deny`     | Chặn hành động - Claude nhìn thấy lý do từ chối |
| `2`      | `instruct` | Tiêm hướng dẫn vào ngữ cảnh của Claude          |

### Các loại sự kiện được hỗ trợ

| Danh mục                  | Sự kiện                                                                                    |
| ------------------------- | ------------------------------------------------------------------------------------------ |
| **Thực thi công cụ**      | `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest`, `PermissionDenied` |
| **Vòng đời phiên**        | `SessionStart`, `SessionEnd`, `Stop`, `StopFailure`                                        |
| **Tương tác người dùng**  | `UserPromptSubmit`, `Notification`, `Elicitation`, `ElicitationResult`                     |
| **Đại lý phụ & nhiệm vụ** | `SubagentStart`, `SubagentStop`, `TaskCreated`, `TaskCompleted`, `TeammateIdle`            |
| **Cấu hình**              | `InstructionsLoaded`, `ConfigChange`, `CwdChanged`                                         |
| **Hệ thống tệp**          | `FileChanged`, `WorktreeCreate`, `WorktreeRemove`                                          |
| **Ngữ cảnh**              | `PreCompact`, `PostCompact`                                                                |
