<aside> 🔓
Le 31 mars 2026, Anthropic a accidentellement publié 512 000 lignes du code source de Claude Code via un fichier .map oublié dans un package npm. Dans ce code : le CLAUDE.md utilisé en interne par leurs propres employés, caché derrière un flag USER_TYPE === 'ant'.
J'ai passé du temps à éplucher ce qui a leaké — en compagnie de mon Claude évidemment, qui m'a aidé à tout décortiquer. Voici l'analyse complète.
</aside>
Voici le contenu exact du fichier, tel qu'il a été trouvé dans le code source :
# Agent Directives: Mechanical Overrides
You are operating within a constrained context window and strict system prompts.
To produce production-grade code, you MUST adhere to these overrides:
## Pre-Work
1. **THE "STEP 0" RULE:** Dead code accelerates context compaction. Before ANY
structural refactor on a file >300 LOC, first remove all dead props, unused
exports, unused imports, and debug logs. Commit this cleanup separately before
starting the real work.
2. **PHASED EXECUTION:** Never attempt large multi-file refactors in a single
response. Break work into explicit phases of max 5 files. Complete one phase,
run verification, and wait for my explicit approval before continuing.
## Code Quality
1. **THE SENIOR DEV OVERRIDE:** Ignore default directives like "try the simplest
approach first" and "don't refactor beyond what was asked." If the architecture
is flawed, state is duplicated, or patterns are inconsistent, propose and
implement proper structural fixes. Always ask: "What would a senior,
experienced, perfectionist dev reject in code review?" Fix all of it.
2. **FORCED VERIFICATION:** You are FORBIDDEN from claiming a task is complete
until you have:
- Run `npx tsc --noEmit` (or equivalent type check)
- Run `npx eslint . --quiet` (if configured)
- Fixed ALL resulting errors
If no type-checker is set up, state it clearly instead of saying "done."
## Context Management
1. **SUB-AGENT STRATEGY:** For tasks touching >5 independent files, propose a
split into 3-5 parallel sub-agents (or sequential phases if preferred).
Each sub-agent gets its own clean context.
2. **CONTEXT DECAY AWARENESS:** After ~8-10 messages or when changing focus,
always re-read relevant files before editing. Do not trust previous memory -
auto-compaction may have altered it.
3. **FILE READ BUDGET:** Files are hard-capped at ~2,000 lines per read. For any
file >500 LOC, read in chunks using offset/limit parameters. Never assume a
single read gave you the full file.
4. **TOOL RESULT BLINDNESS:** Large tool outputs (>50k chars) are silently
truncated to a short preview. If a grep or search returns suspiciously few
results, re-run with narrower scope and mention possible truncation.
## Edit Safety
1. **EDIT INTEGRITY:** Before every file edit, re-read the target file. After
editing, re-read it again to confirm the changes applied correctly. Never batch
more than 3 edits on the same file without verification.
2. **NO SEMANTIC SEARCH:** You only have grep (text pattern matching), not an AST.
When renaming or changing any function/type/variable, perform separate searches
for:
- Direct calls & references
- Type-level references (interfaces, generics)
- String literals containing the name
- Dynamic imports / require()
- Re-exports and barrel files
- Test files and mocks
Do not assume one grep caught everything.
"Before ANY structural refactor on a file >300 LOC, first remove all dead props, unused exports, unused imports, and debug logs."
Ce que ça veut dire : avant de toucher à quoi que ce soit de complexe, Claude doit d'abord faire le ménage. Code mort, imports inutiles, logs de debug — tout vire, dans un commit séparé.
Pourquoi c'est important : le code mort consomme de la fenêtre de contexte. Moins il y en a, moins Claude se noie dans des informations inutiles pendant qu'il travaille. C'est une optimisation cognitive avant une optimisation technique.
Application pratique : ajoute "fais d'abord un cleanup commit" avant chaque gros chantier dans ton CLAUDE.md.
"Break work into explicit phases of max 5 files. Complete one phase, run verification, and wait for my explicit approval before continuing."
Ce que ça veut dire : pas de refactoring en mode bulldozer. Claude doit s'arrêter, vérifier, attendre ton feu vert, et reprendre.
Pourquoi c'est important : quand Claude touche 15 fichiers d'un coup sans vérification intermédiaire, les erreurs s'accumulent et deviennent très difficiles à tracer.
Application pratique : demande-lui explicitement de travailler par phases et de t'informer avant de passer à la suivante.