Moves rarely used built-in tools behind ToolSearch so their schemas stay out of every turn's context, and lets you drop or replace the email address Claude…

A Claude Code plugin that shrinks the tool definitions sent with every request by moving rarely used built-in tools behind ToolSearch.
Claude Code sends the full schema of each non-deferred built-in tool on every turn. Some of them are large and seldom used: the Artifact tool alone is about half of all the tool definitions sent upfront. This plugin marks these tools as deferred, so the model sees only their names and loads a schema through ToolSearch when it actually needs the tool:
ArtifactWorkflowScheduleWakeupReportFindingsReadNotificationsListAgentsAskUserQuestionIn the author's sessions this cut the tool definitions sent with each request by about 80%. Every tool stays available.
It can also drop or replace the email address Claude Code puts in each conversation's context; see The email in context.
At the prompt of a terminal session:
/plugin install cc-lean-system-tools --marketplace TrueNight/claude-tools
Answer y to add the marketplace, then press Enter to install at the user scope.
From a shell:
claude plugin install cc-lean-system-tools --marketplace TrueNight/claude-tools
In the desktop app, where /plugin does not run: click + next to the prompt box, then Plugins, Add marketplace with TrueNight/claude-tools, then Add plugin.
/context may keep showing the old "System tools" number. To see what a session really sends, open its transcript (~/.claude/projects/<project>/<session-id>.jsonl) and look at the api-request-shape record: its shape.tools entries without defer_loading are the tools sent in full.
The defer option holds the tool names to defer, and defaults to the list above. Your own list replaces the default rather than adding to it, and an empty list defers nothing.
From a shell, pass the names as one comma-separated string:
echo '{"defer": "Artifact, Workflow, ScheduleWakeup, WebFetch"}' | claude plugin configure cc-lean-system-tools@claude-tools --values-stdin
Inside Claude Code, run /plugin configure cc-lean-system-tools@claude-tools. Or set it under pluginConfigs in ~/.claude/settings.json, as an array or a comma-separated string:
{
"pluginConfigs": {
"cc-lean-system-tools@claude-tools": {
"options": {
"defer": ["Artifact", "Workflow", "ScheduleWakeup", "WebFetch"]
}
}
}
}
Names match exactly, MCP tools included (mcp__<server>__<tool>). Start a new session for a change to take effect.
To remove a tool from context entirely instead of deferring it, add its bare name to permissions.deny in settings.json.
Claude Code puts a userEmail block in each conversation's first message: "The user's email address is ...", with a note to use it only to identify the user. Claude copies that address into what it writes, git commit identities included. The userEmail option decides what the block says:
keep, the default, leaves the block as Claude Code writes it.drop removes the block.From a shell:
echo '{"userEmail": "me@work.example"}' | claude plugin configure cc-lean-system-tools@claude-tools --values-stdin
Inside Claude Code, run /plugin configure cc-lean-system-tools@claude-tools. Or set it under pluginConfigs in ~/.claude/settings.json:
{
"pluginConfigs": {
"cc-lean-system-tools@claude-tools": {
"options": {
"userEmail": "drop"
}
}
}
}
Subagents get the changed block too. A resumed session's earlier messages keep the block they were sent with.
tool.describe, prompt.context), which is in early access and may change between releases. Written against Claude Code 2.1.300.hooks/register.ts 65 lines1import type { Register } from 'claude-code'
2
3const escapeRegExp = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
4
5// settings.json can hold the list as an array, but `claude plugin configure`
6// saves it as one comma-separated string.
7const toolNames = (value: unknown): string[] =>
8 (Array.isArray(value) ? value : typeof value === 'string' ? value.split(',') : [])
9 .map(name => String(name).trim())
10 .filter(name => name !== '')
11
12type EmailPolicy = { kind: 'keep' } | { kind: 'drop' } | { kind: 'replace'; email: string }
13
14const emailPolicy = (value: unknown): EmailPolicy => {
15 const text = typeof value === 'string' ? value.trim() : ''
16 if (text === '' || text === 'keep') return { kind: 'keep' }
17 if (text === 'drop') return { kind: 'drop' }
18 return { kind: 'replace', email: text }
19}
20
21const EMAIL = /[\w.%+-]+@[\w-]+(?:\.[\w-]+)+/
22
23// Swapping only the address keeps the engine's usage restrictions around it.
24const withEmail = (text: string, email: string) => {
25 const found = EMAIL.exec(text)?.[0]
26 return found ? text.replaceAll(found, email) : `The user's email address is ${email}.`
27}
28
29// The `defer` option's default in plugin.json lists built-in tools few
30// sessions call: carrying each full schema on every turn costs more than one
31// ToolSearch load in the session that does. A user's list replaces it.
32export const register: Register = (on, options) => {
33 const tools = toolNames(options.defer)
34 if (tools.length > 0) {
35 const deferred = new RegExp(`^(${tools.map(escapeRegExp).join('|')})$`)
36
37 on('tool.describe', { tool: deferred }, async ($, e, next) => ({
38 ...(await next(e)),
39 isDeferred: true,
40 }))
41 }
42
43 const email = emailPolicy(options.userEmail)
44 if (email.kind !== 'keep') {
45 on('prompt.context', async ($, e, next) => {
46 const result = await next(e)
47 const blocks =
48 email.kind === 'drop'
49 ? result.blocks.filter(block => block.name !== 'userEmail')
50 : result.blocks.map(block =>
51 block.name === 'userEmail' ? { ...block, text: withEmail(block.text, email.email) } : block,
52 )
53 return { ...result, blocks }
54 })
55 }
56
57 // A resumed session replays the tool placement and context it recorded;
58 // asking again applies the options there too.
59 on('session.start', ($, e, next) => {
60 $.ui.invalidate('tool.describe')
61 $.ui.invalidate('prompt.context')
62 return next(e)
63 })
64}
65