--- description: Cursor hooks system, auto-accept permissions, and TodoWrite practices alwaysApply: true --- # Hooks System Project hooks live in `.cursor/hooks.json` (schema version 1) and scripts under `.cursor/hooks/` and `.cursor/scripts/hooks/`. ## Hook Events - **sessionStart / sessionEnd**: Load and persist session context - **preCompact**: Save state before context compaction - **afterFileEdit**: Suggest strategic compact after edits - **beforeShellExecution**: Gate long-running servers and `git push` ## Current Project Hooks ### sessionStart - Load previous session files from `.cursor/sessions/` - Detect package manager - Report learned skills in `.agents/skills/learned/` ### sessionEnd - Persist session state - Evaluate the session for extractable patterns ### preCompact - Log compaction and append a note to the active session file ### afterFileEdit - Suggest manual compaction after many edits ### beforeShellExecution - Ask before running dev servers outside tmux - Ask before `git push` ## Auto-Accept Permissions Use with caution: - Enable for trusted, well-defined plans - Disable for exploratory work - Never skip permissions for git push, installs, or production commands ## TodoWrite Best Practices Use TodoWrite to: - Track progress on multi-step tasks - Verify understanding of instructions - Show granular implementation steps