{"version":"2.1.335","anchor":"plugin-sessionstart-hooks-may-call-on","canonical_anchor":"plugin-sessionstart-hooks-may-call-on","heading":"Plugin session.start hooks can register more hooks, which run before the first turn","tier":"notice","area":"Plugins","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.335\/e\/plugin-sessionstart-hooks-may-call-on","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.335","markdown":"### Plugin session.start hooks can register more hooks, which run before the first turn\n\nA running session.start hook may now call on() to add hooks, and Claude Code catches up so they land before the first request\n\n**What**\n\nA hook is code that runs when something happens in a session. Plugins register hooks with `register()`. A `session.start` hook, which runs when a session begins, can now add hooks of its own.\n\n- `on()` is now allowed inside a running `session.start` hook. Before, it was allowed only during `register()`.\n\n- Hooks added this late are checked, and some patterns are refused. Hooks on `engine.create`, `plugin.register` and `session.start` are rejected with the message \"a hook on X is for register()\".\n\n- Session start now passes a `catchUp` callback to `session.start`. If more hooks were registered while it ran, Claude Code waits for `catchUp` to finish.\n\n- `owedStart` is reset, and `awaitHooksAheadOfTurn` now passes itself to `landAheadOfRequest`.\n\n**Why**\n\nPlugin authors can add hooks from a `session.start` hook, and those hooks should be in place before Claude's first request.\n\n- Area: Plugins\n- Names: `session.start`\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 3\/5\n- Scope: individual\n- Heads-up: no"}