Claude Code’s Code Mode addresses the growing cost of exposing agents to expanding lists of tools, skills, and MCP servers. Instead of sending 16 tools in a typical session, it presents three: a persistent REPL, a polling tool, and an advisor. The REPL description includes signatures for core tools, while a search function retrieves details for other tools as needed. The model can then compose and run code in a session whose state persists across calls. This reduces trips between the model and tools, but does not eliminate the separate process launches, parsing, or output generated when that code invokes a command-line program.
The author applies the idea to CLIs with many operations, proposing a “CLI CodeMode” library. A CLI registers its operations and descriptions, then offers commands for describing them and running agent-written JavaScript in a small, restricted runtime; the CLI validates the code before execution. In a codebase-analysis task that required seven commands, this approach used one model trip and one process, returning 169 bytes, compared with seven processes and 28,273 bytes in normal mode. Claude Code’s Code Mode needed one model trip but still launched seven processes. For a 24-command system check, CLI CodeMode likewise reduced execution to one process, while Claude Code’s approach launched 24. The library is available in Go, Rust, Python, and TypeScript, with Go as the main implementation.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.