Skip to main content
Running Charter in a pre-commit hook catches score regressions before they reach CI and before other team members have to deal with them. With --quiet, the hook is completely silent on a passing commit and only interrupts when there’s something to fix.

Exit code behavior

Exit codeMeaningHook result
0Score meets or exceeds thresholdCommit proceeds silently
1Score below thresholdCommit blocked, summary printed
All hook runners respect non-zero exit codes to block commits. No additional configuration is needed.
--quiet mode is essential for hooks. On pass: completely silent. On fail: one summary line with the failing findings. Without --quiet, every commit prints the full scan output — which gets noisy fast.

Setup

Threshold guidance

Use the same threshold in your pre-commit hook as in CI. If they diverge, local commits can succeed but CI will fail — which creates friction and erodes trust in the hook.
Set an explicit threshold to match your CI gate:
# Matches a charter.yaml policy.threshold: 85
charter doctor --quiet --threshold 85
Or defer to whatever charter.yaml says, so hook and CI always agree automatically:
# Defers to policy.threshold or policy.profile in charter.yaml
charter doctor --quiet
If charter.yaml has no policy section, Charter uses the built-in default of 80.