# A hook without hooks: the git pre-commit check

> One pre-commit script every coding agent inherits because git runs it: the tests, a secrets grep and a size cap before each commit.

Page: https://videotomd.com/b/text-git-pre-commit-check-any-harness/
Tool: Any AI · Tags: git, pre-commit, hooks, secrets, tests · 581 words, about 755 tokens
Pills: free · Git · self-check · done check · checked 2026-10-12 · Any AI · Aider · Goose · OpenCode · Continue · shell · on event · any model · coding

## Recipe

- Kind: hook
- Stage: not set
- Loads: on event
- Works in: Any AI, Aider, Goose, OpenCode, Continue
- Needs: shell
- Bring: Git
- Cost: free
- Model: any model
- Tested in: not yet
- Checked: 2026-10-12
- For: coding

## When this is useful
- Your agent has no hook system and you want a check that runs whether or not the model remembers.
- A key almost went into a commit last week.
- Three agents and two people commit to one repo and the tests should run before every one of them.


## Change it to
- Claude Code, Codex, Kiro: these have native hooks; keep this one anyway, because it runs for every tool and every person on the repo.
- Only the secrets grep: delete the first and last checks; it then runs in under a second on any repo.
- Short version for a 7B model: the model never sees the script; only the one-line AGENTS.md note matters, so keep that line and nothing else.


## If your AI needs to look something up
- Search: `git githooks pre-commit core.hooksPath` and fetch https://git-scm.com/docs/githooks for the hook names and the executable-bit rule.


## Put it here

Runs on an event: put it where your tool reads it:

- Any AI: Coding agent: save as AGENTS.md in the project root (read natively by Codex, Cursor, Copilot, Gemini CLI, Kiro, Devin, Cline, Roo, OpenHands, OpenCode, Goose, Amp, Zed, Warp, Junie, Factory and Jules; Claude Code when no CLAUDE.md exists; Aider with --read). Chat: paste it first. Reload: new session. Check it loaded: ask it to repeat one rule from the file. Source: https://agents.md/ (checked 2026-10-12).
- Aider: Save as CONVENTIONS.md and add `read: [CONVENTIONS.md]` to .aider.conf.yml, or start with `aider --read CONVENTIONS.md`. Aider does not read AGENTS.md on its own: pass it with --read too. Reload: restart aider. Check it loaded: none documented: ask it to repeat one rule from the file. Source: https://aider.chat/docs/usage/conventions.html (checked 2026-10-12).
- Goose: Save as .goosehints in the project root, or as AGENTS.md. Needs the Developer extension. Restart goose to reload. Reload: restart. Check it loaded: none documented: ask it to repeat one rule from the file. Source: https://goose-docs.ai/docs/guides/using-goosehints (checked 2026-10-12).
- OpenCode: Save as AGENTS.md in the project root. Commit it. Start a new session. Reload: new session. Check it loaded: none documented: ask it to repeat one rule from the file. Source: https://opencode.ai/docs/rules (checked 2026-10-12).
- Continue: Save as .continue/rules/<name>.md with `alwaysApply: true`, or as AGENTS.md at the workspace root. Commit it. Reload: new chat. Check it loaded: the pen icon above the toolbar lists active rules. Source: https://docs.continue.dev/customize/rules (checked 2026-10-12).

## Access

Membership: plans at https://videotomd.com/pricing/, or email then a plan at https://videotomd.com/b/text-git-pre-commit-check-any-harness/. A member's browser downloads the file there; an AI without that session needs the member to attach it.
