Skip to main content

Hooks

know-code gates shipping at two layers: git hooks and agent shell hooks.

Git hooks

Installed by know-code init (or refresh with know-code hooks install):

  • pre-commit — runs know-code check
  • pre-push — runs know-code check

Refresh after upgrading the CLI:

know-code hooks install

Uninstall (restores backup if present):

know-code hooks uninstall

Agent hooks

Optional via know-code init --agents claude,cursor,codex:

AgentConfig file
Cursor.cursor/hooks.json
Claude.claude/settings.json
Codex.codex/hooks.json

Gated commands (parsed command field only):

  • git commit
  • git push
  • gh pr create
  • glab mr create

KNOW_CODE_OVERRIDE is never honored in agent hooks.

Uninstall agent entries:

know-code hooks uninstall --agents claude,cursor,codex

Opting out

  1. know-code hooks uninstall
  2. Remove agent hook entries manually
  3. Human emergency: know-code override then KNOW_CODE_OVERRIDE=1 in your terminal (not agent)

See troubleshooting.