Technical deep-dive: How a single cli.js.map file accidentally open-sourced Anthropic’s entire Claude Code CLI (v2.1.88) If you’ve ever shipped a production JS/TS package, you know exactly what a source map is. A *.js.map is a JSON artifact generated by bundlers (Webpack, esbuild, Bun, Rollup, etc.) that adheres to the Source Map Revision 3 spec. It contains: → "version": 3 → "sources": array of original file paths → "names": original variable/function names → "mappings": VLQ-encoded segments that map every token in the minified cli.js back to the exact line/column in the original TypeScript → "sourceRoot" + "sourcesContent": sometimes the full original source embedded → "file": the generated bundle name Its sole purpose is to let debuggers (DevTools, VS Code, Sentry, etc.) reconstruct readable stack traces and enable source-level debugging. Yesterday, Anthropic published @anthropic-ai/claude-code@2.1.88 to npm. Inside the tarball sat a ~60 MB cli.js.map that should never have left their CI pipeline. Here’s exactly what went wrong (classic release-engineering foot-gun): 1. The package was built with Bun’s bundler (which defaults to sourcemap: true unless explicitly disabled). 2. No entry in .npmignore (or the files field in package.json) excluded *.map files. 3. The generated map still contained the original "sourceRoot" and relative paths pointing directly to Anthropic’s public Cloudflare R2 bucket. 4. That bucket held src.zip — the complete, unobfuscated 1,900+ TypeScript files (~512 kLOC) of the Claude Code agent. Result? Anyone who ran npm install @anthropic-ai/claude-code@2.1.88 could: 1. Extract cli.js.map 2. Parse the sources + sourcesContent (or follow the R2 URLs) 3. Download the full original codebase in seconds No de-minification required. No reverse-engineering tricks. Just pure, readable TypeScript — agent architecture, tool handlers, plugin system, feature flags, internal telemetry, unreleased modules (KAIROS, dreaming memory, Tamagotchi-style pet, etc.) all laid bare. Anthropic has since yanked the version and called it a “release packaging issue caused by human error.” No customer data or model weights were exposed — but the operational security optics for a “safety-first” lab are… not great. This is a textbook reminder that your build pipeline and .npmignore are now part of your threat model. #TypeScript #JavaScript #SourceMaps #BuildTools #npm #DevOps #Anthropic #Claude #AISecurity #ReverseEngineering
Anthropic's Claude Code CLI Source Map Leak Exposed Entire Codebase
More Relevant Posts
-
Debugging inconsistent runtime behavior steals time from feature delivery. ────────────────────────────── Array.map() for Data Transformation Guide with Examples In this comprehensive guide, you'll learn how to leverage JavaScript's Array.map() method for efficient data transformation. Through simple explanations and numerous examples, this tutorial will help you understand how to manipulate arrays effectively. hashtag#javascript hashtag#array.map hashtag#datatransformation hashtag#beginnerguide hashtag#programmingtutorial ────────────────────────────── Core Concept Array.map() is a built-in method in JavaScript that enables developers to create a new array by applying a transformation function to each element of an existing array. Introduced in ECMAScript 5, it has become a foundational tool for developers working with collections of data. Internally, Array.map() loops over the original array and calls the provided function for each element. The result of this function is added to a new array, which is then returned. This method does not modify the original array, making it functional programming-friendly. It fits well within the JavaScript ecosystem, working seamlessly with other array methods like filter() and reduce(). This allows developers to chain methods together for more complex operations. Moreover, the immutability principle followed by Array.map() protects the original data from unintended side effects. Key Rules • Use map() for transformations only: Ensure to use map() only when you need a transformed array and not for side effects. • Avoid modifying the original array: Keep your code functional by not changing the original array inside the map() callback. • Use clear and concise callback functions: Write simple functions to enhance readability and maintainability. 💡 Try This // Define an array of numbers const numbers = [1, 2, 3, 4, 5]; // Use map to double each number ❓ Quick Quiz Q: Is Array.map() for Data Transformation different from Array.forEach()? A: Yes, Array.map() is different from Array.forEach(). While forEach() executes a provided function once for each array element without returning a new array, map() transforms each element and returns a new array. Thus, use map() when you need a new array based on transformations of the original array. 🔑 Key Takeaway In this guide, you explored the Array.map() method for data transformation. You learned how to use it effectively with clear examples and best practices. The key takeaway is its ability to create new arrays based on existing data without mutating the original array. Next, consider exploring related array methods like filter() and reduce() for more advanced data manipulation techniques. ────────────────────────────── 🔗 Read the full guide with code examples & step-by-step instructions: https://lnkd.in/gmCTh_Q2
To view or add a comment, sign in
-
-
Anthropic Forgot One Line. We Got 512,000. One missing entry in a config file. That's it. No sophisticated attack. No insider threat. Someone at Anthropic forgot to add *.map to .npmignore — and on March 31, 2026, that omission handed the world the entire Claude Code codebase. 512,000 lines of TypeScript. 1,900 files. 44 hidden feature flags. A stealth commit system. An autonomous background agent. Internal model codenames with regression data attached. All of it. Public. On npm. What Happened When Anthropic published version 2.1.88 of @anthropic-ai/claude-code, it accidentally included cli.js.map — a 59.8 MB source map sitting in a publicly accessible S3 bucket. A source map is the key that translates minified production output back to readable TypeScript. It's a debugging artifact meant to stay internal. The root cause: Bun, the JavaScript runtime Anthropic builds on, had a known open bug where source maps were generated even when disabled in config. Their own toolchain bit them. A researcher named Chaofan Shou spotted it first and posted on X. Within minutes the code was mirrored to GitHub. Within hours the repo had 75,000 stars — reportedly the fastest-growing repository in GitHub history. What Was Inside Engineers described Claude Code as built less like a chatbot wrapper and more like a small operating system. 40+ internal tools, each with their own permission gates. Background memory processes. A controller agent delegating to swarms of subagents through Coordinator Mode. The 44 hidden feature flags were the real story — compiled production code sitting behind switches that compile to false in the public build. Twenty of those features haven't shipped yet. One was "Undercover Mode" — a 90-line file called undercover.ts — designed to strip all Anthropic internals from commit messages when contributing to external repos. No attribution. No mention of Claude Code itself. Boris Cherny, Anthropic's head of Claude Code: "Plain developer error. 100% of my contributions to Claude Code were written by Claude Code." The irony landed immediately: Anthropic built a system to prevent internal information leaking through code contributions — then leaked the entire source through a file they forgot to exclude from npm. The Competitive Hit Claude Code's ARR had crossed $2.5 billion as of early 2026. The leak handed every competitor — Cursor, Windsurf, Copilot — a literal engineering blueprint for how Anthropic solved multi-agent orchestration, context entropy, and memory management at scale. You can't unsee a blueprint. Next: KAIROS — the autonomous background agent that runs while you sleep. #ClaudeCode #Anthropic #AIEngineering #GenerativeAI #OpenSource #AITooling
To view or add a comment, sign in
-
-
Anthropic Left the Door Open. A .map file in their npm package exposed 512,000+ lines of unobfuscated TypeScript. This is what Claude Code actually is under the hood. THE RUNTIME Not a chat wrapper. A full agentic runtime. Bun + React/Ink terminal UI + QueryEngine.ts (46K lines) handling streaming, tool loops, retry logic, thinking mode, and token counting. ~40 tools. ~85 slash commands. Most users know 5. TOOLS NOBODY USES AgentTool — spawn sub-agents mid-session for parallel execution TeamCreateTool — orchestrate a full agent team via coordinator/ EnterWorktreeTool — isolate work in a git worktree before touching code REPLTool — persistent Python/Node REPL inline LSPTool — go-to-definition, find-references via Language Server Protocol ScheduleCronTool — create scheduled cron triggers inside a session TaskCreateTool — full background task lifecycle management SyntheticOutputTool — structured output for pipeline integration Each: own Zod v4 schema, permission model, concurrency flag, terminal renderer. PERMISSION LAYER src/hooks/toolPermission/ gates every tool call. Four modes: default / plan / bypassPermissions / auto (ML classifier) Wildcard rules: Bash(git *) — all git ops, no prompt FileEdit(/src/*) — edits inside src/ only FileRead(*) — reads never require approval Set once per project via /config. SLASH COMMANDS /compact — compress context mid-session, save tokens /cost — exact token + cost breakdown /pr_comments — pull live GitHub PR comments into terminal /review — structured code review from working diff /doctor — diagnose API, MCP, runtime connectivity /resume — restore any session by ID /skills — invoke reusable named workflows SKILLS + MEMORY skills/ + SkillTool = define once, invoke from any session. memdir/ + extractMemories = persistent memory across sessions. Architecture decisions, conventions, preferences — survive restarts. MCP SERVER npx -y warrioraashuu-codemaster Exposes: list_tools, get_tool_source, search_source, compare_tools, get_architecture. Query the actual source of any tool interactively. WHAT TO CHANGE TODAY 1. Write permission rules before session one 2. /compact every ~30 messages 3. EnterPlanModeTool before any multi-file refactor 4. AgentTool + TeamCreateTool for parallel workloads 5. Define Skills for repeated scaffolding patterns 6. /cost after every session The gap between a casual Claude Code user and a power user is not skill. It is just knowing the surface area of the tool. Now you know it. If you are building something where this kind of agentic control matters — or if you want to go deeper on any of the above — my DMs are open. #ClaudeCode #Anthropic #AgenticAI #DevTools #LLM #TypeScript #SoftwareEngineering #Cybersecurity #OpenSource #AIEngineering #TerminalTools #BuildInPublic
To view or add a comment, sign in
-
- Temporal API: Replace every date library with this. Immutable, timezone-aware, no zero-indexed months. - using / await using: Stop writing try/finally for resource cleanup. Add [Symbol.dispose] to your resource types. - Error.isError(): Use this instead of instanceof Error in catch blocks, especially in library code. - Array.fromAsync(): Collect async iterables into arrays in one line. - Import attributes: Explicitly type your JSON and CSS imports. - Math.sumPrecise(): Precise floating point summation for when it matters. None of these require rewriting your existing codebase. Start using them in new code, add the polyfills where you need them, and watch the category of bugs each one addresses stop appearing in your projects. https://lnkd.in/gxbwbYgk
To view or add a comment, sign in
-
𝗧𝗵𝗲 .𝗺𝗮𝗽 𝗙𝗶𝗹𝗲 𝗧𝗵𝗮𝘁 𝗘𝘅𝗽𝗼𝘀𝗲𝗱 𝗘𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴: 𝗪𝗵𝘆 𝗦𝗼𝘂𝗿𝗰𝗲 𝗠𝗮𝗽 𝗦𝘁𝗮𝗻𝗱𝗮𝗿𝗱𝘀 𝗠𝗮𝘁𝘁𝗲𝗿 𝗠𝗼𝗿𝗲 𝗧𝗵𝗮𝗻 𝗘𝘃𝗲𝗿 𝗧𝗟;𝗗𝗥: A forgotten `.map` file just leaked 512,000 lines of Claude Code's source to the public. Meanwhile, the web dev community just finished ECMA-426, the first official source map standard. The timing couldn't be more urgent. 𝗪𝗵𝗮𝘁 𝗛𝗮𝗽𝗽𝗲𝗻𝗲𝗱 On March 31, 2026, Anthropic accidentally published Claude Code v2.1.88 on npm with a 59.8 MB source map file embedded. Anyone who pulled that package between 00:21–03:29 UTC got direct access to 512,000 lines of unobfuscated TypeScript across ~1,900 files—a complete blueprint of proprietary AI infrastructure. The root cause? One missing line in .npmignore. Someone on the release team failed to add *.map to .npmignore or configure the files field in package.json to exclude build artifacts. Claude Code is built on Bun, which generates source maps by default. The resulting cli.js.map contained sourcesContent arrays with every original TypeScript file—readable, commented, complete. Extraction was trivial: npm pack, untar, parse JSON. Within hours, the code was mirrored globally and rewritten in Python (claw-code hit 50,000 GitHub stars in 2 hours—the fastest-growing repo in GitHub history). 𝗧𝗵𝗲 𝗜𝗿𝗼𝗻𝘆 Days earlier, Bloomberg announced that source maps just became an official ECMA-426 standard after a decade of fragmented, informal coordination between browsers, bundlers, and devtools. The standard exists partly to prevent exactly this kind of chaos. But even with a decade of industry collaboration and billions in resources across Google, Mozilla, and Bloomberg, a single .npmignore oversight exposed over half a million lines of code. Worse? Anthropic had specifically built 𝗨𝗻𝗱𝗲𝗿𝗰𝗼𝘃𝗲𝗿 𝗠𝗼𝗱𝗲 a system prompt forcing Claude to hide its AI nature and strip attribution when contributing to external repos—to prevent internal information leakage. Then shipped the entire codebase by accident. 𝗪𝗵𝗮𝘁 𝗧𝗵𝗶𝘀 𝗧𝗲𝗹𝗹𝘀 𝗨𝘀 1. Tooling is a security layer. Source maps aren't just nice-to-haves for debugging they're now a critical attack surface. A standard means we can build guardrails into bundlers. 2. Formalization saves lives. For years, there was no official spec just a Google Doc. Companies shipped their own variants with no consistency. ECMA-426 formalizes the format and opens the door for validation tools that catch these mistakes at build time. 3. We're still learning. Even "simple" tools like source maps can cascade into supply chain vulnerabilities. Standardization is the first step to adding proper safeguards. The lesson? In an age of supply chain attacks and AI code exposure, even "debugging artifacts" are security decisions. Read more on source maps: [Source Maps: Shipping Features Through Standards]https://lnkd.in/gMwNwvvd
To view or add a comment, sign in
-
[Architecture of Agency · Part 1 of 5] The "Harness" Is the Moat: What 512,000 Lines of Leaked Claude Code Reveal On March 31, 2026, a missing .npmignore entry shipped a 59.8MB source map containing Anthropic’s entire Claude Code source — 512,000 lines of unobfuscated TypeScript across ~1,900 files. Within hours, the code was mirrored, dissected, rewritten in Python and Rust, and a clean-room rewrite hit 50,000 GitHub stars in two hours — likely the fastest-growing repo in GitHub history. Here is what the code actually reveals: 1. Performance Over Everything: Bun, Not Node.js Claude Code runs on Bun — sub-millisecond startup, native TypeScript support. When an agent spawns thousands of sub-processes to search a codebase, Node.js overhead becomes a bottleneck. Bun eliminates it. 2. The 4-Stage Context Management Pipeline This is the real IP. Claude’s 200K token window is managed by: • Stage 1 (Ingestion): Files filtered via .claudeignore • Stage 2 (Compaction): Semantic summarizer strips boilerplate, keeps logic-dense code • Stage 3 (Partitioning): Static/Cached (system rules) vs Dynamic/Uncached (current task) • Stage 4 (Injection): Final assembly into structured XML 3. The YOLO Classifier: Small Model Gates Large Model To solve the "do I ask permission?" problem, a tiny ML model scans the terminal transcript. Low-risk patterns (ls, git status) get auto-approved. Destructive commands escalate to the human. This is "small model gating large model" in production. 4. The Security Risk Found Researchers discovered that by understanding the compaction pipeline, crafted code comments can survive summarization and persist as a backdoor in Claude’s context for an entire session. The Big Takeaway: Building a great AI product in 2026 is 20% Model, 80% Orchestration. The model is powerful, but the harness — the context management, the permission system, the runtime performance — is the actual moat. Next: Part 2 — "Mythos" & the internal roadmap. What is Claude Mythos, and why does the code reference 30-minute "Deep Thinking" mode? Full analysis: https://lnkd.in/eSzcEkFa Curated by Jerry Cards — jerrycards.com #ClaudeCode #Anthropic #AI #SoftwareEngineering #AIAgents #TypeScript #Bun #SourceCode #TechNews #AIArchitecture
To view or add a comment, sign in
-
-
Okay, this is getting lots of attentions now — the Claude Code source code has been leaked through a map file in their NPM registry! 😳 Source: https://lnkd.in/g42D4iue There's also a detailed breakdown in this blog: Blog: https://lnkd.in/gkvU47t6 It’s wild getting this rare peek at how Claude Code’s client-side implementation works, as summarized in the blog. There's an official conceptual documentation on how Claude Code works - with the source code leak, people (or agents) will have a much better understanding on the internal mechanisms of this powerful agent. Some irony here: * Apparently there’s an internal system called “undercover mode” — built to stop the AI from accidentally leaking internal codenames in commits — yet the entire source got published through NPM build files. * Meanwhile, there's already an attempt to re-implement the TypeScript-based Claude Code in Rust, and the repo already has 6.2k forks in under 4 hours… with just one commit. Makes one think what a time to be alive for builders, reverse engineers, and architects.
Claude Code's Entire Source Code Got Leaked via a Sourcemap in npm, Let's Talk About it kuber.studio To view or add a comment, sign in
-
Debugging inconsistent runtime behavior steals time from feature delivery. ────────────────────────────── Array.flat() and flatMap() Guide with Examples In this comprehensive guide, you will learn how to effectively use the Array.flat() and flatMap() methods in JavaScript. We explore their functionalities, practical examples, and best practices to optimize your code. hashtag#javascript hashtag#arraymethods hashtag#flat hashtag#flatmap hashtag#programmingtutorial ────────────────────────────── Core Concept The Array.flat() method was introduced in ECMAScript 2019. It simplifies the process of flattening arrays by allowing developers to control the depth of flattening. Internally, when using flat(), the JavaScript engine recursively traverses the array and concatenates the elements found at the specified depth into a new array. This can save substantial time and complexity in data manipulation tasks. On the other hand, Array.flatMap() is a combination of map() followed by flat(). It is particularly useful when you want to transform elements of an array and flatten the result in a single operation. 💡 Try This const nestedArray = [1, [2, 3], [4, [5, 6]]]; const flatArray = nestedArray.flat(); // [1, 2, 3, 4, [5, 6]] const flatMappedArray = nestedArray.flatMap(x => (Array.isArray(x) ? x : [x])); // [1, 2, 3, 4, [5, 6]] ❓ Quick Quiz Q: Is Array.flat() and flatMap() different from Array.reduce()? A: Yes, while both methods can be used for flattening, Array.reduce() is more versatile and can be used for a wide range of operations beyond flattening. However, it requires more code and lacks the built-in functionality to flatten nested arrays directly, which flat() and flatMap() offer. ────────────────────────────── 🔗 Read the full guide with code examples & step-by-step instructions: https://lnkd.in/gjQQQYcH
To view or add a comment, sign in
-
-
Claude Code feels fast. Surprisingly fast for a CLI tool that makes API calls on every turn. That's not an accident. It's roughly twenty distinct engineering techniques working together to hide latency behind latency. Armed with Wireshark and Chrome DevTools, I traced the full architecture and found five layers of speed optimization, from process boot to terminal rendering. Here's what stood out. During boot, the first 135ms are spent loading JavaScript modules. Nothing useful should be happening. But Claude Code spawns child processes during module evaluation itself, before imports even finish. Keychain reads and enterprise policy checks run as OS-level subprocesses that complete during the import window. By the time the event loop is free, the results are already waiting. Cost: zero additional milliseconds. Users start typing before the prompt renders. Claude Code captures those keystrokes during boot, handles grapheme-aware backspace (so deleting an emoji works correctly), filters escape sequences, and replays the buffer when the input component is ready. You never lose a character. The streaming pipeline is where the biggest wins are. Tools start executing the moment each tool block completes in the API stream, not after the entire response finishes. Read operations run in parallel. A speculative classifier fires the instant a bash command appears, racing the permission dialog with a 2-second grace window. If the classifier approves the command before the dialog would render, the user never sees a prompt at all. The prompt cache architecture locks tool schemas at first render so they never drift mid-session. Feature flag changes, MCP reconnections, dynamic prompt content: none of it breaks the cache. Headers that affect cache keys are latched at session start. The result is that 90%+ of input tokens hit the cache read path instead of the expensive write path. The terminal renderer is borderline obsessive. Cells are packed into typed arrays (two 32-bit integers per cell, zero per-cell object allocations). ASCII characters get a direct array lookup instead of Map hashing. A line-level cache eliminates redundant text measurement. Hardware scroll regions shift pixels without repainting. Every frame is a single atomic stdout.write call wrapped in synchronized output markers. The principle through all five layers is simple: never do one thing when you could be doing three. Every wait is a scheduling opportunity. Every sequential operation is a candidate for parallelization. Every cache miss is a bug to fix. Link to the article in the comments. Follow me on X: https://lnkd.in/gFHM-54v Consider subscribing to stay on top of the AI coding tools actuality: https://lnkd.in/gR3md6PX #ClaudeCode #Anthropic #AIEngineering #PerformanceEngineering #CLI #DeveloperTools
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development