You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -297,6 +297,17 @@ SessionStart hooks **always exit with code 0**, even when:
297
297
298
298
Errors are logged to stderr as warnings, but cchook continues to output JSON and exits successfully. This ensures Claude Code always receives a response.
299
299
300
+
**Plain Text Output** (`output_format: text`):
301
+
For commands that output plain text (not JSON), use `output_format: text` to treat the stdout as `additionalContext`:
302
+
```yaml
303
+
SessionStart:
304
+
- actions:
305
+
- type: command
306
+
command: "get-project-info.sh" # Returns plain text, not JSON
307
+
output_format: text # stdout treated as additionalContext
308
+
```
309
+
- Without `output_format: text`, non-JSON stdout causes `continue: false` (fail-safe)
310
+
300
311
**Example**:
301
312
```yaml
302
313
SessionStart:
@@ -433,6 +444,19 @@ PreToolUse hooks **always exit with code 0**. The `permissionDecision` field con
433
444
434
445
Errors are logged to stderr as warnings, but cchook continues to output JSON and exits successfully. On errors, `permissionDecision` defaults to `"deny"` for safety.
435
446
447
+
**Plain Text Output** (`output_format: text`):
448
+
For commands that output plain text (not JSON), use `output_format: text` to treat the stdout as `permissionDecisionReason` with `permissionDecision: "allow"`:
449
+
```yaml
450
+
PreToolUse:
451
+
- matcher: "Bash"
452
+
actions:
453
+
- type: command
454
+
command: "shellcheck {.tool_input.command}"
455
+
output_format: text # stdout treated as permissionDecisionReason, permissionDecision set to "allow"
456
+
```
457
+
- Non-zero exit code still causes fail-safe `permissionDecision: "deny"` behavior
458
+
- Without `output_format: text`, non-JSON stdout causes `permissionDecision: "deny"` (fail-safe)
459
+
436
460
**Example**:
437
461
```yaml
438
462
PreToolUse:
@@ -641,6 +665,22 @@ After JSON migration:
641
665
- Use `decision` field instead: omit for allow, `"block"` to prompt Claude
642
666
- A stderr warning is emitted if `exit_status` is set (migration reminder)
643
667
668
+
**Plain Text Output** (`output_format: text`):
669
+
For commands that output plain text (not JSON), use `output_format: text` to treat the stdout as `additionalContext`:
670
+
```yaml
671
+
PostToolUse:
672
+
- matcher: "Write|Edit|MultiEdit"
673
+
conditions:
674
+
- type: file_extension
675
+
value: ".go"
676
+
actions:
677
+
- type: command
678
+
command: "gofmt -w {.tool_input.file_path}"
679
+
output_format: text # stdout treated as additionalContext, not parsed as JSON
680
+
```
681
+
- Non-zero exit code still causes fail-safe `decision: "block"` behavior
682
+
- Without `output_format: text`, non-JSON stdout causes `decision: "block"` (fail-safe)
683
+
644
684
**Example**:
645
685
```yaml
646
686
PostToolUse:
@@ -873,6 +913,17 @@ SessionEnd supports the `reason_is` condition to match session end reasons:
873
913
- `"prompt_input_exit"`: User exited via prompt input
874
914
- `"other"`: Other reasons
875
915
916
+
**Plain Text Output** (`output_format: text`):
917
+
For commands that output plain text (not JSON), use `output_format: text` to treat the stdout as `systemMessage`:
918
+
```yaml
919
+
SessionEnd:
920
+
- actions:
921
+
- type: command
922
+
command: "cleanup-session.sh" # Returns plain text, not JSON
923
+
output_format: text # stdout treated as systemMessage
924
+
```
925
+
- Without `output_format: text`, non-JSON stdout causes systemMessage set to error message
0 commit comments