Hook Mechanism
An interception and augmentation mechanism in a harness that allows custom logic, such as audit logging, permission checks and result rewriting, to be inserted before and after model calls and tool executions; together with chained middleware it forms a programmable extension surface.
Timeline (last 90 days)
Compared with polling, the hook mechanism has lower latency and lower overhead.
Hooks typically run within the same process or the same privilege domain, so if an agent has sufficient privileges, it may still tamper with the hook logic or bypass the hooks to directly manipulate underlying resources.
The core mechanism of OpenCode plugins is hooks: plugins register callbacks at specific points in the tool lifecycle, which the host triggers at the appropriate time, rather than calling the tool directly.
All Facts (3)
Compared with polling, the hook mechanism has lower latency and lower overhead.
50%UnverifiedHooks typically run within the same process or the same privilege domain, so if an agent has sufficient privileges, it may still tamper with the hook logic or bypass the hooks to directly manipulate underlying resources.
50%UnverifiedThe core mechanism of OpenCode plugins is hooks: plugins register callbacks at specific points in the tool lifecycle, which the host triggers at the appropriate time, rather than calling the tool directly.
50%