{"version":"2.1.307","anchor":"jsonargument-cloning-rewritten-to-preserve-tojson","canonical_anchor":"jsonargument-cloning-rewritten-to-preserve-tojson","heading":"Plugin hooks get more faithful copies of their arguments","tier":"notice","area":"Plugins","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.307\/e\/jsonargument-cloning-rewritten-to-preserve-tojson","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.307","markdown":"### Plugin hooks get more faithful copies of their arguments\n\nArguments passed to plugin hooks are now copied with `toJSON` methods kept, typed arrays cloned, and endless `toJSON` chains rejected\n\n**What**\n\nPlugins can attach hooks, small pieces of code that Claude Code runs at certain moments, and Claude Code hands each hook a copy of the relevant data. Before, that copy kept only plain objects and lists, down to a fixed depth. Now:\n\n- `toJSON` methods (which decide how an object is turned into JSON text) are kept and applied again on the copy\n\n- typed arrays (fixed-type number lists) are copied with `structuredClone`\n\n- a `toJSON` that keeps returning something with another `toJSON` is rejected, with an error starting \"a toJSON keeps answering with a value that holds another toJSON, more than\"\n\n- a new `adoptArgument` hook is available\n\n**Why**\n\nPlugin authors may see different arguments arrive in their hooks, and a new error their hook can raise.\n\n- Area: Plugins\n- Tier: You'll notice\n- Useful: 1\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}