Files
MyAiConfiguration/shared/hooks
Julian LechnerandClaude Opus 5.5 305bcdeb54
CI / CI configuration security checks (push) Successful in 2s
CI / Capabilities and shell quality (push) Successful in 16s
CI / Python tests and compilation (push) Successful in 29s
CI / QMD unit tests (push) Successful in 5s
CI / Build and inspect generated packages (push) Successful in 17s
CI / PowerShell tests on Ubuntu (push) Successful in 1m10s
CI / Installed client configuration smoke tests (push) Successful in 34s
CI / Bash integration and installation guards (push) Successful in 1m9s
feat(hooks): remind agents to use semantic search before open searches
Add a PreToolUse hook (Show-SearchReminder/show-search-reminder.sh via
agent-guards.py) that, once per session, reminds the agent to run
semantic-search before the first open search. It fires on Grep/Glob and
on shell search commands, never blocks, stays silent once the session
ran qmd-search.mjs, and does nothing unless QMD is installed. Per-session
markers are hashed and pruned after seven days.

Claude matches Grep|Glob|Bash|PowerShell; Codex matches Bash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:56:49 +01:00
..

Hooks

This directory contains registered hooks and optional utilities. They do not bypass client permission prompts or grant access.

When Flashbang is enabled, both clients register Stop (flashbang) for finish notifications. Claude also registers PreCompact (Record-Compact/record-compact.sh) and SessionStart (Show-SessionStatePointer/show-session-state-pointer.sh). PreCompact records its timestamp under the installed configuration root. Both session hooks point to an existing workspace .ai-session/state.json, using event cwd or the process working directory. The main agent owns that state; hooks never write it or print its contents. Missing state is a successful no-op.

Both clients register PreToolUse (Validate-CommandSafety/validate-command-safety.sh), which blocks clearly destructive shell commands by exiting 2; it parses command text, so it is a guard rail rather than a security boundary, and it fails open. Both clients also register Stop (Check-CompletionEvidence/check-completion-evidence.sh) and UserPromptSubmit (Show-CorrectionPrompt/show-correction-prompt.sh). Both call agent-guards.py, store nothing, and fail open. The first pushes back once on a completion claim without a named check while non-prose changes exist; the second asks the agent to propose a durable rule after a likely correction. A second PreToolUse hook (Show-SearchReminder/show-search-reminder.sh, also through agent-guards.py) reminds the agent once per session to run semantic-search before the first open search; it never blocks, stays silent once the session ran qmd-search.mjs, does nothing unless QMD is installed, and keeps only hashed per-session markers under ~/.my-ai-configuration/state/search-reminder/.

Invoke-PostChangeVerification/invoke-post-change-verification.sh is not registered or invoked automatically; it runs the repository build only when explicitly invoked. Python-based hooks resolve their interpreter through Resolve-Python.ps1/resolve-python.sh and are silently skipped without Python 3.11+. Test-SessionConfig/test-session-config.sh checks repository inputs during a build.

When local QMD search is enabled, both clients also register a SessionStart warm-up hook (Start-QmdWarm.ps1/start-qmd-warm.sh). It starts the installed Node wrapper in the background from the process working directory, only inside a Git repository. Warm-up errors are recorded in ~/.my-ai-configuration/qmd/warm.log; they do not fail the session. Disabling local search removes the hook registration.

Codex also registers PostToolUse (matcher Edit|Write|apply_patch) and Stop hooks for Impeccable's design detector (Invoke-ImpeccableHook.ps1/invoke-impeccable-hook.sh). The wrapper runs the installed Impeccable Codex skill's impeccable hook and is a no-op when that skill is missing. Claude receives the same hooks from the Impeccable plugin. The detector is on by default in every project; a project opts out with impeccable hooks off.