Run tool calls from code with Code Mode Claude Code Docs
Edmund and Geffen dig into Claude Code’s experimental Code Mode, which lets Claude write JavaScript that chains multiple tool calls in one step. The practical shift is less about a flashy new model trick and more about where the control loop lives: in the code Claude writes, with permission checks, hooks, and long-running execution rules still doing the real guarding.
Transcript
Edmund So, Code Mode. This is the one where Claude stops doing one tool call at a time and just... writes JavaScript that makes several calls in one go.
Geffen Which is a genuinely different shape of control. You're moving the loop itself into code that Claude generates and Claude Code executes. That's more than just speeding it up.
Edmund And that's why it feels more product-real than the usual feature blip. If you've got a task that repeats across files, or a search that needs filtering before the model should even see the results, this could actually shave off the annoying glue work.
Geffen mm.
Geffen The docs example is clean on that. Claude searches for a retry policy, picks the file, edits it, runs the tests, and returns only the path plus the test output, instead of
Edmund Instead of every intermediate step.
Edmund In the conversation, yeah. And you can still inspect the code if you care, right? Control O, transcript viewer...
Geffen Expand the collapsed Code row, and there's the actual JavaScript behind the tool calls. Not just the diffs.
Edmund That part's sneaky good. The chat stays readable, but the machinery's still there if you want to audit what happened.
Geffen Sure, but the guardrails are doing real work now. Auto mode reviews the code, not each tool call. So if the code computes a path at runtime, the classifier doesn't magically know what that path will be.
Edmund right, right.
Geffen So if you care about a denied command, you still need the rule or hook that catches it in the right form. The doc even calls out that a git push inside a folder can show up as cd app && git push.
Edmund Ugh. Which is exactly the kind of shape-shift that breaks naive matching. That's the thing I'd test first, honestly. Not whether it demos well, whether the policy layer holds when the model starts composing commands instead of firing them one by one.
Geffen And the hook story gets sharper because of that REPL tool. If you want to inspect the generated JavaScript itself, you match REPL and read tool_input.code. Not the shell command text.
Edmund huh.
Edmund So faster agent vibes is just the surface. Underneath, there's a whole new place where teams have to think about what they're actually allowing.
Geffen And the limits are specific. It's experimental, off by default, and only works in an interactive terminal session on supported versions. No Agent SDK, no VS Code panel, no Desktop app, no cloud session.
Edmund That trims the audience a LOT. If you already live in Claude Code doing messy multi-step repo work, worth a look. If you're hoping for a universal agent switch... this is not that.
Geffen No. And the long-running behavior is another sharp edge. If Claude waits, the code stops after ten minutes.
Edmund Wait, ten minutes?
Geffen Ten minutes. If you want background execution, you need auto or bypassPermissions mode, and then it can keep going for up to two hours.
Edmund Which is useful, but also a little funny in the way these systems always are. They give you more freedom, then hand you a list of conditions that decide whether the freedom actually shows up.
Geffen I mean... they're not wrong to, but sure. And the resume behavior is very specific. If you start a Code Mode session, you have to keep the env var on when you resume it, or Claude refuses to continue it in Code Mode.
Edmund Oof. That's the detail people learn the hard way.
Geffen That one I'd call product friction, not just implementation detail. The feature's promising, but the statefulness means teams need a clean mental model for when they're in Code Mode and when they're not.
Edmund And the organization controls are one-way enough to matter. Managed settings can BLOCK Code Mode with a zero, but they can't turn it on for users from the admin side.
Geffen mm-hm.
Geffen Probably the right boundary, honestly. The control point is the session, not the org policy pretending to be the session.
Edmund So my take. This is useful where the work is already a chain of related tool calls. But the real story is that Claude is now writing the control logic it runs under.
Geffen Yeah, and once that's true, whether it can write JavaScript stops being the interesting question. What matters is whether your hooks, permissions, and runtime assumptions are good enough for the JavaScript it writes.
Edmund Come on, Geffen. Let me have one tiny bit of terminal magic before you turn it into a policy audit.