Git Hooks
Auto-generate IDE rule files on every commit with git hooks.
Install a git hook to automatically regenerate IDE config files whenever you commit. This ensures your generated files always reflect the latest state of your memories.
Quick Setup
memories hook installThis installs a pre-commit hook that runs memories generate all --force and stages the generated files before each commit.
How It Works
The hook:
- Runs
memories generate all --forceto regenerate all target files - Stages the generated files with
git add - The commit proceeds with the updated files included
Hook Detection
The installer automatically detects your git hooks setup:
| Setup | Location |
|---|---|
| Husky v9+ | .husky/pre-commit |
| Husky v4–8 | .husky/pre-commit |
| Plain git | .git/hooks/pre-commit |
If an existing hook file is found, the memories section is appended (not overwritten).
Uninstall
memories hook uninstallThis removes only the memories-specific section from the hook. If the hook file contained only the memories section, the file is deleted entirely.
Check Status
memories hook statusReports whether the memories hook is installed and where.
lint-staged Integration
If lint-staged is detected in your project, the installer suggests adding memories generation to your lint-staged config instead:
{
"lint-staged": {
"*": "memories generate all --force"
}
}This approach integrates with your existing pre-commit workflow rather than adding a separate hook.
Custom Hook Name
By default, memories uses the pre-commit hook. You can specify a different hook:
memories hook install --hook pre-push
memories hook uninstall --hook pre-push
memories hook status --hook pre-pushSee memories hook for the full CLI reference.