Checks · Command-line tool
Hathi
Commit and repo checks for Git hooks and CI. The same verdict on your machine and in CI, Claude or not.
Checks every commit on your machine and in CI: its message, secrets, AI credits and history. Same verdict whether a person or Claude made it.
Run by the project’s Git hooks and CI
Up-stream, at the bend of the sluggish pool round the Peace Rock, and Warden of the Water Truce, stood Hathi, the wild elephant, with his sons, gaunt and gray in the moonlight, rocking to and fro—always rocking.
What it does
9 things Hathi does for you
conventional-commits- The message is
type(scope): description, as commitlint’s config-conventional reads it. Types, scopes and line length are yours to set, and a squash-merging repo can have the pull request title checked too. no-ai-coauthor- No AI listed as a co-author and no “Generated with” credit line: Claude, Copilot, Cursor, Codex, Gemini, Devin, Aider, Amp. A person’s co-author passes, even one called Claude with a surname.
no-secrets-in-commits- No Env file and no secret with a known shape: cloud and AI provider keys, GitHub and GitLab tokens, private keys, passwords in URLs, and dozens more. It names the file and line and never prints the value. Placeholders like
AKIA…EXAMPLEpass. no-conflict-markers- No leftover
<<<<<<<or>>>>>>>from a merge. A Markdown heading underlined with equals signs passes. no-large-files- No new file over 1 MB unless you raise the limit. Files already committed pass.
no-stale-adr-date- An ADR you edit carries the date of the edit, so the date always says when the decision last changed.
linear-history- A push sends no merge commit. Merges the default branch already has don’t count.
- One binary, no runtime
- A Go binary for macOS, Linux and Windows, about 2 ms to start in a hook. No Python, no Node, no Claude. It installs nothing and writes no Git config: your hooks call it.
- It explains itself
hathi explain <check>says how to fix a failure and mark a false alarm.hathi doctorsays what is wrong with how the repository runs Hathi.
Use cases
What happens, situation by situation
A commit made without Claude
A teammate fixes a typo in GitHub’s web editor, so no local hook runs. CI runs hathi check ci over every new commit and gives the same verdict a hook would have given.
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: jdx/mise-action@b44d12e7d0d8ee7461bb893e1b1993500433185b # v5.2.7
- run: hathi check ci
An AI signs the commit
An assistant adds itself as a co-author. Hathi refuses the commit and names the line, whichever tool wrote it.
no-ai-coauthor: 3: Co-Authored-By: Claude Opus 4 <noreply@anthropic.com> run: hathi explain no-ai-coauthor
A key slips into a commit
A deploy script picks up a real access key. Hathi names the file, the line and the kind of key, and never prints the key. If it was already pushed, revoke it; for a deliberate test fixture, mark the line.
no-secrets-in-commits: config/deploy.go:12: AWS access key no-secrets-in-commits: .env.local: an Env file; keep it out of Git, or put hathi:allow-secret on its first line
Added in one commit, removed in the next
A pull request adds a token and deletes it a commit later, so the final diff looks clean. Hathi checks each commit on its own, so the token is still caught before the merge puts it in history.
a41c9e02d7b3 no-secrets-in-commits: src/client.ts:4: GitHub token run: hathi explain no-secrets-in-commits
Install
Start using Hathi
Pin Hathi to an exact version in mise.toml, commit the three hooks in .githooks/, and run hathi check ci in CI. Without mise: go install github.com/bunderlog/hathi@v1.2.0.
mise use "github:bunderlog/hathi@1.2.0"mkdir -p .githooks && for h in commit-msg pre-commit pre-push; do hathi hooks print $h > .githooks/$h; chmod +x .githooks/$h; donegit config core.hooksPath .githooks