what shipping programmatic tool calls taught me about skills, scripts and where the model belongs. code mode is the predictability quadrant's promotion step, done by the model, per request.
if you've read the predictability quadrant and skills are a sham, you already have both halves of this. code mode is where they meet, so this one skips the recap.
the short version: code mode is the quadrant's "move work to the bottom-left" step, except the model does the moving, per request, in one shot. it reads the ask, decides the work is predictable, and writes the deterministic thing right there. it also sharpens the skills argument (more on that below).
we just released code mode in Sidebar, SpotDraft's AI legal assistant. instead of calling tools one at a time and copying every result back into its own context, the agent writes a short script. the script calls the tools, loops over the whole set and saves results by reference. the model sees a summary and the IDs it needs, nothing else.
Claude Code shipped its own version the same week we went to production: an experimental opt-in where Claude writes JavaScript that calls its tools (the changelog entry is dated 12 november). Cloudflare wrote up the MCP version earlier this year, and Anthropic's API has had programmatic tool calling since late 2025. nobody invented anything here. when this many teams land on the same idea inside a year, it's usually because the problem is old and everyone finally hit it at once.
the running example is a sales agent next to a CRM, and the ask is "list every deal closed last quarter with a non-standard discount, with the account owner and renewal date, as a table."
our first version was one model, a handful of tools, everything in context. fine for questions about one deal. then we moved to named subagents (a deals agent, a table agent, a drafter), each with a persona and its own slab of prompt. the parent described the data to the child in words, so the model was the data bus. then we moved procedure out of prompts and into skills, and stopped delegating for identity (delegate for a clean context, not for a persona). each step relieved the model of something: first routing, then procedure.
what never moved was the data. a few hundred rows still flowed through the model's context, and the model retyped them into the next call. on one real query it retyped about five hundred rows, landed about a fifth short, and one of the rows it did land was quietly wrong. on a bigger one, a serial run over a few thousand records took so long that the session's token expired halfway through the writes.
none of that is a reasoning failure. it's a model being used as a copy machine, which is a strange job for the one component in your system that's good at judgment.
every version of our harness got better by taking something away from the model.
we replayed the queries that had caused incidents, on a current Sonnet-class model. the table that never finished (twice, after roughly half an hour in prod) finished in about a minute. the run that came up a fifth short came back complete. cost dropped somewhere between 3x and 25x depending on the size of the set. a later prod run over about three thousand records finished in six minutes with no auth failure.
IDs and values now move between tools inside the script, so the model can't drop, change or invent them.
the quadrant sorts work by structure (structured or unstructured) and timing (premeditated or ad-hoc). the model belongs top-right as a discovery engine, and anything with a known shape should move to deterministic bottom-left.
"loop over every deal, call these two tools, save the results" is structured the moment you know the shape. it's bottom-left work that we kept sending to the top-right, because the only way the agent could act was one model turn at a time.
in the original post the promotion was manual. i read traces, noticed a pattern (is this fifty percent of asks or ten?), and someone built the tool. code mode moves the promotion inside the request. the model does the discovery part (what the ask needs, which tools, in what order), then instead of executing its own plan by hand it writes the plan as code and runs it.
use the model to get to the script; use the script to do the actual thing.
that's the tool call line one level up.
i didn't expect the side effect. citations now come from the contracts the script actually read, not from the model remembering to add them. determinism gives you provenance for free: a script that read forty documents can tell you it read forty documents.
in skills are a sham i argued that a skill is a help center article. it's prose a model has to follow, with variance on every run, and capability compounds in code. code mode sharpens that. a skill that says "for each deal, get the deal, get the owner, write a row" is a recipe the model executes by hand every time. a skill with a script next to it is an appliance. the agent doesn't follow the steps, it runs them.
so the interesting artifact isn't the skill, it's the code the agent wrote the first time it solved the problem. throw that away after the run and you pay for the discovery again tomorrow. keep it next to the skill and the next run starts from a script instead of from prose. someone on the team asked whether complex, repeatable workflows could get frozen code. that's the right question, and my bet is that those scripts live as files inside a skill. i haven't proven that yet.
skills keep a real job, which is routing and judgment (when to use this, what done looks like). prose is fine for deciding and bad for doing. "skills = routing, wiki = knowledge, tools = capability" gets a fourth line: scripts = capability the agent wrote itself.
code adds variance. the model writes a different script each run, so you've moved variance from execution to authorship. not everything should go to code mode. a question about one deal gets slower and pricier if the agent writes a script to answer it. only complex, repeatable work earns it, and deciding which is a routing problem we're still evaluating.
the numbers are easy to overclaim. the 37% figure attached to Claude Code's version comes from Anthropic's 2025 API post, not from the feature. one independent hands-on test of it saved tokens but ran slower (about 37 seconds against 15). one run isn't a benchmark. ours aren't either, since they're replays of queries that hurt us, which is a selection effect.
review changes shape. you're reviewing a program instead of a tool call. Claude Code's docs say its auto mode classifier reviews the code before it runs and can't see values computed at run time. we lean on the layer below the agent: a sandbox with no network, and every call inside the script authorized as the user. if your safety story was "the model will behave," code mode makes that more visible, not less.
users don't want to read code. a legal user needs "executing a workflow to do x, y and z" in the trace, not a script. we're still writing better labels for it.
for deterministic problems, deterministic solutions win. code mode is the model writing one for itself.