Skip to content

Firsthand.today

Claude Code has an experimental "Code Mode" that batches tool calls into JavaScript

Summary

An experimental Claude Code mode wraps tool and MCP calls in JavaScript so intermediate data bypasses the model's context. Enable it with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1; the discussion covers token savings, prior art from Cloudflare and Pi, and safety concerns.

What the comments say

  • Code Mode wraps two MCP servers in JavaScript so transcripts pass directly between them instead of through context, avoiding token cost, copy-time hallucination and exposing the data to the model; the pattern traces to Cloudflare's Code Mode.

    — red_hare · Reddit
  • Plain Python scripting never reached harness tools like MCP; this mode does, a pattern popularized by the Pi agent and later adopted by OpenCode.

    — Dudmaster · Reddit
  • Agents dump findings into the session where you write, and the more they dump the more expensive the session gets; this mode filters so only important data reaches the session.

    — ShortTheseNuts · Reddit
  • Current frontier models already use scratchpads to hold data and write one-off scripts for composite actions, so they may not load everything into context as claimed.

    — shif · Reddit
  • Enable it by starting the CLI with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude; it is not visible in the CLI or the VS Code extension settings.

    — Boring-Literature932 · Reddit
  • Risk runs both ways: Claude has filled its own context window with logging, and JavaScript as the scripting language is a questionable choice.

    — Realistic-Aspect-619 · Reddit

Join the discussion

Was this useful to you?