afterFileEdit hooks are not firing after file edits in Cursor Cloud Agents. These same hooks are running as expected when using the local IDE/CLI.
A similar bug report was filed but was closed without follow-up, so it’s unclear if that previous issue was resolved or if it’s actually being worked on.
afterFileEdit hooks are supported in cloud agents - you can see the full support table in our hooks documentation. The earlier thread you referenced was filed before this support was added, which is why it was closed without a clear resolution.
The most likely cause here is that your hook script’s dependencies (uv, ruff, yq) aren’t available in the cloud agent VM. Hooks have a fail-open behavior - if the script exits with an error (e.g., because a tool isn’t found), the agent continues silently without any visible error. So the hook may actually be firing, but the script fails because its dependencies aren’t installed.
Could you try two things to help narrow this down?
1. Test with a minimal hook to confirm the hook fires at all. Replace your current hook with this temporarily:
Run a cloud agent session, let it edit a file, then check /tmp/hook-test.log.
2. If the test hook fires, the issue is dependencies. You’ll need to install uv, ruff, and yq in the cloud agent VM via your environment configuration - either in a Dockerfile or the install command in .cursor/environment.json.
If the test hook doesn’t fire, that would indicate something else is going on, and we’d want a request ID from that cloud agent session to investigate further.
Hi Mohit, thank you for the suggestion. I’ve run the test but the hook is still not firing; /tmp/hook-test.log was not written. The test was performed in bc-bd5f09c5-bc65-44c5-916b-b31262342f5b.
I did some deeper investigation and I can confirm that afterFileEdit hooks are verified working in cloud agents (we have a test repository that exercises every hook type and afterFileEdit fires correctly). So this appears to be something specific to your project setup rather than a platform-level issue.
The most common cause when hooks work locally but not in cloud agents: the hooks config and/or hook scripts aren’t committed to the repository. Cloud agents clone the repo fresh, so any files that only exist locally (not tracked by git) won’t be present in the cloud VM.
Could you verify these two things?
Is .cursor/hooks.json committed to the repo? Run git ls-files .cursor/hooks.json from your repo root - if it returns nothing, the file isn’t tracked.
Is the hook script committed and executable? For the test, run git ls-files .cursor/hooks/test-hook.sh (and git ls-files .agents/hooks/ruff.sh for your original hook). The scripts also need execute permission in git — check with git ls-files -s .cursor/hooks/test-hook.sh (the mode should start with 100755, not 100644).
If the files ARE committed, let me know and I’ll dig into the backend logs from your session to trace exactly what happened.
That was the issue, I had the cloud agent write the test hooks, but since they weren’t committed they didn’t run. A follow-up edit triggered the test hook. I did some more digging and found that our cloud agent tool versions didn’t match our pinned local development tool versions which was causing the hooks to silently fail in the cloud agent environments. We can close this thread, thank you for your help!