Environment
- OS: Linux (x64)
- Cursor version: 3.7.27 (
e48ee6102a199492b0c9964699bf011886708ba0) - Workspace: single-folder project, also tested with a multi-root
.code-workspace - Workspace trust: trusted
Goal
Use a minimal workspaceOpen hook to run a script when the workspace opens.
Setup
.cursor/hooks.json:
{
"version": 1,
"hooks": {
"workspaceOpen": [
{
"command": ".cursor/hooks/hello-world.sh",
"timeout": 60
}
]
}
}
.cursor/hooks/hello-world.sh:
#!/bin/bash
echo "hello from workspaceOpen" >> /tmp/cursor-workspace-open-test.log
echo '{"pluginPaths":[]}'
The script is executable (chmod +x).
Manual test (works)
printf '{"workspace_roots":["/path/to/workspace"]}' \
| CURSOR_PROJECT_DIR=/path/to/workspace .cursor/hooks/hello-world.sh
Result:
/tmp/cursor-workspace-open-test.log contains: hello from workspaceOpen
What happens in Cursor
From Output → Hooks after a full quit and reopen:
Loaded 1 project hook(s) for steps: workspaceOpen
Hook step requested: workspaceOpen
Hook step requested: workspaceOpen
But /tmp/cursor-workspace-open-test.log is not created or updated. The script does not appear to run.
What I tried
| Command format | Result |
|---|---|
.cursor/hooks/hello-world.sh |
Hook registered, script not executed |
bash .cursor/hooks/hello-world.sh |
Same |
sh -c '"$CURSOR_PROJECT_DIR/.cursor/hooks/hello-world.sh"' |
Same |
In all cases: config loads, workspaceOpen is requested, but no log file, no stdout side effects.
Questions: Is workspaceOpen command execution supported on Linux in 3.7.27?