You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs(framework): write the hook contract in docs/ARCHITECTURE.md #1197
Hooks the framework ships must behave the same on every supported tool. The contract lives in PR #1158 and in session notes, not in one place a hook author or the hook generator can follow. Two hooks written without it already disagree (#1190).
Scope
Add a short section to docs/ARCHITECTURE.md:
A hook is a script: deterministic, no model, no network, 5 s timeout, one purpose.
Two reactions: inform (additionalContext) or require (decision: "block" with a reason). Say nothing when there is nothing to report.
Shared moments: SessionStart, PostToolUse, Stop. Optional where the tool has them: PreToolUse, UserPromptSubmit, SubagentStop.
Rules: judge only what changed this turn (sha1 baseline of the relevant files, not a tool-name filter); report only new findings; require nothing that cannot be done yet; require at most once per turn, tracked in the script; neutral message that says what to do; git read-only; no state outside the script's own baseline file.
Scope statement: hooks a user generates for one tool with 08-hook-generate are not bound by this contract.
Per-tool facts go to COMPATIBILITY.md (#978), not here.
Acceptance criteria
The section exists in docs/ARCHITECTURE.md.
Rules 5 and 7 of ARCHITECTURE.md are consistent with it.
Delivered on next, checked against the current code after the CLI convergence (#1253) and the follow-up merges.
Evidence: docs/ARCHITECTURE.md## Hooks with levels Inform/Require, 5 s bound, node built-ins, host.cjs API table (lines ~121-165); touched again by #1370
Closing as completed. Reopen with a reproduction if something is still missing.
Activity
blafourcade commentedon Nov 25, 2026
Delivered on
next, checked against the current code after the CLI convergence (#1253) and the follow-up merges.Evidence:
docs/ARCHITECTURE.md## Hookswith levels Inform/Require, 5 s bound, node built-ins, host.cjs API table (lines ~121-165); touched again by #1370Closing as completed. Reopen with a reproduction if something is still missing.