Classify every comment as tautology, stale, excuse or decision record. Tautology/stale/excuse comments are deleted (excuses filed as issues #196-#236), decisions moved to docs/adr/0001-0034. - scripts/lint-comments.sh + .comment-baseline: per-file comment count may only go down; wired into tests/all.sh - .claude/skills/delete-comment: repeatable audit workflow - cargo fmt applied to touched crates Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
18 lines
926 B
Markdown
18 lines
926 B
Markdown
# Hook dispatch and extension protocol semantics
|
|
|
|
Status: accepted
|
|
|
|
## Context
|
|
Lens, MCP and extensions all plug into the event bus, and extensions are untrusted external processes.
|
|
|
|
## Decision
|
|
- Hooks run in registration order; the first `Block` wins; a `Mutate` is visible to later hooks.
|
|
- Bus clones share the hook list, so the permission bridge can emit on the agent's bus.
|
|
- Extensions speak newline-delimited JSON-RPC 2.0 over stdio: `initialize {protocolVersion, cwd}` returns subscribed event types and tools; `event {event}` returns `{action: continue|block|mutate|inject, ...}`; `tool/call {name, args}` returns `{content, is_error}`.
|
|
- A dead or slow extension never blocks the agent: errors and timeouts count as `continue`.
|
|
|
|
## Consequences
|
|
Ordering matters for hook authors; failing extensions degrade silently to no-ops.
|
|
|
|
Code: crates/hx-core/src/hook.rs (`Bus`, dispatch), crates/hx-core/src/ext.rs (module)
|