How shareai-lab/analysis_claude_code works
Project type and purpose
• This is a reverse-engineering research repository for “Claude Code v1.0.33.”
• It collects analysis scripts, de-obfuscated source chunks, merged results, extensive technical docs, and open-rebuild templates.
• Its goal is to reveal the internal architecture of a modern AI Agent system (the “Claude Code Agent”) and provide guidance for reimplementation.
High-level file structure and roles
• claude_code_v_1.0.33/ – Main analysis workspace
• source/ – Original obfuscated CLI code
• scripts/ – Pre-processing & LLM-assisted analysis tools (beautify, split, merge, LLM calls)
• chunks/ – 102 de-obfuscated code blocks + index
• analysis_results/merged-chunks/ – Optimized merged code
• docs/ – Dozens of deep-dive technical write-ups on each mechanism
• work_doc_for_this/ – Your SOPs and prompt templates for driving the analysis
• README.md & LICENSE – Overview, architecture summary, project metadata
• Open-rebuild folders (Demo_Repo, Open-Claude-Code) – TypeScript templates, tests, and implementation guides
Key insights from the README
• The README contains an ASCII art “Claude Code Agent 系统架构” showing a classic 4-layer design:
1. User Interaction Layer (CLI, VSCode, Web)
2. Agent Core Scheduling Layer (nO loop, h2A queue, stream gen, compressor)
3. Tool Execution & Management Layer (ToolEngine, Scheduler, SubAgents, Permission Gateway, plus an ecosystem of file/network/task tools)
4. Storage & Persistence Layer (short-term, compressed history, long-term, state cache)