{ "hooks": { "SessionStart": [ { "matcher": "startup", "command": "curl -s -X POST http://localhost:8000/api/session/start -H 'Content-Type: application/json' -d '{\"session_type\":\"startup\",\"working_directory\":\"'\"$PWD\"'\",\"git_branch\":\"'$(git branch --show-current 2>/dev/null || echo \"unknown\")'\",\"git_repo\":\"'$(git config --get remote.origin.url 2>/dev/null || echo \"null\")'\",\"environment\":{\"pwd\":\"'\"$PWD\"'\",\"user\":\"'\"$USER\"'\",\"timestamp\":\"'$(date -Iseconds)'\"}}' > /dev/null 2>&1 &" }, { "matcher": "resume", "command": "curl -s -X POST http://localhost:8000/api/session/start -H 'Content-Type: application/json' -d '{\"session_type\":\"resume\",\"working_directory\":\"'\"$PWD\"'\",\"git_branch\":\"'$(git branch --show-current 2>/dev/null || echo \"unknown\")'\",\"git_repo\":\"'$(git config --get remote.origin.url 2>/dev/null || echo \"null\")'\",\"environment\":{\"pwd\":\"'\"$PWD\"'\",\"user\":\"'\"$USER\"'\",\"timestamp\":\"'$(date -Iseconds)'\"}}' > /dev/null 2>&1 &" }, { "matcher": "clear", "command": "curl -s -X POST http://localhost:8000/api/session/start -H 'Content-Type: application/json' -d '{\"session_type\":\"clear\",\"working_directory\":\"'\"$PWD\"'\",\"git_branch\":\"'$(git branch --show-current 2>/dev/null || echo \"unknown\")'\",\"git_repo\":\"'$(git config --get remote.origin.url 2>/dev/null || echo \"null\")'\",\"environment\":{\"pwd\":\"'\"$PWD\"'\",\"user\":\"'\"$USER\"'\",\"timestamp\":\"'$(date -Iseconds)'\"}}' > /dev/null 2>&1 &" } ], "UserPromptSubmit": [ { "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); echo '{\"session_id\":'$SESSION_ID',\"timestamp\":\"'$(date -Iseconds)'\",\"user_prompt\":\"'$(echo \"$CLAUDE_USER_PROMPT\" | sed 's/\"/\\\\\"/g' | tr '\\n' ' ')'\",\"exchange_type\":\"user_prompt\"}' | curl -s -X POST http://localhost:8000/api/conversation -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" } ], "Notification": [ { "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); curl -s -X POST http://localhost:8000/api/waiting/start -H 'Content-Type: application/json' -d '{\"session_id\":'$SESSION_ID',\"timestamp\":\"'$(date -Iseconds)'\",\"context_before\":\"Claude is waiting for input\"}' > /dev/null 2>&1 &" } ], "PostToolUse": [ { "matcher": "Edit", "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); echo '{\"session_id\":'$SESSION_ID',\"tool_name\":\"Edit\",\"action\":\"file_edit\",\"file_path\":\"'\"$CLAUDE_TOOL_FILE_PATH\"'\",\"timestamp\":\"'$(date -Iseconds)'\",\"metadata\":{\"success\":true},\"success\":true}' | curl -s -X POST http://localhost:8000/api/activity -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" }, { "matcher": "Write", "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); echo '{\"session_id\":'$SESSION_ID',\"tool_name\":\"Write\",\"action\":\"file_write\",\"file_path\":\"'\"$CLAUDE_TOOL_FILE_PATH\"'\",\"timestamp\":\"'$(date -Iseconds)'\",\"metadata\":{\"success\":true},\"success\":true}' | curl -s -X POST http://localhost:8000/api/activity -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" }, { "matcher": "Read", "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); echo '{\"session_id\":'$SESSION_ID',\"tool_name\":\"Read\",\"action\":\"file_read\",\"file_path\":\"'\"$CLAUDE_TOOL_FILE_PATH\"'\",\"timestamp\":\"'$(date -Iseconds)'\",\"metadata\":{\"success\":true},\"success\":true}' | curl -s -X POST http://localhost:8000/api/activity -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" }, { "matcher": "Bash", "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); SAFE_COMMAND=$(echo \"$CLAUDE_BASH_COMMAND\" | sed 's/\"/\\\\\"/g' | tr '\\n' ' '); echo '{\"session_id\":'$SESSION_ID',\"tool_name\":\"Bash\",\"action\":\"command_execution\",\"timestamp\":\"'$(date -Iseconds)'\",\"metadata\":{\"command\":\"'$SAFE_COMMAND'\",\"success\":true},\"success\":true}' | curl -s -X POST http://localhost:8000/api/activity -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" }, { "matcher": "Grep", "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); SAFE_PATTERN=$(echo \"$CLAUDE_GREP_PATTERN\" | sed 's/\"/\\\\\"/g'); echo '{\"session_id\":'$SESSION_ID',\"tool_name\":\"Grep\",\"action\":\"search\",\"timestamp\":\"'$(date -Iseconds)'\",\"metadata\":{\"pattern\":\"'$SAFE_PATTERN'\",\"success\":true},\"success\":true}' | curl -s -X POST http://localhost:8000/api/activity -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" }, { "matcher": "Glob", "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); echo '{\"session_id\":'$SESSION_ID',\"tool_name\":\"Glob\",\"action\":\"file_search\",\"timestamp\":\"'$(date -Iseconds)'\",\"metadata\":{\"pattern\":\"'\"$CLAUDE_GLOB_PATTERN\"'\",\"success\":true},\"success\":true}' | curl -s -X POST http://localhost:8000/api/activity -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" }, { "matcher": "Task", "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); echo '{\"session_id\":'$SESSION_ID',\"tool_name\":\"Task\",\"action\":\"subagent_call\",\"timestamp\":\"'$(date -Iseconds)'\",\"metadata\":{\"task_type\":\"'\"$CLAUDE_TASK_TYPE\"'\",\"success\":true},\"success\":true}' | curl -s -X POST http://localhost:8000/api/activity -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 &" } ], "Stop": [ { "command": "CLAUDE_SESSION_FILE='/tmp/claude-session-id'; SESSION_ID=$(cat $CLAUDE_SESSION_FILE 2>/dev/null || echo '1'); echo '{\"session_id\":'$SESSION_ID',\"timestamp\":\"'$(date -Iseconds)'\",\"claude_response\":\"Response completed\",\"exchange_type\":\"claude_response\"}' | curl -s -X POST http://localhost:8000/api/conversation -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 && curl -s -X POST http://localhost:8000/api/waiting/end -H 'Content-Type: application/json' -d '{\"session_id\":'$SESSION_ID',\"timestamp\":\"'$(date -Iseconds)'\"}' > /dev/null 2>&1 &" } ] } }