analysis_claude_code  by shareAI-lab

Claude Code Agent 逆向工程研究

created 1 month ago
8,930 stars

Top 5.7% on SourcePulse

GitHubView on GitHub
Project Summary

This repository provides a comprehensive reverse-engineering study of Claude Code v1.0.33, aimed at researchers and developers seeking to understand modern AI agent system design. It details the core architecture, mechanisms, and implementation logic of a sophisticated AI programming assistant, offering a valuable technical reference for building and analyzing similar systems.

How It Works

The project meticulously analyzes over 50,000 lines of obfuscated code, revealing a layered architecture. Key innovations include a "h2A" asynchronous message queue for zero-latency, high-throughput communication, a multi-agent system with distinct roles (main, sub, task agents) for modularity and isolation, intelligent context management with aggressive compression (92% threshold) and tiered storage, and a robust 6-layer security framework encompassing UI to tool execution.

Quick Start & Requirements

  • Analysis Workspace: The primary analysis workspace is located in claude_code_v_1.0.33/stage1_analysis_workspace/.
  • Prerequisites: Requires Node.js for analysis scripts (e.g., beautify.js, split.js). Analysis results are presented in Markdown and JSON formats.
  • Setup: Primarily involves navigating and reading the provided documentation and code analysis files.

Highlighted Details

  • Real-time Steering: Achieved via a "h2A" dual-buffer asynchronous message queue with >10,000 msgs/sec throughput and Promise-based async iterators.
  • Multi-Agent Architecture: Features a main "nO" loop engine, isolated "I2A" sub-agents, and concurrent "Task Agents" with permission isolation.
  • Context Management: Employs a "wU2" compressor with a 92% auto-trigger threshold for context compression, retaining key information.
  • Security: Implements a 6-layer permission validation chain from UI to tool execution, with sandbox isolation for tool environments.

Maintenance & Community

The project is maintained by ShareAI-Lab. Further details and related projects, including an open-source reconstruction, can be found at https://github.com/shareAI-lab/AgentKode. Updates and analysis articles are also published on the ShareAI Lab official WeChat public account.

Licensing & Compatibility

The project is licensed under the Apache License Version 2.0. This license is generally permissive and compatible with commercial use and closed-source linking.

Limitations & Caveats

The analysis is explicitly stated as "not 100% accurate" due to the difficulty of reverse-engineering obfuscated code, with potential for "hallucinations." The findings are intended for reference and learning purposes only.

Health Check
Last commit

4 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
6,412 stars in the last 30 days

Explore Similar Projects

Starred by Jeffrey Morgan Jeffrey Morgan(Cofounder of Ollama), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
18 more.

codex by openai

3.9%
35k
Coding agent CLI tool for terminal-based chat-driven development
created 4 months ago
updated 1 day ago
Feedback? Help us improve.