Summary
CodeWhale today ships as an npm package with a TypeScript/Node TUI and CLI. While this makes distribution easy, the Node runtime introduces noticeable overhead: cold-start latency, memory footprint, and single-threaded event-loop stalls all become visible when running long agent sessions or handling large workspaces.
I would like to propose a longer-term initiative to re-implement the core runtime (and optionally a native desktop/TUI shell) in Rust, similar in spirit to how the community has explored Rust rewrites of Claude Code / Codex. Rust gives us:
- Sub-second cold start and a much smaller binary.
- True parallelism for file indexing, git operations, and tool calls.
- Memory safety without GC pauses.
- Easier native distribution (single binary, no
npm install).
Motivation / Pain Points
- Startup speed: Node + dependency tree loading adds hundreds of milliseconds before the first prompt is rendered.
- Runtime performance: File walking, parsing, and diff generation in large repos are CPU-heavy and currently run on the JS event loop.
- Bundle size: Shipping a standalone CodeWhale tool currently requires bundling the entire Node runtime or asking users to have Node installed.
- Non-coding workflows: A Rust core could power a lighter native desktop companion (e.g., system tray, global hotkey, quick chat panel) that feels responsive outside the terminal.
Proposed Scope
This does not have to be a big-bang rewrite. A phased approach could be:
-
Rust core runtime (codewhale-core)
- Workspace/file operations
- Git state management
- Tool execution / sandboxing
- LSP/diff utilities
- Expose a C-API or JSON-RPC interface.
-
TypeScript compatibility layer
- Keep the existing agent logic / prompt templates in TS/Node if needed.
- Have the TS layer call the Rust core for heavy operations.
-
Native TUI / desktop client
- Terminal: built with
ratatui + crossterm.
- Desktop (optional): built with
Tauri (Rust backend + web frontend) or egui / iced for a fully native experience.
-
Model provider adapters
- Re-implement the OpenAI / Anthropic / DeepSeek / local vLLM / Ollama adapters in Rust so the native client can run standalone.
Success Criteria
codewhale binary starts in <100 ms on a modern laptop.
- Peak memory usage is noticeably lower than the Node version for the same session.
- Large-repo file scans / diffs complete faster.
- Existing approval-gated tools, side-git snapshots, and
/restore rollback remain supported.
References
- CodeWhale is currently an npm package: README (https://github.com/Hmbown/CodeWhale/blob/main/README.md)
- Community Rust rewrites of Claude Code have reported 2.5x faster startup and 25x faster command execution.
- Relevant Rust ecosystem:
tokio, ratatui, crossterm, Tauri, egui, iced.
Open Questions
- Should the Rust runtime be the default, or an optional native build alongside the TS version?
- Which parts of the agent orchestration are easiest to move to Rust first without losing the existing plugin/skill ecosystem?
Summary
CodeWhale today ships as an npm package with a TypeScript/Node TUI and CLI. While this makes distribution easy, the Node runtime introduces noticeable overhead: cold-start latency, memory footprint, and single-threaded event-loop stalls all become visible when running long agent sessions or handling large workspaces.
I would like to propose a longer-term initiative to re-implement the core runtime (and optionally a native desktop/TUI shell) in Rust, similar in spirit to how the community has explored Rust rewrites of Claude Code / Codex. Rust gives us:
npm install).Motivation / Pain Points
Proposed Scope
This does not have to be a big-bang rewrite. A phased approach could be:
Rust core runtime (
codewhale-core)TypeScript compatibility layer
Native TUI / desktop client
ratatui+crossterm.Tauri(Rust backend + web frontend) oregui/icedfor a fully native experience.Model provider adapters
Success Criteria
codewhalebinary starts in <100 ms on a modern laptop./restorerollback remain supported.References
tokio,ratatui,crossterm,Tauri,egui,iced.Open Questions