Hey team,
We added hooks in .cursor to send all events using OTEL to a dedicated observability platform. Looking at the logs we generate, i can see the using the IDE works perfectly for our use case, but when working with cursor-agent (cursor cli), it sends only beforeShellExecution & afterShellExecution. All other events are omitted for some reason.
hooks.json (under .cursor directory) :
{
"version": 1,
"hooks": {
"beforeSubmitPrompt": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"afterAgentResponse": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"afterAgentThought": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"beforeShellExecution": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"afterShellExecution": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"beforeMCPExecution": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"afterMCPExecution": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"beforeReadFile": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"afterFileEdit": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"stop": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"beforeTabFileRead": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
],
"afterTabFileEdit": [
{
"command": "python3.12 .cursor/hooks/hook_handler.py"
}
]
}
}
The Python script works fine as i mentioned that all events are being fired correctly if using the IDE.
CLI version:
2026.01.02-80e4d9b
OS:
MacOS
Any suggestions please?
Thanks!