{"id":50659305,"url":"https://github.com/aimasteracc/inside-claude-code","last_synced_at":"2026-06-08T01:08:00.452Z","repository":{"id":362351681,"uuid":"1258661214","full_name":"aimasteracc/inside-claude-code","owner":"aimasteracc","description":"Reverse-engineering Claude Code's prompt architecture — free chapters + agent-engineering field guide","archived":false,"fork":false,"pushed_at":"2026-06-03T21:16:42.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T21:18:39.767Z","etag":null,"topics":["agent-engineering","agentic","ai-agents","claude-code","llm","prompt-engineering"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aimasteracc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T19:48:18.000Z","updated_at":"2026-06-03T21:16:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aimasteracc/inside-claude-code","commit_stats":null,"previous_names":["aimasteracc/inside-claude-code"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aimasteracc/inside-claude-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimasteracc%2Finside-claude-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimasteracc%2Finside-claude-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimasteracc%2Finside-claude-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimasteracc%2Finside-claude-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimasteracc","download_url":"https://codeload.github.com/aimasteracc/inside-claude-code/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimasteracc%2Finside-claude-code/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34043838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-engineering","agentic","ai-agents","claude-code","llm","prompt-engineering"],"created_at":"2026-06-08T01:08:00.306Z","updated_at":"2026-06-08T01:08:00.447Z","avatar_url":"https://github.com/aimasteracc.png","language":null,"funding_links":["https://github.com/sponsors/aimasteracc?frequency=one-time","https://github.com/sponsors/aimasteracc?frequency=one-time);"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Inside Claude Code\n### A Reverse-Engineering Field Guide to Agent Engineering\n\n**12 prompt-design patterns · 7 agent failure modes · the internal mechanics behind the world's leading agentic coding tool, inferred from how it behaves.**\n\n**🌍 English · 简体中文 · 日本語 — all three editions included.**\n\n[**💖 Sponsor $25 to unlock the full book + toolkit**](https://github.com/sponsors/aimasteracc?frequency=one-time)  ·  [Read 2 free chapters ↓](#-read-free)\n\n*Sponsor the **$25 Inside Claude Code** tier — you get the full book (EN + 中文 + 日本語 PDF) + toolkit, delivered within hours.*\n\n\u003c/div\u003e\n\n\u003e 📘 **The full book ships through GitHub Sponsors.** Read the two free chapters below, then [**sponsor the $25 *Inside Claude Code* tier**](https://github.com/sponsors/aimasteracc?frequency=one-time) to unlock all 10 chapters + the toolkit. ⭐ Star the repo too.\n\n---\n\n## Why this exists\n\nEveryone is building agents. Almost no one has taken apart one that actually works.\n\nClaude Code is the reference implementation of the autonomous coding agent — it runs for hours, edits dozens of files, tests its own work, and ships. Underneath it is a body of hard-won engineering: a prompt layer built as **many small, single-purpose units** rather than one block, a precise request-assembly pipeline, a context engine that survives long sessions, and a set of guardrails where **the majority of the instructions describe what the agent must *not* do.**\n\nThis book reverse-engineers that machine and hands you the patterns — organized, translated into plain English, and turned into things you can paste into your own agent today.\n\n\u003e If you've ever watched an autonomous agent confidently declare a half-finished task \"complete,\" there is a known fix for that. It's in Chapter 6.\n\n## Who it's for\n\n- Engineers **building agents** on the Claude or OpenAI APIs who want production-grade patterns, not blog-post platitudes.\n- **Power users** of Claude Code / Cursor who want to understand — and bend — the tool they live in.\n- Anyone shipping LLM features who is tired of agents that stub out work, inflate their own grades, or panic near the context limit.\n\n## What's inside\n\n**60+ pages · ~14,000 words · 10 chapters · a copy-paste toolkit.**\n\n| # | Chapter | You walk away with |\n|---|---------|--------------------|\n| 1 | The Five-Layer Prompt Architecture | Why a great agent's prompt is a *filesystem*, not a string |\n| 2 | The Prompt Loading Flow | How one message becomes an API request — and where the cache boundary stops you re-billing the whole static prompt every turn |\n| 3 | Twelve Patterns I — Behavior \u0026 Architecture | Constraint-first, single-responsibility, event-driven, cognitive boundaries, delegation, progressive safety |\n| 4 | Twelve Patterns II — Runtime \u0026 Knowledge | Compaction, output efficiency, mode switching, the memory trinity, skillification, observability |\n| 5 | Print Mode \u0026 Autonomous Loops | Signal handling, the auto-compaction threshold, designing a headless loop that won't wedge |\n| 6 | The Seven Agent Failure Modes | Each failure, its root cause, and the *verified* fix |\n| 7 | Sub-agents \u0026 Layered Delegation | The isolation contract — and the messaging asymmetry that silently kills most multi-agent setups |\n| 8 | The Autonomous Development Pipeline | A full prompt-to-verified-build loop with an expert-review panel |\n| 9 | Designing Your Own Harness | The whole book reduced to five buildable subsystems |\n| 10 | The Checklist \u0026 Templates | A pre-flight checklist + paste-ready templates |\n\n### The toolkit (ships with the book)\n- 🗂️ **`CLAUDE.md.template`** — a constraint-first operating-rules file for any repo\n- 🤖 **`subagent-prompt.template.md`** — brief sub-agents so they don't silently fail\n- 🔄 **`context-handoff.template.md`** — survive a context reset without losing the thread\n- 📄 **Patterns cheat sheet** (1 page) + **Failure-modes checklist** (1 page) — print and pin\n\n## A taste — the 7 ways autonomous agents fail\n\nEvery chapter is this concrete. Chapter 6 names all seven failure modes and gives each a *verified* fix. The modes:\n\n1. **One-shot impulse** — does everything at once, exhausts context, leaves fragments\n2. **Premature \"done\"** — declares victory with most of the work unfinished\n3. **Context anxiety** — rushes to wrap up near the context limit, with capacity to spare\n4. **Self-evaluation inflation** — grades its own broken work 9/10\n5. **Skipping E2E** — unit tests pass; the actual button does nothing\n6. **Stub-ification** — the UI looks complete; the interactions are hollow\n7. **Spec cascade** — a planner's one wrong detail poisons everything downstream\n\nYou've probably met at least three. The fixes are in the book.\n\n## \u003ca name=\"-read-free\"\u003e\u003c/a\u003e📖 Read free\n\nNo email required. Read the first two chapters right here:\n\n- [**Introduction — Why Take a Coding Agent Apart?**](book/00-introduction.md)\n- [**Chapter 1 — The Five-Layer Prompt Architecture**](book/01-five-layer-architecture.md)\n- [**Chapter 2 — The Prompt Loading Flow**](book/02-prompt-loading-flow.md)\n\n**🇨🇳 简体中文免费试读：** [引言](book-zh/00-introduction.md) · [第 1 章 · 五层提示词架构](book-zh/01-five-layer-architecture.md) · [第 2 章 · Prompt 加载流程](book-zh/02-prompt-loading-flow.md)\n\n**🇯🇵 日本語 無料サンプル：** [はじめに](book-ja/00-introduction.md) · [第1章 · 5層アーキテクチャ](book-ja/01-five-layer-architecture.md) · [第2章 · プロンプト読み込みフロー](book-ja/02-prompt-loading-flow.md)\n\nIf the mechanism-level depth is what you've been looking for, the other eight chapters and the toolkit are one click away.\n\n\u003cdiv align=\"center\"\u003e\n\n### [💖 Sponsor $25 to unlock the full book + toolkit](https://github.com/sponsors/aimasteracc?frequency=one-time)\n*Sponsor the **$25 Inside Claude Code** tier → you get a private-repo invite with the full PDF (3 languages) + toolkit, usually within hours.*\n\n\u003c/div\u003e\n\n## Why trust it\n\nThese patterns were distilled from **careful observation of how Claude Code behaves**, inference about the request pipeline that behavior implies, and Anthropic's own **published** guidance on long-running agent harnesses. It is independent analysis and commentary on observed behavior — it describes patterns in original words and does **not** reproduce any proprietary source code or prompt text.\n\n## FAQ\n\n**Is this just the Claude Code docs?** No. The docs tell you how to *use* the tool. This book reverse-engineers how it's *built*, and turns that into patterns for your own agents.\n\n**I don't use Claude Code — is it still useful?** Yes. The patterns are model- and tool-agnostic. Chapters 3, 4, 6, 7, and 9 apply to any agent on any API.\n\n**What format?** A PDF plus the raw Markdown, and the toolkit files. Yours forever, free updates.\n\n**How do I get it after sponsoring?** Sponsor the **$25** *Inside Claude Code* tier on [GitHub Sponsors](https://github.com/sponsors/aimasteracc?frequency=one-time); you'll get an invite to the private repo with the full PDF + toolkit (usually within a few hours). Any tier at or above the book tier works.\n\n**Not happy?** Message me and I'll make it right.\n\n## License\n\nThe two free preview chapters and the README are shared for evaluation. The full book and toolkit are commercial — please don't redistribute. © 2026. All rights reserved.\n\n\u003cdiv align=\"center\"\u003e\n\n*Study the machine that works, and you stop guessing at the one you're building.*\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimasteracc%2Finside-claude-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimasteracc%2Finside-claude-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimasteracc%2Finside-claude-code/lists"}