Cursor
Cursor supports afterFileEdit hooks and rules files. vibecop uses both for a two-layer integration: the hook runs the scan, and the rules file reinforces the fix behavior.
Auto Setup
npx vibecop initIf a .cursor/ directory is detected, vibecop init generates both the hooks file and the rules file.
Manual Setup
Step 1: Create the Hook
Create .cursor/hooks.json in your project root:
{ "hooks": { "afterFileEdit": [ { "command": "npx vibecop scan --diff HEAD --format agent" } ] }}Step 2: Create the Rules File
Create .cursor/rules/vibecop.md:
---trigger: always_on---
After every code edit, review vibecop findings and fix issues before proceeding.Run: npx vibecop scan --diff HEAD --format agentHow It Works
- Cursor edits a file
- The
afterFileEdithook fires and runsnpx vibecop scan --diff HEAD --format agent - vibecop scans only the changed files
- If findings are detected, the agent reads the output
- The rules file reinforces the instruction to fix findings before continuing
- The agent corrects the code, and the hook runs again
Why Both Hook and Rules?
The hook provides deterministic execution — vibecop runs automatically after every edit. The rules file provides LLM-level reinforcement, ensuring the agent understands it must fix findings rather than ignore them. Together, they form a reliable feedback loop.
Troubleshooting
Hook timeout
If Cursor has a timeout for hooks, vibecop should complete within a few seconds on most codebases. For large repos, scope the scan:
npx vibecop scan --diff HEAD --format agent --path src/Permission issues
On some systems, npx may not be in the PATH when hooks execute. Use the full path:
$(npm root -g)/.bin/vibecop scan --diff HEAD --format agentOr use the local installation:
node_modules/.bin/vibecop scan --diff HEAD --format agent