I reverse-engineered Claude Code

Reddit r/LocalLLaMA / 3/24/2026

💬 OpinionDeveloper Stack & InfrastructureSignals & Early TrendsTools & Practical Usage

Key Points

  • The author reverse-engineered “Claude Code” and recreated an SDK across four languages (Node.js, Python, Go, and Rust) with an emphasis on being copy-paste single-file and dependency-free where possible.
  • The rebuilt SDK exposes Claude Code capabilities such as streaming, multi-turn agent loop behavior, and tool calling, along with a built-in tool set (e.g., bash, read/write, glob, grep) and an NDJSON stdin/stdout bridge for automation.
  • Authentication and billing rely on a non-public combination of requirements, including an OAuth token sourced from macOS keychain plus several special headers (including one related to billing embedded in system prompt behavior) and a browser access header.
  • The SDK also includes interactive REPL support and MCP server compatibility, aiming to make Claude Code functionality easier to embed in existing projects without depending on the original large Bun bundle.
  • The project is MIT-licensed and invites feedback and PRs, positioning it as an open implementation of the observed Claude Code integration flow rather than official documentation.

I reverse-engineered Claude Code and rebuilt the entire SDK in 4 languages. Single file. Zero dependencies and open-source. Uses your existing Pro/Max subscription.

Why: Claude Code is a 190MB Bun bundle. I wanted to use its capabilities (streaming, tool calling, multi-turn agent loop) inside my own projects without depending on a massive binary or npm. One file I can copy into any repo was the goal.

What I found: The subscription auth protocol requires four things at once — an OAuth token from macOS keychain, specific beta headers, a billing header hidden inside the system prompt, and a browser access header. None of this is publicly documented.

The SDKs:

  • Node.js (claude-native.mjs) — 0 deps
  • Python (claude-native.py) — 0 deps
  • Go (claude-native.go) — 0 deps
  • Rust (rust-sdk/) — serde + reqwest

Each one gives you:

  • OAuth or API key auth
  • Full agent loop with streaming + tool use
  • Built-in tools (bash, read, write, glob, grep)
  • NDJSON bridge for automation (spawn as subprocess, JSON on stdin/stdout)
  • Interactive REPL
  • MCP server support

Usage is dead simple: cp claude-native.py your-project/python3 claude-native.py -p "explain this code". That's it.

MIT licensed. Feedback and PRs welcome :)

submitted by /u/elpad92
[link] [comments]