🔥 A collection of the newest Claude Code open source
TypeScript1.5k1.7k3 issues
创建于 2026-03-31最近推送 2026-04-05
项目说明
A collection of the newest Claude Code open source
License and Disclaimer This repository is for academic research and educational purposes only. All subprojects are built from publicly accessible information. Users are responsible for complying with applicable laws, regulations, and service terms.
Source archive of Claude Code and different versions of the clean-room Python rewrite research repository
The raw leaked TypeScript source of Claude Code, preserved as-is from the original exposure on March 31, 2026. Contains 1,884 TypeScript/TSX files (packaged as src.zip) spanning the full src/ directory tree — the same files that triggered community discussion and downstream research.
original-source-code/
├── src/ # Full TypeScript source tree (1,884 .ts/.tsx files)
│ ├── main.tsx # CLI entry point
│ ├── query.ts # Core agent loop
│ ├── commands.ts # Slash command definitions
│ ├── tools.ts # Tool registration
│ └── ... # All other source directories (same layout as claude-code-source-code/src)
├── src.zip # Compressed archive (~9.5 MB)
└── readme.md
This directory serves as the unmodified reference snapshot. No annotations, docs, or build tooling have been added — use claude-code-source-code for the researched and annotated version.
2. claude-code-source-code
A decompiled/unpacked source archive of Claude Code v2.1.88, reconstructed from the npm package @anthropic-ai/[email protected], containing approximately 163,318 lines of TypeScript code.
A clean-room Python rewrite of Claude Code (without including original source copies), focused on architectural mirroring and research. Built by @instructkr (Sigrid Jin), and became one of the fastest GitHub repositories in the world to reach 30K stars.
Query engine handling message submission, streaming output, and session compression
PortRuntime
Runtime manager responsible for routing, session startup, and turn-loop execution
PortManifest
Workspace manifest that generates Markdown overviews
ToolPermissionContext
Tool permission context (allow / deny / ask)
WorkspaceSetup
Environment detection and initialization reporting
TranscriptStore
Session transcript storage with append, compaction, and replay support
CLI Commands
python3 -m src.main [COMMAND]
# Overview
summary # Markdown workspace overview
manifest # Print manifest
subsystems # List Python modules# Routing and indexing
commands # List all commands
tools # List all tools
route [PROMPT] # Route prompt to corresponding command/tool# Execution
bootstrap [PROMPT] # Start runtime session
turn-loop [PROMPT] # Run turn loop (--max-turns)
exec-command NAME # Execute command
exec-tool NAME # Execute tool# Session management
flush-transcript # Persist session transcript
load-session ID # Load saved session# Remote mode
remote-mode TARGET # Simulate remote control
ssh-mode TARGET # Simulate SSH branch
teleport-mode TARGET # Simulate Teleport branch# Audit and config
parity-audit # Compare consistency with TypeScript source
setup-report # Startup configuration report
bootstrap-graph # Bootstrap phase graph
command-graph # Command graph partition view
tool-pool # Tool pool assembly view
Design Features
Snapshot-driven: command/tool metadata is loaded through JSON snapshots without requiring full logical implementations
Clean-room rewrite: does not include original TypeScript code; independently implemented
Parity audit: built-in parity_audit.py tracks gaps from the original implementation
Lightweight architecture: core framework implemented in 109 files, suitable for learning and extension
4. nano-claude-code
A minimal, fully-runnable Python reimplementation of Claude Code (~5,000 lines). Unlike claw-code (which focuses on architectural mapping), nano-claude-code is a real coding assistant that can be used immediately. It supports 20+ closed-source models and local open-source models, and has grown from a ~900-line prototype to a feature-rich v3.0 with multi-agent orchestration, persistent memory, and a skill system.
Memory — persistent across sessions, dual-scope (user ~/.nano_claude/memory/ and project .nano_claude/memory/):
/memory # list all memories with staleness info
MemorySave(name="...", type="feedback", content="...", scope="user")
MemorySearch(query="...", use_ai=True)
Skills — reusable prompt templates, invoke from REPL:
/commit # built-in: review staged changes and create a git commit
/review 123 # built-in: review PR #123
/skills # list all available skills with triggers and hints
Multi-agent — spawn typed sub-agents with optional git worktree isolation:
Agent(prompt="...", subagent_type="coder", isolation="worktree", wait=False)
SendMessage(agent_name="my-agent", message="...")
/agents # show all active and finished sub-agent tasks