Claude Code Mode, an experimental Anthropic feature available from version 2.1.323, lets an agent write JavaScript that calls its tools and processes the results, instead of returning to the model after every step. It cuts model round trips. It also raises a harder question: how do you approve a whole block of code instead of a single action?
What Claude Code Mode changes
The agent writes a script that calls tools, handles the results and returns only the information it needs. Loops and conditionals live in that code, so the model isn’t consulted for every decision. Anthropic’s documentation covers the current behavior, and the approach builds on the company’s earlier work on code execution with MCP.
The practical gains are fewer round trips to the model, less intermediate data piling up in context, and the chance to run independent operations in parallel. How much faster it gets depends on the task, but work that used to need another model response can often continue directly.
The permission problem
Faster agents mean more moments where an agent touches something outside itself: reading a document, changing a file or sending data to a service. Each needs a decision. One developer who needed agents to work outside the sandbox and change files on a host machine built a macOS menu-bar panel called Agent Dock to bring Claude Code and Codex permission requests into view. It reduces the interruption, but you still have to understand each proposed action.
The choice often feels like a toggle. Broad permission lets the agent move quickly, including into actions you didn’t intend. Approval for sensitive operations keeps you in control but keeps pulling your attention away. Allow and deny rules help, though you have to decide which categories to authorize ahead of time.
Code Mode still pauses for individual tool calls that need approval under your permission settings. In auto mode, a classifier reviews the whole snippet before it runs, while deny rules, ask rules and tool hooks still apply to each call. Anthropic also documents that Claude Code Mode’s shell sandbox doesn’t isolate the JavaScript or its non-shell tool calls, so it is not a complete boundary on its own.
Capabilities as a model
One proposal borrows from capability security. A capability gives its holder authority over specific operations on a specific resource, like an open file handle that lets a program read one file without letting it open anything else. For an agent, picture a service window: it can request a document and hand back an edited version, with no side door to the shell, raw filesystem access or a broader tool.
The idea has a long record. Capsicum brought capability-based compartmentalization to Unix applications, and Deno lets a program be granted reads under one directory or network access to a single host, though its permissions apply to all code on the same thread. Android and iOS combine app sandboxes with permissions or entitlements, which are related approaches but not pure capability systems.
Linux offers pieces too. Capabilities such as CAP_NET_ADMIN split up root privileges but don’t cover individual documents or URLs. Landlock lets an unprivileged process restrict its own access and that of its descendants. A Capsicum port exists for Linux 3.11.1, but it is experimental and ordinary installations don’t offer FreeBSD’s Capsicum API. These are places to enforce limits. They don’t describe a specific piece of work, which is where types come in.
What Haskell-style types could add
The argument is that a function’s type can say what it may do before it runs. Haskell didn’t solve agent permissions twenty years ago, but it offers ways to separate effects and enforce abstraction boundaries, and some foundations are older: researchers described type-enforced encapsulation of mutable state in 1994.
In Haskell’s safe subset, a function that counts words from supplied text can’t open a file or send data to a server. A function typed only to require a read capability would be rejected by the compiler if an agent slipped in a write call. The function must work in any permitted environment that supports reading, including one with no writer.
This only holds if agent code is limited to approved imports and trusted implementations, with no arbitrary IO or unsafe escape hatches. The signature gives an upper bound, not a forecast. It doesn’t say how many reads will happen or whether the result will be useful.
Narrower rules: provenance and read-before-write
The technique can go finer. An agent told to find sources and save a note with excerpts might search, broaden the query if nothing comes back, then fetch up to three results. The branch and loop can change which pages are fetched without granting new capabilities, and the compiler checks every path under the same constraints.
A tighter rule could require that fetched URLs come from a search in the current run. Search would return a special value that fetching requires, so a made-up URL string wouldn’t type-check. The host still has to issue those values only after a successful search and tie them to the session. This tells you where a URL came from, not that it’s safe: a malicious page can appear in results, and redirects need their own policy.
The same pattern fits a common complaint, agents editing files they haven’t read. Make the read operation return a value the write operation demands, and a blind edit won’t compile.
What to watch
Anthropic’s documentation will show how Claude Code Mode evolves from its experimental form. Whether permissions can be stated in checked types, as this proposal suggests, or stay a mix of classifiers and rules, will shape how much supervision coding agents need.
Source: Keller AI