nxtfruit. Let’s talk

AI Engineering

The Claude Code Source Leak:
3 Fixes It Found in Our Own Agent

A deobfuscated read of Claude Code's shipped bundle hit 1,376 points on Hacker News. We reviewed it against our own AI development platform — and the three changes that survived the review were all fixes to our code, not features copied from theirs.

AI Development Specialists

The Claude Code source leak

The Claude Code source leak is a third-party deobfuscated read of a shipping agent harness, published 31 March 2026 and pushed to 1,376 points on Hacker News. We reviewed it against our own AI development platform rather than testing it. Verdict: adopt — but the three changes that survived are fixes to our code, not features copied from theirs.

What the leak is, and what we actually did with it

The write-up walks a deobfuscated build of Claude Code’s shipped bundle and names three things that raised eyebrows: fake tools, frustration regexes, and an “undercover mode.” Our research radar surfaced it off Hacker News, and it went through the same path every trend takes here — a devil’s-advocate review against the production pipeline we build software with. Be precise about what that means. We read the write-up, then read our own code, prompts and architecture beside it. We did not run Claude Code’s internals, benchmark anything, or trial a change in production. The output of that process is a verdict, not a measurement.

Six candidate takeaways went in. Each had to survive a refuter pass — a second stage whose only job is to kill the claim by checking it against our actual implementation. Three survived as adoptions. Three came back already-better: we do that, differently, on purpose.

What does the Claude Code source leak reveal about agent design?

The three named findings are, in shape: a tool schema used as a behaviour surface rather than a pure capability list; pattern matching over user text that detects frustration and changes what the agent does; and a mode that alters how the agent presents itself. Treat all of it as reported by someone reading a minified bundle, not as vendor documentation. Anthropic has published no spec for any of it, and nothing in the write-up is independently reproducible without the same artifact. So the tricks themselves aren’t the signal. What they imply is: in a shipping agent, the harness carries at least as much product as the model does. Tool definitions steer behaviour. Prompt prefixes are byte-stable or they are not cached. Environment variables are prompt content. Every one of those is a decision someone made in a file you can read — and a leak is a rare chance to read someone else’s.

We did not copy a single one of those three features. We used them as a checklist to audit the equivalent decisions in our own harness. That is where the value was.

Fix 1: the prompt cache we built and never switched on

Our platform runs dual execution — a CLI subprocess path and a direct API path — and they don’t share prompt assembly. The CLI path inherits caching behaviour from the harness it runs inside. The API path had a helper written specifically to assemble a cached system prompt plus tool definitions, complete with wiring instructions in its own docstring, and zero production callers. Dead code that documents how to revive itself. The leak’s attention to prompt-prefix construction is what sent us looking. The principle is unglamorous: caching only pays when the prefix is byte-identical call after call, which means the cached block has to be assembled in exactly one place, in exactly one order, every time. Two code paths that each build their own prefix will drift, and the drift shows up as a cost line, not an error.

We expect lower per-call cost and latency on the API path. We have not measured the saving, because we have not shipped it — the change is queued as a plan.

Fix 2: our devil’s advocate was too polite

We run two adversarial stages over generated work: a gap-analysis pass and a devil’s-advocate pass, the latter applied both to plans and to execution output. Reading how another harness pressures its model made us diff our critic prompts against each other, which we had never done. The gap-analysis stage carries a position-forcing instruction — it must land on a stance rather than hedge. Neither devil’s-advocate stage had an equivalent. The anti-rubber-stamp force lived in exactly one of three critics. Here is the opinion I’ll defend: an LLM reviewer’s default failure mode is agreement, not hallucination. A critic with no forced position converges on “looks good, minor suggestions,” and that is worse than having no critic at all, because it launders approval into the record. The fix mirrors the counterweight into both devil’s-advocate stages.

Fix 3: credentials your model can read

Our CLI execution path runs the agent with permission prompts disabled. That is how unattended work happens in a background daemon — there is nobody at the keyboard to approve a file write at 3am. The consequence is easy to forget: under --dangerously-skip-permissions, everything in the process environment is reachable by the model, and we were merging a GitHub token into that environment. Nothing in the leak exposed this. Reading how a different harness handles its subprocess boundary is simply what made us look at ours. The remedy is boring — a credential helper, or a scoped short-lived token instead of a long-lived one sitting in env. The rule generalises: if you pass a flag that says dangerous, believe it, and scope every secret in that process as though it will appear in a log.

What we didn’t take

Three of the six candidates came back already covered, and the reasons are more instructive than the adoptions. Cache stability: our context assembler already enforces a fixed prefix ordering as a standing rule, which is the discipline the leaked harness appears to pay for in its own way. Command execution: our API path runs deny-by-default against an explicit allowlist rather than filtering a denylist, so an unknown command fails closed. Knowledge compaction: our daemon already runs background distillation jobs that compress learnings out of completed tasks instead of letting context grow forever.

When you review someone else’s architecture, that “we already do this, differently” column is the one worth reading twice. It separates the decisions you made deliberately from the ones you got away with by accident.

Is a source leak reliable evidence for engineering decisions?

Partly, and only in one direction. There are no benchmarks in this story and I’m not going to borrow any — a deobfuscated bundle has no model version, no harness, and no vendor-reported-versus-independently-verified status to attach to a number, so any figure here would be decoration. What a leak is genuinely good for is existence proofs: it shows that a team shipping an agent at scale thought a given problem was worth code. It does not show the solution works, and it certainly doesn’t show it works in your stack. Our working rule is that a leak can open an investigation but never close one. Every one of the three adoptions had to be re-verified against our own source before it counted, and each is currently a queued plan rather than a deployed change.

FAQ

What is the Claude Code source leak?

It’s a March 2026 write-up analysing a deobfuscated build of Claude Code’s shipped JavaScript bundle, reporting internal details including fake tool definitions, regex-based frustration detection, and an “undercover mode.” It trended on Hacker News at 1,376 points. It is third-party reverse engineering, not Anthropic documentation, and should be read that way.

Should I copy frustration-detection regexes into my own agent?

Probably not, and definitely not reflexively. Sentiment-triggered behaviour assumes a human is typing in real time. Our pipeline runs most work unattended through a background daemon, where there is no live user whose tone means anything — so the mechanism has nothing to read. Match the technique to your interaction model, not to whoever shipped it.

Does prompt caching need its own code path for API execution?

It needs one place that builds the cached prefix, not one per execution mode. If a CLI path and a direct API path each assemble their own system prompt and tool schema, the two will drift and cache hits quietly stop. We found exactly that in our own platform: a cache builder written, documented, and never called from the API path.

Is --dangerously-skip-permissions safe for unattended agents?

It’s necessary for them and it is not safe by itself. The flag removes the approval gate, which makes everything in the process environment model-reachable. Pair it with a hard command allowlist that fails closed, and keep long-lived credentials out of env entirely — use a credential helper or a scoped, short-lived token.

Did you test any of this in production?

No. This was a devil’s-advocate review — we read the source material and compared it against our own code, prompts and architecture. No benchmark run, no production trial, no rollout. Three changes came out of it as verified plan items, and we’ll write about results once there are results to write about.

Not sure what fits your project?

Get a free recommendation from a senior engineer.

Ask an engineer

Start a project

Tell us what
you’re imagining.

A new product, a better website or a process that needs rethinking. Start with the idea; we’ll help work out the next step.

We’ll use your details to respond to your project enquiry.

Prefer email? admin@nxtfruit.com