claurst  by Kuberwastaken

AI coding agent reimplemented in Rust

Created 1 week ago

New!

8,871 stars

Top 5.8% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Summary

This repository provides a clean-room reimplementation in Rust of Anthropic's Claude Code CLI, developed after its source code was inadvertently leaked via an npm sourcemap. The project meticulously reverse-engineers Claude Code's behavior through a two-phase AI-driven process: first, generating exhaustive behavioral specifications, then implementing those specifications in Rust without direct reference to the original TypeScript code. This approach offers a deep technical dive into the architecture, features, and internal workings of a sophisticated AI coding agent, valuable for engineers evaluating similar AI-powered development tools.

How It Works

The project employs a legal and technical strategy known as clean-room engineering. An AI agent analyzed the leaked source to create detailed behavioral specifications, including architecture, data flows, and tool contracts. A separate AI agent then implemented these specifications in Rust, ensuring no proprietary code was directly copied. This method aims to replicate Claude Code's functionality and internal logic while adhering to copyright principles that protect expression, not ideas or behavior. The analysis is presented as commentary on publicly available software, with code excerpts used illustratively under fair use.

Quick Start & Requirements

This repository contains a reimplementation and analysis of Claude Code, not the original executable. Setup instructions for running this specific Rust project are not provided in the README. The original Claude Code utilizes Bun as its bundler.

Highlighted Details

  • Buddy System: Features a Tamagotchi-style companion pet with deterministic gacha mechanics, procedurally generated stats, and unique "soul" descriptions, gated by a compile-time feature flag.
  • Kairos (Always-On Assistant): An internal mode (PROACTIVE/KAIROS flag) that logs, monitors, and proactively acts on observations with a 15-second blocking budget, featuring exclusive tools like SendUserFile and PushNotification.
  • Ultraplan: A remote planning feature offloading complex tasks to a Cloud Container Runtime session (Opus 4.6) for up to 30 minutes, with browser-based approval.
  • Dream System (autoDream): A background memory consolidation engine that runs as a forked sub-agent, performing a four-phase reflective pass over memory files (Orient, Gather, Consolidate, Prune) triggered by time, session, and lock gates.
  • Undercover Mode: A system designed to prevent Anthropic employees' AI contributions to open-source repositories from revealing internal codenames, model versions, or project details.
  • Multi-Agent Orchestration: A "Coordinator Mode" (CLAUDE_CODE_COORDINATOR_MODE=1) that manages parallel worker agents for research, synthesis, implementation, and verification, utilizing a shared scratchpad and XML-based task notifications.
  • Feature Gating: Extensive use of compile-time feature flags (via Bun's feature() function) and runtime configuration (GrowthBook, tengu_* flags) to differentiate internal builds from external releases, controlling features like KAIROS, Buddy, and Coordinator Mode.
  • Tool Registry: A comprehensive system (tools/) listing over 40 tools, including shell execution, file operations, web access, LSP communication, and agent/task management, with a sophisticated permission and risk classification system.

Maintenance & Community

The analysis and write-up are attributed to Kuber Mehta. No specific community channels, contributor lists, or ongoing maintenance details for the Rust reimplementation are provided.

Licensing & Compatibility

The license for the Kuberwastaken/claurst Rust code is not explicitly stated. The analysis and commentary are presented under fair use (17 U.S.C. § 107). The original Claude Code is proprietary software developed by Anthropic.

Limitations & Caveats

This repository is a reverse-engineered reimplementation based on analysis of leaked source code, not the official Anthropic product. Its accuracy is dependent on the completeness and interpretation of the leaked data. The legal implications surrounding the leak and subsequent analysis may present adoption risks. Certain advanced features like Kairos, Ultraplan, and the Dream System are internal-only and gated, meaning their full behavior might not be perfectly captured or reproducible.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
31
Issues (30d)
52
Star History
8,962 stars in the last 11 days

Explore Similar Projects

Feedback? Help us improve.