jameswniu/claude-code-new-king-james

GitHub: jameswniu/claude-code-new-king-james

Claude Code CLI 生产运行时的 Python 逆向实现与配套散文体架构文档,用于理解该 AI 编程助手的完整内部工作机制。

Stars: 4 | Forks: 0

# Claude Code:新钦定版 Claude Code 的生产 runtime 架构 —— Python 实现与正式的散文篇章并列。 ## 这是什么 本仓库包含 Anthropic 的 Claude Code CLI(版本 2.1.87)的两种平行表示形式: - **`code-python/`** —— 生产 runtime 的 Python 实现:query loop、工具、服务、类型和实用程序。 - **`chapters-md/`** —— 用自然语言描述架构的正式散文章节。没有代码,只有描述系统结构及其功能的说明性文章。 ## 法律依据 本作品构成对公开发行的软件产品的评论、分析和描述。对软件行为方式的描述是受《第一修正案》保护的表达。本仓库不包含受版权保护的源代码、编译产物或可执行复制品。它等同于描述小说情节的书评,或解释引擎工作原理的技术文章。 最高法院一贯认为,思想、操作方法和功能描述不受版权保护。受保护的是代码的特定创造性表达,而不是其实现的底层概念、算法或架构模式。 ### 相关判例法 - [Baker v. Selden, 101 U.S. 99 (1879)](https://supreme.justia.com/cases/federal/us/101/99/) —— 思想和操作方法不受版权保护;只有特定的表达受保护。 - [Lotus Dev. Corp. v. Borland Int'l, Inc., 49 F.3d 807 (1st Cir. 1995), aff'd 516 U.S. 233 (1996)](https://law.justia.com/cases/federal/appellate-courts/F3/49/807/551122/) —— 菜单命令层级是 17 U.S.C. Section 102(b) 下不受版权保护的 操作方法。 - [Google LLC v. Oracle America, Inc., 593 U.S. 1 (2021)](https://supreme.justia.com/cases/federal/us/593/18-956/) —— 重新实现功能性 API 接口构成合理使用;软件的功能性方面无权获得与创造性作品同等的版权保护。 - [Sega Enterprises Ltd. v. Accolade, Inc., 977 F.2d 1510 (9th Cir. 1992)](https://law.justia.com/cases/federal/appellate-courts/F2/977/1510/305345/) —— 为实现互操作性而对软件进行逆向工程属于合理使用。 - [Sony Computer Entertainment v. Connectix Corp., 203 F.3d 596 (9th Cir. 2000)](https://law.justia.com/cases/federal/appellate-courts/F3/203/596/474793/) —— 在逆向工程期间为创建兼容产品而进行的中间复制属于合理使用。 ### 第一修正案 - [Eldred v. Ashcroft, 537 U.S. 186 (2003)](https://supreme.justia.com/cases/federal/us/537/186/) —— 版权法内建的第一修正案适应性包括思想/表达二分法和合理使用。 - [17 U.S.C. Section 102(b)](https://www.law.cornell.edu/uscode/text/17/102) —— “在任何情况下,对原创作品的版权保护均不延伸至任何思想、程序、过程、系统、操作方法、概念、原理或发现。” - [17 U.S.C. Section 107 (Fair Use)](https://www.law.cornell.edu/uscode/text/17/107) —— 合理使用因素:目的/性质、作品性质、使用量及市场影响。 ### DMCA 背景 - [Anthropic DMCA 下架通知(2026 年 4 月)](https://developers.slashdot.org/story/26/04/01/158240/anthropic-issues-copyright-takedown-requests-to-remove-8000-copies-of-claude-code-source-code) —— Anthropic 发布了针对约 8,000 个包含 Claude Code 源代码副本的仓库的下架请求。本仓库不包含任何源代码。 ## 如何阅读本文档 各章节已编号并按生产 runtime 的结构进行组织。请从第 00 章开始阅读以获得概述,然后按顺序阅读或跳转至任何感兴趣的章节。 ## 章节 - [00 - 简介](chapters-md/00-introduction.md) - [01 - Workspace Context](chapters-md/01-workspace-context.md) - [02 - Cost Tracking](chapters-md/02-cost-tracking.md) - [03 - Session History](chapters-md/03-session-history.md) - [04 - The Query Loop](chapters-md/04-the-query-loop.md) - [05 - Task Management](chapters-md/05-task-management.md) - [06 - Tool Architecture](chapters-md/06-tool-architecture.md) - [07 - Application State](chapters-md/07-application-state.md) - [08 - Bridge System](chapters-md/08-bridge-system.md) - [09 - Slash Commands](chapters-md/09-slash-commands.md) - [10 - Hook Events](chapters-md/10-hook-events.md) - [11 - Cron Scheduling](chapters-md/11-cron-scheduling.md) - [12 - Session Persistence](chapters-md/12-session-persistence.md) - [13 - Bundled Skills](chapters-md/13-bundled-skills.md) - [14 - Swarm Orchestration](chapters-md/14-swarm-orchestration.md) - [15 - MCP Protocol](chapters-md/15-mcp-protocol.md) - [16 - Sandbox Enforcement](chapters-md/16-sandbox-enforcement.md) - [17 - Tool Registry](chapters-md/17-tool-registry.md) - [18 - Bash Tool](chapters-md/18-bash-tool.md) - [19 - File Tools](chapters-md/19-file-tools.md) - [20 - Search Tools](chapters-md/20-search-tools.md) - [21 - Agent Tool](chapters-md/21-agent-tool.md) - [22 - Web Tools](chapters-md/22-web-tools.md) - [23 - Task Tools](chapters-md/23-task-tools.md) - [24 - Team Tools](chapters-md/24-team-tools.md) - [25 - Plan Mode](chapters-md/25-plan-mode.md) - [26 - Cron Tools](chapters-md/26-cron-tools.md) - [27 - Worktree Tools](chapters-md/27-worktree-tools.md) - [28 - Specialized Tools](chapters-md/28-specialized-tools.md) - [29 - Services Overview](chapters-md/29-services-overview.md) - [30 - Compaction and Dreams](chapters-md/30-compaction-and-dreams.md) - [31 - Memory System](chapters-md/31-memory-system.md) - [32 - Type System](chapters-md/32-type-system.md) - [33 - Utilities](chapters-md/33-utilities.md)
标签:AI助手, LLM, Python, Unmanaged PE, 云资产清单, 无后门, 架构分析, 逆向工具, 逆向工程, 防御加固