hn.today

Claude Code Mode Internals

muthuishere.medium.com9 points1 comments
Screenshot of Claude Code Mode Internals

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.

Read on muthuishere.medium.com1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

I checked Clojure's core with Lean and found unreported bugs

I checked Clojure's core with Lean and found unreported bugs

Lean formal checks and differential testing of Clojure 1.12.7 uncovered 17 previously unreported bugs, including issues in `vector-of`, HAMT hash collisions, and Java functional-interface calls without type hints. Three million HAMT operations and vector boundary tests found no errors in the core tree structures; the bugs appeared in surrounding code and interactions such as equality and hashing. (s.conao3.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.