charter check is designed for CI. It does not judge whether code semantically complies with a Decision. Instead, it guarantees that a matching accepted Decision was explicitly acknowledged.
How matching works
- Charter collects changed file names relative to the base ref using
git diff <base>...HEAD. - It considers accepted Decisions only.
- A Decision matches if a path glob matches a changed file, or if a scope tag appears in the unified diff.
- For each matching
blockingDecision, Charter searches commit messages in<base>..HEADforGoverned-By: <id>orCharter: <id>. - An uncited blocking match exits
2.
GitHub Actions example
Use a full Git history so the base commit and commit messages are available:charter check --diff ....
Commit acknowledgments
Use one trailer per Decision:Local use versus CI
--diff, Charter compares the working tree with HEAD, reports matches, and does not block—there is no commit range whose trailers it can inspect. With --diff, it enforces blocking Decisions.
Interpret exit codes
If
charter check cannot run at all — bad base ref, unreadable or corrupt decision store, missing .charter — it exits 3. Fail the job on it: it means “not checked”, never “passed”.
Practical CI guidance
- Run the check on pull requests, not just after merge.
- Pass a stable base SHA or branch reachable in the checkout.
- Use
fetch-depth: 0for GitHub Actions; shallow history can prevent Charter from reading the range and commit trailers. - Keep scopes narrow enough that acknowledgments mean something.
- Treat stale advisories as a review prompt, not a failed compliance check.