# I Reverse-Engineered Claude Code: Learn These Agent Tricks <!-- ref: @content/youtube/yifan-bth/i-reverse-engineered-claude-code-learn-these-agent-tricks tags: [Claude Code, system prompts, tool definitions, sub-agents, prompt engineering, agent loops, model-specific tuning] version: 2 updated_at: 2026-11-24T07:21:14.328Z --> **[Watch on YouTube](https://www.youtube.com/watch?v=i0P56Pm1Q3U)** # I Reverse-Engineered Claude Code: Learn These Agent Tricks *Synthesized from Yifan on Beyond the Hype, 2025-08-07.* Yifan presents a solo walkthrough of how he inspected the shipped Claude Code CLI bundle and captured its live API traffic to see how the agent is built. The transcript is a rough automatic transcription. ## Core Thesis Yifan argues that Claude Code's advantage comes mostly from prompt design rather than from hidden code: its system prompt, tool descriptions and reminder messages carry most of the behavior, and they are tuned closely to one model family. He concludes that anyone building a coding agent should treat prompts as the main product surface and keep evaluations in place when switching models. ## Key Insights - **Method.** The CLI ships as a single bundled JavaScript file of about 9 MB. After unbundling and deobfuscating it with WebCrack, Yifan got a file of roughly 443,000 lines, but the prompt text is assembled dynamically, so searching for it did not work. Setting the Anthropic base URL environment variable and routing traffic through a proxy (Proxyman, as the transcript names it) captured every request. - **Request anatomy.** Each request carries the full message history, a system prompt at the top, the tool definitions, and the responses with any tool calls. The client runs the tools, appends the results and calls the API again until the model returns a final message. - **Repetition for reliability.** The to-do tool appears in several sections of the system prompt, with examples. Lint and type-check instructions appear only once, and Yifan says Claude Code runs them only about half the time, so he adds them to his CLAUDE.md file. - **Reminders.** The client inserts a system reminder about the to-do list after the task progresses and after each to-do write, which he links to why the planning behavior holds up. - **Workflows live in prose.** Most flow control is written in natural language in the prompt rather than in code, so changing behavior mostly means editing prompt text. Emphasis words, capitalized rules and XML-style tags are used to mark what the model must respect. - **Sub-agents.** A sub-agent gets its own message history and its own system prompt. When it finishes, only its final summary returns to the main agent as a tool result, so that summary must carry everything the main agent needs. The delegation behavior comes from the Task tool's long description, not from the main system prompt. - **Model specificity.** Yifan says prompts tuned for Claude often underperform on other model families, so switching models requires evals and prompt tuning. ## Actionable Takeaways 1. Put must-follow steps, such as lint and type checks, in the project instructions file and repeat them where they matter. 2. Design sub-agent return messages to hold all the information the parent needs, since the rest of the sub-agent history is discarded. 3. Write tool descriptions in detail, with when-to-use and when-not-to-use guidance and examples, because that text drives delegation. 4. Use reminders that re-insert key tool instructions into the message history as the task progresses. 5. Build evals before switching models, since prompt behavior does not transfer cleanly between model families. ## Notable Quotes > "It's not you, it's just that agents forget." — Yifan > "Prompt engineering is still very much a thing in 2025" — Yifan --- *Related: `@content/youtube/zazencodes/build-your-own-ai-software-factory-with-claude-code` · `@content/youtube/sean-kochel/opus-4-7-is-insanely-powerful-and-insanely-expensive` · `@content/youtube/yifan-bth/the-complete-claude-code-workflow-90-skip-this` · `@content/youtube/tiago-forte/stop-overthinking-ai-use-this-4-step-framework` · `@content/youtube/starter-story/my-ai-app-made-1000-last-week`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*