Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

- _No unreleased entries yet._

### Fixed

- Fixed Claude Code hook integration (`gait-gate.sh`) to wrap hook responses in
the `hookSpecificOutput` envelope required by Claude Code's PreToolUse
protocol. Without this wrapper, Claude Code silently ignores hook responses,
making all gait verdicts (allow, deny, ask) unenforceable.

### Changed

- Gate intent normalization now treats omitted target `discovery_method` as `unknown` instead of empty so policies can deterministically match unknown/dynamic discovery paths.
Expand Down
14 changes: 8 additions & 6 deletions examples/integrations/claude_code/gait-gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ emit_response() {
import json
import os

payload = {
inner = {
"hookEventName": "PreToolUse",
"permissionDecision": os.environ["DECISION"],
"permissionDecisionReason": os.environ["REASON"],
}
trace_path = os.environ.get("TRACE_PATH", "").strip()
if trace_path:
payload["tracePath"] = trace_path
print(json.dumps(payload))
inner["tracePath"] = trace_path
print(json.dumps({"hookSpecificOutput": inner}))
PY
}

Expand Down Expand Up @@ -60,13 +61,14 @@ strict_mode = os.environ.get("STRICT_MODE", "0").strip().lower() in {"1", "true"
trace_path = os.environ.get("TRACE_PATH", "").strip()

def emit(decision: str, reason: str) -> None:
payload = {
inner = {
"hookEventName": "PreToolUse",
"permissionDecision": decision,
"permissionDecisionReason": reason,
}
if trace_path:
payload["tracePath"] = trace_path
print(json.dumps(payload))
inner["tracePath"] = trace_path
print(json.dumps({"hookSpecificOutput": inner}))

try:
decoded = json.loads(proxy_output) if proxy_output.strip() else {}
Expand Down