What's Fixed
Eliminated ~1.4 seconds of redundant work per LLM flight from the tool.definition hook handler. The hook fires once per tool per flight (~58 fires/flight on rich MC setups), and each fire was running JSON.stringify on the full schema, the Claude tokenizer on description+params, and an INSERT OR REPLACE against the plugin database — all producing identical output across flights because tool descriptions and parameters virtually never change.
The fix adds a per-(provider, model, agent, toolID) content fingerprint that bails out before any work when the new fire matches the previous one, plus a cached prepared INSERT statement to avoid repeated SQL compile cost on cold paths. Steady-state plugin overhead drops from ~1400ms/flight to ~19µs/flight. Cold paths (first flight after restart, MCP server reload) are unchanged — they still do the full measurement once.
Upgrade
npx @cortexkit/magic-context@latest doctor --force