This script intercepts shell commands before execution and applies project-local rules defined in .cursor/hook_config.json.
-Each command is checked against patterns (literal substrings or regex) defined in hook_config.json.
-Permissions: Rules can be allow, disallow, or ask. Interactive prompts: If a rule is ask, the script always shows (unless choice is saved) a popup (Tkinter GUI or console fallback).
-The popup text comes from the rule’s userMessage.
-Leases: If the user checks “Remember” in the popup, the decision is stored under the conversation ID in the config’s Lease section, with an expiry set by the dropdown (1–24h, default from leaseTimer or defaultLeaseHours).
This should allow those who did not want to play with hooks, the ability to use at least the beforeshell usage hook. As i use it more and more i will add feasture, but fell free to request feature if you want, modify it.
You can just ask your agent of choice to install python and that should be all you need to do. How to install. %HOME%/.cursor/hook_manager.py Ask agent to install python with winget Your done. Modify the config in your project/.cursor/hook-config.
This should give you total control on a per “chat” command persistence without having to modify cursor or with cursor as complementary.
The script is part of a bigger project i am currently working on. Stay tuned!
hook_manager.7z (5.4 KB)