Skip to content

feat: REPL tool POC (Code Mode spike) - #436

Merged
dahai80 merged 1 commit into
mainfrom
feat/code-mode-repl-poc
Dec 1, 2026
Merged

dahai80 merged 1 commit into
mainfrom
feat/code-mode-repl-poc

Conversation

@dahai80

@dahai80 dahai80 commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • REPL tool executes a JavaScript snippet that makes several tool calls in one step ($ shell, read/write/edit, glob/grep); only the last expression returns to model context
  • Gated on REPL mode or BENCH_CODE_MODE=1 — default-off, byte-identical when disabled
  • MLX tier table untouched (frozen spec): REPL injected post-tier-filter instead
  • lazy require() wiring avoids the REPLTool→Tool.js→AgentTool TDZ loop

Validation

  • 8 new unit tests + full suite: 1892 tests, 0 fail
  • typecheck / lint / docs validator (ERROR 0) / compile build: green
  • Real-engine spike on Qwen3.8-27B-4bit-mtp: scripted file-count task resolved in 2 REPL calls, result matches ground truth; read+edit flow also green

Design: docs/research/code-mode-design.md (#433)

🤖 Generated with Claude Code

Code-orchestrated tool calls per docs/research/code-mode-design.md:
- REPLTool executes a JavaScript snippet making several tool calls
  (shell via $, files via read/write/edit, search via glob/grep);
  only the last expression returns to context
- Implicit-return transform: final expression is returned even when
  the snippet ends with a semicolon; SyntaxError falls back to raw body
- Wired in getAllBaseTools + post-MLX-tier-filter injection (tier spec
  table frozen — REPL bypasses tiering); gated on REPL mode or
  BENCH_CODE_MODE=1, default-off otherwise
- lazy require(): REPLTool→Tool.js→AgentTool TDZ import loop
- Validated on Qwen3.8-27B-4bit-mtp: scripted count task resolved in
  2 REPL calls with correct result; read+edit flow also green

Co-Authored-By: Claude Code <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant