From 9b2ee10fe2a035c9f963acf91cdf67e2d26cfbd1 Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Fri, 21 Nov 2025 13:45:07 +0100 Subject: [PATCH] chore: update docs --- internal/hooks/README.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/internal/hooks/README.md b/internal/hooks/README.md index a7af873e96c12756d51c1874dc01c3dc6d28791b..0fd4b4c0194a413fd009489a1bb001e90e115cbf 100644 --- a/internal/hooks/README.md +++ b/internal/hooks/README.md @@ -67,6 +67,7 @@ chmod +x .crush/hooks/pre-tool-use/01-block-dangerous.sh - `prompt` - User's prompt text - `attachments` - List of attached files - `model` - Model name +- `provider` - Provider name (e.g., "anthropic", "openai") - `is_first_message` - Boolean indicating if this is the first message in the conversation **Example**: @@ -161,7 +162,9 @@ fi **Available data** (via stdin JSON): - `reason` - Why the loop stopped (e.g., "completed", "cancelled", "error") -- `session_id` - The session ID that stopped + +**Environment variables**: +- `$CRUSH_SESSION_ID` - The session ID that stopped **Example**: ```bash @@ -169,13 +172,12 @@ fi # Save conversation summary when agent loop stops REASON=$(crush_get_input reason) -SESSION_ID=$(crush_get_input session_id) # Archive session logs -if [ -f ".crush/session-$SESSION_ID.log" ]; then - ARCHIVE="logs/session-$SESSION_ID-$(date +%Y%m%d-%H%M%S).log" +if [ -f ".crush/session-$CRUSH_SESSION_ID.log" ]; then + ARCHIVE="logs/session-$CRUSH_SESSION_ID-$(date +%Y%m%d-%H%M%S).log" mkdir -p logs - mv ".crush/session-$SESSION_ID.log" "$ARCHIVE" + mv ".crush/session-$CRUSH_SESSION_ID.log" "$ARCHIVE" gzip "$ARCHIVE" crush_log "Archived session logs: $ARCHIVE.gz (reason: $REASON)" fi @@ -467,13 +469,13 @@ Configure hooks in `crush.json`: ```json { "hooks": { - "enabled": true, + "disabled": false, "timeout_seconds": 30, "directories": [ "/path/to/custom/hooks", ".crush/hooks" ], - "disabled": [ + "disable_hooks": [ "pre-tool-use/slow-check.sh", "user-prompt-submit/verbose.sh" ], @@ -492,10 +494,10 @@ Configure hooks in `crush.json`: ### Configuration Options -- **enabled** (bool) - Enable/disable the entire hooks system (default: `true`) +- **disabled** (bool) - Disable hook execution entirely (default: `false`) - **timeout_seconds** (int) - Maximum execution time per hook (default: `30`) -- **directories** ([]string) - Additional directories to search for hooks -- **disabled** ([]string) - List of hook paths to skip (relative to hooks directory) +- **directories** ([]string) - Directories to search for hook scripts (defaults to `[".crush/hooks"]`) +- **disable_hooks** ([]string) - List of hook paths to skip (relative to hooks directory) - **environment** (map) - Environment variables to pass to all hooks - **inline** (map) - Hooks defined directly in config (by hook type)