When hooks don't work as expected, debugging can be frustrating. The basic execution log in Cursor's settings confirms whether your script ran, but it doesn't show what data was sent or what your script returned. This lesson reveals where to find the comprehensive logs that expose the complete input and output of your hook scripts, making debugging straightforward and efficient.
The First Check: Hooks Settings
Your first stop should be the Cursor settings to confirm your hook is configured correctly.
- Open Cursor Settings (Cmd/Ctrl + ,).
 - Search for "hooks".
 - This view will show your Configured Hooks and a basic Execution Log.
 
This log is useful for confirming that Cursor is attempting to run your script, but it doesn't show the data being passed or any errors from the script itself. If your hook appears here but isn't behaving correctly, you need to dig deeper.
Deep Dive Debugging: The Output Panel
The key to effective debugging is the Output panel, which provides a detailed, real-time log of hook executions.
To access the hooks log:
- Open the bottom panel in Cursor (where the Terminal, Problems, etc., are located).
 - Click on the Output tab.
 - In the dropdown menu on the right side of the panel, select Hooks.
 
Here you will see a detailed log for each time a hook is triggered, including the full INPUT JSON payload sent to your script and the OUTPUT it returned. This is essential for understanding what data your script is receiving and how it's responding.
For example, when the instructor triggers a file read, the log shows the execution of the debug.sh script:
It also reveals the full JSON payload that was piped to the script as standard input:
The debug.sh script in this lesson simply captures this input:
By monitoring this output, you can debug your scripts by seeing exactly what Cursor is sending them, which is critical for fixing logic errors or handling different event payloads. The Hooks output panel becomes your debugging console, showing you everything you need to diagnose issues.
Test this by asking the AI to read a file:
The hook triggers immediately, and a new entry appears in the Hooks output log, allowing you to inspect the data in real-time and verify your hook is receiving the correct information.
