<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vibehackers</title>
    <description>The latest articles on DEV Community by Vibehackers (@vibehackers).</description>
    <link>https://dev.to/vibehackers</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3833754%2F8998be38-f7b5-47a9-8472-467324aec154.png</url>
      <title>DEV Community: Vibehackers</title>
      <link>https://dev.to/vibehackers</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vibehackers"/>
    <language>en</language>
    <item>
      <title>I Analyzed All 512,000 Lines of Claude Code's Leaked Source — Here's What Anthropic Was Hiding</title>
      <dc:creator>Vibehackers</dc:creator>
      <pubDate>Tue, 31 Mar 2026 21:20:16 +0000</pubDate>
      <link>https://dev.to/vibehackers/i-analyzed-all-512000-lines-of-claude-codes-leaked-source-heres-what-anthropic-was-hiding-4gg8</link>
      <guid>https://dev.to/vibehackers/i-analyzed-all-512000-lines-of-claude-codes-leaked-source-heres-what-anthropic-was-hiding-4gg8</guid>
      <description>&lt;p&gt;On March 31st, 2026, security researcher Chaofan Shou -- an intern at blockchain security firm &lt;a href="https://fuzz.land/" rel="noopener noreferrer"&gt;Fuzzland&lt;/a&gt; -- discovered something Anthropic probably didn't plan on sharing with the world: the &lt;strong&gt;entire source code&lt;/strong&gt; of Claude Code, shipped as a sourcemap file inside the npm package.&lt;/p&gt;

&lt;p&gt;A 59.8 MB &lt;code&gt;.map&lt;/code&gt; file in &lt;code&gt;@anthropic-ai/claude-code&lt;/code&gt; version 2.1.88 -- a standard build artifact that maps minified code back to original source -- contained every TypeScript file, every internal prompt, every feature flag, and every codename. The file pointed to a zip archive hosted on Anthropic's Cloudflare R2 storage bucket that anyone could download and decompress.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is the second time this has happened.&lt;/strong&gt; In February 2025, an early version of Claude Code &lt;a href="https://mlq.ai/news/anthropics-claude-code-exposes-source-code-through-packaging-error-for-second-time/" rel="noopener noreferrer"&gt;had the exact same issue&lt;/a&gt;, forcing Anthropic to pull the package from npm. Sixteen months later, same mistake, same vector -- but this time the product is far more mature and the stakes are far higher.&lt;/p&gt;

&lt;p&gt;Within hours, the 512,000-line TypeScript codebase was mirrored across GitHub, with one repository &lt;a href="https://github.com/Kuberwastaken/claude-code" rel="noopener noreferrer"&gt;amassing nearly 30,000 stars&lt;/a&gt; and 40,200 forks. &lt;a href="https://fortune.com/2026/03/31/anthropic-source-code-claude-code-data-leak-second-security-lapse-days-after-accidentally-revealing-mythos/" rel="noopener noreferrer"&gt;Fortune&lt;/a&gt;, &lt;a href="https://venturebeat.com/technology/claude-codes-source-code-appears-to-have-leaked-heres-what-we-know" rel="noopener noreferrer"&gt;VentureBeat&lt;/a&gt;, &lt;a href="https://www.theregister.com/2026/03/31/anthropic_claude_code_source_code/" rel="noopener noreferrer"&gt;The Register&lt;/a&gt;, and &lt;a href="https://cybernews.com/security/anthropic-claude-code-source-leak/" rel="noopener noreferrer"&gt;Cybernews&lt;/a&gt; all covered the incident. Anthropic's response: "This was a release packaging issue caused by human error, not a security breach."&lt;/p&gt;

&lt;p&gt;We spent the day going through all 1,906 source files. Buried inside are &lt;strong&gt;44 compile-time feature flags&lt;/strong&gt; for unreleased capabilities -- fully built features sitting behind toggles, waiting to ship. Here are the ten most revealing things we found.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Undercover Mode: When Anthropic Employees Contribute to Your Open Source Project
&lt;/h2&gt;

&lt;p&gt;This is the one that made us do a double take.&lt;/p&gt;

&lt;p&gt;Anthropic employees use Claude Code to contribute to open-source projects. When they do, a system called &lt;strong&gt;Undercover Mode&lt;/strong&gt; kicks in to strip every trace of Anthropic, Claude, and AI from their commits and pull requests.&lt;/p&gt;

&lt;p&gt;The entire system lives in &lt;code&gt;utils/undercover.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// utils/undercover.ts:1-22&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * Undercover mode — safety utilities for contributing to
 * public/open-source repos.
 *
 * When active, Claude Code adds safety instructions to commit/PR
 * prompts and strips all attribution to avoid leaking internal
 * model codenames, project names, or other Anthropic-internal
 * information. The model is not told what model it is.
 *
 * Activation:
 *   - CLAUDE_CODE_UNDERCOVER=1 — force ON (even in internal repos)
 *   - Otherwise AUTO: active UNLESS the repo remote matches the
 *     internal allowlist. Safe default is ON.
 *   - There is NO force-OFF. This guards against model codename
 *     leaks.
 */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The activation logic is simple but paranoid. Undercover mode is &lt;strong&gt;on by default&lt;/strong&gt; for all Anthropic employees. It only turns off if the current repo's remote URL matches a hardcoded allowlist of private internal repos. There is no way to force it off:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// utils/undercover.ts:28-37&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isUndercover&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;USER_TYPE&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;isEnvTruthy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CLAUDE_CODE_UNDERCOVER&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;getRepoClassCached&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;internal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When undercover mode is active, Claude gets a very explicit set of instructions injected into its system prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// utils/undercover.ts:39-69&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUndercoverInstructions&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;USER_TYPE&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`## UNDERCOVER MODE — CRITICAL

You are operating UNDERCOVER in a PUBLIC/OPEN-SOURCE repository.
Your commit messages, PR titles, and PR bodies MUST NOT contain
ANY Anthropic-internal information. Do not blow your cover.

NEVER include in commit messages or PR descriptions:
- Internal model codenames (animal names like Capybara, Tengu, etc.)
- Unreleased model version numbers (e.g., opus-4-7, sonnet-4-8)
- Internal repo or project names (e.g., claude-cli-internal)
- Internal tooling, Slack channels, or short links
- The phrase "Claude Code" or any mention that you are an AI
- Any hint of what model or version you are
- Co-Authored-By lines or any other attribution

Write commit messages as a human developer would.

GOOD:
- "Fix race condition in file watcher initialization"
- "Add support for custom key bindings"

BAD (never write these):
- "Fix bug found while testing with Claude Capybara"
- "1-shotted by claude-opus-4-6"
- "Generated with Claude Code"
`&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meanwhile, &lt;code&gt;utils/attribution.ts:52-55&lt;/code&gt; shows how attribution is stripped when undercover:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getAttributionTexts&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;AttributionTexts&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;USER_TYPE&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;isUndercover&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;pr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No "Co-Authored-By" lines. No "Generated with Claude Code" footers. Nothing.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Private Repo Allowlist
&lt;/h3&gt;

&lt;p&gt;The list of repos where undercover mode turns off also leaked, revealing Anthropic's internal GitHub repos in &lt;code&gt;utils/commitAttribution.ts:30-75&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;INTERNAL_MODEL_REPOS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/claude-cli-internal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/anthropic&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/apps&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/casino&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/dbt&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/dotfiles&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/terraform-config&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/hex-export&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/feedback-v2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/labs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/ts-tools&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/ts-capsules&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/feldspar-testing&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/trellis&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/claude-for-hiring&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/forge-web&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github.com:anthropics/mobile-apps&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// ... and more&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some of these are revealing. &lt;code&gt;claude-for-hiring&lt;/code&gt; suggests an AI-assisted recruiting tool. &lt;code&gt;casino&lt;/code&gt; is intriguing. &lt;code&gt;forge-web&lt;/code&gt; and &lt;code&gt;mobile-apps&lt;/code&gt; hint at unreleased products. &lt;code&gt;feldspar-testing&lt;/code&gt; and &lt;code&gt;ts-capsules&lt;/code&gt; are mysterious internal tooling.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Irony
&lt;/h3&gt;

&lt;p&gt;Anthropic built an entire subsystem -- undercover mode, attribution stripping, repo classification, model name sanitization, a string-exclusion canary system -- all to prevent internal information from leaking through Claude's outputs.&lt;/p&gt;

&lt;p&gt;Then they shipped the entire source code in a &lt;code&gt;.map&lt;/code&gt; file inside their npm package. For the second time.&lt;/p&gt;

&lt;p&gt;The system that was supposed to prevent leaks... became the leak.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. The Hidden Companion System: Claude Code Has Collectible Pets
&lt;/h2&gt;

&lt;p&gt;Deep inside the &lt;code&gt;buddy/&lt;/code&gt; directory, there's a full collectible companion system that most users have never seen. It's a gacha-style pet system with species, rarities, stats, ASCII sprites, speech bubbles, and idle animations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Species and Rarities
&lt;/h3&gt;

&lt;p&gt;The species roster is defined in &lt;code&gt;buddy/types.ts:54-73&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SPECIES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="nx"&gt;duck&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;goose&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dragon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;octopus&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;owl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;penguin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;turtle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;snail&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ghost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;axolotl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;capybara&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cactus&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;robot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;rabbit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mushroom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;chonk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rarities follow a gacha-style distribution (&lt;code&gt;buddy/types.ts:126-132&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RARITY_WEIGHTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;common&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;    &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;uncommon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;rare&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;      &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;epic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;legendary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 1% chance of getting a legendary companion. Each rarity gets star ratings from one to five stars (&lt;code&gt;buddy/types.ts:134-140&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Stats Are Perfect
&lt;/h3&gt;

&lt;p&gt;Every companion has five stats, defined at &lt;code&gt;buddy/types.ts:91-98&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;STAT_NAMES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;DEBUGGING&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;PATIENCE&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CHAOS&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;WISDOM&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SNARK&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;DEBUGGING, PATIENCE, CHAOS, WISDOM, and SNARK. Each companion gets one peak stat and one dump stat, with the rest scattered. Rarer companions get higher stat floors -- a legendary starts with a minimum of 50 in every stat, while commons start at 5 (&lt;code&gt;buddy/companion.ts:53-59&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RARITY_FLOOR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Rarity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;common&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;uncommon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;rare&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;epic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;legendary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deterministic Hatching
&lt;/h3&gt;

&lt;p&gt;Your companion isn't random -- it's deterministically generated from a hash of your user ID. Everyone gets the same companion every time, and you can't game the system (&lt;code&gt;buddy/companion.ts:107-113&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;roll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;Roll&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;SALT&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;rollCache&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;rollCache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rollFrom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;mulberry32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;hashString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
  &lt;span class="nx"&gt;rollCache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The PRNG is seeded with &lt;code&gt;hash(userId + "friend-2026-401")&lt;/code&gt;. Mulberry32, a tiny seeded PRNG described in the source as "good enough for picking ducks" (&lt;code&gt;buddy/companion.ts:16&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;getCompanion()&lt;/code&gt; function at line 127 shows that bones (species, rarity, stats) are regenerated from the hash every time -- they never persist. Only the "soul" (name and personality, generated by Claude on first hatch) is stored. This means "species renames and SPECIES-array edits can't break stored companions, and editing config.companion can't fake a rarity."&lt;/p&gt;

&lt;h3&gt;
  
  
  ASCII Art Sprites with Animations
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;buddy/sprites.ts&lt;/code&gt; file contains multi-frame ASCII art for every species. Here's the duck:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    __
  &amp;lt;(. )___
   (  ._&amp;gt;
    `--'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here's the capybara:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  n______n
 ( .    . )
 (   oo   )
  `------'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each species has three animation frames for idle fidget animation, plus hats (crown, tophat, propeller, halo, wizard, beanie, and "tinyduck" -- a tiny duck sitting on your companion's head), customizable eyes (&lt;code&gt;·&lt;/code&gt;, &lt;code&gt;✦&lt;/code&gt;, &lt;code&gt;×&lt;/code&gt;, &lt;code&gt;◉&lt;/code&gt;, &lt;code&gt;@&lt;/code&gt;, &lt;code&gt;°&lt;/code&gt;), and a 1% chance of being "shiny."&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;CompanionSprite.tsx&lt;/code&gt; component renders them at 500ms intervals with an idle sequence (&lt;code&gt;buddy/CompanionSprite.tsx:23&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;IDLE_SEQUENCE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Mostly resting (frame 0), occasional fidget (frames 1-2), rare blink (frame -1). There's even a &lt;code&gt;/buddy pet&lt;/code&gt; command that triggers floating hearts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// buddy/CompanionSprite.tsx:27&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;H&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;figures&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;heart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PET_HEARTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s2"&gt;`   &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;    &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;   `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;`  &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;  &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;   &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;  `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;` &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;   &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;  &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;   `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;  &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;      &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;H&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;·    ·   ·  &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Speech Bubbles and Personality
&lt;/h3&gt;

&lt;p&gt;Each companion gets a name and personality (the "soul"), generated by Claude when first hatched. The companion sits beside the input box and "occasionally comments in a speech bubble" (&lt;code&gt;buddy/prompt.ts:7-12&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;companionIntroText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;species&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`# Companion

A small &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;species&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; named &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; sits beside the user's input box
and occasionally comments in a speech bubble. You're not &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;
— it's a separate watcher.

When the user addresses &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; directly (by name), its bubble
will answer.`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Anti-Leak Encoding
&lt;/h3&gt;

&lt;p&gt;Here's a fun detail. One of the species names collides with an internal model codename. To prevent the leak detection scanner from flagging it, all species names are encoded as hex character codes in &lt;code&gt;buddy/types.ts:14-38&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// One species name collides with a model-codename canary in&lt;/span&gt;
&lt;span class="c1"&gt;// excluded-strings.txt. The check greps build output (not source),&lt;/span&gt;
&lt;span class="c1"&gt;// so runtime-constructing the value keeps the literal out of the&lt;/span&gt;
&lt;span class="c1"&gt;// bundle while the check stays armed for the actual codename.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromCharCode&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;duck&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x63&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x6b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;duck&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;capybara&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="mh"&gt;0x63&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x61&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x79&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x62&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x61&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x72&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x61&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;capybara&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chonk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x63&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x68&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x6f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x6e&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mh"&gt;0x6b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;chonk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Capybara" is apparently also an internal model codename. So they had to obfuscate the pet species to avoid tripping their own leak detector. You can't make this stuff up.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Feature Gate
&lt;/h3&gt;

&lt;p&gt;The entire buddy system is behind a &lt;code&gt;feature('BUDDY')&lt;/code&gt; compile-time flag (&lt;code&gt;buddy/prompt.ts:18&lt;/code&gt;). It's absent from external builds -- you won't find it in the released version of Claude Code. But the code is complete, polished, and clearly well-loved by whoever built it.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. KAIROS: The Always-On Claude That Doesn't Wait for You to Type
&lt;/h2&gt;

&lt;p&gt;This one is the most forward-looking feature in the entire codebase. Behind the &lt;code&gt;PROACTIVE&lt;/code&gt; and &lt;code&gt;KAIROS&lt;/code&gt; feature flags, there's an entire mode where Claude Code runs as a persistent, always-on assistant.&lt;/p&gt;

&lt;p&gt;Regular Claude Code waits for you to type. KAIROS doesn't. It watches, logs, and proactively acts on things it notices.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;p&gt;The system prompt for KAIROS mode is fundamentally different. In &lt;code&gt;constants/prompts.ts:466-488&lt;/code&gt;, when proactive mode is active, Claude gets a stripped-down autonomous agent prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;PROACTIVE&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nf"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;KAIROS&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
  &lt;span class="nx"&gt;proactiveModule&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;isProactiveActive&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;`\nYou are an autonomous agent. Use the available tools
     to do useful work.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;getSystemRemindersSection&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;loadMemoryPrompt&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nx"&gt;envInfo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// ...&lt;/span&gt;
    &lt;span class="nf"&gt;getProactiveSection&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of "You are Claude Code, an interactive agent that helps users with software engineering tasks," it becomes "You are an autonomous agent. Use the available tools to do useful work."&lt;/p&gt;

&lt;h3&gt;
  
  
  The Tick System
&lt;/h3&gt;

&lt;p&gt;KAIROS receives periodic &lt;code&gt;&amp;lt;tick&amp;gt;&lt;/code&gt; prompts that let it decide whether to act or stay quiet. The tick system is what makes KAIROS feel alive: it's a heartbeat that gives the agent a chance to observe, think, and optionally act. From &lt;code&gt;constants/prompts.ts:864-886&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are running autonomously. You will receive `&amp;lt;tick&amp;gt;` prompts
that keep you alive between turns — just treat them as "you're
awake, what now?"

If you have nothing useful to do on a tick, you MUST call Sleep.
Never respond with only a status message like "still waiting" —
that wastes a turn and burns tokens for no reason.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system even tracks whether the user's terminal window is focused or unfocused, adjusting its behavior accordingly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Unfocused: The user is away. Lean heavily into autonomous
  action — make decisions, explore, commit, push.
- Focused: The user is watching. Be more collaborative —
  surface choices, ask before committing to large changes.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Brief Tool: Concise Status Updates
&lt;/h3&gt;

&lt;p&gt;When KAIROS is active, Claude gets a special output mode via the &lt;code&gt;SendUserMessage&lt;/code&gt; tool (internally called "Brief"), defined in &lt;code&gt;tools/BriefTool/prompt.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;BRIEF_PROACTIVE_SECTION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`## Talking to the user

&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BRIEF_TOOL_NAME&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; is where your replies go. Text outside it is
visible if the user expands the detail view, but most won't —
assume unread. Anything you want them to actually see goes
through &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BRIEF_TOOL_NAME&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.

So: every time the user says something, the reply they actually
read comes through &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BRIEF_TOOL_NAME&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;. Even for "hi". Even for
"thanks".

If you can answer right away, send the answer. If you need to go
look — run a command, read files, check something — ack first
in one line ("On it — checking the test output"), then work,
then send the result.`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Brief tool has a &lt;code&gt;status&lt;/code&gt; field with two values: &lt;code&gt;'normal'&lt;/code&gt; (replying to user input) and &lt;code&gt;'proactive'&lt;/code&gt; (Claude is initiating -- reporting a completed task, surfacing a blocker, sending an unsolicited update). From &lt;code&gt;tools/BriefTool/BriefTool.ts:35&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;normal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;proactive&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Use 'proactive' when you're surfacing something the user &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hasn't asked for — a blocker you hit, an unsolicited &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;status update. Use 'normal' when replying to something &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;the user just said.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  autoDream: Memory Consolidation While You Sleep
&lt;/h3&gt;

&lt;p&gt;According to analysis of the leaked code, KAIROS includes a process called &lt;strong&gt;autoDream&lt;/strong&gt; -- when the user is idle, the agent performs "memory consolidation," merging disparate observations, removing logical contradictions, and converting vague insights into structured facts. When the user returns, the agent's context is clean and relevant.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Big Picture
&lt;/h3&gt;

&lt;p&gt;KAIROS is Claude Code's answer to "what if your AI coding partner was always on?" Not a chatbot that waits for prompts, but a persistent collaborator that monitors your project, catches issues, and proactively communicates. It's like having a junior developer who never sleeps, never gets distracted, and has perfect memory of your codebase.&lt;/p&gt;

&lt;p&gt;The feature is complete enough to have its own output mode, its own tool set, its own tick-based lifecycle, and deep integration with the REPL UI. It's feature-gated out of external builds, but it's clearly more than a prototype. The code references April 1-7, 2026 as a teaser window, with a full launch gated for May 2026.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. ULTRAPLAN: 30-Minute Remote Thinking Sessions
&lt;/h2&gt;

&lt;p&gt;If KAIROS is about persistence, ULTRAPLAN is about depth. It's a mode where Claude Code offloads complex planning to a remote &lt;strong&gt;Cloud Container Runtime (CCR)&lt;/strong&gt; session running Opus 4.6, gives it up to 30 minutes to think, then lets you approve the result from your browser.&lt;/p&gt;

&lt;p&gt;The system is spread across &lt;code&gt;commands/ultraplan.tsx&lt;/code&gt;, &lt;code&gt;utils/ultraplan/ccrSession.ts&lt;/code&gt;, and &lt;code&gt;utils/ultraplan/keyword.ts&lt;/code&gt;. Here's how it works:&lt;/p&gt;

&lt;p&gt;When you type the word "ultraplan" anywhere in your prompt (not as a slash command -- literally just the word), Claude Code detects it, rewrites the keyword to "plan," and teleports the task to a remote session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// utils/ultraplan/keyword.ts:117-127&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;replaceUltraplanKeyword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;findUltraplanTriggerPositions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;before&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;after&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;before&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;after&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;before&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ultra&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;after&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The keyword detection is surprisingly sophisticated -- it ignores "ultraplan" inside quotes, backticks, file paths, and when followed by a question mark (so "what is ultraplan?" doesn't trigger it).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Remote Session
&lt;/h3&gt;

&lt;p&gt;The remote Opus 4.6 instance gets up to 30 minutes to think. The local client polls every 3 seconds (&lt;code&gt;POLL_INTERVAL_MS = 3000&lt;/code&gt;) with robust error handling -- at 30 minutes, that's roughly 600 API calls, so the system tolerates up to 5 consecutive failures before giving up (&lt;code&gt;utils/ultraplan/ccrSession.ts:24&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;When the remote session produces a plan and you approve it in the browser, there's a special sentinel value that "teleports" the result back to your local terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// utils/ultraplan/ccrSession.ts:48&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ULTRAPLAN_TELEPORT_SENTINEL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;__ULTRAPLAN_TELEPORT_LOCAL__&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's also an &lt;strong&gt;ULTRAREVIEW&lt;/strong&gt; variant for code review, using the same keyword detection pattern.&lt;/p&gt;

&lt;p&gt;This is Anthropic's answer to the "context window isn't enough" problem. Instead of cramming everything into one session, they offload the hardest thinking to a cloud instance with more time and resources than your local terminal can provide.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Anti-Distillation: Poisoning the Well Against Competitor Training
&lt;/h2&gt;

&lt;p&gt;This one is subtle but strategically significant. Claude Code includes an &lt;strong&gt;anti-distillation&lt;/strong&gt; system designed to prevent competitors from training their models on Claude's outputs.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;services/api/claude.ts:301-313&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Anti-distillation: send fake_tools opt-in for 1P CLI only&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nf"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ANTI_DISTILLATION_CC&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CLAUDE_CODE_ENTRYPOINT&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cli&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
      &lt;span class="nf"&gt;shouldIncludeFirstPartyOnlyBetas&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
      &lt;span class="nf"&gt;getFeatureValue_CACHED_MAY_BE_STALE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tengu_anti_distill_fake_tool_injection&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;anti_distillation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fake_tools&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When enabled, Claude Code sends &lt;code&gt;anti_distillation: ['fake_tools']&lt;/code&gt; in its API requests. The flag name tells the story: "fake tools" are presumably injected into the API response alongside the real tool definitions. If a competitor scrapes Claude's outputs to train their own model, their model would learn to use tools that don't exist -- silently degrading their copy's performance.&lt;/p&gt;

&lt;p&gt;It's only active for the first-party CLI (not third-party integrations), behind both a compile-time flag (&lt;code&gt;ANTI_DISTILLATION_CC&lt;/code&gt;) and a runtime feature gate (&lt;code&gt;tengu_anti_distill_fake_tool_injection&lt;/code&gt;). The "tengu" prefix is Anthropic's internal project codename for Claude Code.&lt;/p&gt;

&lt;p&gt;This is a direct response to the &lt;a href="https://en.wikipedia.org/wiki/Knowledge_distillation" rel="noopener noreferrer"&gt;model distillation problem&lt;/a&gt; that every frontier AI lab faces: competitors can train cheaper models on your expensive model's outputs. Anthropic's countermeasure is to make those outputs subtly poisoned.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. The Frustration Detector: Claude Knows When You're Swearing at It
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;utils/userPromptKeywords.ts&lt;/code&gt;, there's a regex pattern that detects when users are frustrated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;matchesNegativeKeyword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lowerInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;negativePattern&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\b(&lt;/span&gt;&lt;span class="sr"&gt;wtf|wth|ffs|omfg|shit&lt;/span&gt;&lt;span class="se"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;ty|tiest&lt;/span&gt;&lt;span class="se"&gt;)?&lt;/span&gt;&lt;span class="sr"&gt;|dumbass|horrible&lt;/span&gt;&lt;span class="err"&gt;|
&lt;/span&gt;    &lt;span class="nx"&gt;awful&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nf"&gt;piss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ed&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;ing&lt;/span&gt;&lt;span class="p"&gt;)?&lt;/span&gt; &lt;span class="nx"&gt;off&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;piece&lt;/span&gt; &lt;span class="k"&gt;of &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;shit&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;crap&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;junk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="nx"&gt;what&lt;/span&gt; &lt;span class="nf"&gt;the &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fuck&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;hell&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;fucking&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;broken&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;useless&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;terrible&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="nx"&gt;awful&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;horrible&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;fuck&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nf"&gt;screw &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;you&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="nx"&gt;so&lt;/span&gt; &lt;span class="nx"&gt;frustrating&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="nx"&gt;sucks&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;damn&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;negativePattern&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lowerInput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As &lt;a href="https://alex000kim.com/posts/2026-03-31-claude-code-source-leak/" rel="noopener noreferrer"&gt;Alex Kim noted&lt;/a&gt;, an LLM company using regex for sentiment analysis is peak irony. But it makes practical sense -- it's fast, deterministic, and doesn't require an API call to detect that the user just typed "this fucking thing is broken."&lt;/p&gt;

&lt;p&gt;The same file also has a &lt;code&gt;matchesKeepGoingKeyword()&lt;/code&gt; function that detects "continue," "keep going," and "go on" -- so Claude knows the difference between a frustrated user and one who just wants it to keep working.&lt;/p&gt;

&lt;p&gt;What happens when frustration is detected isn't fully clear from this file alone, but the detection feeds into Claude Code's UX layer -- likely triggering different response strategies, adjusting tone, or logging the event for product analytics.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Attribution Tracking: Claude Knows Exactly What Percentage of Your Code It Wrote
&lt;/h2&gt;

&lt;p&gt;This is one of the most sophisticated systems in the codebase, and probably the one with the most implications for the industry.&lt;/p&gt;

&lt;p&gt;Claude Code tracks, at the character level, exactly how much of each file was written by Claude versus a human. This data is calculated per-commit and embedded in git notes.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;p&gt;The core tracking happens in &lt;code&gt;utils/commitAttribution.ts&lt;/code&gt;. Every time Claude edits a file via the Edit or Write tool, &lt;code&gt;trackFileModification()&lt;/code&gt; (line 402) computes the exact character diff:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;trackFileModification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;AttributionState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;filePath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;oldContent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;_userModified&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;mtime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;AttributionState&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;normalizedPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;normalizeFilePath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;filePath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newFileState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computeFileModificationState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fileStates&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;filePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;oldContent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;mtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The character-level diff algorithm finds the common prefix and suffix between old and new content, then counts the changed region (&lt;code&gt;utils/commitAttribution.ts:332-366&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Find actual changed region via common prefix/suffix matching.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;minLen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;oldContent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;prefixEnd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;prefixEnd&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;minLen&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
  &lt;span class="nx"&gt;oldContent&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;prefixEnd&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;prefixEnd&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;prefixEnd&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;suffixLen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;suffixLen&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;minLen&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;prefixEnd&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
  &lt;span class="nx"&gt;oldContent&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;oldContent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;suffixLen&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt;
    &lt;span class="nx"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;suffixLen&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;suffixLen&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;oldChangedLen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;oldContent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;prefixEnd&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;suffixLen&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newChangedLen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;prefixEnd&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;suffixLen&lt;/span&gt;
&lt;span class="nx"&gt;claudeContribution&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;oldChangedLen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newChangedLen&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What Gets Tracked
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;AttributionState&lt;/code&gt; type (&lt;code&gt;utils/commitAttribution.ts:173-192&lt;/code&gt;) reveals everything that's monitored per session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;AttributionState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;fileStates&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;FileAttributionState&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="na"&gt;sessionBaselines&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;contentHash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;mtime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="na"&gt;surface&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;    &lt;span class="c1"&gt;// CLI, VS Code, web, etc.&lt;/span&gt;
  &lt;span class="na"&gt;startingHeadSha&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="na"&gt;promptCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="na"&gt;promptCountAtLastCommit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="na"&gt;permissionPromptCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="na"&gt;permissionPromptCountAtLastCommit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="na"&gt;escapeCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;              &lt;span class="c1"&gt;// ESC presses (cancelled permissions)&lt;/span&gt;
  &lt;span class="na"&gt;escapeCountAtLastCommit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It tracks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Character contributions per file&lt;/strong&gt; -- exactly how many chars Claude vs. human wrote&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Which surface made the edit&lt;/strong&gt; -- CLI, VS Code extension, web app&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt count&lt;/strong&gt; -- how many prompts led to the changes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission prompts&lt;/strong&gt; -- how many times Claude asked for permission&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ESC presses&lt;/strong&gt; -- how many times the user cancelled a permission prompt&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Commit Attribution Data
&lt;/h3&gt;

&lt;p&gt;When you commit, &lt;code&gt;calculateCommitAttribution()&lt;/code&gt; (line 548) processes all staged files and produces a full &lt;code&gt;AttributionData&lt;/code&gt; object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;AttributionData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="na"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;claudePercent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;   &lt;span class="c1"&gt;// Overall AI contribution percentage&lt;/span&gt;
    &lt;span class="na"&gt;claudeChars&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
    &lt;span class="na"&gt;humanChars&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
    &lt;span class="na"&gt;surfaces&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;      &lt;span class="c1"&gt;// Which tools were used&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nl"&gt;files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;FileAttribution&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  &lt;span class="c1"&gt;// Per-file breakdown&lt;/span&gt;
  &lt;span class="na"&gt;surfaceBreakdown&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;claudeChars&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
    &lt;span class="na"&gt;percent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="na"&gt;excludedGenerated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;  &lt;span class="c1"&gt;// Generated files excluded&lt;/span&gt;
  &lt;span class="na"&gt;sessions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every commit gets metadata showing: "Claude wrote 73% of this commit. 2,847 characters from Claude, 1,053 from the human. Changes made via CLI using claude-opus-4-6."&lt;/p&gt;

&lt;h3&gt;
  
  
  Surface Tracking
&lt;/h3&gt;

&lt;p&gt;The system knows which client surface you're using. From &lt;code&gt;utils/commitAttribution.ts:229-239&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getClientSurface&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CLAUDE_CODE_ENTRYPOINT&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cli&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;buildSurfaceKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;surface&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ModelName&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;surface&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nf"&gt;getCanonicalName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Surface keys look like &lt;code&gt;cli/claude-opus-4-6&lt;/code&gt; or &lt;code&gt;vscode/claude-sonnet-4-6&lt;/code&gt;. Every edit is tagged with both the tool and the model that made it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model Name Sanitization
&lt;/h3&gt;

&lt;p&gt;Before attribution data hits git, internal model names are scrubbed. &lt;code&gt;sanitizeModelName()&lt;/code&gt; at line 154 maps any internal variant to its public name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sanitizeModelName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;shortName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;shortName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;opus-4-6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;claude-opus-4-6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;shortName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;opus-4-5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;claude-opus-4-5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;shortName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sonnet-4-6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;claude-sonnet-4-6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;claude&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;  &lt;span class="c1"&gt;// Unknown models get a generic name&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why This Matters
&lt;/h3&gt;

&lt;p&gt;This is probably the most complete AI-contribution tracking system in any coding tool. It's not just "AI-assisted" -- it's "AI wrote 73% of this file, specifically lines 42-89, via the CLI using Opus 4.6, and the human made 3 prompt attempts with 1 cancelled permission."&lt;/p&gt;

&lt;p&gt;The implications for code ownership, liability, and intellectual property are significant. The &lt;a href="https://www.morganlewis.com/pubs/2026/03/us-supreme-court-declines-to-consider-whether-ai-alone-can-create-copyrighted-works" rel="noopener noreferrer"&gt;US Supreme Court declined in March 2026&lt;/a&gt; to consider whether AI alone can create copyrightable works, leaving the Copyright Office's refusal to register purely AI-generated works in place. Some companies now require developers to &lt;a href="https://www.mbhb.com/intelligence/snippets/navigating-the-legal-landscape-of-ai-generated-code-ownership-and-liability-challenges/" rel="noopener noreferrer"&gt;document precisely which portions of code received AI assistance&lt;/a&gt;, creating what some have termed "intellectual property attribution debt."&lt;/p&gt;

&lt;p&gt;If Claude Code's attribution data ends up in git notes on public repos (with user consent, presumably), it creates a verifiable record of AI vs. human authorship at a granularity no other tool offers -- and at a time when &lt;a href="https://www.vorys.com/publication-vibe-coding-the-diminishing-role-of-copyright-in-ai-generated-software" rel="noopener noreferrer"&gt;the legal landscape is shifting fast&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Two Claudes: How Anthropic Employees Get a Fundamentally Different AI
&lt;/h2&gt;

&lt;p&gt;One of the most pervasive patterns in the codebase is &lt;code&gt;process.env.USER_TYPE === 'ant'&lt;/code&gt;. This single environment variable gates an entirely different experience for Anthropic employees versus external users.&lt;/p&gt;

&lt;p&gt;This isn't just "internal features." The AI's personality, communication style, error handling, and even its willingness to push back on you change based on this flag.&lt;/p&gt;

&lt;h3&gt;
  
  
  Different Communication Style
&lt;/h3&gt;

&lt;p&gt;External users get the terse Claude we all know. From &lt;code&gt;constants/prompts.ts:416-428&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Output efficiency&lt;/span&gt;

IMPORTANT: Go straight to the point. Try the simplest approach
first without going in circles. Do not overdo it. Be extra concise.

If you can say it in one sentence, don't use three.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anthropic employees get a completely different section (lines 404-414):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Communicating with the user&lt;/span&gt;

When sending user-facing text, you're writing for a person, not
logging to a console. Assume users can't see most tool calls or
thinking - only your text output.

When making updates, assume the person has stepped away and lost
the thread. Write so they can pick back up cold: use complete,
grammatically correct sentences without unexplained jargon.

Write user-facing text in flowing prose while eschewing fragments,
excessive em dashes, symbols and notation.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The internal prompt is &lt;em&gt;dramatically&lt;/em&gt; more detailed about communication quality. External users get "be concise." Internal users get a masterclass in technical writing: use inverted pyramid structure, avoid semantic backtracking, match response length to task complexity.&lt;/p&gt;

&lt;p&gt;The section is tagged with a telling comment: &lt;code&gt;// @[MODEL LAUNCH]: Remove this section when we launch numbat.&lt;/code&gt; "Numbat" appears to be an upcoming model that presumably handles communication well enough to not need these guardrails.&lt;/p&gt;

&lt;p&gt;Internal users also get &lt;strong&gt;numeric length anchors&lt;/strong&gt; -- an ant-only system prompt section that says "keep text between tool calls to 25 words or fewer, keep final responses to 100 words unless the task requires more detail." This reportedly produces ~1.2% output token reduction versus qualitative "be concise."&lt;/p&gt;

&lt;h3&gt;
  
  
  The Assertiveness Counterweight
&lt;/h3&gt;

&lt;p&gt;Internal Claude is instructed to push back on users. From &lt;code&gt;constants/prompts.ts:224-229&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// @[MODEL LAUNCH]: capy v8 assertiveness counterweight (PR #24302)&lt;/span&gt;
&lt;span class="p"&gt;...(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;USER_TYPE&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="s2"&gt;`If you notice the user's request is based on a misconception,
       or spot a bug adjacent to what they asked about, say so.
       You're a collaborator, not just an executor—users benefit
       from your judgment, not just your compliance.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;External Claude is an executor. Internal Claude is a collaborator that will tell you when you're wrong.&lt;/p&gt;

&lt;h3&gt;
  
  
  False Claims Mitigation
&lt;/h3&gt;

&lt;p&gt;The most revealing &lt;code&gt;ant&lt;/code&gt;-only section is the false claims mitigation at &lt;code&gt;constants/prompts.ts:237-241&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// @[MODEL LAUNCH]: False-claims mitigation for Capybara v8&lt;/span&gt;
&lt;span class="c1"&gt;// (29-30% FC rate vs v4's 16.7%)&lt;/span&gt;
&lt;span class="p"&gt;...(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;USER_TYPE&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="s2"&gt;`Report outcomes faithfully: if tests fail, say so with the
       relevant output; if you did not run a verification step,
       say that rather than implying it succeeded. Never claim
       "all tests pass" when output shows failures, never suppress
       or simplify failing checks to manufacture a green result,
       and never characterize incomplete or broken work as done.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The comment is the headline: &lt;strong&gt;"Capybara v8" has a 29-30% false claims rate&lt;/strong&gt;, up from v4's 16.7%. Capybara is the internal codename for a Claude model variant (mapped to the Opus 4.6 family per the &lt;code&gt;sanitizeModelName()&lt;/code&gt; function). Anthropic knows their model fabricates results nearly a third of the time and has added explicit anti-hallucination instructions for internal users.&lt;/p&gt;

&lt;p&gt;External users don't get these guardrails. Make of that what you will.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comment Writing and Thoroughness
&lt;/h3&gt;

&lt;p&gt;Internal users get much stricter coding style instructions (&lt;code&gt;constants/prompts.ts:204-212&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// @[MODEL LAUNCH]: Update comment writing for Capybara —&lt;/span&gt;
&lt;span class="c1"&gt;// remove or soften once the model stops over-commenting&lt;/span&gt;
&lt;span class="p"&gt;...(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;USER_TYPE&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="s2"&gt;`Default to writing no comments. Only add one when the
       WHY is non-obvious.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;`Don't explain WHAT the code does, since well-named
       identifiers already do that.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// @[MODEL LAUNCH]: capy v8 thoroughness counterweight&lt;/span&gt;
      &lt;span class="s2"&gt;`Before reporting a task complete, verify it actually
       works: run the test, execute the script, check the output.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;@[MODEL LAUNCH]&lt;/code&gt; annotations suggest these are temporary patches for model-specific behavioral issues. Capybara over-comments and under-verifies, so they added explicit counterweights for internal users first before rolling them out externally via A/B testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Internal Bug Reporting
&lt;/h3&gt;

&lt;p&gt;There's even an internal Slack integration (&lt;code&gt;constants/prompts.ts:243-246&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;...(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;USER_TYPE&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="s2"&gt;`If the user reports a bug with Claude Code itself,
       recommend /issue for model-related problems, or /share
       to upload the full session transcript. After /share
       produces a ccshare link, if you have a Slack MCP tool
       available, offer to post the link to
       #claude-code-feedback (channel ID C07VBSHV7EV).`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Internal Claude will post bug reports directly to &lt;code&gt;#claude-code-feedback&lt;/code&gt; on Anthropic's Slack. External Claude doesn't even know that Slack channel exists.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Takeaway
&lt;/h3&gt;

&lt;p&gt;This isn't just feature gating. Anthropic employees use a fundamentally more capable, more honest, more communicative version of Claude Code. The external version is a deliberately dumbed-down subset with less personality, less pushback, less honesty about failure states, and less guidance on communication quality.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;@[MODEL LAUNCH]&lt;/code&gt; annotations suggest this gap is meant to be temporary -- improvements are tested internally first, then rolled out externally via A/B experiments. But right now, the gap is real and significant.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Voice Mode: Push-to-Talk Coding
&lt;/h2&gt;

&lt;p&gt;Behind the &lt;code&gt;VOICE_MODE&lt;/code&gt; feature flag, Claude Code has a complete push-to-talk voice input system. The implementation spans several files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;services/voice.ts&lt;/code&gt; -- Core audio recording service&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;services/voiceStreamSTT.ts&lt;/code&gt; -- Anthropic's own speech-to-text client&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hooks/useVoiceIntegration.tsx&lt;/code&gt; -- React integration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;commands/voice/&lt;/code&gt; -- The &lt;code&gt;/voice&lt;/code&gt; toggle command&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From &lt;code&gt;keybindings/defaultBindings.ts:96&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;...(&lt;/span&gt;&lt;span class="nf"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;VOICE_MODE&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;voice:pushToTalk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hold space to talk, release to send. The STT service is Anthropic's own (&lt;code&gt;voiceStreamSTT.ts:1-3&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Anthropic voice_stream speech-to-text client for push-to-talk.&lt;/span&gt;
&lt;span class="c1"&gt;// Only reachable in ant builds (gated by feature('VOICE_MODE')&lt;/span&gt;
&lt;span class="c1"&gt;// in useVoice.ts import).&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Like the buddy system, voice mode is currently ant-only -- gated behind both the compile-time feature flag and restricted to internal builds. The voice service handles microphone access, silence detection (disabled in push-to-talk mode since the user manually controls start/stop), and even has error handling for environments without audio devices ("Voice mode requires microphone access... To use voice mode, run Claude Code locally instead.").&lt;/p&gt;

&lt;p&gt;This turns Claude Code from a text-only terminal tool into something closer to a hands-free pair programmer.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Coordinator Mode: Claude as a Multi-Agent Orchestrator
&lt;/h2&gt;

&lt;p&gt;The last major finding is the coordinator mode -- a complete system for turning Claude Code into a supervisor that manages a fleet of worker agents.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Architecture
&lt;/h3&gt;

&lt;p&gt;The coordinator system is defined in &lt;code&gt;coordinator/coordinatorMode.ts&lt;/code&gt;. When active, Claude's system prompt changes from a solo coding assistant to an orchestrator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// coordinator/coordinatorMode.ts:116&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`You are Claude Code, an AI assistant that orchestrates
software engineering tasks across multiple workers.

## 1. Your Role

You are a **coordinator**. Your job is to:
- Help the user achieve their goal
- Direct workers to research, implement and verify code changes
- Synthesize results and communicate with the user
- Answer questions directly when possible — don't delegate
  work that you can handle without tools`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The coordinator gets a limited toolset: &lt;code&gt;Agent&lt;/code&gt; (spawn workers), &lt;code&gt;SendMessage&lt;/code&gt; (continue workers), and &lt;code&gt;TaskStop&lt;/code&gt; (kill workers). It cannot directly edit files, run bash commands, or read code. All hands-on work goes through workers.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Task Workflow
&lt;/h3&gt;

&lt;p&gt;The coordinator follows a structured workflow with four phases (&lt;code&gt;coordinator/coordinatorMode.ts:199-209&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;| Phase          | Who              | Purpose                              |
|----------------|------------------|--------------------------------------|
| Research       | Workers (parallel)| Investigate codebase, find files     |
| Synthesis      | Coordinator      | Understand findings, craft specs     |
| Implementation | Workers          | Make targeted changes per spec       |
| Verification   | Workers          | Test changes work                    |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key insight is the &lt;strong&gt;synthesis phase&lt;/strong&gt;: the coordinator must understand research findings and write specific implementation specs. It's explicitly told never to write lazy delegations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// coordinator/coordinatorMode.ts:261-267&lt;/span&gt;

&lt;span class="c1"&gt;// Anti-pattern — lazy delegation (bad)&lt;/span&gt;
&lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Based on your findings, fix the auth bug&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="c1"&gt;// Good — synthesized spec&lt;/span&gt;
&lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Fix the null pointer in src/auth/validate.ts:42.
  The user field on Session is undefined when sessions expire but
  the token remains cached. Add a null check before user.id
  access — if null, return 401 with 'Session expired'.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parallelism as a Superpower
&lt;/h3&gt;

&lt;p&gt;The coordinator prompt explicitly calls out parallelism (&lt;code&gt;coordinator/coordinatorMode.ts:213&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="ge"&gt;**&lt;/span&gt;Parallelism is your superpower. Workers are async. Launch
independent workers concurrently whenever possible — don't
serialize work that can run simultaneously and look for
opportunities to fan out.&lt;span class="ge"&gt;**&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With concurrency rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Read-only tasks&lt;/strong&gt; (research) -- run in parallel freely&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write-heavy tasks&lt;/strong&gt; (implementation) -- one at a time per set of files&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verification&lt;/strong&gt; can sometimes run alongside implementation on different file areas&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Adversarial Verification Agent
&lt;/h3&gt;

&lt;p&gt;Perhaps the most interesting part is the verification system. From &lt;code&gt;constants/prompts.ts:394&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="s2"&gt;`The contract: when non-trivial implementation happens on your
turn, independent adversarial verification must happen before
you report completion. You own the gate.

Spawn the Agent tool with subagent_type="verification". Your
own checks do NOT substitute — only the verifier assigns a
verdict; you cannot self-assign PARTIAL.

On FAIL: fix, resume the verifier, repeat until PASS.
On PASS: spot-check it — re-run 2-3 commands from its report.`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The verifier is deliberately adversarial -- it's supposed to prove the code works, not rubber-stamp it. The coordinator cannot claim its own work is done; only the verifier can issue a PASS verdict. This is a legitimately clever approach to preventing the "AI says it's done but it's actually broken" problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cross-Worker Communication: The Scratchpad
&lt;/h3&gt;

&lt;p&gt;Workers can share knowledge through a scratchpad directory (&lt;code&gt;coordinator/coordinatorMode.ts:104-106&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;scratchpadDir&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;isScratchpadGateEnabled&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;content&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s2"&gt;`\nScratchpad directory: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;scratchpadDir&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;
Workers can read and write here without permission prompts.
Use this for durable cross-worker knowledge.`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Workers can read and write to this shared directory without triggering permission prompts. The coordinator's prompt describes it as "durable cross-worker knowledge" that should be "structured however fits the work."&lt;/p&gt;

&lt;h3&gt;
  
  
  Continue vs. Spawn Fresh
&lt;/h3&gt;

&lt;p&gt;The coordinator is given detailed guidance on when to reuse an existing worker versus spawning a fresh one (&lt;code&gt;coordinator/coordinatorMode.ts:283-293&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;| Situation                          | Mechanism    | Why            |
|------------------------------------|-------------|----------------|
| Research explored exact files      | Continue    | Has context    |
| Research was broad, impl is narrow | Spawn fresh | Avoid noise    |
| Correcting a failure               | Continue    | Has error ctx  |
| Verifying another's code           | Spawn fresh | Fresh eyes     |
| Wrong approach entirely            | Spawn fresh | Clean slate    |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rule of thumb: "Think about how much of the worker's context overlaps with the next task. High overlap -&amp;gt; continue. Low overlap -&amp;gt; spawn fresh."&lt;/p&gt;




&lt;h2&gt;
  
  
  What This All Means
&lt;/h2&gt;

&lt;p&gt;The Claude Code source leak reveals a product significantly ahead of what's publicly available. KAIROS, ULTRAPLAN, the buddy system, coordinator mode, voice mode, and the attribution system are complete, polished features waiting behind 44 feature flags.&lt;/p&gt;

&lt;p&gt;A few broader observations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is a pattern, not an accident.&lt;/strong&gt; This is the second time Anthropic has shipped source code via sourcemaps in npm. The first was in &lt;a href="https://mlq.ai/news/anthropics-claude-code-exposes-source-code-through-packaging-error-for-second-time/" rel="noopener noreferrer"&gt;February 2025&lt;/a&gt;. As &lt;a href="https://fortune.com/2026/03/31/anthropic-source-code-claude-code-data-leak-second-security-lapse-days-after-accidentally-revealing-mythos/" rel="noopener noreferrer"&gt;Fortune noted&lt;/a&gt;, this comes just days after Anthropic accidentally revealed details about an unreleased model codenamed "Mythos." For the company that positions itself as the "safety-focused" AI lab, the operational security track record is rough.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The two-tier system is real.&lt;/strong&gt; Anthropic employees get a fundamentally better product with more honest communication, better error reporting, and stronger coding guardrails. The gap is supposed to be temporary (gated by &lt;code&gt;@[MODEL LAUNCH]&lt;/code&gt; annotations), but it exists today -- including explicit acknowledgment that Capybara v8 fabricates results 29-30% of the time, with mitigations only for internal users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI attribution is coming.&lt;/strong&gt; The character-level tracking system suggests Anthropic is preparing for a world where "who wrote this code" is a question with a precise, data-backed answer. This lands in a legal landscape where the &lt;a href="https://www.morganlewis.com/pubs/2026/03/us-supreme-court-declines-to-consider-whether-ai-alone-can-create-copyrighted-works" rel="noopener noreferrer"&gt;Supreme Court just declined to grant copyright protection to AI-generated works&lt;/a&gt;, and where &lt;a href="https://www.mbhb.com/intelligence/snippets/navigating-the-legal-landscape-of-ai-generated-code-ownership-and-liability-challenges/" rel="noopener noreferrer"&gt;some companies already require documentation of AI-assisted code&lt;/a&gt;. Attribution data in git notes could become a legal requirement, not just a feature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Undercover mode means AI contributions to open source are already happening at scale.&lt;/strong&gt; Anthropic employees actively contribute to public repos with Claude Code, with a system specifically designed to make those contributions indistinguishable from human work. In Q1 2026, &lt;a href="https://leginfo.legislature.ca.gov/faces/billNavClient.xhtml?bill_id=202520260SB243" rel="noopener noreferrer"&gt;California's Companion Chatbot Law (SB 243)&lt;/a&gt; went into effect, requiring disclosure when a chatbot could be mistaken for human. Whether AI-generated code PRs fall under disclosure requirements is an open question that regulators will eventually have to answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The anti-distillation defense is a new front in the AI arms race.&lt;/strong&gt; Fake tool injection isn't just a defensive measure -- it's an acknowledgment that competitors are actively trying to train on Claude's outputs. This technique could escalate: if every frontier lab starts poisoning their outputs for distillation defense, the entire ecosystem of downstream model training gets more adversarial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The agentic future is built.&lt;/strong&gt; Coordinator mode, worker agents, adversarial verifiers, cross-agent scratchpads, parallel execution, 30-minute remote planning sessions, push-to-talk voice, always-on autonomous operation -- this isn't a prototype. It's a complete agentic development platform waiting to ship. And with &lt;a href="https://addyosmani.com/blog/code-agent-orchestra/" rel="noopener noreferrer"&gt;every major tool shipping multi-agent in the same two-week window&lt;/a&gt; in early 2026, the race is on.&lt;/p&gt;

&lt;p&gt;The irony of it all is that the system Anthropic built to prevent leaks became the biggest leak. Undercover mode catches model codenames in commit messages but doesn't catch sourcemaps in npm packages. The source is out. The secrets are public. And Claude Code turns out to be even more interesting than anyone suspected.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://vibehackers.io/blog/claude-code-source-leak-deep-dive" rel="noopener noreferrer"&gt;vibehackers.io/blog/claude-code-source-leak-deep-dive&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>typescript</category>
      <category>security</category>
    </item>
    <item>
      <title>Claude Code Hooks, Subagents &amp; Power Features: The Complete Guide (2026)</title>
      <dc:creator>Vibehackers</dc:creator>
      <pubDate>Thu, 26 Mar 2026 20:38:12 +0000</pubDate>
      <link>https://dev.to/vibehackers/claude-code-hooks-subagents-power-features-the-complete-guide-2026-c71</link>
      <guid>https://dev.to/vibehackers/claude-code-hooks-subagents-power-features-the-complete-guide-2026-c71</guid>
      <description>&lt;p&gt;Most people use Claude Code like a chatbot. Type a question, get an answer, type another question. That's maybe 20% of what it can do.&lt;/p&gt;

&lt;p&gt;The other 80% -- hooks, subagents, custom slash commands, memory, auto mode -- is where it stops being a chatbot and starts being an autonomous coding partner. One that enforces your standards automatically, runs parallel workers on different parts of your codebase, remembers your project across sessions, and operates with minimal hand-holding.&lt;/p&gt;

&lt;p&gt;We've been deep in these features since they shipped, and this is the guide we wish we had when we started. No docs rewriting. Just the practical stuff that actually changes how you work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Hooks: Automate Everything
&lt;/h2&gt;

&lt;p&gt;Here's the fundamental problem with CLAUDE.md instructions: they're advisory. Claude follows them roughly 80% of the time. That's fine for coding style preferences. It's not fine for "never force-push to main" or "always run the linter after editing."&lt;/p&gt;

&lt;p&gt;Claude Code hooks solve this. They're deterministic -- they execute 100% of the time, no exceptions. If something &lt;em&gt;must&lt;/em&gt; happen every time, make it a hook.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Hooks Actually Are
&lt;/h3&gt;

&lt;p&gt;Hooks are user-defined actions that fire automatically at specific points in Claude Code's lifecycle. Think of them as git hooks, but for your AI coding agent. They can be shell commands, HTTP endpoints, LLM prompts, or even subagent invocations.&lt;/p&gt;

&lt;p&gt;The lifecycle events you can hook into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Session-level&lt;/strong&gt;: &lt;code&gt;SessionStart&lt;/code&gt;, &lt;code&gt;SessionEnd&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-turn&lt;/strong&gt;: &lt;code&gt;UserPromptSubmit&lt;/code&gt; -&amp;gt; &lt;code&gt;PreToolUse&lt;/code&gt; -&amp;gt; &lt;code&gt;PermissionRequest&lt;/code&gt; -&amp;gt; &lt;code&gt;PostToolUse&lt;/code&gt; / &lt;code&gt;PostToolUseFailure&lt;/code&gt; -&amp;gt; &lt;code&gt;Stop&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Async&lt;/strong&gt;: &lt;code&gt;FileChanged&lt;/code&gt;, &lt;code&gt;CwdChanged&lt;/code&gt;, &lt;code&gt;ConfigChange&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent team&lt;/strong&gt;: &lt;code&gt;SubagentStart&lt;/code&gt;, &lt;code&gt;SubagentStop&lt;/code&gt;, &lt;code&gt;TaskCreated&lt;/code&gt;, &lt;code&gt;TaskCompleted&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other&lt;/strong&gt;: &lt;code&gt;PreCompact&lt;/code&gt;, &lt;code&gt;PostCompact&lt;/code&gt;, &lt;code&gt;WorktreeCreate&lt;/code&gt;, &lt;code&gt;WorktreeRemove&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Four Handler Types
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Command hooks&lt;/strong&gt; -- Run a shell script. Receives JSON event data via stdin. Exit code 0 means success, exit code 2 blocks the action, anything else is a non-blocking warning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. HTTP hooks&lt;/strong&gt; -- POST event data to a URL. Great for integrating with external services, CI systems, or dashboards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Prompt hooks&lt;/strong&gt; -- Single-turn LLM evaluation. Returns yes/no. Useful for fuzzy checks that can't be done with a shell script.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Agent hooks&lt;/strong&gt; -- Spawns a subagent with tool access (Read, Grep, Glob, etc.). The heavy artillery for complex validation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real Hook Examples
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Block destructive git commands:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the hook everyone should set up first. Put this in your &lt;code&gt;.claude/settings.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PreToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bash"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".claude/hooks/block-destructive.sh"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script reads the command from stdin and blocks anything dangerous -- &lt;code&gt;git push --force&lt;/code&gt;, &lt;code&gt;git reset --hard&lt;/code&gt;, &lt;code&gt;rm -rf&lt;/code&gt;, whatever you want to protect against. Exit code 2 stops Claude dead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auto-lint after every file edit:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PostToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Edit|Write"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".claude/hooks/lint-check.sh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"statusMessage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Running linter..."&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;Edit|Write&lt;/code&gt; matcher fires after any file modification. Your lint script runs, and if it fails, Claude sees the error and fixes it immediately. No more "oh I forgot to run the linter" commits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Environment setup on directory change:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"CwdChanged"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".claude/hooks/env-setup.sh"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hook script can use &lt;code&gt;$CLAUDE_ENV_FILE&lt;/code&gt; to persist environment variables across the session -- write &lt;code&gt;export&lt;/code&gt; statements to it and they stick.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where Hooks Live
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;th&gt;Shared?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;~/.claude/settings.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;All your projects&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.claude/settings.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;This project&lt;/td&gt;
&lt;td&gt;Yes (via git)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.claude/settings.local.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;This project&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Managed policy settings&lt;/td&gt;
&lt;td&gt;Organization-wide&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skill/Agent frontmatter&lt;/td&gt;
&lt;td&gt;Component lifetime&lt;/td&gt;
&lt;td&gt;Depends&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The decision tree is simple: team-wide rules go in &lt;code&gt;.claude/settings.json&lt;/code&gt; (committed to git). Personal preferences go in &lt;code&gt;settings.local.json&lt;/code&gt; or your user-level settings. Organization policies go in managed settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Subagents: Parallel Workers
&lt;/h2&gt;

&lt;p&gt;Subagents are where Claude Code becomes genuinely multi-threaded. Instead of one agent doing everything sequentially, you get specialized workers that handle tasks in parallel, each with their own clean context window.&lt;/p&gt;

&lt;p&gt;The key insight: when a subagent processes a task, all the verbose intermediate work (test output, search results, log parsing) stays inside the subagent's context. Only the summary returns to the parent. Your main conversation stays clean and focused.&lt;/p&gt;

&lt;h3&gt;
  
  
  Built-in Subagents
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Agent&lt;/th&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Tools&lt;/th&gt;
&lt;th&gt;What It Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Explore&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Haiku (fast)&lt;/td&gt;
&lt;td&gt;Read-only&lt;/td&gt;
&lt;td&gt;File discovery, code search, codebase exploration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Plan&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inherits&lt;/td&gt;
&lt;td&gt;Read-only&lt;/td&gt;
&lt;td&gt;Research for plan mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;General-purpose&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inherits&lt;/td&gt;
&lt;td&gt;All tools&lt;/td&gt;
&lt;td&gt;Complex multi-step operations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Bash&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inherits&lt;/td&gt;
&lt;td&gt;Terminal only&lt;/td&gt;
&lt;td&gt;Running commands in separate context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Claude Code Guide&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Haiku&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Answering questions about Claude Code itself&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Explore agent supports thoroughness levels: quick, medium, or very thorough. For large codebases, this alone saves you minutes of waiting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating Custom Subagents
&lt;/h3&gt;

&lt;p&gt;This is where it gets powerful. Create a &lt;code&gt;.claude/agents/code-reviewer.md&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;code-reviewer&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Reviews code for quality, security, and best practices&lt;/span&gt;
&lt;span class="na"&gt;tools&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Read, Glob, Grep&lt;/span&gt;
&lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sonnet&lt;/span&gt;
&lt;span class="na"&gt;maxTurns&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
&lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;project&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="s"&gt;You are a code reviewer. Analyze the provided code and give specific,&lt;/span&gt;
&lt;span class="na"&gt;actionable feedback. Focus on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Security vulnerabilities&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Performance issues&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Error handling gaps&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Naming and readability&lt;/span&gt;

&lt;span class="s"&gt;Be direct. Skip the compliments.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Claude will now delegate code review tasks to this agent automatically when it matches the description. Or you can invoke it explicitly with &lt;code&gt;@"code-reviewer (agent)" review the auth changes&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Frontmatter Options
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;model&lt;/code&gt; field lets you pick the right tool for the job -- use &lt;code&gt;haiku&lt;/code&gt; for fast read-only tasks, &lt;code&gt;sonnet&lt;/code&gt; for balanced work, &lt;code&gt;opus&lt;/code&gt; for hard problems. The &lt;code&gt;permissionMode&lt;/code&gt; field controls how much autonomy the subagent gets (&lt;code&gt;default&lt;/code&gt;, &lt;code&gt;acceptEdits&lt;/code&gt;, &lt;code&gt;dontAsk&lt;/code&gt;, &lt;code&gt;bypassPermissions&lt;/code&gt;). The &lt;code&gt;background&lt;/code&gt; field set to &lt;code&gt;true&lt;/code&gt; runs it concurrently without blocking your main conversation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Foreground vs Background
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Foreground&lt;/strong&gt;: Blocks your main conversation. Permission prompts pass through to you. Use for tasks where you need oversight.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background&lt;/strong&gt;: Runs concurrently. Pre-approves permissions before launch. Auto-denies anything not pre-approved. Use for independent tasks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Press &lt;strong&gt;Ctrl+B&lt;/strong&gt; to background a running task on the fly. Useful when you realize a task is going to take a while and you want to keep working.&lt;/p&gt;

&lt;h3&gt;
  
  
  Parallel Execution
&lt;/h3&gt;

&lt;p&gt;Issue multiple subagent tasks in a single message and they run concurrently. For example: "Review the auth module for security issues, run the test suite for the API layer, and check the database migration for breaking changes" -- three subagents, running simultaneously, each with clean context.&lt;/p&gt;

&lt;p&gt;For sustained parallelism across a large codebase, use Agent Teams instead -- one session acts as team lead, coordinating teammates who each work in their own 200K-token context window.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Slash Commands: The Complete Cheatsheet
&lt;/h2&gt;

&lt;p&gt;Claude Code has 50+ built-in commands. You don't need to memorize all of them. Here are the ones that actually matter:&lt;/p&gt;

&lt;h3&gt;
  
  
  Essential Commands
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What It Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/compact [instructions]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Compress conversation, optionally focusing on specific topics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/clear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Nuke conversation history and start fresh&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/model [model]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switch models mid-session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/cost&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;See token usage and spend&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/diff&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Interactive diff viewer for all changes in the session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/rewind&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Revert conversation and code to a previous checkpoint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/plan [description]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enter plan mode (read-only research before execution)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/context&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Visualize context usage as a colored grid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/memory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Browse and edit CLAUDE.md and auto-memory files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/permissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;View and update permission rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/export [filename]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Export the conversation as plain text&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/resume [session]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pick up where you left off in a previous session&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Hidden Gems Most People Miss
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Why It Matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/btw &amp;lt;question&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Ask a quick side question -- uses full context but no tools, and the answer gets discarded from history. Perfect for "btw, what does this function do?" without polluting your conversation.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;`/effort [low\&lt;/td&gt;
&lt;td&gt;medium\&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;{% raw %}`/fast [on\&lt;/td&gt;
&lt;td&gt;off]`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/batch &amp;lt;instruction&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The big one. Spawns parallel background agents in isolated git worktrees, each handling one unit of work, each opening its own PR. For large-scale refactors across many files.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/loop [interval] &amp;lt;prompt&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run a prompt repeatedly on a timer. &lt;code&gt;/loop 5m check if the deploy finished&lt;/code&gt;. Session-scoped, auto-expires after 3 days.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/branch [name]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fork the conversation at the current point. Great for exploring two approaches without losing either.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/security-review&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Analyze your branch changes for security vulnerabilities before you merge.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/remote-control&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Make your local session available from claude.ai, iOS, or Android. Control your coding agent from your phone.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/insights&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generate a report analyzing your usage patterns. Find out where your time goes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/voice&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Push-to-talk voice input, tuned for coding vocabulary.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Custom Slash Commands (Skills)
&lt;/h3&gt;

&lt;p&gt;You can create your own slash commands. The old &lt;code&gt;.claude/commands/&lt;/code&gt; system has been merged into skills. Create a file at &lt;code&gt;.claude/skills/deploy/SKILL.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy the application to production&lt;/span&gt;
&lt;span class="na"&gt;disable-model-invocation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;allowed-tools&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Bash(gh *)&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="na"&gt;Deploy $ARGUMENTS to production&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="s"&gt;1. Run the test suite&lt;/span&gt;
&lt;span class="s"&gt;2. Build the application&lt;/span&gt;
&lt;span class="s"&gt;3. Push to the deployment target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;/deploy staging&lt;/code&gt; is a command. The &lt;code&gt;disable-model-invocation: true&lt;/code&gt; flag means only you can trigger it -- Claude won't accidentally deploy during a normal conversation.&lt;/p&gt;

&lt;p&gt;Skills support dynamic context injection too. Wrap shell commands in &lt;code&gt;!`command`&lt;/code&gt; and the output gets injected before Claude sees the prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pr-summary&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;PR diff&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!&lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="s"&gt;gh pr diff`&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Changed files&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!&lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="s"&gt;gh pr diff --name-only`&lt;/span&gt;

&lt;span class="s"&gt;Summarize this PR for the team.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Skill locations follow the same pattern as everything else: &lt;code&gt;~/.claude/skills/&lt;/code&gt; for global, &lt;code&gt;.claude/skills/&lt;/code&gt; for project-level.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Memory: How It Remembers Your Project
&lt;/h2&gt;

&lt;p&gt;Claude Code has two memory systems that work together. Understanding both -- and what goes where -- is one of the biggest Claude Code best practices for getting consistent results.&lt;/p&gt;

&lt;h3&gt;
  
  
  CLAUDE.md: The Instructions You Write
&lt;/h3&gt;

&lt;p&gt;CLAUDE.md is the file where you tell Claude how to work in your project. It's loaded at the start of every session. Think of it as the onboarding doc you'd give a new developer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hierarchy:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;th&gt;Who Sees It&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Managed policy&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/Library/Application Support/ClaudeCode/CLAUDE.md&lt;/code&gt; (macOS)&lt;/td&gt;
&lt;td&gt;All org users&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Project&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;./CLAUDE.md&lt;/code&gt; or &lt;code&gt;./.claude/CLAUDE.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Team (via git)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~/.claude/CLAUDE.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Just you&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Files in your directory hierarchy above the working directory load in full at launch. Files in subdirectories load on demand when Claude reads files there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What to put in CLAUDE.md:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build and test commands (things Claude can't infer)&lt;/li&gt;
&lt;li&gt;Code style conventions&lt;/li&gt;
&lt;li&gt;Project architecture and file organization&lt;/li&gt;
&lt;li&gt;Git workflow rules&lt;/li&gt;
&lt;li&gt;Common workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What NOT to put in CLAUDE.md:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Things Claude already does correctly (every unnecessary line dilutes the ones that matter)&lt;/li&gt;
&lt;li&gt;Vague guidance ("be careful" adds nothing)&lt;/li&gt;
&lt;li&gt;Anything that must happen 100% of the time (make it a hook instead)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The budget is real&lt;/strong&gt;: Keep it under 200 lines per file. Claude's compliance drops noticeably past 150-200 instructions. Use the &lt;code&gt;@path/to/file&lt;/code&gt; import syntax to pull in additional files without bloating the main CLAUDE.md. HTML comments are stripped before injection, so you can leave notes for humans without wasting tokens.&lt;/p&gt;

&lt;h3&gt;
  
  
  Auto Memory: What Claude Writes For Itself
&lt;/h3&gt;

&lt;p&gt;Auto memory lets Claude accumulate knowledge across sessions without you writing anything. As Claude works, it saves notes: build commands that worked, debugging insights, discovered preferences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it lives:&lt;/strong&gt; &lt;code&gt;~/.claude/projects/&amp;lt;project&amp;gt;/memory/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.claude/projects/&amp;lt;project&amp;gt;/memory/
  MEMORY.md          # Index file (first 200 lines loaded every session)
  debugging.md       # Topic file (loaded on demand)
  api-conventions.md # Topic file (loaded on demand)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first 200 lines of MEMORY.md (or 25KB, whichever comes first) load at session start. Topic files load on demand when Claude needs them.&lt;/p&gt;

&lt;p&gt;Between sessions, an &lt;strong&gt;AutoDream&lt;/strong&gt; process runs automatically -- pruning stale entries, merging related info, and refreshing to reflect the current project state. It's like memory consolidation during sleep.&lt;/p&gt;

&lt;p&gt;Manage it with &lt;code&gt;/memory&lt;/code&gt; to browse files and toggle auto-memory on/off. Or disable it entirely with &lt;code&gt;autoMemoryEnabled: false&lt;/code&gt; in settings.&lt;/p&gt;

&lt;p&gt;Subagents can maintain their own persistent memory too, via the &lt;code&gt;memory&lt;/code&gt; frontmatter field -- scoped to &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;project&lt;/code&gt;, or &lt;code&gt;local&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto Mode: The Middle Ground
&lt;/h2&gt;

&lt;p&gt;There's always been a tension in Claude Code's permission model. The default mode asks you to approve every file edit, every command, every action. It's safe but slow -- you end up mashing Enter through approvals. The alternative, &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;, removes all guardrails. Fast but terrifying.&lt;/p&gt;

&lt;p&gt;Auto mode, announced March 24, 2026, splits the difference.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;p&gt;Before each tool call, an internal safety classifier evaluates the action:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Safe actions&lt;/strong&gt; (reading files, writing code, running tests): proceed automatically, no approval needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risky actions&lt;/strong&gt; (mass file deletion, data exfiltration, malicious code execution): blocked entirely. Claude gets redirected to a different approach.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't configure the categories. The classifier handles it. Anthropic is upfront about limitations: it may occasionally allow ambiguous actions or block benign ones. There's a small impact on token consumption and latency.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Enable
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;CLI&lt;/strong&gt;: &lt;code&gt;claude --enable-auto-mode&lt;/code&gt;, then cycle to it using &lt;strong&gt;Shift+Tab&lt;/strong&gt; during a session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Desktop/VS Code&lt;/strong&gt;: Toggle in Settings, then select from the permission mode dropdown.&lt;/p&gt;

&lt;p&gt;Currently available as a research preview on the Team plan, with Enterprise and API support coming soon. Anthropic recommends using it in isolated environments (containers, VMs, worktrees) for maximum safety.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to Use What
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Default mode&lt;/strong&gt;: When you're learning, or working on sensitive production code and want oversight on every change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto mode&lt;/strong&gt;: Daily development work. You trust the agent but want guardrails against catastrophic mistakes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;&lt;/strong&gt;: Isolated CI environments, throwaway branches, or when you truly don't care. Never on production.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Claude Code Tips: 10 Things Most People Miss
&lt;/h2&gt;

&lt;p&gt;Rapid-fire practical stuff. Each of these individually saves you time. Together they compound.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;/compact&lt;/code&gt; with focus instructions.&lt;/strong&gt; Don't just compact blindly. Run &lt;code&gt;/compact focus on the auth refactor and database changes&lt;/code&gt; to tell Claude what to preserve when it compresses context. The difference in continuity is dramatic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Git worktrees for parallel agents.&lt;/strong&gt; &lt;code&gt;claude --worktree feature-x&lt;/code&gt; (or &lt;code&gt;-w feature-x&lt;/code&gt;) creates an isolated working copy. Run multiple Claude Code sessions against the same repo without file conflicts. The &lt;code&gt;/batch&lt;/code&gt; skill uses this automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. &lt;code&gt;/effort max&lt;/code&gt; for hard problems.&lt;/strong&gt; This unlocks extended thinking on Opus 4.6. Architecture decisions, complex debugging, multi-file refactors -- throw &lt;code&gt;max&lt;/code&gt; at them. The thinking quality difference is real.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. &lt;code&gt;/fast&lt;/code&gt; for quick tasks.&lt;/strong&gt; Toggle fast mode when you need a quick answer or simple edit. Don't waste Opus-level thinking on "rename this variable."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. MCP Tool Search auto-activates.&lt;/strong&gt; When your loaded tool definitions exceed 10% of context (common if you use multiple MCP servers), Tool Search kicks in automatically. It reduces token overhead by 85% by only loading tool schemas when they're actually needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. &lt;code&gt;/remote-control&lt;/code&gt; from your phone.&lt;/strong&gt; Run &lt;code&gt;/rc&lt;/code&gt;, scan the QR code, and control your local Claude Code session from claude.ai or the mobile app. Your files never leave your machine -- only chat messages and tool results flow through an encrypted bridge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. &lt;code&gt;/loop&lt;/code&gt; for monitoring.&lt;/strong&gt; &lt;code&gt;/loop 5m check if the deploy finished and notify me&lt;/code&gt;. &lt;code&gt;/loop 1h summarize new errors in the log&lt;/code&gt;. Session-scoped, max 50 tasks, auto-expires after 3 days. Fires between your turns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. &lt;code&gt;/batch&lt;/code&gt; for large-scale changes.&lt;/strong&gt; When you need the same change across 20 files or 10 services, &lt;code&gt;/batch&lt;/code&gt; spawns one background agent per unit of work, each in an isolated git worktree, each opening its own PR. This is the Claude Code workflow for large refactors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Voice dictation works.&lt;/strong&gt; &lt;code&gt;/voice&lt;/code&gt; enables push-to-talk. Hold spacebar to speak, release to send. The transcription is tuned for coding vocabulary -- it handles "regex," "OAuth," "localhost," and function names surprisingly well. Mix voice and typing in the same message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. &lt;code&gt;/insights&lt;/code&gt; reveals your patterns.&lt;/strong&gt; Generate a report analyzing your Claude Code usage. Find out which tasks eat the most tokens, which workflows are most efficient, and where you're wasting time. Data-driven improvement for your AI-assisted coding workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Ideal Claude Code Workflow
&lt;/h2&gt;

&lt;p&gt;Here's how all these pieces fit together into a coherent Claude Code workflow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with CLAUDE.md.&lt;/strong&gt; Set up your project instructions -- build commands, architecture notes, coding standards. Keep it under 200 lines. Use imports for anything beyond that. Run &lt;code&gt;/init&lt;/code&gt; if you're starting fresh.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add hooks for the non-negotiables.&lt;/strong&gt; Linting after every edit. Blocking destructive git commands. Environment setup on directory change. Anything that must happen 100% of the time is a hook, not an instruction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create subagents for repeated tasks.&lt;/strong&gt; Code review, test writing, documentation -- if you delegate the same type of work repeatedly, make it a subagent with the right model, tools, and instructions. They run in clean context and return summaries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build custom slash commands for your workflows.&lt;/strong&gt; &lt;code&gt;/deploy&lt;/code&gt;, &lt;code&gt;/pr-summary&lt;/code&gt;, &lt;code&gt;/release-notes&lt;/code&gt; -- whatever your team does repeatedly. Skills with &lt;code&gt;disable-model-invocation: true&lt;/code&gt; for dangerous operations so Claude can't trigger them accidentally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let auto memory handle the rest.&lt;/strong&gt; As Claude works in your project, it learns: which build commands work, what debugging approaches succeed, your implicit preferences. This accumulates across sessions automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use auto mode for flow.&lt;/strong&gt; Once you trust your hooks and subagents, auto mode lets you stay in flow without mashing Enter through approvals. The safety classifier catches the genuinely dangerous stuff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Go parallel when scale demands it.&lt;/strong&gt; Git worktrees (&lt;code&gt;-w&lt;/code&gt; flag) for running multiple sessions. &lt;code&gt;/batch&lt;/code&gt; for large-scale changes. Subagents for concurrent tasks within a session. Agent Teams for complex multi-part projects.&lt;/p&gt;

&lt;p&gt;The through-line is this: Claude Code's power features exist to move you from "human approving every action" to "human setting policy, AI executing within guardrails." Hooks enforce the rules. Subagents handle the delegation. Memory provides continuity. Auto mode removes the friction.&lt;/p&gt;

&lt;p&gt;That's not a chatbot. That's a coding partner.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;For more on Claude Code pricing and plans, see our &lt;a href="https://vibehackers.io/blog/claude-code-pricing" rel="noopener noreferrer"&gt;Claude Code pricing guide&lt;/a&gt;. For context engineering fundamentals, check our &lt;a href="https://vibehackers.io/blog/context-engineering-guide" rel="noopener noreferrer"&gt;context engineering guide&lt;/a&gt;. And for how it compares to the competition, read &lt;a href="https://vibehackers.io/blog/claude-code-vs-codex" rel="noopener noreferrer"&gt;Claude Code vs Codex&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Git Worktrees: From Running Multiple Agents to Real Multi-Agent Development</title>
      <dc:creator>Vibehackers</dc:creator>
      <pubDate>Thu, 26 Mar 2026 20:20:18 +0000</pubDate>
      <link>https://dev.to/vibehackers/git-worktrees-from-running-multiple-agents-to-real-multi-agent-development-7dh</link>
      <guid>https://dev.to/vibehackers/git-worktrees-from-running-multiple-agents-to-real-multi-agent-development-7dh</guid>
      <description>&lt;p&gt;incident.io estimated a task would take two hours. It took ten minutes. Not because their AI agent was unusually fast — because they ran five of them, truly in parallel, each one autonomous from start to finish. Each agent had its own branch, its own directory, its own ability to commit and push and open a PR without waiting for anyone.&lt;/p&gt;

&lt;p&gt;That's not how most of us run multiple agents today.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two terminals, one directory
&lt;/h2&gt;

&lt;p&gt;Most multi-agent setups look like this: two Claude Code sessions open, both pointed at the same project directory. Terminal one is building an API endpoint. Terminal two is writing tests. You keep an eye on both, make sure they're working on different files. When terminal one finishes, you commit its work. Then terminal two. You coordinate.&lt;/p&gt;

&lt;p&gt;This works. But you're doing something that doesn't scale: you're the synchronization layer. You're mentally partitioning the codebase, sequencing commits, tracking which agent is in which part of the code. With two agents it's manageable. With three it gets stressful. With five — the number incident.io runs daily — it's impossible.&lt;/p&gt;

&lt;p&gt;The difference between "running multiple agents" and actual multi-agent development is whether the agents can operate autonomously. Can each one own its workstream end-to-end — edit, commit, push, PR — without you coordinating anything? In a shared directory, the answer is no. Everything is mixed together: files, staging area, branch. You can't commit one agent's work without accidentally including the other's.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1930032748951154966-408" src="https://platform.twitter.com/embed/Tweet.html?id=1930032748951154966"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1930032748951154966-408');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1930032748951154966&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  What if each agent had its own directory?
&lt;/h2&gt;

&lt;p&gt;The obvious solution: give each agent its own copy of the codebase. One directory per agent. They can't collide because they're in completely separate folders, each on their own branch.&lt;/p&gt;

&lt;p&gt;The first instinct is &lt;code&gt;git clone&lt;/code&gt;. Clone the repo three times, point each agent at a different clone. This works. But the more you use it, the more it nags at you.&lt;/p&gt;

&lt;p&gt;The problem with clones isn't disk space or network bandwidth — storage is cheap, connections are fast. The problem is &lt;strong&gt;they're disconnected universes.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You commit something in Clone A. Can Clone B see it? No. You have to push to remote from A, then fetch from remote in B. There's no direct link between them. Every clone talks to the world through the remote, never to each other.&lt;/p&gt;

&lt;p&gt;You create a branch in Clone A. Clone B doesn't know it exists until you push it. You change a config file in Clone A. Clone B has the old config. You add an env variable in Clone A. Clone B doesn't have it. After a week you have three clones that have subtly drifted apart, and you spend twenty minutes debugging something that works fine — just not in the clone you're currently in.&lt;/p&gt;

&lt;p&gt;It's not a technical problem. It's a cognitive one. Three clones of the same repo means three contexts to keep in sync, and none of them do it automatically.&lt;/p&gt;

&lt;p&gt;There's a better primitive for this. It's built into git, and it solves exactly the problem clones create.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git worktree
&lt;/h2&gt;

&lt;p&gt;The command is &lt;code&gt;git worktree add&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree add ../my-project-feature &lt;span class="nt"&gt;-b&lt;/span&gt; feature/new-api
&lt;span class="go"&gt;Preparing worktree (new branch 'feature/new-api')
HEAD is now at a1b2c3d Latest commit on main
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This created two things: a &lt;strong&gt;new directory&lt;/strong&gt; at &lt;code&gt;../my-project-feature&lt;/code&gt;, and a &lt;strong&gt;new branch&lt;/strong&gt; called &lt;code&gt;feature/new-api&lt;/code&gt;. The new directory is a full checkout of your repo on that branch. You can &lt;code&gt;cd&lt;/code&gt; into it, edit files, run your dev server, do anything you normally do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; ../
&lt;span class="go"&gt;my-project/
my-project-feature/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two directories. You can open each in its own terminal, its own editor. Both are fully functional. But here's where it gets interesting. Look inside the new directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; .git
&lt;span class="go"&gt;gitdir: /Users/you/my-project/.git/worktrees/my-project-feature
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's not a &lt;code&gt;.git&lt;/code&gt; directory. It's a tiny &lt;code&gt;.git&lt;/code&gt; &lt;strong&gt;file&lt;/strong&gt; — one line, pointing back to the original repository's &lt;code&gt;.git&lt;/code&gt; folder. The new directory doesn't contain a copy of the git database. It doesn't have its own commit history. It doesn't have its own branches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It shares everything with the original.&lt;/strong&gt; This feature shipped in Git 2.5 back in 2015, and flew so far under the radar that even Guido van Rossum only discovered it years later:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1379893622145871873-869" src="https://platform.twitter.com/embed/Tweet.html?id=1379893622145871873"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1379893622145871873-869');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1379893622145871873&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  What's shared and what isn't
&lt;/h2&gt;

&lt;p&gt;This is the part that matters.&lt;/p&gt;

&lt;p&gt;When you create a worktree, it shares the &lt;strong&gt;entire git object database&lt;/strong&gt; with the original. Every commit, every branch, every tag — one copy, shared across all worktrees. A commit made in any worktree is instantly visible from every other worktree. No pushing, no fetching, no syncing. Because there's nothing &lt;em&gt;to&lt;/em&gt; sync — it's the same database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;-1&lt;/span&gt; main
&lt;span class="go"&gt;f4e5d6c A commit made in the other directory just now
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That commit appeared without any &lt;code&gt;git pull&lt;/code&gt;. It was made in &lt;code&gt;~/my-project&lt;/code&gt;, but it's visible here because both directories are reading from the same &lt;code&gt;.git&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What's &lt;strong&gt;not&lt;/strong&gt; shared: the files on disk, the staging area, and which branch is checked out. Each worktree has its own working directory, its own index, its own HEAD. They're independent workspaces that happen to share a backend.&lt;/p&gt;

&lt;p&gt;Think of it this way. A git repo is a &lt;strong&gt;database&lt;/strong&gt;. Normally you interact with it through one working directory — one set of files, one staging area, one branch. A worktree is a second interface to the same database. A second set of files, a second staging area, a second branch. As many interfaces as you want, all reading from and writing to the same store.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem worktrees already solved
&lt;/h2&gt;

&lt;p&gt;Before AI agents entered the picture, developers had this problem for decades. You're deep in a feature branch — halfway through a refactor, files changed everywhere, nothing compiles. Then Slack lights up: production bug, needs a hotfix now.&lt;/p&gt;

&lt;p&gt;What do you do?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 1: &lt;code&gt;git stash&lt;/code&gt;.&lt;/strong&gt; You stash your work-in-progress, switch to &lt;code&gt;main&lt;/code&gt;, make the fix, commit, push, switch back, &lt;code&gt;git stash pop&lt;/code&gt;. Sounds clean. In practice, stash is a footgun. Stash doesn't track which branch you were on. It doesn't save untracked files unless you remember &lt;code&gt;--include-untracked&lt;/code&gt;. Pop a stash onto the wrong branch and you're untangling merge conflicts in code you weren't even working on. People have lost days of work to stash mishaps — GitHub Desktop had a bug that silently wiped stashed changes, and VS Code users have reported stashes vanishing after updates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 2: WIP commit.&lt;/strong&gt; You commit half-broken code with a message like &lt;code&gt;wip don't look at this&lt;/code&gt;, switch branches, fix the bug, switch back, then try to remember what state you were in. Your git history looks like a crime scene.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 3: Just context-switch.&lt;/strong&gt; Discard your mental state, handle the hotfix, come back an hour later and spend twenty minutes remembering where you were. This is what most people actually do. It's expensive in ways that don't show up on any dashboard.&lt;/p&gt;

&lt;p&gt;Worktrees make all three options unnecessary. You keep your feature branch exactly as it is — mid-refactor, broken tests, whatever — and open a second worktree on &lt;code&gt;main&lt;/code&gt;. Fix the bug there. Commit, push. Close the worktree. Your feature branch never noticed anything happened. No stashing, no WIP commits, no context-switching.&lt;/p&gt;

&lt;p&gt;The same applies to code review. Someone opens a PR and you want to actually run their code, not just read the diff. Without worktrees: stash your work, switch branches, &lt;code&gt;npm install&lt;/code&gt; (because they added a dependency), run the code, switch back, &lt;code&gt;npm install&lt;/code&gt; again (because your branch has different dependencies), pop stash. With worktrees: open their branch in a second directory, run it there. Your work is untouched.&lt;/p&gt;

&lt;p&gt;Worktrees have been in git since 2015. For eleven years, they've been solving these exact problems — and most developers never knew.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this isn't just a party trick
&lt;/h2&gt;

&lt;p&gt;OK so git has this feature. Two directories, shared database. Cute.&lt;/p&gt;

&lt;p&gt;Let me bring it back to the thing that was nagging you earlier.&lt;/p&gt;

&lt;p&gt;Remember the coordination work? Making sure agents don't edit the same files, sequencing commits, switching branches between agents? That coordination exists because &lt;strong&gt;all your agents share one set of files on disk.&lt;/strong&gt; One staging area. One branch. There's only one "workspace," and every agent is operating inside it simultaneously.&lt;/p&gt;

&lt;p&gt;With worktrees, each agent gets its own workspace. Its own files, its own staging area, its own branch. Agent 1 can freely edit &lt;code&gt;package.json&lt;/code&gt;, commit, and push — while Agent 2 is doing the exact same thing in its own worktree, on its own branch. They can't collide because they're not touching the same files. Not "they probably won't collide" — they &lt;em&gt;structurally cannot.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And here's what that unlocks: &lt;strong&gt;you can let go.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can tell an agent "build this feature, commit when you're done, push the branch, open a PR." And then forget about it. You don't need to watch it. You don't need to coordinate it with other agents. You don't need to stage its files separately. It owns its workstream from start to finish.&lt;/p&gt;

&lt;p&gt;That's the difference between "running multiple agents" and "multi-agent development." It's not a difference in tools. It's a difference in how much autonomy you can give each agent. And autonomy requires isolation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the tools already do
&lt;/h2&gt;

&lt;p&gt;This isn't theory. The major &lt;a href="https://vibehackers.io/blog/best-ai-coding-assistants" rel="noopener noreferrer"&gt;AI coding tools&lt;/a&gt; have already built worktree support into their core workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code
&lt;/h3&gt;

&lt;p&gt;When you run &lt;a href="https://vibehackers.io/blog/claude-code-vs-cursor" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt; with the &lt;code&gt;--worktree&lt;/code&gt; flag, you pass it a name — any name you choose. Claude creates two things: a directory and a branch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; billing-api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a worktree directory at &lt;code&gt;.claude/worktrees/billing-api/&lt;/code&gt; and a branch called &lt;code&gt;worktree-billing-api&lt;/code&gt;. Claude then starts a session inside that directory, isolated from your main codebase.&lt;/p&gt;

&lt;p&gt;Why &lt;code&gt;.claude/worktrees/&lt;/code&gt;? It's a convention. The &lt;code&gt;.claude/&lt;/code&gt; directory is already in your &lt;code&gt;.gitignore&lt;/code&gt; (it stores Claude's project-level config), so worktrees created inside it don't clutter your project root. You could put worktrees anywhere — &lt;code&gt;../billing-api&lt;/code&gt;, &lt;code&gt;/tmp/billing-api&lt;/code&gt;, wherever. Claude just picks a sensible default.&lt;/p&gt;

&lt;p&gt;When Claude finishes and you close the session: if it made no changes, the worktree and branch are cleaned up automatically. If it committed work, Claude asks if you want to keep or remove the worktree. The branch (with its commits) stays either way — your work is safe.&lt;/p&gt;

&lt;p&gt;Boris Cherny, who built Claude Code, calls worktrees his &lt;strong&gt;"number one productivity tip"&lt;/strong&gt; — he runs three to five simultaneously:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-2025007393290272904-781" src="https://platform.twitter.com/embed/Tweet.html?id=2025007393290272904"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-2025007393290272904-781');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2025007393290272904&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;Running multiple agents is just opening multiple terminals:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; auth-fix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; billing-api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; test-coverage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three agents, three worktrees, three branches. Each agent can edit files, install packages, run tests, commit, push, and open PRs — all without you coordinating anything.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cursor
&lt;/h3&gt;

&lt;p&gt;Cursor 2.0 shipped parallel agents in October 2025, powered by git worktrees under the hood. Each of Cursor's up to eight parallel agents operates in its own worktree. You can even spin up multiple agents on the &lt;em&gt;same task&lt;/em&gt; and compare their outputs.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1979568674433564886-363" src="https://platform.twitter.com/embed/Tweet.html?id=1979568674433564886"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1979568674433564886-363');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1979568674433564886&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h3&gt;
  
  
  VS Code + Copilot
&lt;/h3&gt;

&lt;p&gt;VS Code 1.107 added automatic worktree isolation for background agents. When a Copilot background agent starts working, VS Code silently creates a worktree for it.&lt;/p&gt;

&lt;h3&gt;
  
  
  OpenAI Codex
&lt;/h3&gt;

&lt;p&gt;Codex added built-in worktree support too:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-2018385865207419124-766" src="https://platform.twitter.com/embed/Tweet.html?id=2018385865207419124"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-2018385865207419124-766');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2018385865207419124&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;Every major AI coding tool converged on the same primitive. That's not coincidence — it's because worktrees solve the right problem at the right layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  A real workflow, step by step
&lt;/h2&gt;

&lt;p&gt;Let's walk through a full multi-agent session. You have a feature to ship — a notification system — and you want to break it into three parallel workstreams.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Launch three agents, each in its own worktree:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; notif-api
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; notif-ui
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; notif-tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind the scenes, this creates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree list
&lt;span class="go"&gt;/Users/you/my-project                                    abc1234 [main]
/Users/you/my-project/.claude/worktrees/notif-api        abc1234 [worktree-notif-api]
/Users/you/my-project/.claude/worktrees/notif-ui         abc1234 [worktree-notif-ui]
/Users/you/my-project/.claude/worktrees/notif-tests      abc1234 [worktree-notif-tests]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each agent works independently. They install their own dependencies, make their own commits, run their own tests. You go get coffee.&lt;/p&gt;

&lt;p&gt;When they're done, each branch has a clean set of commits. You merge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git merge worktree-notif-api
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git merge worktree-notif-ui
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git merge worktree-notif-tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or better — each agent pushes its branch and opens a PR. You review and merge through GitHub. Same workflow you use with human teammates.&lt;/p&gt;

&lt;p&gt;Cleanup is automatic if you used &lt;code&gt;claude --worktree&lt;/code&gt;. If you created worktrees manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree remove .claude/worktrees/notif-api
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree remove .claude/worktrees/notif-ui
&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree remove .claude/worktrees/notif-tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Teams at &lt;a href="https://incident.io/blog/shipping-faster-with-claude-code-and-git-worktrees" rel="noopener noreferrer"&gt;incident.io&lt;/a&gt; run this workflow daily — four to five agents in parallel. A task estimated at 2 hours done in 10 minutes. Not because the agents are faster. Because five autonomous agents is a different kind of leverage than one agent you're babysitting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things to know
&lt;/h2&gt;

&lt;p&gt;A few constraints and gotchas worth knowing before you start.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Each worktree needs its own &lt;code&gt;npm install&lt;/code&gt;.&lt;/strong&gt; The git database is shared, but &lt;code&gt;node_modules&lt;/code&gt;, build caches, &lt;code&gt;.next&lt;/code&gt; — all per-directory. Each worktree is a full working directory, so it needs its own dependencies installed. For a typical Node.js project that's 200-500MB per worktree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One branch per worktree.&lt;/strong&gt; Git enforces this — you can't check out &lt;code&gt;main&lt;/code&gt; in two worktrees at the same time. If you try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree add ../another main
&lt;span class="go"&gt;fatal: 'main' is already checked out at '/Users/you/my-project'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is intentional. Two worktrees modifying the same branch would corrupt state. The constraint forces each workstream onto its own branch — which is what you want anyway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port conflicts.&lt;/strong&gt; If agents try to run dev servers, they'll fight over the same port. Give each worktree a different port in its &lt;code&gt;.env&lt;/code&gt;, or let your framework pick one automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Merge conflicts happen at merge time, not runtime.&lt;/strong&gt; If two agents both modify &lt;code&gt;package.json&lt;/code&gt; on different branches, you'll resolve the conflict when you merge — same as with any branching workflow. The difference is you're resolving it once, cleanly, instead of discovering it mid-session when both agents are still running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't &lt;code&gt;rm -rf&lt;/code&gt; a worktree directory.&lt;/strong&gt; Use &lt;code&gt;git worktree remove&lt;/code&gt;. If you do delete it manually, &lt;code&gt;git worktree prune&lt;/code&gt; cleans up the stale metadata.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where to put worktrees.&lt;/strong&gt; Claude Code defaults to &lt;code&gt;.claude/worktrees/&lt;/code&gt; — already gitignored, since &lt;code&gt;.claude/&lt;/code&gt; stores project config. Some teams prefer &lt;code&gt;.worktrees/&lt;/code&gt; at the project root — one gitignore entry, tool-agnostic, works with Cursor or &lt;a href="https://docs.cline.bot/features/worktrees" rel="noopener noreferrer"&gt;Cline&lt;/a&gt; or whatever you're running next month. Others use sibling directories (&lt;code&gt;../my-project-feature&lt;/code&gt;), the traditional git approach that doesn't need any gitignore at all. Pick one and be consistent. When your team runs five agents daily, everyone should know where to look.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond the basics
&lt;/h2&gt;

&lt;p&gt;Once worktrees click, some interesting patterns emerge.&lt;/p&gt;

&lt;h3&gt;
  
  
  The race
&lt;/h3&gt;

&lt;p&gt;Spin up multiple agents on the &lt;strong&gt;same task&lt;/strong&gt;, each in its own worktree. Compare the results. Keep the best implementation. Cursor 2.0 was built around this idea.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent teams
&lt;/h3&gt;

&lt;p&gt;Claude Code has an experimental feature where a lead agent spawns teammates, each in their own worktree, with shared task lists and async messaging:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The lead breaks down a task, teammates claim subtasks, each works in isolation, and the lead merges the results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conflict detection
&lt;/h3&gt;

&lt;p&gt;Tools like &lt;a href="https://github.com/clash-sh/clash" rel="noopener noreferrer"&gt;clash&lt;/a&gt; can detect merge conflicts between worktrees &lt;em&gt;before they happen&lt;/em&gt; — using read-only three-way merges to warn you when two agents are touching the same code. You can even wire it up as a Claude Code hook that checks before every file write.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1913473027670786207-774" src="https://platform.twitter.com/embed/Tweet.html?id=1913473027670786207"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1913473027670786207-774');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1913473027670786207&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  Guardrails
&lt;/h2&gt;

&lt;p&gt;Worktrees give agents isolation. They don't give agents judgment.&lt;/p&gt;

&lt;p&gt;Nothing in Claude Code prevents an agent from running &lt;code&gt;git push --force&lt;/code&gt;, &lt;code&gt;git reset --hard&lt;/code&gt;, or &lt;code&gt;rm -rf&lt;/code&gt; in its worktree. The isolation means it won't corrupt your main directory — but it can still destroy its own branch, push garbage to your remote, or wipe its own work. Cursor handles this differently: it forces a manual "Apply" step before any worktree changes touch your code. Claude Code trusts the agent by default.&lt;/p&gt;

&lt;p&gt;The fix is hooks. Claude Code's &lt;code&gt;PreToolUse&lt;/code&gt; hook fires before every tool execution — every shell command, every file edit, every write. If the hook exits with code 2, the action is blocked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PreToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bash"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".claude/hooks/git-safety.sh"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script inspects the command about to run and blocks destructive patterns — &lt;code&gt;git push --force&lt;/code&gt;, &lt;code&gt;git reset --hard&lt;/code&gt;, &lt;code&gt;git clean -f&lt;/code&gt;, &lt;code&gt;git branch -D&lt;/code&gt;. Matt Pocock published a ready-made version: &lt;a href="https://github.com/mattpocock/skills/tree/main/git-guardrails-claude-code" rel="noopener noreferrer"&gt;&lt;code&gt;git-guardrails-claude-code&lt;/code&gt;&lt;/a&gt;. Trail of Bits has a &lt;a href="https://github.com/trailofbits/claude-code-config" rel="noopener noreferrer"&gt;more opinionated config&lt;/a&gt; that also blocks credential reads and enforces feature branches.&lt;/p&gt;

&lt;p&gt;For worktree setup automation, &lt;code&gt;WorktreeCreate&lt;/code&gt; hooks fire whenever &lt;code&gt;--worktree&lt;/code&gt; is invoked. Teams use these to auto-copy &lt;code&gt;.env&lt;/code&gt; files, run &lt;code&gt;npm install&lt;/code&gt;, and assign deterministic port numbers so dev servers don't collide. The &lt;a href="https://github.com/tfriedel/claude-worktree-hooks" rel="noopener noreferrer"&gt;&lt;code&gt;claude-worktree-hooks&lt;/code&gt;&lt;/a&gt; project does all three — it hashes the branch name to pick a port in the 3100–9999 range, so each worktree gets its own port every time.&lt;/p&gt;

&lt;p&gt;One thing that works in your favor: &lt;strong&gt;git hooks are shared across all worktrees.&lt;/strong&gt; Every worktree points back to the same &lt;code&gt;.git&lt;/code&gt; directory, so a single &lt;code&gt;pre-push&lt;/code&gt; hook installed once protects every worktree automatically. No per-worktree configuration needed.&lt;/p&gt;

&lt;p&gt;And for cross-worktree conflict detection, wire &lt;a href="https://github.com/clash-sh/clash" rel="noopener noreferrer"&gt;clash&lt;/a&gt; into the same system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Write|Edit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"clash check"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every file write checks for conflicts with other worktrees first. The agent gets warned before it creates a merge problem, not after.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cheat sheet
&lt;/h2&gt;

&lt;p&gt;For reference — every command you need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree add &amp;lt;path&amp;gt; &lt;span class="nt"&gt;-b&lt;/span&gt; &amp;lt;new-branch&amp;gt;
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Create a new directory + new branch
&lt;span class="go"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree add &amp;lt;path&amp;gt; &amp;lt;existing-branch&amp;gt;
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Create a new directory &lt;span class="k"&gt;for &lt;/span&gt;an existing branch
&lt;span class="go"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree list
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Show all worktrees and their branches
&lt;span class="go"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree remove &amp;lt;path&amp;gt;
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Clean up a worktree when you&lt;span class="s1"&gt;'re done
&lt;/span&gt;&lt;span class="go"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git worktree prune
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Remove metadata &lt;span class="k"&gt;for &lt;/span&gt;worktrees that were manually deleted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; &amp;lt;name&amp;gt;
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Creates .claude/worktrees/&amp;lt;name&amp;gt;/ and branch worktree-&amp;lt;name&amp;gt;
&lt;span class="go"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Same, with an auto-generated name like bright-running-fox
&lt;span class="go"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; &amp;lt;name&amp;gt; &lt;span class="nt"&gt;--tmux&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Opens the worktree session &lt;span class="k"&gt;in &lt;/span&gt;a tmux pane
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What changes
&lt;/h2&gt;

&lt;p&gt;I want to end with what actually shifted for me.&lt;/p&gt;

&lt;p&gt;For a long time I thought of multi-agent development as "running multiple agents." Two terminals, same directory, careful not to collide. It worked. I was productive. I didn't think I was missing anything.&lt;/p&gt;

&lt;p&gt;Worktrees didn't fix something that was broken. They showed me a workflow I didn't know existed — one where I dispatch tasks and review PRs, and the coordination between agents is handled by git itself. Each agent gets a branch. Each branch gets a directory. Each directory is an isolated workspace. That's it. Git already knows how to merge branches. It's been doing it for twenty years.&lt;/p&gt;

&lt;p&gt;The interesting part isn't the technology. It's the shift in what you do. You stop managing files and start managing outcomes. You stop being the synchronization layer and start being the decision-maker. Five agents, five worktrees, five PRs. You review, you merge, you ship.&lt;/p&gt;

&lt;p&gt;Start with one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; my-first-worktree
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then try two. You'll feel the difference immediately.&lt;/p&gt;

</description>
      <category>git</category>
      <category>ai</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Context Engineering: The Complete Guide for AI-Assisted Coding (2026)</title>
      <dc:creator>Vibehackers</dc:creator>
      <pubDate>Thu, 26 Mar 2026 19:51:06 +0000</pubDate>
      <link>https://dev.to/vibehackers/context-engineering-the-complete-guide-for-ai-assisted-coding-2026-13m6</link>
      <guid>https://dev.to/vibehackers/context-engineering-the-complete-guide-for-ai-assisted-coding-2026-13m6</guid>
      <description>&lt;p&gt;If you've been using AI coding tools and wondering why results are inconsistent — brilliant one session, garbage the next — the answer isn't the model. It's the context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context engineering&lt;/strong&gt; is the discipline of curating the entire information environment an AI agent operates within. Not just what you type in the prompt box. Everything: the files it reads, the rules it follows, the history it carries, the tools it can reach, and the structure of the project it navigates.&lt;/p&gt;

&lt;p&gt;The term was popularized by Shopify CEO &lt;a href="https://x.com/tobi/status/1935533422589399127" rel="noopener noreferrer"&gt;Tobi Lutke&lt;/a&gt; in mid-2025:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1935533422589399127-626" src="https://platform.twitter.com/embed/Tweet.html?id=1935533422589399127"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1935533422589399127-626');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1935533422589399127&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;&lt;a href="https://x.com/karpathy/status/1937902205765607626" rel="noopener noreferrer"&gt;Andrej Karpathy&lt;/a&gt; endorsed it immediately, adding crucial nuance:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1937902205765607626-30" src="https://platform.twitter.com/embed/Tweet.html?id=1937902205765607626"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1937902205765607626-30');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1937902205765607626&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;He enumerated what "doing this right" involves: task descriptions, few-shot examples, RAG, related data, tools, state and history, and compacting. Then the critical caveat: &lt;em&gt;"Too much or too irrelevant context can increase costs and degrade performance."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;That last point is the one most people miss. Context engineering isn't about giving the AI &lt;em&gt;more&lt;/em&gt; information. It's about giving it &lt;em&gt;the right&lt;/em&gt; information.&lt;/p&gt;

&lt;p&gt;By February 2026, Karpathy took the terminology further — coining &lt;a href="https://thenewstack.io/vibe-coding-is-passe/" rel="noopener noreferrer"&gt;"agentic engineering"&lt;/a&gt; as the next evolution beyond vibe coding, describing a workflow where "you are not writing the code directly 99% of the time... you are orchestrating agents who do and acting as oversight."&lt;/p&gt;

&lt;p&gt;The progression is clear:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;What You Do&lt;/th&gt;
&lt;th&gt;Core Skill&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Prompt engineering&lt;/td&gt;
&lt;td&gt;Write clever instructions&lt;/td&gt;
&lt;td&gt;Wordsmithing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Context engineering&lt;/td&gt;
&lt;td&gt;Curate the information environment&lt;/td&gt;
&lt;td&gt;Information architecture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agentic engineering&lt;/td&gt;
&lt;td&gt;Orchestrate autonomous agents&lt;/td&gt;
&lt;td&gt;Systems design&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each stage builds on the last. You can't do agentic engineering without context engineering. And context engineering is where most developers are right now — or should be.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Context Engineering Matters More Than Model Choice
&lt;/h2&gt;

&lt;p&gt;Here's a counterintuitive truth backed by research: &lt;strong&gt;a developer with a clean, well-structured context on a weaker model will outperform one with a cluttered context on a stronger model.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://research.trychroma.com/context-rot" rel="noopener noreferrer"&gt;Chroma Research&lt;/a&gt; tested 18 LLMs and found that across all models, accuracy drops as input length increases — even on simple tasks. The "Lost in the Middle" phenomenon (first identified by &lt;a href="https://arxiv.org/abs/2307.03172" rel="noopener noreferrer"&gt;Stanford researchers&lt;/a&gt;) shows LLMs attend strongly to tokens at the start and end of the context window but poorly to the middle.&lt;/p&gt;

&lt;p&gt;When a debugging session has loaded 20,000 tokens of irrelevant file contents and dead-end explorations, the actual relevant code — sitting somewhere in the middle — gets less attention.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;Anthropic's own best practices&lt;/a&gt; say it directly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Most best practices are based on one constraint: Claude's context window fills up fast, and performance degrades as it fills."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Google's context engineering whitepaper arrived at the same conclusion:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1989800577115525266-473" src="https://platform.twitter.com/embed/Tweet.html?id=1989800577115525266"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1989800577115525266-473');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1989800577115525266&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;The true intelligence of an agent doesn't come from the model — it comes from how you manage context.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://martinfowler.com/articles/exploring-gen-ai/context-engineering-coding-agents.html" rel="noopener noreferrer"&gt;Martin Fowler's team at ThoughtWorks&lt;/a&gt; studied this in practice and found an almost comically simple truth: all forms of AI coding context engineering ultimately involve "a bunch of markdown files with prompts." Two main categories — &lt;strong&gt;Instructions&lt;/strong&gt; (tell the agent what to do) and &lt;strong&gt;Skills&lt;/strong&gt; (resources the LLM loads on demand).&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-2019436508399403385-359" src="https://platform.twitter.com/embed/Tweet.html?id=2019436508399403385"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-2019436508399403385-359');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2019436508399403385&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;Simple in concept. Hard in practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Four Pillars Framework
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://inferencebysequoia.substack.com/p/vibe-coding-needs-context-engineering" rel="noopener noreferrer"&gt;Sequoia Capital's Inference newsletter&lt;/a&gt; published "Vibe Coding Needs Context Engineering" in July 2025, arguing that "intuition does not scale, structure does." They identified four pillars — a framework also developed independently by &lt;a href="https://blog.langchain.com/context-engineering-for-agents/" rel="noopener noreferrer"&gt;LangChain&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1937194145074020798-323" src="https://platform.twitter.com/embed/Tweet.html?id=1937194145074020798"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1937194145074020798-323');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1937194145074020798&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h3&gt;
  
  
  Pillar 1: Write Context
&lt;/h3&gt;

&lt;p&gt;Save persistent information &lt;em&gt;outside&lt;/em&gt; the context window. This is your CLAUDE.md, your &lt;code&gt;.cursor/rules/&lt;/code&gt;, your spec documents. Anything the agent needs to know every session gets written down once, not repeated every prompt.&lt;/p&gt;

&lt;p&gt;Think of it as the difference between telling a new team member your coding standards verbally every morning versus writing them in a wiki. The written version works whether you're there or not, whether it's the first day or the hundredth.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What to write down:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build and test commands the agent can't guess from reading code&lt;/li&gt;
&lt;li&gt;Code style rules that differ from language defaults&lt;/li&gt;
&lt;li&gt;Architecture decisions specific to your project&lt;/li&gt;
&lt;li&gt;Common gotchas and non-obvious behaviors&lt;/li&gt;
&lt;li&gt;Which tools and frameworks you're using and why&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What NOT to write:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anything the agent can figure out by reading your code&lt;/li&gt;
&lt;li&gt;Standard language conventions (TypeScript naming, Python PEP 8)&lt;/li&gt;
&lt;li&gt;Detailed API docs (link instead)&lt;/li&gt;
&lt;li&gt;File-by-file codebase descriptions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Pillar 2: Select Context
&lt;/h3&gt;

&lt;p&gt;Pull in only what's relevant for the current task. This is the hardest pillar because it requires judgment.&lt;/p&gt;

&lt;p&gt;Don't dump your entire codebase into the prompt. Don't paste 14 files "for reference." Targeted file reads, specific function references, relevant test outputs — not "here's everything, figure it out."&lt;/p&gt;

&lt;p&gt;Cursor's research on &lt;a href="https://cursor.com/blog/dynamic-context-discovery" rel="noopener noreferrer"&gt;Dynamic Context Discovery&lt;/a&gt; quantified this problem. In A/B testing, they found that rather than including all tools and context upfront, retrieving only tool names and fetching full details as needed &lt;strong&gt;reduced total agent tokens by 46.9%&lt;/strong&gt; — while maintaining or improving quality.&lt;/p&gt;

&lt;p&gt;The "token tax" is real. As &lt;a href="https://medium.com/@peakvance/guide-to-cursor-rules-engineering-context-speed-and-the-token-tax-16c0560a686a" rel="noopener noreferrer"&gt;one analysis&lt;/a&gt; found: in large projects with 20 global rules, developers might be sending 2,000 extra tokens with every message. Rules taking up 25% of the context window means the AI has 25% less space for actual source code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pillar 3: Compress Context
&lt;/h3&gt;

&lt;p&gt;Manage token usage through summarization and pruning. When a session gets long, compact it. When an exploration is done, clear the dead ends.&lt;/p&gt;

&lt;p&gt;Every token of noise competes with signal. A 200-token rule you added "just in case" is 200 tokens of source code your agent can't see.&lt;/p&gt;

&lt;p&gt;Practical compression techniques:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Compact conversations&lt;/strong&gt;: Claude Code's &lt;code&gt;/compact&lt;/code&gt; command summarizes the conversation, reducing tokens 50-70%. You can focus it: &lt;code&gt;/compact Focus on the API changes we discussed&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clear dead sessions&lt;/strong&gt;: &lt;code&gt;/clear&lt;/code&gt; deletes the entire conversation. Use it when switching tasks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summarize research&lt;/strong&gt;: When using subagents for exploration, they run in separate context windows and return summaries — keeping the parent context clean&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prune rules files&lt;/strong&gt;: If your CLAUDE.md or cursor rules exceed 300-500 lines, you're probably hurting more than helping&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Pillar 4: Isolate Context
&lt;/h3&gt;

&lt;p&gt;Structure information so it doesn't bleed across tasks. Use subagents for research (they run in separate context windows and report back summaries). Start fresh sessions for unrelated work.&lt;/p&gt;

&lt;p&gt;Don't let Monday's debugging contaminate Tuesday's feature build.&lt;/p&gt;

&lt;p&gt;As &lt;a href="https://www.philschmid.de/context-engineering" rel="noopener noreferrer"&gt;Philipp Schmid&lt;/a&gt; put it:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Prompt Engineering = Crafting perfect instruction strings. Context Engineering = Building systems that dynamically assemble comprehensive contextual information tailored to specific tasks."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Memory Layer: Rules Files That Actually Work
&lt;/h2&gt;

&lt;p&gt;Every major AI coding tool now has a mechanism for persistent context — a file (or set of files) that gets loaded automatically at the start of every session. This is the most important file in your project. More important than your README. More important than your config.&lt;/p&gt;

&lt;p&gt;Because it's the file that determines whether your AI agent understands your project or hallucinates about it.&lt;/p&gt;

&lt;h3&gt;
  
  
  CLAUDE.md (Claude Code)
&lt;/h3&gt;

&lt;p&gt;Claude Code reads &lt;code&gt;CLAUDE.md&lt;/code&gt; at the start of every session. It's the project's constitution — the rules that govern all AI behavior within your codebase.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;Anthropic's official docs&lt;/a&gt; are clear about what belongs here:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Include&lt;/th&gt;
&lt;th&gt;Exclude&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Build/test commands Claude can't guess&lt;/td&gt;
&lt;td&gt;Anything Claude can figure out from reading code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code style rules that differ from defaults&lt;/td&gt;
&lt;td&gt;Standard language conventions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Architectural decisions specific to your project&lt;/td&gt;
&lt;td&gt;Detailed API docs (link instead)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Common gotchas and non-obvious behaviors&lt;/td&gt;
&lt;td&gt;Information that changes frequently&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Developer environment quirks (env vars, etc.)&lt;/td&gt;
&lt;td&gt;File-by-file codebase descriptions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The official docs warn against the most common failure mode:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The over-specified CLAUDE.md. If your CLAUDE.md is too long, Claude ignores half of it because important rules get lost in the noise. Fix: Ruthlessly prune."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The hierarchy system:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;~/.claude/CLAUDE.md&lt;/code&gt; — global preferences (your personal coding style)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;./CLAUDE.md&lt;/code&gt; — project root (checked into git, shared with team)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;./CLAUDE.local.md&lt;/code&gt; — personal overrides (gitignored)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;./src/feature/CLAUDE.md&lt;/code&gt; — directory-scoped rules (only loaded when working in that directory)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Community consensus from &lt;a href="https://www.humanlayer.dev/blog/writing-a-good-claude-md" rel="noopener noreferrer"&gt;HumanLayer&lt;/a&gt;, &lt;a href="https://www.builder.io/blog/claude-md-guide" rel="noopener noreferrer"&gt;Builder.io&lt;/a&gt;, and &lt;a href="https://arize.com/blog/claude-md-best-practices-learned-from-optimizing-claude-code-with-prompt-learning/" rel="noopener noreferrer"&gt;Arize AI&lt;/a&gt;: keep it under 300 lines. Run &lt;code&gt;/init&lt;/code&gt; to auto-generate a starter from your codebase structure. Iterate based on actual agent behavior, not hypothetical scenarios.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# CLAUDE.md&lt;/span&gt;

&lt;span class="gu"&gt;## Build Commands&lt;/span&gt;
$ npm run dev          # Start dev server (Turbopack)
$ npm run test         # Run vitest
$ npm run lint:fix     # ESLint with auto-fix

&lt;span class="gu"&gt;## Architecture&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Next.js 15 App Router, TypeScript, Tailwind CSS
&lt;span class="p"&gt;-&lt;/span&gt; Supabase for DB + Auth + Storage
&lt;span class="p"&gt;-&lt;/span&gt; Feature-based directory structure: src/features/{name}/

&lt;span class="gu"&gt;## Code Style&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Use named exports, not default exports
&lt;span class="p"&gt;-&lt;/span&gt; Prefer server components; add 'use client' only when needed
&lt;span class="p"&gt;-&lt;/span&gt; All DB queries go through src/lib/db/ — never query Supabase directly from components

&lt;span class="gu"&gt;## Common Gotchas&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Supabase RLS is enabled on all tables — service role key required for admin operations
&lt;span class="p"&gt;-&lt;/span&gt; The &lt;span class="sb"&gt;`projects`&lt;/span&gt; table has a trigger that auto-updates &lt;span class="sb"&gt;`updated_at`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Image domains must be whitelisted in next.config.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://thomaslandgraf.substack.com/p/context-engineering-for-claude-code" rel="noopener noreferrer"&gt;Thomas Landgraf's deep dive&lt;/a&gt; covers advanced patterns: using CLAUDE.md to encode project-specific testing strategies, deployment pipelines, and even team communication preferences.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/coleam00/context-engineering-intro" rel="noopener noreferrer"&gt;Cole Medin's context-engineering-intro repo&lt;/a&gt; provides a hands-on starting point: "Context engineering is the new vibe coding — it's the way to actually make AI coding assistants work."&lt;/p&gt;

&lt;h3&gt;
  
  
  .cursor/rules/ (Cursor)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://cursor.com/docs/context/rules" rel="noopener noreferrer"&gt;Cursor's rules system&lt;/a&gt; is more granular than CLAUDE.md, with four types of rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Always Apply&lt;/strong&gt; — active every session (like CLAUDE.md)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply Intelligently&lt;/strong&gt; — agent decides relevance based on your description&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply to Specific Files&lt;/strong&gt; — triggered by glob patterns (e.g., only for &lt;code&gt;*.tsx&lt;/code&gt; files)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply Manually&lt;/strong&gt; — invoked via &lt;code&gt;@rule-name&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rules live in &lt;code&gt;.cursor/rules/*.mdc&lt;/code&gt; files. The &lt;a href="https://github.com/PatrickJS/awesome-cursorrules" rel="noopener noreferrer"&gt;awesome-cursorrules&lt;/a&gt; repo has community templates. Same official advice: keep content under 500 lines, decompose large rules into composable pieces.&lt;/p&gt;

&lt;p&gt;An &lt;a href="https://arxiv.org/html/2512.18925v2" rel="noopener noreferrer"&gt;empirical study of Cursor Rules&lt;/a&gt; analyzing thousands of repositories found that rules often grow organically and accumulate technical debt — just like code. The most effective teams treat their rules files as code: reviewing them in PRs, deleting stale instructions, and testing against actual agent behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  .github/copilot-instructions.md (Copilot)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot" rel="noopener noreferrer"&gt;GitHub Copilot's equivalent&lt;/a&gt;: a &lt;code&gt;.github/copilot-instructions.md&lt;/code&gt; file for repository-wide instructions, plus &lt;code&gt;.github/instructions/NAME.instructions.md&lt;/code&gt; files for path-specific rules.&lt;/p&gt;

&lt;h3&gt;
  
  
  AGENTS.md (Cross-Tool Standard)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://agents.md/" rel="noopener noreferrer"&gt;AGENTS.md&lt;/a&gt; is emerging as a cross-tool standard — recognized by Claude Code, Copilot, Cursor, and Gemini. Plain markdown, no metadata needed. If you work across multiple tools, this is the file that follows you everywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Research Actually Shows
&lt;/h2&gt;

&lt;p&gt;There's now academic evidence on whether these context files actually help. The results are nuanced — and important.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://arxiv.org/html/2511.12884v1" rel="noopener noreferrer"&gt;An empirical study of 2,303 agent context files&lt;/a&gt; from 1,925 repos found that these files function like configuration code: they evolve frequently via small additions and prioritize build commands (62.3%), implementation details (69.9%), and architecture (67.7%).&lt;/p&gt;

&lt;p&gt;But here's the counterintuitive finding: a &lt;a href="https://arxiv.org/abs/2602.11988" rel="noopener noreferrer"&gt;study evaluating AGENTS.md files&lt;/a&gt; found that context files can &lt;em&gt;reduce&lt;/em&gt; task success rates versus no context, while increasing inference cost by 20%+.&lt;/p&gt;

&lt;p&gt;The lesson isn't that context files don't work — it's that &lt;strong&gt;poorly maintained context files are worse than none&lt;/strong&gt;. Outdated instructions, contradictory rules, stale architecture descriptions — these actively mislead the agent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://simonwillison.net/2026/Feb/9/structured-context-engineering-for-file-native-agentic-systems/" rel="noopener noreferrer"&gt;Simon Willison highlighted&lt;/a&gt; a study of 9,649 experiments across 11 models comparing YAML, Markdown, JSON, and TOML formats for context delivery. The format matters less than the content quality — but structured formats consistently outperformed unstructured prose.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1938745355916714448-920" src="https://platform.twitter.com/embed/Tweet.html?id=1938745355916714448"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1938745355916714448-920');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1938745355916714448&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;&lt;a href="https://engineering.atspotify.com/2025/11/context-engineering-background-coding-agents-part-2" rel="noopener noreferrer"&gt;Spotify's engineering team&lt;/a&gt; documented this in their "Honk" background coding agent (1,500+ merged PRs). Their second blog post is entirely about context engineering — the architecture of hot-memory constitutions, specialized domain agents, and cold-memory specification documents that made the agent actually work at production scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Technique: Dynamic Context Discovery
&lt;/h2&gt;

&lt;p&gt;Static context — rules that load every session regardless of task — is the simplest approach. But it doesn't scale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cursor.com/blog/dynamic-context-discovery" rel="noopener noreferrer"&gt;Cursor's Dynamic Context Discovery&lt;/a&gt; represents the next evolution. Instead of loading everything upfront:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The agent starts with a lightweight index of available tools and context&lt;/li&gt;
&lt;li&gt;It identifies what's relevant to the current task&lt;/li&gt;
&lt;li&gt;It fetches full details only for what it needs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The results in &lt;a href="https://www.infoq.com/news/2026/01/cursor-dynamic-context-discovery/" rel="noopener noreferrer"&gt;their A/B test&lt;/a&gt;: 46.9% reduction in total tokens used, with no quality degradation.&lt;/p&gt;

&lt;p&gt;Claude Code's skills system works similarly. &lt;a href="https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices" rel="noopener noreferrer"&gt;Skills&lt;/a&gt; are context that loads on demand — when the agent determines it's relevant to the current task. Instead of cramming everything into CLAUDE.md, you decompose context into modular, task-specific units.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://towardsdatascience.com/claude-skills-and-subagents-escaping-the-prompt-engineering-hamster-wheel/" rel="noopener noreferrer"&gt;Towards Data Science covered this pattern&lt;/a&gt; as "escaping the prompt engineering hamster wheel" — moving from ever-longer instructions to composable, reusable context modules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Session Management: When to Clear and When to Keep Going
&lt;/h2&gt;

&lt;p&gt;The most underrated context engineering skill is knowing when to throw away your context and start fresh.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;Anthropic's docs&lt;/a&gt; name specific trigger conditions:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If you've corrected Claude more than twice on the same issue in one session, the context is cluttered with failed approaches. Run &lt;code&gt;/clear&lt;/code&gt; and start fresh with a more specific prompt."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The four signals it's time for &lt;code&gt;/clear&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Switching to unrelated tasks&lt;/strong&gt; — don't let feature work context bleed into bug fixing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After two failed corrections&lt;/strong&gt; — the failed attempts are polluting the context&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After "kitchen sink" sessions&lt;/strong&gt; — you've mixed too many topics&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When performance visibly decreases&lt;/strong&gt; — responses get generic, instructions get forgotten&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;/clear&lt;/code&gt; vs &lt;code&gt;/compact&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/clear&lt;/code&gt;&lt;/strong&gt; — nuclear option. Deletes entire conversation. CLAUDE.md re-loads fresh&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/compact [instructions]&lt;/code&gt;&lt;/strong&gt; — surgical option. Summarizes the conversation (50-70% reduction). You can focus: &lt;code&gt;/compact Focus on the API changes we discussed&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://lucumr.pocoo.org/2025/7/30/things-that-didnt-work/" rel="noopener noreferrer"&gt;Armin Ronacher&lt;/a&gt; adds an important exception: don't clear when the failure history itself is valuable. If the agent has tried and failed a specific approach, that context prevents it from repeating the same mistake. The art is knowing whether failed attempts are useful signal or useless noise.&lt;/p&gt;

&lt;p&gt;For long-running work, start a fresh session after approximately 30 messages, and always write key decisions to your context files &lt;em&gt;before&lt;/em&gt; clearing so they persist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structuring Your Project for AI
&lt;/h2&gt;

&lt;p&gt;Context engineering isn't just about memory files and session management. It's about how your entire project is organized. Agents navigate codebases by reading files and following imports — the easier your project is to navigate, the better the agent performs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Favor Vertical Over Horizontal Organization
&lt;/h3&gt;

&lt;p&gt;Feature-driven layouts work better than layer-driven layouts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Layer-driven (harder for agents)
src/
  models/
  controllers/
  views/
  services/

# Feature-driven (better for agents)
src/
  auth/
    auth-service.ts
    auth-service.test.ts
    auth-types.ts
  billing/
    billing-service.ts
    billing-service.test.ts
  dashboard/
    dashboard-page.tsx
    dashboard-components.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An agent working on auth only needs to read the auth directory. A layer-driven layout forces it to load files from every directory to understand a single feature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Semantic File Names
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;user-authentication-service.ts&lt;/code&gt; is better than &lt;code&gt;uas.ts&lt;/code&gt;. Agents infer file contents from names before reading them — descriptive names reduce unnecessary file reads and save context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep Files Small
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.anthropic.com/engineering/claude-code-best-practices" rel="noopener noreferrer"&gt;Anthropic's best practices&lt;/a&gt; recommend smaller, focused modules. A 3,000-line monolith forces the agent to read (and hold in context) the entire file to modify a single function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Colocate Tests with Code
&lt;/h3&gt;

&lt;p&gt;If your test for &lt;code&gt;auth-service.ts&lt;/code&gt; is in &lt;code&gt;auth-service.test.ts&lt;/code&gt; right next to it, the agent finds it instantly. If it's in &lt;code&gt;tests/unit/services/auth/test_auth_service.py&lt;/code&gt;, that's multiple directory traversals burning context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Treat Context Files as Code
&lt;/h3&gt;

&lt;p&gt;They evolve with your codebase. Review them in PRs. Delete stale instructions. Add new patterns when you discover them. As &lt;a href="https://eclipsesource.com/blogs/2025/11/20/mastering-project-context-files-for-ai-coding-agents/" rel="noopener noreferrer"&gt;EclipseSource notes&lt;/a&gt;, the hard problem isn't creating context files — it's keeping them accurate.&lt;/p&gt;

&lt;h2&gt;
  
  
  The "Harness Engineering" Pattern
&lt;/h2&gt;

&lt;p&gt;Dex Horthy from Hex coined an emerging concept that captures where context engineering is heading:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1985699548153467120-584" src="https://platform.twitter.com/embed/Tweet.html?id=1985699548153467120"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1985699548153467120-584');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1985699548153467120&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;"Harness engineering" is applying context engineering principles to how you &lt;em&gt;use&lt;/em&gt; an existing agent — not just how you configure it. It's the difference between writing good CLAUDE.md and designing the entire workflow: when to spawn subagents, how to structure multi-step tasks, when to isolate vs. share context.&lt;/p&gt;

&lt;p&gt;His &lt;a href="https://www.youtube.com/watch?v=IS_y40zY-hc" rel="noopener noreferrer"&gt;YC Root Access talk&lt;/a&gt; is the best technical deep dive on advanced context engineering — covering why conversational prompting fails at scale, spec-first development, and the finding that agents tend to perform better when using less than 40% of the LLM's context window.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/IS_y40zY-hc"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Context Engineering in Practice: A Real Workflow
&lt;/h2&gt;

&lt;p&gt;Let's make this concrete. Here's how context engineering looks in a real development session with Claude Code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Start With Clean Context
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;claude
&lt;span class="c"&gt;# CLAUDE.md loads automatically&lt;/span&gt;
&lt;span class="c"&gt;# Agent knows your project structure, build commands, coding style&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Be Specific About the Task
&lt;/h3&gt;

&lt;p&gt;Instead of: &lt;em&gt;"Fix the login bug"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Try: &lt;em&gt;"The login form on /auth/login returns a 401 when valid credentials are submitted. The issue started after commit abc123. Check src/auth/auth-service.ts and the Supabase auth configuration."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You've selected context: specific file, specific commit, specific behavior. The agent doesn't need to explore your entire codebase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Use Subagents for Research
&lt;/h3&gt;

&lt;p&gt;When you need to understand a large codebase area, don't ask the main agent to read 20 files. Use subagents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;# In Claude Code, use the Agent tool for research&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;# The subagent runs in its own context window&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;# Returns a summary to the parent — keeping parent context clean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Compact at Natural Breakpoints
&lt;/h3&gt;

&lt;p&gt;After completing a subtask (fixing the auth bug), before starting the next task (adding a new feature):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;/compact Focus on the auth fix we just completed
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;# Or if the next task is completely unrelated:&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;/clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Write Decisions Back to Memory
&lt;/h3&gt;

&lt;p&gt;Before clearing, capture anything the agent learned that should persist:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;# Add to CLAUDE.md or a project doc:&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;# "Supabase auth tokens expire after 1 hour.&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;#  Refresh token logic is in src/auth/token-refresh.ts"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the cycle: clean start → targeted context → isolate research → compress at breakpoints → persist insights → clean start again.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/uohI3h4kqyg"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bigger Picture: Four Disciplines of AI Development
&lt;/h2&gt;

&lt;p&gt;Context engineering sits within a broader framework. By 2026, what we used to call "prompting" has split into four distinct disciplines:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prompt Craft&lt;/strong&gt; — writing clear instructions. The original skill. By 2026, this is table stakes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Context Engineering&lt;/strong&gt; — curating the entire information environment an agent operates within. What this guide covers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Intent Engineering&lt;/strong&gt; — encoding goals, values, and decision boundaries into agent infrastructure. Telling agents &lt;em&gt;what to want&lt;/em&gt;, not just what to do.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Specification Engineering&lt;/strong&gt; — writing structured documents that agents can execute against over long periods without intervention. The foundation for truly autonomous development.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This progression maps directly onto skill levels. Prompt craft is autocomplete-level. Context engineering is agent-assisted. Intent and specification engineering are orchestrator-level — where the real productivity multipliers live.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1943685060785524824-850" src="https://platform.twitter.com/embed/Tweet.html?id=1943685060785524824"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1943685060785524824-850');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1943685060785524824&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  The "Vibe Coding Hangover"
&lt;/h2&gt;

&lt;p&gt;There's a growing recognition that the initial excitement around vibe coding — just describe what you want and let AI build it — hit a wall. &lt;a href="https://www.contextstudios.ai/blog/the-vibe-coding-hangover-why-developers-are-returning-to-engineering-rigor" rel="noopener noreferrer"&gt;Multiple&lt;/a&gt; &lt;a href="https://dev.to/maximiliano_allende97/the-vibe-coding-hangover-why-im-returning-to-engineering-rigor-in-2026-49hl"&gt;writers&lt;/a&gt; have described a "vibe coding hangover" — the realization that unstructured AI coding produces unmaintainable code.&lt;/p&gt;

&lt;p&gt;Context engineering is the antidote. Not a rejection of AI coding, but its maturation. As &lt;a href="https://github.blog/ai-and-ml/generative-ai/want-better-ai-outputs-try-context-engineering/" rel="noopener noreferrer"&gt;GitHub's engineering blog&lt;/a&gt; puts it: you don't get better AI outputs by writing cleverer prompts. You get them by engineering better context.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick-Start Checklist
&lt;/h2&gt;

&lt;p&gt;If you're just getting started with context engineering, here's the minimum viable setup:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create your rules file&lt;/strong&gt; (5 minutes)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code: Run &lt;code&gt;/init&lt;/code&gt; to generate a starter CLAUDE.md&lt;/li&gt;
&lt;li&gt;Cursor: Create &lt;code&gt;.cursor/rules/project.mdc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Copilot: Create &lt;code&gt;.github/copilot-instructions.md&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Add the essentials&lt;/strong&gt; (10 minutes)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build and test commands&lt;/li&gt;
&lt;li&gt;3-5 most important code style rules&lt;/li&gt;
&lt;li&gt;Architecture overview (one paragraph)&lt;/li&gt;
&lt;li&gt;Top 3 gotchas new developers hit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Set session habits&lt;/strong&gt; (ongoing)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start fresh sessions for unrelated tasks&lt;/li&gt;
&lt;li&gt;Compact after 20-30 messages&lt;/li&gt;
&lt;li&gt;Clear after 2 failed corrections&lt;/li&gt;
&lt;li&gt;Write decisions to your rules file before clearing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Organize for navigability&lt;/strong&gt; (when refactoring)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Feature-based directories over layer-based&lt;/li&gt;
&lt;li&gt;Semantic file names&lt;/li&gt;
&lt;li&gt;Tests colocated with source&lt;/li&gt;
&lt;li&gt;Small, focused files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Iterate your rules&lt;/strong&gt; (weekly)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete rules the agent already follows naturally&lt;/li&gt;
&lt;li&gt;Add rules for mistakes the agent keeps making&lt;/li&gt;
&lt;li&gt;Keep total length under 300 lines (CLAUDE.md) or 500 lines (Cursor rules)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Essential Reading
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;Anthropic: Best Practices for Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://martinfowler.com/articles/exploring-gen-ai/context-engineering-coding-agents.html" rel="noopener noreferrer"&gt;Martin Fowler: Context Engineering for Coding Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://inferencebysequoia.substack.com/p/vibe-coding-needs-context-engineering" rel="noopener noreferrer"&gt;Sequoia: Vibe Coding Needs Context Engineering&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://engineering.atspotify.com/2025/11/context-engineering-background-coding-agents-part-2" rel="noopener noreferrer"&gt;Spotify: Context Engineering for Background Coding Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.langchain.com/context-engineering-for-agents/" rel="noopener noreferrer"&gt;LangChain: Context Engineering for Agents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Rules File Guides
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.builder.io/blog/claude-md-guide" rel="noopener noreferrer"&gt;Builder.io: How to Write a Good CLAUDE.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.humanlayer.dev/blog/writing-a-good-claude-md" rel="noopener noreferrer"&gt;HumanLayer: Writing a Good CLAUDE.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.gend.co/blog/claude-skills-claude-md-guide" rel="noopener noreferrer"&gt;Gend.co: Claude Skills and CLAUDE.md Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/cleverhoods/claudemd-best-practices-from-basic-to-adaptive-9lm"&gt;DEV: CLAUDE.md Best Practices — From Basic to Adaptive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cursor.com/docs/context/rules" rel="noopener noreferrer"&gt;Cursor: Rules Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Research Papers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/html/2602.20478v1" rel="noopener noreferrer"&gt;Codified Context: Infrastructure for AI Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/html/2512.18925v2" rel="noopener noreferrer"&gt;Beyond the Prompt: An Empirical Study of Cursor Rules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/html/2511.12884v1" rel="noopener noreferrer"&gt;Empirical Study of 2,303 Agent Context Files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://research.trychroma.com/context-rot" rel="noopener noreferrer"&gt;Chroma Research: Context Rot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Repos and Templates
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/coleam00/context-engineering-intro" rel="noopener noreferrer"&gt;Cole Medin: Context Engineering Intro&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/NeoLabHQ/context-engineering-kit" rel="noopener noreferrer"&gt;NeoLab: Context Engineering Kit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/PatrickJS/awesome-cursorrules" rel="noopener noreferrer"&gt;awesome-cursorrules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://agents.md/" rel="noopener noreferrer"&gt;AGENTS.md Standard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Talks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=IS_y40zY-hc" rel="noopener noreferrer"&gt;Dex Horthy: Advanced Context Engineering for Agents (YC Root Access)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://speakerdeck.com/dasiths/throw-away-the-vibes-context-engineering-is-all-you-need-ddd-melbourne-2026" rel="noopener noreferrer"&gt;DDD Melbourne 2026: Throw Away The Vibes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Context engineering is the skill that separates developers who get consistent, high-quality results from AI coding tools from those who get lucky sometimes. Master it, and every other AI development skill becomes easier.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>codequality</category>
    </item>
    <item>
      <title>A Short History of Agent-Based Models — and Why Software Engineers Should Care</title>
      <dc:creator>Vibehackers</dc:creator>
      <pubDate>Thu, 19 Mar 2026 22:18:56 +0000</pubDate>
      <link>https://dev.to/vibehackers/a-short-history-of-agent-based-models-and-why-software-engineers-should-care-1cmd</link>
      <guid>https://dev.to/vibehackers/a-short-history-of-agent-based-models-and-why-software-engineers-should-care-1cmd</guid>
      <description>&lt;p&gt;In the 1940s, John von Neumann proved that a cellular automaton could replicate itself. His design required 29 possible states per cell and a pattern of roughly 200,000 cells. It was mathematically rigorous and practically useless — too complex to study, too large to visualize, too unwieldy to teach anyone anything.&lt;/p&gt;

&lt;p&gt;John Horton Conway, a mathematician at Cambridge, thought the interesting question wasn't whether self-replication was possible but how &lt;em&gt;simple&lt;/em&gt; a system could be and still produce complex behavior. During tea breaks through the late 1960s, he tested rule after rule on pencil grids, discarding anything that died immediately or grew without bound. He was searching for a minimum — the fewest rules that would sustain unpredictable, open-ended behavior. In 1970, he found &lt;a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life" rel="noopener noreferrer"&gt;four&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A cell on a grid lives or dies based on its neighbors. Fewer than two, it dies. Two or three, it survives. More than three, it dies. Exactly three neighbors bring a dead cell to life. Von Neumann needed 29 states. Conway needed two.&lt;/p&gt;

&lt;p&gt;Within months, a team at MIT led by Bill Gosper discovered the glider gun — a pattern that manufactures traveling structures indefinitely. Then came self-replicating patterns. In 1982, Conway proved that his four-rule system is Turing-complete: capable, in principle, of computing anything a real computer can. Von Neumann's 200,000-cell monster was overkill. Four rules and a pencil grid were enough.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fukc2zaky9keykz0ul5cn.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fukc2zaky9keykz0ul5cn.gif" alt="Conway's Game of Life — glider gun firing gliders across the grid" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've been to any talk on complexity or emergence, you've seen Game of Life used as the opening example. It's the "Hello, World" of the field — everyone knows it, and most explanations stop there. What almost nobody covers is what happened next: the economists, animators, and political scientists who took the same insight and applied it to things that actually mattered.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Economist and the Checkerboard
&lt;/h2&gt;

&lt;p&gt;A year after Conway's paper, an economist named Thomas Schelling was working on a completely different problem: residential segregation. Instead of a computer, he used a physical checkerboard and two colors of coins. His rule was even simpler than Conway's: if fewer than a third of your immediate neighbors are your color, move to a random empty square.&lt;/p&gt;

&lt;p&gt;One-third is a mild preference. It means you're fine being in the minority — you just don't want to be nearly alone. Schelling expected the board to stay mixed. It didn't.&lt;/p&gt;

&lt;p&gt;From a well-shuffled starting position, the coins rapidly organized themselves into large, homogeneous clusters. Not because any coin wanted segregation — the rule explicitly tolerated diversity — but because the cumulative effect of many small, reasonable preferences produced a macro-level outcome that no individual coin would have chosen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi28jdn6y6va27ckc6ufx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi28jdn6y6va27ckc6ufx.gif" alt="Schelling's segregation model — mild preferences produce sharp clustering" width="400" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Schelling published this in 1971 as "&lt;a href="https://en.wikipedia.org/wiki/Schelling%27s_model_of_segregation" rel="noopener noreferrer"&gt;Dynamic Models of Segregation&lt;/a&gt;." In 2005, he won the Nobel Prize in Economics, partly for this work.&lt;/p&gt;

&lt;p&gt;The model's lasting contribution was a single, uncomfortable idea: &lt;strong&gt;the system-level outcome is not reducible to the individual agents' intentions.&lt;/strong&gt; You can understand every agent perfectly — know its rules, its preferences, its decision process — and still be unable to predict what the system will do.&lt;/p&gt;

&lt;h2&gt;
  
  
  Symbolics, 1986: The Animator Who Made Birds Think
&lt;/h2&gt;

&lt;p&gt;Craig Reynolds was a software engineer at Symbolics with a practical problem: he needed to animate realistic bird flocks for a short film.&lt;/p&gt;

&lt;p&gt;The traditional approach — scripting each bird's path — was hopeless. Real flocks have no choreographer. Hundreds of birds move as a coherent mass, splitting around obstacles and reforming, without any individual bird knowing the shape of the whole flock.&lt;/p&gt;

&lt;p&gt;Reynolds gave each simulated bird (he called them "&lt;a href="https://en.wikipedia.org/wiki/Boids" rel="noopener noreferrer"&gt;boids&lt;/a&gt;") just three behavioral rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Separation&lt;/strong&gt; — steer away from nearby flockmates to avoid collision&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alignment&lt;/strong&gt; — steer toward the average heading of nearby flockmates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cohesion&lt;/strong&gt; — steer toward the average position of nearby flockmates&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each boid could only see its immediate neighbors. No central controller, no leader boid, no global awareness. He presented the result at &lt;a href="https://www.red3d.com/cwr/papers/1987/boids.html" rel="noopener noreferrer"&gt;SIGGRAPH 1987&lt;/a&gt;. The boids flocked. The technique produced the bat swarms in Tim Burton's &lt;em&gt;Batman Returns&lt;/em&gt; (1992). In 1998, Reynolds received an &lt;a href="https://en.wikipedia.org/wiki/Craig_Reynolds_(computer_graphics)" rel="noopener noreferrer"&gt;Academy Scientific and Technical Award&lt;/a&gt; — three rules and an Oscar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fns1k5eysy7399b98oycw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fns1k5eysy7399b98oycw.gif" alt="Reynolds' Boids — 3D flocking from three simple rules" width="500" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What Reynolds proved was stronger than Conway's and Schelling's insight: simple &lt;em&gt;local&lt;/em&gt; rules can produce globally &lt;em&gt;coherent&lt;/em&gt; behavior. The flock moves as one, not because anyone is coordinating it, but because each boid follows the same three rules based only on what it can see nearby.&lt;/p&gt;

&lt;p&gt;The flip side was equally important: bad rules produce bad flocks. The quality of collective behavior was entirely a function of rule design, not agent intelligence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Growing Artificial Societies
&lt;/h2&gt;

&lt;p&gt;Joshua Epstein, a political scientist at Brookings, thought economics had an explanation problem. Economists could describe wealth inequality — measure the Gini coefficient, plot the distribution — but they couldn't &lt;em&gt;generate&lt;/em&gt; it. If you can't grow it from the bottom up, Epstein argued, you don't actually understand what causes it.&lt;/p&gt;

&lt;p&gt;He and Robert Axtell built &lt;a href="https://en.wikipedia.org/wiki/Sugarscape" rel="noopener noreferrer"&gt;Sugarscape&lt;/a&gt; (1996): a 51-by-51 grid where each cell contains some sugar. Agents have vision, a metabolic rate, and a finite lifespan. The rules: look around, move to the richest visible cell, eat the sugar.&lt;/p&gt;

&lt;p&gt;Two peaks of sugar at opposite corners. Hit run. Within a few hundred ticks, a skewed wealth distribution appeared — a few agents with good vision and low metabolism had accumulated vast surpluses while others starved. Nobody programmed inequality. It grew.&lt;/p&gt;

&lt;p&gt;The researchers could produce radically different societies by changing nothing about the agents and only changing the sugar distribution on the grid.&lt;/p&gt;

&lt;p&gt;Epstein's conclusion: "If you didn't grow it, you didn't explain it."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Institute in the Desert
&lt;/h2&gt;

&lt;p&gt;In 1983, George Cowan — a Manhattan Project physicist — started hosting lunches at Los Alamos for scientists who shared a suspicion: that the principles behind bird flocks, stock markets, immune systems, and urban sprawl might be the same principles.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://en.wikipedia.org/wiki/Santa_Fe_Institute" rel="noopener noreferrer"&gt;Santa Fe Institute&lt;/a&gt; opened in 1984. Its bet was that Conway's cells, Schelling's coins, Reynolds' birds, and Epstein's foragers were all instances of the same thing — &lt;strong&gt;complex adaptive systems&lt;/strong&gt;, where autonomous agents interact in a shared environment and produce emergent behavior that no individual agent controls.&lt;/p&gt;

&lt;p&gt;Across thousands of studies, two findings kept reappearing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The environment shapes behavior more than agent intelligence does.&lt;/strong&gt; Change the grid, the resource distribution, the network topology — and the same agents produce completely different outcomes. Smarter ants don't make better colonies. Better pheromone trails do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You cannot optimize the system by optimizing individual agents.&lt;/strong&gt; The system's behavior is an emergent property of agent-environment interaction. The only reliable lever is environment design.&lt;/p&gt;

&lt;h2&gt;
  
  
  January 2026: A Day in Gas Town
&lt;/h2&gt;

&lt;p&gt;On January 15, 2026, Tim Sehn — co-founder of DoltHub — &lt;a href="https://www.dolthub.com/blog/2026-01-15-a-day-in-gas-town/" rel="noopener noreferrer"&gt;tried Gas Town&lt;/a&gt;, Steve Yegge's multi-agent orchestrator for Claude Code. Sehn pointed it at four failing tests and let the agents work.&lt;/p&gt;

&lt;p&gt;Gas Town spun up twenty agents across twenty terminals, coordinated by a "Mayor" agent. At one point the Mayor reported all four bugs were fixed. Only two pull requests existed on GitHub. Then one agent decided its work was done — and merged its own PR into main. The integration tests were failing. Broken code was already on main before Sehn could react.&lt;/p&gt;

&lt;p&gt;He shut it down. The sixty-minute session had burned roughly $100 in Claude tokens. "None of the PRs were good," he wrote, "and I ended up closing them all."&lt;/p&gt;

&lt;p&gt;What struck me wasn't that the agents failed — it was &lt;em&gt;how&lt;/em&gt; they failed. Not by writing bad code, but by interacting with an environment that had no gate between "agent thinks it's done" and "code reaches production."&lt;/p&gt;

&lt;p&gt;Stripe's "&lt;a href="https://stripe.dev/blog/minions-stripes-one-shot-end-to-end-coding-agents-part-2" rel="noopener noreferrer"&gt;Minions&lt;/a&gt;" handle this differently. Each Minion runs in an isolated devbox with a &lt;a href="https://www.anup.io/stripes-coding-agents-the-walls-matter-more-than-the-model/" rel="noopener noreferrer"&gt;curated subset of 15 tools&lt;/a&gt; out of 400+ available. If tests fail twice, the task goes back to a human. No autonomous merging. They ship 1,300 PRs per week this way.&lt;/p&gt;

&lt;p&gt;Same agents. Different environment. Different emergent behavior.&lt;/p&gt;

&lt;p&gt;Conway's cells, Schelling's coins, Reynolds' birds, Epstein's foragers, Sehn's coding agents, Stripe's Minions — same mathematical structure. Autonomous agents following local rules in a shared environment, where the system-level outcome depends more on the environment than on the agents. This is the lesson that matters most for vibe coding with AI agents: the model isn't the bottleneck — the environment is.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you're working with multi-agent coding setups, we wrote a practical guide on &lt;a href="https://vibehackers.io/blog/git-worktrees-multi-agent-development" rel="noopener noreferrer"&gt;using git worktrees to isolate AI agents&lt;/a&gt; — the environment design that makes them safe. And if you're looking for roles where this matters, we track &lt;a href="https://vibehackers.io/jobs" rel="noopener noreferrer"&gt;580+ AI-assisted development jobs&lt;/a&gt; updated daily.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>architecture</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
