Skip to content

Hooks

Most of GAIA’s hooks live at .claude/hooks/*.sh and are registered in .claude/settings.json under the hooks key, keyed by event name. A few helper scripts under .gaia/scripts/ are registered the same way for events outside the standard tool-call surface.

Most hooks here either block dangerous tool calls outright (deny the call with a reason shown to Claude) or inject a one-line nudge into context. A few are advisory: they run, log a reminder to stderr, and exit clean.

For Claude Code’s own hook documentation, see the Hooks reference on docs.claude.com.

HookWhat it doesPath
wiki-session-startRecords HEAD into .git/claude-session-start so the Stop hook can detect wiki commits during the session, and re-asserts per-machine memory contracts..claude/hooks/wiki-session-start.sh
HookWhat it doesPath
wiki-session-stopIf wiki files were committed during the session, prompts a hot-cache refresh; nags /gaia wiki sync when commits land but wiki/.state.json did not advance..claude/hooks/wiki-session-stop.sh
wiki-squash-autocommitsSquashes the trailing run of wiki: auto-commit commits into one; on main, redirects the squash to a wiki/* branch and merges via PR..claude/hooks/wiki-squash-autocommits.sh
HookWhat it doesPath
wiki-drift-checkDetects drift between wiki/.state.json and HEAD; injects a once-per-session reminder when drifted..claude/hooks/wiki-drift-check.sh
HookMatcherWhat it doesPath
intercept-initinitRedirects /init to /gaia-init so the built-in flow does not overwrite GAIA’s curated CLAUDE.md..claude/hooks/intercept-init.sh
HookWhat it doesPath
block-env-writeDenies writes to .env and .env.* files; allows .env.example..claude/hooks/block-env-write.sh
block-eslint-config-editDenies edits to eslint.config.{js,cjs,mjs,ts}; force fixes back into the source file where the lint error occurred..claude/hooks/block-eslint-config-edit.sh
block-lockfile-editDenies direct edits to pnpm-lock.yaml; lockfile changes must come from pnpm install..claude/hooks/block-lockfile-edit.sh
block-secrets-writeDenies writes that contain AWS keys, GitHub PATs, private-key headers, or non-placeholder _TOKEN/_SECRET/_KEY/_PASSWORD assignments..claude/hooks/block-secrets-write.sh
block-vitest-globals-tsconfigBlocks adding vitest/globals to tsconfig.json; tests must use explicit imports from vitest..claude/hooks/block-vitest-globals-tsconfig.sh
check-i18n-stringsAdvisory once-per-session reminder when a .tsx file under app/pages/ or app/components/ is edited; does not block..claude/hooks/check-i18n-strings.sh
check-story-existsAdvisory reminder to add a Storybook story when a new component index.tsx is written without a sibling tests/index.stories.tsx..claude/hooks/check-story-exists.sh
HookWhat it doesPath
block-bare-testBlocks bare pnpm test / npm test invocations; requires --run so vitest does not start watch mode..claude/hooks/block-bare-test.sh
block-main-destructive-gitBlocks commits to main/master and force-pushes to those branches..claude/hooks/block-main-destructive-git.sh
block-rm-rfDenies rm -rf against root, $HOME, cwd, unscoped globs, .git, node_modules, and any path outside a small whitelist of scratch dirs..claude/hooks/block-rm-rf.sh
pr-merge-audit-checkBlocks gh pr merge until a code-review-audit marker file exists at .gaia/local/audit/<HEAD-sha>.ok..claude/hooks/pr-merge-audit-check.sh
HookWhat it doesPath
wiki-commit-nudgeAfter every non-amend git commit, injects commit metadata and the current wiki drift count into context..claude/hooks/wiki-commit-nudge.sh
HookWhat it doesPath
audit-stamp-trailerWrites the GAIA-Audit: commit trailer on HEAD so CI can recognize an already-audited tree. Called by the code-review-audit agent at the end of a clean review..claude/hooks/audit-stamp-trailer.sh