# Codex PostToolUse/Stop: run the Impeccable design detector when its Codex skill is installed; otherwise a no-op. # Claude receives the same hooks from the Impeccable plugin. Projects can still opt out with `impeccable hooks off`. $codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $HOME '.codex' } $windows = $env:OS -eq 'Windows_NT' foreach ($skill in @((Join-Path $HOME '.agents/skills/impeccable'), (Join-Path $codexHome 'skills/impeccable'))) { $launcher = Join-Path $skill $(if ($windows) { 'scripts/impeccable.cmd' } else { 'scripts/impeccable' }) if (-not (Test-Path -LiteralPath $launcher -PathType Leaf)) { continue } # The hook reply carries non-ASCII text; Windows PowerShell would otherwise decode it with the OEM code page. [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false) if ($windows) { & $launcher hook } else { & sh $launcher hook } exit $LASTEXITCODE } exit 0