Skip to content

CharlesWong/ClaudeCodeUnleashed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”“ Claude Code Unleashed - Deobfuscated v1.0.115

The fully reverse-engineered and deobfuscated source code of Claude Code CLI

Version Status Deobfuscation Architecture

โš ๏ธ Important Notice

This is a reverse-engineered, deobfuscated version of Claude Code CLI v1.0.115.

This repository contains:

  • ๐Ÿ”ฌ Fully deobfuscated source code extracted from the original webpack bundle
  • ๐Ÿ“š Comprehensive documentation detailing the internal architecture
  • ๐Ÿ—บ๏ธ Complete module mapping showing how 50,360 lines were reorganized into readable modules
  • ๐Ÿ—๏ธ Architectural analysis of the event-driven, streaming-first design

Legal Disclaimer

This project is provided for educational and research purposes only. The original Claude Code is property of Anthropic. Users should:

  • Respect Anthropic's intellectual property rights
  • Use this for learning and understanding, not for commercial purposes
  • Comply with all applicable laws and Anthropic's terms of service
  • Understand that this is NOT an official release

๐ŸŽฏ What is This Repository?

This repository contains the complete deobfuscation of Claude Code CLI v1.0.115, transforming:

Original Deobfuscated
50,360 lines of webpack-bundled code 6,409 lines of clean, organized Claude code
Minified, obfuscated variables Meaningful function and variable names
Single massive file 71 organized modules across logical directories
No documentation Comprehensive architectural documentation
Unreadable control flow Clear, understandable program structure

๐Ÿ” Deobfuscation Methodology

  1. Static Analysis: Parsed the webpack bundle to identify module boundaries
  2. Variable Recovery: Restored ~10,000+ mangled variable names using contextual analysis
  3. Function Extraction: Identified and separated ~500+ individual functions
  4. Module Reconstruction: Rebuilt the original ES6 module structure
  5. Type Inference: Reconstructed TypeScript-like interfaces from usage patterns
  6. Documentation Generation: Created comprehensive docs from code analysis

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18.0.0 or higher
  • npm or yarn package manager
  • Unix-like terminal (macOS, Linux, WSL for Windows)

Installation

# Clone the repository
git clone https://github.com/yourusername/ClaudeCodeUnleashed.git
cd ClaudeCodeUnleashed

# Navigate to the code directory
cd 1.0.115/code

# Install dependencies
npm install

# Make the CLI executable
chmod +x src/main.js

# Optional: Create global symlink
npm link

Authentication

Option 1: OAuth (Claude.ai Account)

# Login with your Claude.ai account
node src/main.js login

# This will open your browser for authentication

Option 2: API Key (Anthropic API)

# Login with Anthropic API key
node src/main.js login --api-key

# Or set environment variable
export ANTHROPIC_API_KEY="sk-ant-api03-..."

Basic Usage

# Start a conversation with default model
node src/main.js

# Use a specific model
node src/main.js -m claude-3-opus-20240229

# Check authentication status
node src/main.js status

# Logout
node src/main.js logout

๐Ÿ“ Project Structure

ClaudeCodeUnleashed/
โ”œโ”€โ”€ ๐Ÿ“„ README.md                    # This file
โ”œโ”€โ”€ ๐Ÿ“„ CLAUDE.md                    # Quick reference for Claude instances
โ”‚
โ””โ”€โ”€ ๐Ÿ“‚ 1.0.115/
    โ”œโ”€โ”€ ๐Ÿ“‚ code/                    # Deobfuscated source code
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ package.json         # Node.js configuration
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ README.md            # Code-specific documentation
    โ”‚   โ”‚
    โ”‚   โ””โ”€โ”€ ๐Ÿ“‚ src/
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ main.js          # CLI entry point
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ index.js         # Module exports
    โ”‚       โ”‚
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“‚ auth/            # Authentication system
    โ”‚       โ”‚   โ”œโ”€โ”€ oauth.js        # OAuth PKCE flow
    โ”‚       โ”‚   โ””โ”€โ”€ api-key.js      # API key management
    โ”‚       โ”‚
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“‚ tools/           # Tool implementations
    โ”‚       โ”‚   โ”œโ”€โ”€ bash.js         # Shell execution
    โ”‚       โ”‚   โ”œโ”€โ”€ read.js         # File reading
    โ”‚       โ”‚   โ”œโ”€โ”€ write.js        # File writing
    โ”‚       โ”‚   โ”œโ”€โ”€ edit.js         # File editing
    โ”‚       โ”‚   โ”œโ”€โ”€ grep.js         # Pattern search
    โ”‚       โ”‚   โ”œโ”€โ”€ web-fetch.js    # Web content fetching
    โ”‚       โ”‚   โ”œโ”€โ”€ web-search.js   # Web searching
    โ”‚       โ”‚   โ”œโ”€โ”€ task.js         # Agent tasks
    โ”‚       โ”‚   โ””โ”€โ”€ ...             # More tools
    โ”‚       โ”‚
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“‚ conversation/    # Core conversation engine
    โ”‚       โ”‚   โ”œโ”€โ”€ loop.js         # Main REPL loop
    โ”‚       โ”‚   โ”œโ”€โ”€ tool-execution.js
    โ”‚       โ”‚   โ”œโ”€โ”€ token-management.js
    โ”‚       โ”‚   โ””โ”€โ”€ microcompaction.js
    โ”‚       โ”‚
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“‚ ui/              # Terminal interface
    โ”‚       โ”‚   โ”œโ”€โ”€ terminal.js     # React-based UI
    โ”‚       โ”‚   โ””โ”€โ”€ components/     # UI components
    โ”‚       โ”‚
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“‚ mcp/             # Model Context Protocol
    โ”‚       โ”‚   โ”œโ”€โ”€ server.js       # MCP server
    โ”‚       โ”‚   โ””โ”€โ”€ protocol.js     # Protocol handlers
    โ”‚       โ”‚
    โ”‚       โ”œโ”€โ”€ ๐Ÿ“‚ network/         # Networking layer
    โ”‚       โ”‚   โ”œโ”€โ”€ client.js       # HTTP client
    โ”‚       โ”‚   โ””โ”€โ”€ streaming.js    # SSE/WebSocket
    โ”‚       โ”‚
    โ”‚       โ””โ”€โ”€ ๐Ÿ“‚ utils/           # Utilities
    โ”‚           โ””โ”€โ”€ ...             # Helper functions
    โ”‚
    โ””โ”€โ”€ ๐Ÿ“‚ docs/                    # Documentation
        โ”œโ”€โ”€ ๐Ÿ“‚ en-US/               # English documentation
        โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ README.md
        โ”‚   โ”œโ”€โ”€ part-01-architecture/
        โ”‚   โ”œโ”€โ”€ part-02-runtime/
        โ”‚   โ”œโ”€โ”€ part-03-conversation/
        โ”‚   โ”œโ”€โ”€ part-04-tools/
        โ”‚   โ”œโ”€โ”€ part-05-agents/
        โ”‚   โ”œโ”€โ”€ part-06-api/
        โ”‚   โ”œโ”€โ”€ part-07-ui/
        โ”‚   โ”œโ”€โ”€ part-08-performance/
        โ”‚   โ”œโ”€โ”€ part-09-development/
        โ”‚   โ”œโ”€โ”€ part-10-security/
        โ”‚   โ””โ”€โ”€ part-11-extensibility/
        โ”‚
        โ””โ”€โ”€ ๐Ÿ“‚ zh-CN/               # Chinese documentation
            โ””โ”€โ”€ ...                 # (ๅŒไธŠ)

๐Ÿ› ๏ธ Features & Capabilities

Core Features

Feature Description Status
๐Ÿ” Authentication OAuth 2.0 PKCE flow & API key support โœ… Complete
๐Ÿ’ฌ Conversation Engine Streaming responses with token management โœ… Complete
๐Ÿงฐ Tool System Extensible tool architecture โœ… Complete
๐Ÿ“ File Operations Read, write, edit with permission control โœ… Complete
๐Ÿ–ฅ๏ธ Terminal UI React-based terminal interface using Ink โœ… Complete
๐Ÿ”„ Background Tasks Async task execution with monitoring โœ… Complete
๐ŸŽฃ Hook System Pre/post execution hooks โœ… Complete
๐Ÿค– Agent System Multi-agent task delegation โœ… Complete
๐Ÿ” Search Tools Web search and content fetching โœ… Complete
๐Ÿ“Š Token Management Usage tracking and auto-compaction โœ… Complete

Available Tools

  • Bash - Execute shell commands with timeout control
  • Read - Read files (text, images, PDFs, notebooks)
  • Write - Create or overwrite files
  • Edit - Find and replace text in files
  • Grep - Pattern search using ripgrep
  • WebFetch - Fetch and analyze web content
  • WebSearch - Search the web
  • NotebookEdit - Edit Jupyter notebooks
  • Task - Launch specialized agents
  • BashOutput - Monitor background shell output
  • KillShell - Terminate background shells

๐Ÿ—๏ธ Architecture Highlights

Event-Driven Design

// Everything is event-based
conversationLoop.on('stream:delta', handleDelta);
conversationLoop.on('tool:execute', handleToolExecution);
conversationLoop.on('message:complete', handleComplete);

Streaming-First Approach

  • Server-Sent Events (SSE) for real-time responses
  • WebSocket fallback for bidirectional communication
  • Chunked processing for large outputs

Token Management

  • Max conversation: 200,000 tokens
  • Auto-compaction: Triggers at 150,000 tokens
  • Microcompaction: Preserves context while reducing size

Permission System

  • Granular file access control
  • Allow/deny rules per directory
  • Hook-based permission checks

๐Ÿ“š Documentation

Comprehensive documentation is available in the 1.0.115/docs/ directory:

English Documentation (en-US)

ไธญๆ–‡ๆ–‡ๆกฃ (zh-CN)

  • ๅฎŒๆ•ด็š„ไธญๆ–‡็‰ˆๆœฌๆ–‡ๆกฃ๏ผŒๅŒ…ๅซๆ‰€ๆœ‰ไธŠ่ฟฐๅ†…ๅฎน

๐Ÿ”ฌ Technical Details

Deobfuscation Statistics

Metric Value
Original bundle size 50,360 lines
Actual Claude code 6,409 lines
Library/bundler code 43,951 lines
Extraction coverage 96.4%
Modules identified 71
Functions recovered ~500
Variables renamed ~10,000

Technology Stack

  • Runtime: Node.js 18+ with ES6 modules
  • UI Framework: React + Ink (terminal UI)
  • HTTP Client: Axios + native fetch
  • Streaming: EventSource (SSE) + WebSocket
  • File System: Native fs with permission layer
  • Authentication: OAuth 2.0 PKCE + API keys
  • State Management: Event-driven with EventEmitter

Performance Characteristics

  • Startup time: ~200ms
  • First response: <1s (with warm connection)
  • Token processing: ~1000 tokens/second
  • Memory usage: ~50-100MB baseline
  • Background task limit: Configurable (default 10)

๐Ÿšง Known Limitations

Current Status

  • โœ… Core functionality: Fully operational
  • โš ๏ธ MCP connections: Partially implemented
  • โš ๏ธ Hook system: Configuration UI incomplete
  • โš ๏ธ Update system: Not fully extracted
  • โŒ Tests: No test suite recovered

Technical Limitations

  1. Some internal APIs may have subtle differences from original
  2. Error messages might differ from official version
  3. Performance optimizations may be missing
  4. Some edge cases might not be handled identically

๐Ÿค Contributing

While this is primarily a research/educational project, contributions are welcome for:

  1. Documentation improvements: Clarifying explanations, fixing errors
  2. Code organization: Better module structure, cleaner interfaces
  3. Missing features: Identifying and documenting unextracted functionality
  4. Analysis tools: Scripts for further deobfuscation or analysis

Please note:

  • This is NOT intended to be a maintained fork
  • No feature additions beyond what exists in v1.0.115
  • Focus on understanding and documenting, not extending

๐Ÿ“œ License & Legal

Educational Purpose Disclaimer: This repository is provided solely for educational and research purposes to understand the architecture and implementation of Claude Code.

  • The original Claude Code is property of Anthropic, PBC
  • This deobfuscation is not endorsed or authorized by Anthropic
  • Users must comply with Anthropic's terms of service
  • No warranty or support is provided
  • Use at your own risk

For official Claude Code, please visit: https://claude.ai/code


๐Ÿ™ Acknowledgments

  • Anthropic for creating Claude and Claude Code
  • The reverse engineering community for deobfuscation techniques
  • Open source tools used in the analysis process

๐Ÿ“ž Contact & Resources


Last updated: September 2024 | Version 1.0.115 | Research Project

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published