Part of the AI Coding Harness Guide — environment design for coding agents in production.

Turn Off the Artifact Tool in Claude Code to Free 12k Tokens of Context#

Published by

The Artifact tool in Claude Code publishes HTML pages to claude.ai, and its definition loads into every interactive session whether you publish anything or not. On Claude Code v2.1.322, a permissions.deny rule for Artifact cut startup context from 42.5k to 30.3k tokens: 12.2k freed, almost all of it from the built-in tool definitions.

What the Artifact tool does#

The tool writes an HTML page and publishes it as a private page on claude.ai, with a link you can share. It is built for work that other people look at: a report for a team, a dashboard, a slide deck, an interactive explainer. Related tools (ArtifactComments, ArtifactData) read comments and a page's shared data.

Its schema is long because it carries the publishing rules, the update flow, file and asset limits, and the content policy. When your work is code in your own repository, the model reads all of it on every request and uses none of it.

Measure it with /context#

Start a fresh interactive session and run /context before you send a message. Then start a second session with the tool denied and compare:

claude                                                         # default
claude --settings '{"permissions":{"deny":["Artifact"]}}'      # Artifact denied

Both sessions below ran in the same directory, on the same account, at startup:

CategoryDefaultArtifact deniedChange
System tools14.5k2.6k−11.9k
System prompt4.3k4.0k−0.3k
MCP tools, memory files, skills23.7k23.7k0
Total used42.5k30.3k−12.2k
Free space (1M window)924.5k936.7k+12.2k

Claude Code v2.1.322, Opus 5.5 with the 1M window, macOS. A second repository gave −12.1k (37.3k to 25.2k), and Haiku 5.5 gave −12.1k (44.1k to 32k). --disallowedTools Artifact gives the same 30.3k as the deny rule. The Artifact tool alone is about 80% of the built-in tool definitions that load at startup.

Three things the rule does not remove:

  • The artifact-capabilities, artifact-design and artifact-diagramming skill entries, about 390 tokens together. Skill descriptions stay in the skills list.
  • ArtifactComments and ArtifactData. These are deferred tools: only their names load until the model asks for the schema, so they cost close to nothing.
  • Anything in print mode. claude -p "/context" reports the same total with and without the rule, because headless sessions do not load the Artifact tool. The saving is for interactive sessions only.

Why 12k matters when prompt caching is on#

Prompt caching makes the repeated prefix cheaper: cache reads bill at a fraction of the input price. It does not make the prefix smaller. The 12k tokens still sit in the context window on every turn, so they take space from your files, tool output and conversation, and bring auto-compaction closer by the same amount.

On the 1M window, 12k is about 1.2%. On a 200K window, it is about 6% of the whole window, before the auto-compact buffer takes its share. A long session on a 200K model compacts earlier with the tool loaded than without it. A cache miss, such as after an idle break longer than the cache lifetime, also pays to write those tokens to the cache again.

Turn it off#

For every project, add the rule to your user settings in ~/.claude/settings.json:

{
  "permissions": {
    "deny": ["Artifact"]
  }
}

For one repository, put the same block in .claude/settings.json (shared with the team) or .claude/settings.local.json (only you). For one session, pass it on the command line:

claude --settings '{"permissions":{"deny":["Artifact"]}}'

Settings load at launch, so start a new session after you edit a file. Run /context and check that System tools dropped to about 2.6k.

To undo, remove "Artifact" from the deny list and start a new session. A deny in user settings also applies in every project, and a project cannot override it with an allow rule, because deny rules take precedence over allow rules at every level.

What you lose and what stays#

With the rule on, Claude Code cannot publish or update a claude.ai page from the CLI. When you ask for a shareable report or dashboard, it writes a local HTML or Markdown file and you share it yourself. Every other tool, MCP server, skill and memory file loads as before.

When you need a page, start one session without the rule: put the deny in a project or local settings file for the repositories where you never publish, and keep user settings clean.

The 15k number#

The figure circulating on social media says the tool costs about 15k tokens every turn. The measured cost on v2.1.322 is 12.1k to 12.2k, depending on the model and setup. The size of a tool schema changes between releases, so measure it on your own version with /context, which takes ten seconds.

FAQ#

How do I reduce Claude Code context usage? Run /context at startup and look for the largest categories. Deny built-in tools you never use (the Artifact tool is about 12k), move part-of-the-repository docs out of the root CLAUDE.md (see what Claude Code loads from CLAUDE.md), and remove MCP servers and skills you do not use. More in context window management.

What is the Artifact tool in Claude Code? A built-in tool that publishes HTML pages, such as reports, dashboards and decks, as private, shareable pages on claude.ai. It loads in interactive sessions, not in claude -p.

Does a deny rule remove the tool from context? Yes, for a deny rule that names the tool without a pattern. On v2.1.322, "deny": ["Artifact"] dropped System tools from 14.5k to 2.6k tokens. --disallowedTools Artifact has the same effect for one session.

Get the weekly digest

New Claude Code, Codex, Gemini CLI and OpenCode guides and release analyses, once a week, plus occasional notes.

One email a week plus occasional notes. Confirm by email; unsubscribe from any issue. Privacy