{"version":"2.1.108","anchor":"javascript-repl-tool","canonical_anchor":"javascript-repl-tool","heading":"JavaScript REPL Tool","tier":null,"area":null,"scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.108\/e\/javascript-repl-tool","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.108","markdown":"### JavaScript REPL Tool\n\n**What**\n\nA new built-in tool that lets Claude execute JavaScript code in a persistent VM context with programmatic access to Claude Code tools (Read, Write, Edit, Glob, Grep, Bash).\n\nUsage: Claude can now run JavaScript directly to perform file operations, chain tool calls, and compute results. Variables persist across multiple REPL invocations within the same conversation.\n\n**Details**\n\n- Supports top-level `await` for async operations\n- State persists across calls \u2014 variables defined in one REPL call remain accessible in subsequent calls\n- Provides `registerTool()`, `unregisterTool()`, `listTools()`, and `getTool()` for dynamic tool management\n- Includes a `haiku(prompt, schema?)` function for lightweight model sampling\n- Includes `shQuote(s)` for safe shell string quoting\n- `import`\/`require` are not available (VM context is sealed); use the built-in tool functions for file and shell operations\n- REPL VM state is cleared on `\/compact` \u2014 a notification informs you: \"Your REPL VM state has been cleared as part of this compaction\"\n- Includes a replay mechanism for validating REPL execution determinism across compaction boundaries\n\n**Evidence**\n\nREPL tool registration with \"Execute JavaScript code with access to Claude Code tools\" description (search for `\"Execute JavaScript\"`)"}