caliber-pre-commit — Claude Code rule: what it does, how to install
caliber-pre-commit — a commit-time rule: it checks for the Caliber git hook and, when the hook is absent, syncs and stages your agent config files.
MIT ★ 1,319 updated 2026-09-24
.cursor/rules/caliber-pre-commit.mdcWhat caliber-pre-commit does
The rule runs on every commit. Before anything gets fixed in history, the agent greps .git/hooks/pre-commit for caliber and lands on one of two answers.
With the hook in place, the commit goes through untouched and Caliber handles the sync on its own. Without it, the agent calls caliber refresh, stages CLAUDE.md, .claude/, .cursor/, .cursorrules, .github/copilot-instructions.md, .github/instructions/, AGENTS.md and CALIBER_LEARNINGS.md, then reports what changed.
If caliber is missing entirely, the rule points the agent to .cursor/skills/setup-caliber/SKILL.md, where the setup-caliber skill walks through installing Caliber. So the rule only pays off once the CLI exists on the machine. Until then each commit ends in the same install detour.
What it helps with
- keep agent config files current before a commit
- check whether the Caliber hook sits in
.git/hooks/pre-commit - stage refreshed
CLAUDE.mdand.claude/files after a sync - find out what a sync actually changed
- install Caliber when the command is missing
Example prompts for the agent
- Commit these changes and make sure the agent configs are up to date.
- Run
caliber refreshbefore the commit and stage the updated files. - Check whether the Caliber hook is installed in this repo.
How to install caliber-pre-commit
Manually: put the files in place
.cursor/rules/caliber-pre-commit.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/caliber-pre-commit.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/caliber-pre-commit.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/caliber-pre-commit.mdManually: put the files in place
.clinerules/caliber-pre-commit.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about caliber-pre-commit
How to install caliber-pre-commit in Claude Code?
Copy the rule file to .claude/rules/caliber-pre-commit.md. From then on it applies to every commit.
What does caliber-pre-commit do?
It checks whether the Caliber hook exists in .git/hooks/pre-commit. When the hook is absent, it runs caliber refresh and stages the refreshed agent configs before you commit.
What do I need for the rule to work?
A working caliber command. Without it the rule sends the agent to .cursor/skills/setup-caliber/SKILL.md to follow the setup-caliber skill and install Caliber first.
Source text
caliber-pre-commit.mdc · MIT
--- description: Run Caliber sync before git commits to keep agent configs up to date alwaysApply: true --- Before every git commit, check if the Caliber pre-commit hook is installed: Run: `grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || echo "no-hook"` If hook-active: just commit normally — Caliber syncs automatically via the hook. Tell the user: "Caliber will sync your agent configs automatically." If no-hook: run `caliber refresh && git add CLAUDE.md .claude/ .cursor/ .cursorrules .github/copilot-instructions.md .github/instructions/ AGENTS.md CALIBER_LEARNINGS.md 2>/dev/null` before committing, and tell the user what was updated. If `caliber` is not found, read the setup-caliber skill from .cursor/skills/setup-caliber/SKILL.md and follow its instructions to install Caliber.
© caliber-ai-org · MIT · caliber-ai-org/ai-setup