anomalyco / anomalyco/opencode

plugin docs list three hooks as subscribable events

Open
#45,231 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The plugin docs list three hooks in the "events available" section. A plugin author who follows that list writes a handler that never fires.

packages/web/src/content/docs/plugins.mdx, under "Plugins can subscribe to events as seen below... Here is a list of the different events available":

#### Shell Events

- `shell.env`

#### Tool Events

- `tool.execute.after`
- `tool.execute.before`

None of those three is an event. There is no type: "shell.env" or type: "tool.execute.before" anywhere in the repo. They are top-level keys on the Hooks interface (packages/plugin/src/index.ts), taking (input, output):

"tool.execute.before"?: (
  input: { tool: string; sessionID: string; callID: string },
  output: { args: any },
) => Promise<void>
"shell.env"?: (
  input: { cwd: string; sessionID?: string; callID?: string },
  output: { env: Record<string, string> },
) => Promise<void>

So this does nothing:

event: async ({ event }) => {
  if (event.type === "tool.execute.before") { /* never runs */ }
}

It fails silently — no error, no warning, just a hook that never fires.

The same page already documents them correctly elsewhere. Lines 93, 250 and 268 show "tool.execute.before": async (input, output) => {...} and "shell.env": async (input, output) => {...} as sibling keys. So the page contradicts itself: the examples are right, the list is wrong.

I checked the other 25 entries in that list against the code and they are all genuine event types, so this is exactly the three.

Steps to reproduce
  1. Read the "events available" list in the plugins docs.
  2. Write a plugin subscribing to tool.execute.before through the event hook.
  3. The handler is never called.
Operating System

Windows 11 (platform independent)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.