{"version":"2.1.333","anchor":"generator-form-hooks-are-allowed-for-more-events-with-a-for","canonical_anchor":"generator-form-hooks-are-allowed-for-more-events-with-a-for","heading":"Plugin hooks written as generators are allowed for more events","tier":"internal","area":"Plugin Hooks","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.333\/e\/generator-form-hooks-are-allowed-for-more-events-with-a-for","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.333","markdown":"### Plugin hooks written as generators are allowed for more events\n\nPlugin hooks written as async generators are now accepted for more events, and a hook's .catch must use the same form as the hook\n\n**Unclear.** Which events now accept generator hooks is not stated.\n\n**What**\n\nIn Claude Code's plugin runtime, a hook is code a plugin runs at a set point. Some hooks are written as async generators, functions that hand back results bit by bit. Before, Claude Code refused a generator hook on any event that does not stream its output. It now skips that refusal for events that pass a new check.\n\nThere is also a new rule: a hook and its `.catch` handler must take the same form. Either both are async generators, or neither is.\n\n**Why**\n\nPlugin authors can write generator hooks in more places, and will see a different error if a hook and its `.catch` do not match.\n\n- Area: Plugin Hooks\n- Tier: Under the hood\n- Useful: 2\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: no"}