kuberwastaken/claude-code
Summary
A clean-room Rust reimplementation of Anthropic's Claude Code CLI, reverse-engineered from a source map leak in the official npm package. The project includes behavioral specs derived from the TypeScript original and a full Rust port organized as a multi-crate workspace covering API client, TUI (ratatui/crossterm), slash commands, MCP server integration, tools, and a Tamagotchi-style companion system called 'Buddy'.
Great for
Rust developers interested in building terminal AI coding agents — specifically the architecture of multi-turn agentic loops, TUI design with ratatui, MCP (Model Context Protocol) client integration, and permission/tool orchestration systems.
Easy wins
- +Add CI (GitHub Actions with `cargo build`, `cargo test`, `cargo clippy`) — no CI exists at all despite having tests
- +The cc-buddy crate uses SHA-256 seeding but the README describes FNV-1a from the original TypeScript; document or reconcile this intentional divergence
- +Add integration tests for slash commands in cc-commands — the trait interface is clean and testable but coverage appears thin
- +Add a CONTRIBUTING.md explaining the crate layout, how to run the TUI locally, and how to add new slash commands (the SlashCommand trait makes this very approachable)
Red flags
- !Legal gray area: despite the clean-room claim and legal citations (Phoenix v. IBM, Baker v. Selden), this is built from a leaked source map of proprietary code. Anthropic could still send a DMCA takedown or pursue other remedies. Contributing to this project carries real legal risk that individual contributors should assess.
- !No license on the repository — this means by default all rights are reserved and contributors have no explicit grant to use, modify, or distribute the code.
- !Single commit, single contributor, commit frequency of 1 in 30 days — effectively a dump with no ongoing maintenance signal.
- !The README claims a '785KB main.tsx' maps to src-rust/crates/cli/src/main.rs but the Rust file is the CLI entry point, not a 785KB file — the README is describing the original TypeScript source, which creates confusion about what's actually implemented vs. specified.
- !No .npmignore or build config files in the repo means the irony described in the README (shipping source via sourcemap) could theoretically apply here too if this were ever published.
Code quality
The code is notably clean for a reverse-engineered port. cc-core/src/lib.rs shows well-structured error types with `thiserror`, a coherent type hierarchy for messages/content blocks, and thoughtful helpers like `get_tool_use_blocks()` and `has_tool_use()`. The TUI app in cc-tui correctly handles UTF-8 cursor positioning with `char_boundary_at`/`prev_char_boundary` rather than naive byte indexing — a common bug in Rust TUI code. The buddy crate faithfully ports the PRNG logic with clear comments explaining divergence from the TypeScript (SHA-256 vs FNV-1a). Main weakness: `src-rust/crates/cli/src/main.rs` is already large and doing a lot of work (MCP init, tool wiring, permission handler selection, auth, headless/interactive branching) — this will become a maintenance burden.
What makes it unique
There is no other public Rust reimplementation of Claude Code with this level of architectural fidelity — the multi-crate workspace covering API streaming, TUI, MCP client, permission system, and slash commands is genuinely comprehensive. However, the project's origin from a leaked sourcemap is what makes it notable, not its technical novelty alone. As a reference implementation for 'how would you build Claude Code in Rust from scratch,' it's interesting. As a production tool, it's unclear whether it actually connects to the API correctly since no integration tests or real run examples are shown.