Pre-commit hooks enforcing AI-readiness best practices for Red Hat development teams.
Currently, the hooks available from this repo have minimal scope. This serves to drive early adoption to solicit feedback and identify additional practices that can be codified, without significant adopter friction.
Issues and PRs that add hooks for enforcing AI-enabled software development practices are welcomed!
First, navigate to the repository that you want to configure with Red Hat security and AI-readiness practices.
Then run the quick setup script:
curl -sSL https://raw.githubusercontent.com/openshift-hyperfleet/rh-hooks-ai/main/bootstrap/quick-setup.sh | bashOr manually add to .pre-commit-config.yaml:
repos:
- repo: https://github.com/openshift-hyperfleet/rh-hooks-ai
rev: v1.0.0 # Use latest release
hooks:
- id: check-rh-precommit
- id: validate-agents-md # Optional: Remove if not using AGENTS.md
- id: ai-attribution-reminder
# - id: check-version # Optional: Enable for update notificationsThen run:
pre-commit install
pre-commit install --hook-type pre-push
pre-commit run --all-files # TestFirst-time setup note: If this is your first time running pre-commit run --all-files with rh-pre-commit on this machine, the command may fail with an authentication error. If you see "Could not find pattern server auth token!", follow the instructions in the error message to authenticate:
python3 -m rh_gitleaks loginAfter logging in and copying the authentication token when prompted, re-run pre-commit run --all-files to complete the setup.
Enforces rh-pre-commit configuration in .pre-commit-config.yaml. Blocks commits if missing.
Validates AGENTS.md file exists in git and contains meaningful content (>100 chars). Runs on git push to avoid blocking local commits. Based on agentsmd.net standard.
One-time reminder to use Assisted-by: or Generated-by: trailers in commit messages for AI-assisted code.
Example:
Add authentication feature
Implements JWT-based auth with refresh tokens.
Assisted-by: Claude Code
Checks for updates once per 24 hours. Commented out by default in baseline config.
templates/AGENTS.md.template- Starter template for AI context filestemplates/gitmessage.txt- Commit message template with AI attribution reminder
Configure commit template:
git config commit.template .gitmessageDO commit .pre-commit-config.yaml to your repository - this is a repository-wide configuration that ensures all contributors run the same security and quality checks. It should never be added to .gitignore.
DO add to .gitignore: .gitmessage - this is a personal workflow file that each developer can customize locally. The quick-setup script generates it automatically for each user.
Minimal setup (security enforcement only):
repos:
- repo: https://github.com/openshift-hyperfleet/rh-hooks-ai
rev: v1.0.0 # Replace with latest tag
hooks:
- id: check-rh-precommitFull AI-ready setup:
repos:
- repo: https://github.com/openshift-hyperfleet/rh-hooks-ai
rev: v1.0.0 # Replace with latest tag
hooks:
- id: check-rh-precommit
- id: validate-agents-md
- id: ai-attribution-reminder
- id: check-versionSee CONTRIBUTING.md for development setup, testing, and release process.