惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
L
LINUX DO - 最新话题
Recorded Future
Recorded Future
月光博客
月光博客
博客园 - 【当耐特】
博客园 - 叶小钗
宝玉的分享
宝玉的分享
量子位
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
Vercel News
Vercel News
L
LangChain Blog
B
Blog
Y
Y Combinator Blog
爱范儿
爱范儿
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
博客园 - Franky
P
Palo Alto Networks Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
云风的 BLOG
云风的 BLOG
C
Cisco Blogs
Scott Helme
Scott Helme
I
Intezer
T
The Exploit Database - CXSecurity.com
MyScale Blog
MyScale Blog
T
Tor Project blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Troy Hunt's Blog
N
News and Events Feed by Topic
大猫的无限游戏
大猫的无限游戏
F
Fortinet All Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Security Affairs
Cyberwarzone
Cyberwarzone
PCI Perspectives
PCI Perspectives
小众软件
小众软件
D
DataBreaches.Net
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Know Your Adversary
Know Your Adversary
Forbes - Security
Forbes - Security
S
Securelist
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
The Last Watchdog
The Last Watchdog

Hacker News - Newest: "AI"

AI can't read an investor deck AI as an attorney? Student uses ChatGPT, Gemini to sue UW over alleged racial discrimination Hacking MCP Servers in AI Systems – The Rug Pull: Tool Changes After Approval GitHub - MeepCastana/KubeezCut: Free Web based video editor GitHub - GenAI-Gurus/awesome-eu-ai-act: Curated tools, official sources, OSS, templates, and guides for EU AI Act compliance. Amazon AI Cancelling Webcomics Can AI judge journalism? A Thiel-backed startup says yes, even if it risks chilling whistleblowers Coming soon: 10 Things That Matter in AI Right Now DARPA built an AI to fact-check enemy weapons claims What explains heterogeneity in AI adoption? When AI Meets Muscle: Context-Aware Electrical Stimulation Promises a New Way to Guide Human Movements - Department of Computer Science AI Changed How We Build. It Did Not Change What Matters. Linux rules on using AI-generated code - Copilot is OK, but humans must take 'full responsibility for the… Meta spins up AI version of Mark Zuckerberg to engage with employees Code Mode: Let Your AI Write Programs, Not Just Call Tools | TanStack Blog GitHub - Delavalom/graft: Go framework for building AI agents. Type-safe tools, multi-provider (OpenAI, Anthropic, Gemini, Bedrock), zero vendor SDKs. India's TCS tops estimates, says new AI models did not dent services demand Gen Z's fading AI hype Strong feeling: we are in a folded AI reality GitHub - machinarii/total-recall-catalog: A reference catalog of latest knowledge retrieval, memory & RAG systems GitHub - mensfeld/code-on-incus: Give each AI agent its own isolated machine with root, Docker, and systemd. Active defense detects and stops threats automatically.. Quantization, LoRA, and the 8% Problem: Benchmarking Local LLMs for Production AI Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda Powell, Bessent discussed Anthropic's Mythos AI cyber threat with major U.S. banks GitHub - immartian/bellamem: Persistent belief-graph memory for AI agents. Retrieves decisive context by importance — not recency, not RAG, not /compact. recursive-mode: The Repo-Native Operating System for AI Engineering After the attack on Sam Altman's home, will AI CEO's go on the offensive? The biggest advance in AI since the LLM Opus 4.6 vs GPT 5.4 One Prompt Unity World Generation Test “AI polls” are fake polls Client Challenge Can AI be a 'child of God'? Inside Anthropic's meeting with Christian leaders How to Switch AI Chatbots and Why You Might Want To GitHub - MattMessinger1/agentic_refund_guardrail: Safe refund policy layer for AI agents — Python + TypeScript. Same behavior, shared tests. Adam/papers/emergent_values_whitepaper.md at master · strangeadvancedmarketing/Adam Ask HN: How do you stop playing 20 questions with your AI coding tools How far can automation and AI support psychotherapy? - @theU GitHub - stagas/rtdiff: realtime git diff gui and AI-assisted commits A Mac Studio for Local AI — 6 Months Later A History of the Early Years of AI at the University of Edinburgh Why AI Coding Tools Still Feel Stuck on Localhost MSN AI Datacenters Are Becoming Strategic Targets twitter.com Penn Researchers Use AI to Surface Unreported GLP-1 Side Effects in Reddit Posts Show HN: MoodSense AI (ML and FastAPI and Gradio, Deployed on Hugging Face) Moodsense Ai - a Hugging Face Space by aman179102 AI models are terrible at betting on soccer—especially xAI Grok GitHub - xialeistudio/echoic GitHub - HimashaHerath/github-dev-wrapped: AI-powered weekly GitHub activity reports deployed to GitHub Pages AI and Tech brief: Ireland ascendant GitHub - Titovilal/context0: Context0 - Never Surrender Training for a Marathon with an AI Coach: What Worked and What Didn't Cyber Pulse: Agentic Intel - Apps on Google Play I Built an AI PR Reviewer That Catches Bugs by Not Looking for Bugs Gen Z workers are so fearful AI will take their job they’re intentionally sabotaging their company’s AI rollout | Fortune How AI Is Reimagining the Game of Golf–For Both Players and Courses GitHub - nattergabriel/reseed: A CLI tool for managing and distributing agent skills across projects Is SVG the final frontier? My AI workflow evolved from prompts to a near-autonomous workflow MLSharp Help - 3DGS Viewer & Generator I put my cognitive field based AI's runtime on GitHub Is Numble the first AI-proof game? A3: Kubernetes for autonomous AI agent fleets | Emergent Principles Deepali Vyas ("The Elite Recruiter") GitHub - msmarkgu/RelayFreeLLM: A restful API designed to route user prompts to various AI model providers. Unionized ProPublica staff are on strike over AI, layoffs, and wages Unleashing the Advantage of Quantum AI We're heading for an AI-fueled 'dementia crisis,' brain scientist warns The AI-Assisted Breach of Mexico's Government Infrastructure [pdf] GitHub - stef41/lmscan: 🔍 Detect AI-generated text and fingerprint which LLM wrote it. Open-source GPTZero alternative. Zero dependencies, works offline. MSN GitHub - visionscaper/collabmem: Enabling long-term collaboration with Agentic AI - building up episodic and world model memory over time with in-context awareness We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs AI Code is Hollowing Out Open Source, and Maintainers are Looking the Other Way What leaked "SteamGPT" files could mean for the PC gaming platform's use of AI AI is the boss at this retail store. What could go wrong? GitHub - Wuzu11517/agentic-proxy: Local proxy meant to help reduce With Drones, Geophysics and ArtificiaI Intelligence, Researchers Prepare to Do Battle Against Land Mines A Single Operator, Two AI Platforms, Nine Government Agencies: The Full Technical Report 在 Steam 上购买 FriedrichAI: Offline AI 立省 10% GitHub - inevolin/resume-cli: Hit Claude usage limits? Resume any AI coding session elsewhere. Switch tools at zero friction. GitHub - atripati/ark: AI Runtime Kernel — a context operating system for AI agents. Eliminates tool bloat, loads only what’s needed, and gives LLMs their reasoning space back. How to Build a Secure AI PR Reviewer with Claude, GitHub Actions, and JavaScript This Startup Wants You to Pay Up to Talk With AI Versions of Human Experts Intel Arc Pro B70 Brings 32GB VRAM to Local AI for $949 WordPress 7.0: The Good, the AI, and the Still Missing AI on the couch: Anthropic gives Claude 20 hours of psychiatry IatroBench: Pre-Registered Evidence of Iatrogenic Harm from AI Safety Measures AI Agents Know About Supabase. They Don't Always Use It Right. The history and future of AI at Google, with Sundar Pichai Inside an AI‑enabled device code phishing campaign How Meta Used AI to Map Tribal Knowledge in Large-Scale Data Pipelines AI for Systems: Using LLMs to Optimize Database Query Execution Forecasting the Economic Effects of AI Introducing Tinker: Play with AI, bring your ideas to life AI sheds light on an ancient gaming mystery People really hate AI but not as much as Iran—or Democrats | Fortune What is an AI Product Engineer? Phoebe Gates wants her $185 million AI startup to succeed with 'no ties to my privilege or my last name': 'I have a chip on my shoulder' | Fortune
GitHub - alejandrobalderas/claude-code-from-source: Architecture, patterns & internals of Anthropic's AI coding agent — reverse-engineered from source maps
2026-04-11 · via Hacker News - Newest: "AI"

Architecture, Patterns & Internals of Anthropic's AI Coding Agent


This repository is purely educational. It contains no source code from Claude Code — not a single line. Every code block is original pseudocode written to illustrate architectural patterns. The goal is to help engineers understand how production AI agents are built, not to reproduce or redistribute proprietary software.


When Anthropic shipped Claude Code on npm, the .js.map source maps contained a sourcesContent field with the full original TypeScript. This book is the result of studying that architecture and distilling the patterns, trade-offs, and design decisions into a technical narrative that any engineer can learn from.

18 chapters across 7 parts. ~400 pages in print equivalent.

Every chapter has layered depth: a narrative flow for technical leaders, deep-dive sections for implementers, and an "Apply This" closing that extracts transferable patterns you can steal for your own systems. Diagrams use Mermaid and render natively on GitHub.


Who This Is For

  • Senior engineers building agentic systems — steal the patterns, understand the trade-offs, implement in your own stack
  • Technical leaders evaluating architectures — follow the narrative without reading every code block
  • Anyone curious about how production AI tools actually work under the hood

Table of Contents

Part I: Foundations

Before the agent can think, the process must exist.

# Chapter What You'll Learn
1 The Architecture of an AI Agent The 6 key abstractions, data flow, permission system, build system
2 Starting Fast — The Bootstrap Pipeline 5-phase init, module-level I/O parallelism, trust boundary
3 State — The Two-Tier Architecture Bootstrap singleton, AppState store, sticky latches, cost tracking
4 Talking to Claude — The API Layer Multi-provider client, prompt cache, streaming, error recovery

Part II: The Core Loop

The heartbeat of the agent: stream, act, observe, repeat.

# Chapter What You'll Learn
5 The Agent Loop query.ts deep dive, 4-layer compression, error recovery, token budgets
6 Tools — From Definition to Execution Tool interface, 14-step pipeline, permission system
7 Concurrent Tool Execution Partition algorithm, streaming executor, speculative execution

Part III: Multi-Agent Orchestration

One agent is powerful. Many agents working together are transformative.

# Chapter What You'll Learn
8 Spawning Sub-Agents AgentTool, 15-step runAgent lifecycle, built-in agent types
9 Fork Agents and the Prompt Cache Byte-identical prefix trick, cache sharing, cost optimization
10 Tasks, Coordination, and Swarms Task state machine, coordinator mode, swarm messaging

Part IV: Persistence and Intelligence

An agent without memory makes the same mistakes forever.

# Chapter What You'll Learn
11 Memory — Learning Across Conversations File-based memory, 4-type taxonomy, LLM recall, staleness
12 Extensibility — Skills and Hooks Two-phase skill loading, lifecycle hooks, snapshot security

Part V: The Interface

Everything the user sees passes through this layer.

# Chapter What You'll Learn
13 The Terminal UI Custom Ink fork, rendering pipeline, double-buffer, pools
14 Input and Interaction Key parsing, keybindings, chord support, vim mode

Part VI: Connectivity

The agent reaches beyond localhost.

# Chapter What You'll Learn
15 MCP — The Universal Tool Protocol 8 transports, OAuth for MCP, tool wrapping
16 Remote Control and Cloud Execution Bridge v1/v2, CCR, upstream proxy

Part VII: Performance Engineering

Making it all fast enough that humans don't notice the machinery.

# Chapter What You'll Learn
17 Performance — Every Millisecond and Token Counts Startup, context window, prompt cache, rendering, search
18 Epilogue — What We Learned The 5 architectural bets, what transfers, where agents are heading

The 10 Patterns That Make It Work

If you read nothing else:

  1. AsyncGenerator as agent loop — yields Messages, typed Terminal return, natural backpressure and cancellation
  2. Speculative tool execution — start read-only tools during model streaming, before the response completes
  3. Concurrent-safe batching — partition tools by safety, run reads in parallel, serialize writes
  4. Fork agents for cache sharing — parallel children share byte-identical prompt prefixes, saving ~95% input tokens
  5. 4-layer context compression — snip, microcompact, collapse, autocompact — each lighter than the next
  6. File-based memory with LLM recall — Sonnet side-query selects relevant memories, not keyword matching
  7. Two-phase skill loading — frontmatter only at startup, full content on invocation
  8. Sticky latches for cache stability — once a beta header is sent, never unset mid-session
  9. Slot reservation — 8K default output cap, escalate to 64K on hit (saves context in 99% of requests)
  10. Hook config snapshot — freeze at startup to prevent runtime injection attacks

How This Book Was Made

The source was extracted from npm source maps. 36 AI agents analyzed nearly two thousand TypeScript files in four phases:

  1. Exploration: 6 parallel agents read every file in the source tree
  2. Analysis: 12 agents wrote 494KB of raw technical documentation
  3. Writing: 15 agents rewrote everything from scratch as narrative chapters
  4. Review & Revision: 3 editorial reviewers produced 900 lines of feedback; 3 revision agents applied all fixes

The entire process — from source extraction to final revised book — took approximately 6 hours.


Disclaimer

This repository does not contain any source code from Claude Code. All code blocks are original pseudocode using different variable names, written to illustrate architectural patterns. No proprietary prompt text, internal constants, or exact function implementations are included. This project exists purely for educational purposes — to help engineers understand the design patterns behind production AI coding agents.

The "NO'REILLY" cover is a parody/meme for illustrative purposes only. This project has no affiliation with O'Reilly Media. The crab is just a crab.

This is an independent analysis. Claude Code is a product of Anthropic. This book is not affiliated with, endorsed by, or sponsored by Anthropic.