Files
ECC/hooks/hooks.metadata.json
T
haelyra ae9ce433cd fix(hooks): harden context-gate checkpoint ownership (#3106)
Maintainer carry-forward of the four edge cases reproduced on 5a565cf:

- Same-named project roots: bind the proposal to a SHA-256 owner key of
  the full real project root plus the raw session ID, and put that key in
  both the file name and the ownership marker.
- Sanitized session-ID aliasing: hash the raw session ID before filename
  sanitization so IDs such as owner/a and owner?a no longer share a path.
- Linked or special destinations: probe with lstat, open read-only with
  O_NOFOLLOW and O_NONBLOCK, require a regular single-link file whose
  complete first-line marker matches, and decline linked handoff
  directories. A FIFO at the destination previously hung the prompt.
- Literal resume arguments: emit the resume prompt as one single-quoted
  POSIX (or PowerShell on Windows) argument.

Also merge the UserPromptSubmit registration into the existing event
array. The main merge left a duplicate UserPromptSubmit key in
hooks.json and hooks.metadata.json, and JSON.parse kept only the last,
which silently dropped prompt:hookify-runtime.

Adds tests/hooks/context-gate-ownership.test.js, which fires the hook
through the registered run-with-flags.js entry: 12/12 pass here, 1/12
pass on 5a565cf.
2026-11-16 21:11:56 -05:00

162 lines
6.2 KiB
JSON

{
"$schema": "../schemas/hooks-metadata.schema.json",
"entries": {
"PreToolUse": [
{
"id": "pre:bash:dispatcher",
"description": "Consolidated Bash preflight dispatcher for quality, tmux, push, and GateGuard checks",
"fingerprint": "73f5c1a01074"
},
{
"id": "pre:powershell:gateguard-fact-force",
"description": "PowerShell fact-forcing gate: inspect destructive commands without running unrelated Bash-only preflight hooks",
"fingerprint": "46a805223053"
},
{
"id": "pre:write:doc-file-warning",
"description": "Doc file warning: warn about non-standard documentation files (exit code 0; warns only)",
"fingerprint": "37def33777d0"
},
{
"id": "pre:edit-write:suggest-compact",
"description": "Suggest manual compaction at logical intervals",
"fingerprint": "0f903aca71cf"
},
{
"id": "pre:observe:continuous-learning",
"description": "Capture tool use observations for continuous learning",
"fingerprint": "a77d63149961"
},
{
"id": "pre:governance-capture",
"description": "Capture governance events (secrets, policy violations, approval requests). Enable with ECC_GOVERNANCE_CAPTURE=1",
"fingerprint": "5ccfc381eb8a"
},
{
"id": "pre:config-protection",
"description": "Block modifications to linter/formatter config files. Steers agent to fix code instead of weakening configs.",
"fingerprint": "b75c69a065b7"
},
{
"id": "pre:mcp-health-check",
"description": "Check MCP server health before MCP tool execution and block unhealthy MCP calls",
"fingerprint": "06d268a8095a"
},
{
"id": "pre:edit-write:gateguard-fact-force",
"description": "Fact-forcing gate: deny the first Edit/Write/MultiEdit/NotebookEdit of each file with questions chosen by target class and by what the change touches; a completed search naming the file in the current turn, a comment or whitespace-only edit, or a same-turn sibling of a new file already gated passes with a note instead; sensitive targets (secrets, keys, auth/payment code, migrations, CI workflows) and hard-linked files are always gated, also in subagents",
"fingerprint": "4778e39c56cf"
},
{
"id": "pre:hookify-runtime",
"description": "Evaluate project-local Hookify rules before Bash, PowerShell, and file tools run",
"fingerprint": "3577a44df932"
}
],
"UserPromptSubmit": [
{
"id": "prompt:hookify-runtime",
"description": "Evaluate project-local Hookify prompt rules before a user prompt is processed",
"fingerprint": "e59b2f099bf7"
},
{
"id": "user-prompt:context-gate",
"description": "Opt-in checkpoint-and-restart gate (ECC_CONTEXT_GATE_MODE=enforce): at >=90% context, order a clean stopping point, a session-scoped checkpoint under the handoff dir, and a fresh-session resume command. Default mode is advisory — inert, suppresses nothing",
"fingerprint": "13d8180d18ec"
}
],
"PreCompact": [
{
"id": "pre:compact",
"description": "Save state before context compaction",
"fingerprint": "1beef3acf474"
}
],
"SessionStart": [
{
"id": "session:start",
"description": "Load previous context and detect package manager on new session",
"fingerprint": "e4e7c9f975d2"
},
{
"id": "session-start:plan-canvas-sessions",
"description": "Surface open Plan Canvas review sessions so a fresh session can resume the loop",
"fingerprint": "728d48b97fdb"
}
],
"PostToolUse": [
{
"id": "post:dispatcher:sync",
"description": "Run synchronous PostToolUse hooks in one process while preserving per-hook controls",
"fingerprint": "ca419a145e5b"
},
{
"id": "post:dispatcher:async",
"description": "Run background PostToolUse hooks in one process while preserving per-hook controls",
"fingerprint": "c494e10d87ed"
}
],
"PostToolUseFailure": [
{
"id": "post:mcp-health-check",
"description": "Track failed MCP tool calls, mark unhealthy servers, and attempt reconnect",
"fingerprint": "72cf431345fc"
},
{
"id": "post:skill:track",
"description": "Record hard Skill tool failures for skill-health telemetry",
"fingerprint": "06d3de215e25"
}
],
"Stop": [
{
"id": "stop:hookify-runtime",
"description": "Evaluate project-local Hookify completion rules before Claude stops",
"fingerprint": "7b319512edb9"
},
{
"id": "stop:plan-canvas-pending",
"description": "Deliver undelivered Plan Canvas browser feedback before the agent stops",
"fingerprint": "6f634558e137"
},
{
"id": "stop:format-typecheck",
"description": "Batch format (Biome/Prettier) and typecheck (tsc) all JS/TS files edited this response — runs once at Stop instead of after every Edit",
"fingerprint": "243bd81ff17a"
},
{
"id": "stop:check-console-log",
"description": "Check for console.log in modified files after each response",
"fingerprint": "8211fdea0cdd"
},
{
"id": "stop:session-end",
"description": "Persist session state after each response (Stop carries transcript_path)",
"fingerprint": "bb1cddf9932b"
},
{
"id": "stop:evaluate-session",
"description": "Evaluate session for extractable patterns",
"fingerprint": "1c3322c0f2a2"
},
{
"id": "stop:cost-tracker",
"description": "Track token and cost metrics per session",
"fingerprint": "c6b1c1c6e9e3"
},
{
"id": "stop:desktop-notify",
"description": "Send desktop notification (macOS/WSL) with task summary when Claude responds",
"fingerprint": "23030441f3f5"
}
],
"SessionEnd": [
{
"id": "session:end:marker",
"description": "Session end lifecycle marker (non-blocking)",
"fingerprint": "a991d34f4d89"
}
]
}
}