Skip to content

Feature Request: Rust-based native runtime / desktop client for lower latency and better non-coding UX #3541

Description

@jghwwnq

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

  1. Startup speed: Node + dependency tree loading adds hundreds of milliseconds before the first prompt is rendered.
  2. Runtime performance: File walking, parsing, and diff generation in large repos are CPU-heavy and currently run on the JS event loop.
  3. Bundle size: Shipping a standalone CodeWhale tool currently requires bundling the entire Node runtime or asking users to have Node installed.
  4. 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    Status
    Backlog

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions