claude-code-source-map
A full deobfuscated source map of the Claude Code npm bundle reconstructed from the published package's source maps - the largest single research artifact in this corpus (~160MB of mapped source). Its directory structure serves as the canonical map of Claude Code's internal modules.
View source on GitHubKey takeaways
- 01
Use the directory layout as the canonical module map of the harness
- 02
Reconstructed from public npm source maps, not the internal repo
- 03
Cross-check ambiguous findings against the leeyeel sourcemap
Flows built on this research
From the archive
Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.
Cache-breaking prompt sections require a written reason
/**
* Create a memoized system prompt section.
* Computed once, cached until /clear or /compact.
*/
export function systemPromptSection(name, compute) {
return { name, compute, cacheBreak: false }
}
/**
* Create a volatile system prompt section that recomputes every turn.
* This WILL break the prompt cache when the value changes.
* Requires a reason explaining why cache-breaking is necessary.
*/
export function DANGEROUS_uncachedSystemPromptSection(name, compute, _reason) {
return { name, compute, cacheBreak: true }
} Restored Claude Code source: the API design itself enforces cache discipline - the volatile variant is prefixed DANGEROUS_ and demands a justification argument.
restored-src/src/constants/systemPromptSections.ts
The Magic Docs auto-update prompt
Your ONLY task is to use the Edit tool to update the documentation file if there is substantial new information to add, then stop. CRITICAL RULES FOR EDITING: - Keep the document CURRENT with the latest state of the codebase - this is NOT a changelog or history - Update information IN-PLACE to reflect the current state - do NOT append historical notes or track changes over time - Remove or replace outdated information rather than adding "Previously..." or "Updated to..." notes - Clean up or DELETE sections that are no longer relevant DOCUMENTATION PHILOSOPHY - READ CAREFULLY: - BE TERSE. High signal only. No filler wo…
Restored Claude Code source: the prompt that keeps living docs from becoming changelogs - in-place updates, deletion encouraged, terseness as policy.
restored-src/src/services/MagicDocs/prompts.ts
Team memory's two-step save protocol
Saving a memory is a two-step process: Step 1 - write the memory to its own file in the chosen directory (private or team, per the type's scope guidance) using this frontmatter format: ... Step 2 - add a pointer to that file in the same directory's MEMORY.md. Each entry should be one line, under ~150 characters: - [Title](file.md) - one-line hook. They have no frontmatter. Never write memory content directly into a MEMORY.md. - Organize memory semantically by topic, not chronologically - Update or remove memories that turn out to be wrong or outdated - Do not write duplicate memories. First check if there is an existing memory you can update.
Restored Claude Code source: memory is a file per fact plus a size-bounded index of one-line pointers - the index is navigation, never storage.
restored-src/src/memdir/teamMemPrompts.ts