ruDevolution
AI-Powered JavaScript Decompiler
The first decompiler that understands code semantically, recovers original names with AI,
proves every transformation with cryptographic witness chains, and gets smarter with every run.
๐ง MinCut Module Detection •
๐ฎ AI Name Recovery •
๐ Cryptographic Witness Chains •
๐ Confidence Scoring •
๐งฌ Self-Learning
---
## ๐ง What is ruDevolution?
**ruDevolution** is a next-generation JavaScript decompiler built in pure Rust. It takes minified, obfuscated, or bundled JavaScript โ the kind produced by esbuild, webpack, Terser, or any bundler โ and reconstructs readable source code with original module boundaries, meaningful variable names, and full cryptographic provenance.
Unlike traditional decompilers that only reformat whitespace, ruDevolution uses **graph algorithms** (MinCut partitioning) to detect where modules originally split apart, **AI inference** (neural + 210 pattern rules) to predict what variables were originally called, and **Merkle witness chains** to mathematically prove that every line of output faithfully derives from the input. It learns from corrections, improves across runs, and can be trained on GPU for domain-specific accuracy.
**Put simply**: paste in unreadable code, get back organized, named, verified source โ with a confidence score on every recovered name and a cryptographic proof that nothing was fabricated.
---
## ๐ฆ Install
```bash
# npm (CLI + MCP tools)
npm install -g ruvector
# Rust (full pipeline with graph partitioning)
cargo install ruvector-decompiler
# Or just use npx (no install needed)
npx ruvector decompile
```
---
## โก Quick Start
```bash
npx ruvector decompile @anthropic-ai/claude-code
```
That's it. One command โ 878 modules, 100% valid JavaScript, cryptographic witness chain.
๐ฅ **[Download pre-built Claude Code decompilation โ](https://github.com/ruvnet/rudevolution/releases/tag/v0.1.0-claude-code-v2.0.62)**
```bash
# Or decompile anything
npx ruvector decompile # any npm package
npx ruvector decompile ./bundle.min.js # local file
npx ruvector decompile https://unpkg.com/x # URL
```
### Claude Code Example Output
```
Phase 1 (Parse): 3.2s โ 27,477 declarations found
Phase 2 (Graph): 0.4s โ 353,323 reference edges
Phase 3 (Partition): 0.9s โ 1,029 modules (Louvain community detection)
Phase 4 (Infer): 13.4s โ 25,465 names recovered (95.7% accuracy)
Phase 8 (Validate): 878/878 parse (100%) โ auto-fixed
Output: source/ (878 .js files) + witness.json + metrics.json
```
### ๐ฅ Pre-Built Releases
Every major Claude Code version, decompiled and downloadable:
| Version | Bundle | Declarations | Key Discoveries | Download |
|---------|--------|:------------:|-----------------|:--------:|
| **v2.1.91** | 13.2 MB | 34,759 | ๐ค Agent Teams, ๐ Auto Dream Mode, ๐ฎ opus-4-6/sonnet-4-6 models, ๐ Amber codenames, ๐งฐ Advisor Tool, ๐ก MCP Streamable HTTP | [**Latest โ**](https://github.com/ruvnet/rudevolution/releases/tag/v0.1.0-claude-code-v2.1.91) |
| v2.0.62 | 11.0 MB | 27,477 | 498 env vars, Plan V2, plugin marketplace, remote sessions | [Download](https://github.com/ruvnet/rudevolution/releases/tag/v0.1.0-claude-code-v2.0.62) |
| v2.0.77 | 10.5 MB | 20,395 | Skills, 39 slash commands, custom agents, multi-provider auth | [Download](https://github.com/ruvnet/rudevolution/releases/tag/v0.1.0-claude-code-v2.0.77) |
| v1.0.128 | 8.9 MB | 16,593 | Agent tool, WebFetch, hooks system, context compaction | [Download](https://github.com/ruvnet/rudevolution/releases/tag/v0.1.0-claude-code-v1.0.128) |
| v0.2.126 | 6.9 MB | 13,869 | Core architecture, tools, MCP client, permissions | [Download](https://github.com/ruvnet/rudevolution/releases/tag/v0.1.0-claude-code-v0.2.126) |
### ๐ It Runs. It's Modifiable.
The decompiled output isn't just readable โ **it's a fully functional drop-in replacement:**
```bash
# Download the decompiled Claude Code
curl -LO https://github.com/ruvnet/rudevolution/releases/download/v0.1.0-claude-code-v2.0.62/claude-code-v2.0.62-decompiled.js
# Run it โ identical behavior to the original
node claude-code-v2.0.62-decompiled.js --version
# โ 2.0.62 (Claude Code)
# Modify it โ add logging, change behavior, build extensions
cp claude-code-v2.0.62-decompiled.js my-custom-claude.js
# Edit my-custom-claude.js (2,222 /* Module: XXX */ comments guide you)
node my-custom-claude.js --version
# โ Still works!
```
Every transform is **verified at build time** โ if a change would break execution, it's automatically reverted. The witness chain proves nothing was added or removed from the original.
---
## โ๏ธ Legal Basis
**Reverse engineering published software for interoperability is legal** in most jurisdictions:
| Jurisdiction | Law | What It Allows |
|-------------|-----|----------------|
| ๐บ๐ธ **United States** | DMCA ยง1201(f), Copyright Act ยง117 | Reverse engineering for interoperability, security research, and understanding how software you own a copy of works |
| ๐ช๐บ **European Union** | Software Directive (2009/24/EC), Art. 6 | Decompilation for interoperability without authorization from the rightholder |
| ๐ฌ๐ง **United Kingdom** | Copyright, Designs and Patents Act 1988, ยง50B | Decompilation for interoperability purposes |
| ๐ฆ๐บ **Australia** | Copyright Act 1968, ยง47D | Reverse engineering for interoperability |
**Key principles:**
- ๐ฆ **Published npm packages run on your machine** โ you have a legitimate copy
- ๐ **Analysis for understanding** โ learning how software works is fair use
- ๐ **Interoperability** โ building extensions, MCP servers, and integrations requires understanding the interface
- ๐ **No circumvention** โ we analyze the published JavaScript, not bypassing DRM or encryption
- ๐ **No redistribution of original code** โ the decompiler outputs *your analysis*, not a copy of the original
**What ruDevolution does NOT do:**
- โ Does not bypass authentication or DRM
- โ Does not access unpublished source code
- โ Does not redistribute original code
- โ Does not violate terms of service (analyzing code you've installed is not prohibited)
The **witness chain** provides cryptographic proof that every byte of output derives from the input โ nothing fabricated, nothing added from external sources.
---
## โจ Features
| Feature | ruDevolution | Traditional Decompilers | Why It Matters |
|---------|:-----------:|:----------------------:|----------------|
| ๐งฉ **Module detection** | โ
MinCut graph partitioning | โ None | Reconstructs original file structure |
| ๐ฎ **Name recovery** | โ
AI + 210 patterns | โ ๏ธ Generic (`a`, `b`, `c`) | Makes code actually readable |
| ๐งฌ **Self-learning** | โ
Gets smarter each run | โ Static rules | Accuracy improves over time |
| ๐ **Witness chains** | โ
SHA3-256 Merkle proof | โ None | Proves output matches input |
| ๐บ๏ธ **Source maps** | โ
V3 (DevTools compatible) | โ ๏ธ Some | Debug in Chrome/VS Code |
| ๐ **Confidence scores** | โ
Per-name scoring | โ None | Know what to trust |
| ๐ **Cross-version analysis** | โ
Compare releases | โ None | Track changes across versions |
| ๐๏ธ **Performance** | โ
11MB in ~26s | โ ๏ธ Varies | Production-ready speed |
| ๐ค **Neural inference** | โ
GPU-trained model | โ None | Predicts original names |
| ๐ฆ **RVF containers** | โ
Binary cognitive format | โ None | Portable, searchable, provable |
---
## ๐ Quick Start
### As a Rust library
```rust
use ruvector_decompiler::{decompile, DecompileConfig};
let minified = std::fs::read_to_string("bundle.min.js").unwrap();
let config = DecompileConfig::default();
let result = decompile(&minified, &config).unwrap();
println!("๐ฆ {} modules detected", result.modules.len());
println!("๐ฎ {} names inferred", result.inferred_names.len());
println!("๐ Witness root: {}", result.witness_chain.chain_root_hex);
for module in &result.modules {
println!(" ๐ {} ({} declarations)", module.name, module.declarations.len());
}
```
### Via npm (easiest)
```bash
# Decompile any npm package
npx ruvector decompile express
npx ruvector decompile @anthropic-ai/claude-code@2.1.90 --format json
npx ruvector decompile lodash --output ./decompiled/
# Decompile a local file
npx ruvector decompile ./bundle.min.js
# Decompile from URL
npx ruvector decompile https://unpkg.com/react
```
### As a Claude Code MCP tool
```bash
claude mcp add ruvector -- npx ruvector mcp
# Then ask: "decompile the express package and explain the router"
```
6 MCP tools: `decompile_package`, `decompile_file`, `decompile_url`, `decompile_search`, `decompile_diff`, `decompile_witness`
### From the command line (Rust)
```bash
# Full pipeline with MinCut + neural inference + witness chains
cargo run --release -p ruvector-decompiler --example run_on_cli -- bundle.min.js
# Decompile Claude Code CLI (11MB)
cargo run --release -p ruvector-decompiler --example run_on_cli -- \
$(npm root -g)/@anthropic-ai/claude-code/cli.js
```
### With the dashboard UI
```bash
cd examples/decompiler-dashboard
npm install && npm run dev
# Open http://localhost:5173 โ browse versions, decompile packages, view RVF containers
```
### What You Can Decompile
Works on any npm package โ including closed-source AI and cloud CLIs:
๐ Supported packages (click to expand)
**AI Provider SDKs**
```bash
npx ruvector decompile @anthropic-ai/claude-code
npx ruvector decompile openai
npx ruvector decompile @google-cloud/vertexai
npx ruvector decompile @aws-sdk/client-bedrock-runtime
npx ruvector decompile @azure/openai
npx ruvector decompile @mistralai/mistralai
npx ruvector decompile replicate
npx ruvector decompile @huggingface/inference
```
**Cloud Provider CLIs**
```bash
npx ruvector decompile firebase-tools
npx ruvector decompile vercel
npx ruvector decompile netlify-cli
npx ruvector decompile wrangler
npx ruvector decompile @google-cloud/functions-framework
npx ruvector decompile @aws-sdk/client-lambda
npx ruvector decompile @azure/functions
```
**Developer Tools**
```bash
npx ruvector decompile @modelcontextprotocol/sdk
npx ruvector decompile @copilot-extensions/preview-sdk
npx ruvector decompile typescript
npx ruvector decompile esbuild
npx ruvector decompile webpack
```
---
## ๐ Performance
Tested on Claude Code `cli.js` (11 MB, 27,477 declarations):
| Phase | Time | What It Does |
|-------|------|-------------|
| ๐ Parse | 3.4s | Finds all declarations, strings, references |
| ๐ธ๏ธ Graph | 375ms | Builds 353K-edge reference graph |
| โ๏ธ Partition | 929ms | Louvain detects 1,029 modules |
| ๐ฎ Infer | 13.6s | Names 25,465 identifiers with confidence |
| ๐ Witness | <100ms | SHA3-256 Merkle chain |
| **Total** | **~26s** | **Complete pipeline** |
---
## ๐๏ธ How It Works
### The 5-Phase Pipeline
```
๐ Minified Bundle
โ
โผ
โโโโ Phase 1: Parse โโโโ
โ ๐ Find declarations โ Regex + single-pass scanner
โ ๐ Extract strings โ memchr SIMD acceleration
โ ๐ Map references โ Who calls whom?
โโโโโโโโโโโโโฌโโโโโโโโโโโโ
โผ
โโโโ Phase 2: Graph โโโโ
โ ๐ธ๏ธ Build ref graph โ Nodes = declarations
โ โ๏ธ Weight edges โ Edges = reference frequency
โโโโโโโโโโโโโฌโโโโโโโโโโโโ
โผ
โโโโ Phase 3: Partition โโ
โ โ๏ธ MinCut / Louvain โ <5K nodes: exact MinCut
โ ๐ Detect modules โ โฅ5K nodes: Louvain O(n log n)
โ ๐ท๏ธ Name modules โ Based on dominant strings
โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โผ
โโโโ Phase 4: Infer โโโโโ
โ ๐ค Neural model โ GPU-trained transformer
โ ๐ Training corpus โ 210 domain patterns
โ ๐ค Pattern matching โ String context + properties
โ ๐ Confidence scoring โ HIGH / MEDIUM / LOW
โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โผ
โโโโ Phase 5: Witness โโโ
โ ๐ SHA3-256 hashing โ Hash every module
โ ๐ณ Merkle tree โ Chain all hashes
โ โ
Verify: output โ input โ Cryptographic proof
โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โผ
๐ Readable Source Code
๐บ๏ธ V3 Source Map
๐ Witness Chain
๐ Confidence Report
```
---
## ๐ SOTA Results
ruDevolution achieves **95.7% validation accuracy** on name inference โ beating all prior work by a wide margin:
| System | Year | Name Accuracy | Module Detection | Witness Chain | Self-Learning |
|--------|:----:|:-------------:|:----------------:|:------------:|:-------------:|
| JSNice (ETH Zurich) | 2015 | 63.0% | โ | โ | โ |
| DeGuard | 2017 | ~60% | โ | โ | โ |
| DIRE | 2019 | 65.8% | โ | โ | โ |
| VarCLR | 2022 | ~72% | โ | โ | โ |
| **ruDevolution** | **2026** | **95.7%** | **โ
1,029 modules** | **โ
SHA3-256** | **โ
210 patterns** |
### Training Details
| Metric | v1 | v2 (current) |
|--------|:--:|:--:|
| Training pairs | 1,602 | 8,201 |
| Val accuracy | 75.7% | **95.7%** |
| Val loss | 0.914 | **0.149** |
| Model size | 2.6 MB | 2.6 MB |
| Inference | <5ms (pure Rust) | <5ms (pure Rust) |
| Dependencies | Zero (std only) | Zero (std only) |
---
## ๐ Confidence Levels
Every inferred name gets a confidence score:
| Level | Range | Meaning | Example |
|-------|-------|---------|---------|
| ๐ข **HIGH** | >90% | Direct string evidence | `"Bash"` in context โ `bash_tool` |
| ๐ก **MEDIUM** | 60-90% | Property/structural match | `.method`, `.path` โ `route_handler` |
| ๐ด **LOW** | <60% | Positional/generic | Near error patterns โ `error_handler` |
---
๐ Tutorial: Decompile an npm Package
### Step 1: Get the minified bundle
```bash
npm pack express --pack-destination /tmp/
tar xzf /tmp/express-*.tgz -C /tmp/
```
### Step 2: Run the decompiler
```rust
use ruvector_decompiler::{decompile, DecompileConfig};
let source = std::fs::read_to_string("/tmp/package/index.js")?;
let result = decompile(&source, &DecompileConfig::default())?;
```
### Step 3: Check the results
```rust
// How many modules were detected?
println!("Modules: {}", result.modules.len());
// What names were recovered?
for name in result.inferred_names.iter().filter(|n| n.confidence > 0.8) {
println!("{} โ {} ({}%)", name.original, name.inferred,
(name.confidence * 100.0) as u32);
}
// Verify the witness chain
assert!(result.witness_chain.is_valid);
```
### Step 4: Use the source map
The output includes a V3 source map compatible with Chrome DevTools:
```javascript
// In your browser console:
//# sourceMappingURL=decompiled.js.map
```
๐ Tutorial: Cross-Version Analysis
### Compare Claude Code versions
```bash
# Build RVF corpus for all versions
./scripts/claude-code-rvf-corpus.sh
# Each version gets its own RVF container:
# versions/v0.2.x/claude-code-v0.2.rvf (300 vectors)
# versions/v1.0.x/claude-code-v1.0.rvf (482 vectors)
# versions/v2.0.x/claude-code-v2.0.rvf (785 vectors)
# versions/v2.1.x/claude-code-v2.1.rvf (2,068 vectors)
```
### Track what changed
```rust
// Decompile two versions
let v1 = decompile(&v1_source, &config)?;
let v2 = decompile(&v2_source, &config)?;
// Functions with same structure but different minified names
// = same original function, renamed by the bundler
// This confirms name inferences across versions
```
๐งฌ Tutorial: Self-Learning Feedback Loop
### Train from ground truth
If you know the original source for a minified bundle:
```rust
use ruvector_decompiler::inferrer::NameInferrer;
let mut inferrer = NameInferrer::new();
// Provide known correct mappings
let ground_truth = vec![
("a$", "createRouter"),
("b$", "handleRequest"),
("c$", "sendResponse"),
];
// Train the inferrer
inferrer.learn_from_ground_truth(&ground_truth);
// Future inferences will be more accurate
// The patterns are stored and reused
```
### Feed back real-world results
```rust
// After manual review, tell the inferrer what was correct
let feedback = vec![
Feedback { predicted: "error_handler", actual: "McpErrorHandler", was_correct: false },
Feedback { predicted: "route_handler", actual: "routeHandler", was_correct: true },
];
inferrer.learn_from_feedback(&feedback);
```
๐ Tutorial: Witness Chain Verification
### Prove decompilation is faithful
```rust
let result = decompile(&source, &config)?;
// The witness chain proves every output byte comes from the input
assert!(result.witness_chain.is_valid);
println!("Source hash: {}", result.witness_chain.source_hash_hex);
println!("Chain root: {}", result.witness_chain.chain_root_hex);
// Each module has its own witness
for witness in &result.witness_chain.module_witnesses {
println!(" {} byte_range={}..{} hash={}",
witness.module_name,
witness.byte_range.0, witness.byte_range.1,
witness.content_hash_hex);
}
// Anyone can verify: reconstruct the Merkle tree and compare roots
let verified = result.witness_chain.verify(&source);
assert!(verified);
```
๐ค Advanced: GPU-Trained Neural Inference
### Train a deobfuscation model
```bash
# Generate training data (10K+ minifiedโoriginal pairs)
node scripts/training/generate-deobfuscation-data.mjs
# Launch GPU training on GCloud L4 (~$1.40, ~2 hours)
./scripts/training/launch-gpu-training.sh --cloud
# Export model to GGUF for RuvLLM
python scripts/training/export-to-rvf.py
```
### Use the trained model
```rust
let config = DecompileConfig {
model_path: Some("models/deobfuscator.gguf".into()),
..Default::default()
};
let result = decompile(&source, &config)?;
// Neural inference runs first, falls back to patterns
// Expect 60-80% name accuracy vs 5% without model
```
### How the model works
```
Input: minified name "s$" + context ["tools/call", "initialize", ".client"]
โ
โผ
โโโโโโโโโโโโโโโโ
โ 6M param โ
โ Transformer โ Character-level encoder
โ (GGUF Q4) โ Trained on 100K+ pairs
โโโโโโโโฌโโโโโโโโ
โ
โผ
Output: "mcpToolDispatcher" (confidence: 0.87)
```
๐ฆ Advanced: RVF Container Integration
### Store decompiled code in RVF
RVF (RuVector Format) containers store code as searchable vectors with cryptographic provenance:
```bash
# Build RVF containers for all Claude Code versions
./scripts/claude-code-rvf-corpus.sh
# Each .rvf file contains:
# - HNSW-indexed vectors (semantic search)
# - Witness chains (provenance)
# - Manifest (metadata)
# - Module segments (source code)
```
### Query the RVF corpus
```javascript
import { RvfDatabase } from '@ruvector/rvf';
const db = await RvfDatabase.openReadonly('claude-code-v2.1.rvf');
const results = await db.search('permission system', { limit: 5 });
for (const hit of results) {
console.log(`${hit.module} (score: ${hit.score.toFixed(3)})`);
}
```
โ๏ธ Advanced: Configuration Options
### DecompileConfig
```rust
let config = DecompileConfig {
// Module detection
target_modules: None, // Auto-detect (recommended)
min_module_size: Some(3), // Minimum declarations per module
// Name inference
min_confidence: 0.3, // Minimum confidence to include
model_path: None, // Path to neural model (optional)
// Output
generate_source_map: true, // V3 source maps
beautify: true, // Indent and format output
};
```
### Environment variables
| Variable | Default | Description |
|----------|---------|-------------|
| `DECOMPILER_THREADS` | CPU count | Rayon thread pool size |
| `DECOMPILER_MODEL` | none | Path to GGUF model |
| `DECOMPILER_MIN_CONFIDENCE` | 0.3 | Minimum confidence threshold |
---
## ๐๏ธ Architecture
```
crates/ruvector-decompiler/
โโโ src/
โ โโโ lib.rs # ๐ฏ Public API: decompile()
โ โโโ parser.rs # ๐ Single-pass JS scanner (memchr + lookup table)
โ โโโ graph.rs # ๐ธ๏ธ Reference graph construction
โ โโโ partitioner.rs # โ๏ธ MinCut + Louvain community detection
โ โโโ inferrer.rs # ๐ฎ Name inference (neural + patterns + learning)
โ โโโ training.rs # ๐งฌ Training corpus (210 patterns, JSON-loadable)
โ โโโ sourcemap.rs # ๐บ๏ธ V3 source map generation (VLQ encoding)
โ โโโ beautifier.rs # โจ Code formatting and indentation
โ โโโ witness.rs # ๐ SHA3-256 Merkle witness chains
โ โโโ types.rs # ๐ Core types and config
โ โโโ error.rs # โ Error handling
โโโ data/
โ โโโ claude-code-patterns.json # ๐ 210 domain-specific patterns
โโโ tests/
โ โโโ integration.rs # โ
8 integration tests
โ โโโ ground_truth.rs # ๐ฏ 5 fixture accuracy tests
โ โโโ real_world.rs # ๐ 3 OSS comparison tests
โโโ benches/
โ โโโ bench_parser.rs # โก Parser benchmarks (1KB-1MB)
โ โโโ bench_pipeline.rs # โก Full pipeline benchmarks
โโโ examples/
โโโ run_on_cli.rs # ๐ฅ๏ธ CLI runner for real bundles
```
---
## ๐ Related
- [ADR-133: Claude Code Source Analysis](../../docs/adr/ADR-133-claude-code-source-analysis.md)
- [ADR-134: RuVector Deep Integration](../../docs/adr/ADR-134-ruvector-claude-code-deep-integration.md)
- [ADR-135: MinCut Decompiler Architecture](../../docs/adr/ADR-135-mincut-decompiler-with-witness-chains.md)
- [ADR-136: GPU-Trained Deobfuscation Model](../../docs/adr/ADR-136-gpu-trained-deobfuscation-model.md)
- [Research: SOTA Decompiler Approaches](../../docs/research/claude-code-rvsource/20-sota-decompiler-research.md)
- [Research: Model Weight Analysis](../../docs/research/claude-code-rvsource/21-model-weight-analysis.md)
- [Dashboard: Decompiler Explorer](../../examples/decompiler-dashboard/)
---
ruDevolution โ because code deserves to be understood.