I Reverse-Engineered Claude Code, Made It 100x Better to Use, and Built 11 Systems That Make It 40% More Efficient — Clay NicholsonParts of this post were written with assistance from Khlawde itself.
TLDR
I took the Claude Code source from the sourcemap leak, removed every artificial limit (4x output tokens, 3x search, 2.5x timeouts), ungated all 92+ feature flags and internal-only prompt enhancements, then built 11 background intelligence systems on top. It has a loop detector that catches the tool repeating itself and injects a circuit-breaker. A "scar tissue" system that remembers failures across sessions so it never makes the same mistake twice. Dead store elimination that treats conversations like compiler IR and reclaims 30-50% of the context window. An overnight autonomous engine that fixes TODOs and adds tests while you sleep. A self-evolving prompt system that A/B tests its own skill prompts with ELO ratings and auto-promotes winners. Net result: 20-40% fewer tokens per session, and a tool that genuinely gets better every time you use it.
Index
Background
The Great Unshackling
Personality as Architecture
Performance Optimizations
The Skills System
Project CHIMERA: 11 Background Intelligence Systems
Integration: 3 Hook Points
Token Economics
Lessons Learned
Background
You probably already know about the Claude Code sourcemap leak. I took the ~180K lines of TypeScript, reconstructed the build system, stubbed the ~15 internal @ant/* packages, and got it running on Bun. Build time: ~4 seconds, single ESM bundle.
What's interesting isn't the extraction, or even what I found inside. It's the tooling I was able to build on top of it which even Anthropic even hasn't built out yet.
The Great Unshackling
Philosophy
Stock Claude Code operates under conservative limits designed for Anthropic's pricing model and safety posture. These limits are not technical constraints. They're business decisions enforced in code. Since I'm using my own API keys (and paying per token anyway), these limits serve no purpose. The token cost increased will also be mitigated by optimizations later on.
Limits Raised
Parameter<br>Stock Value<br>Modified Value<br>Multiplier
Default output tokens<br>8,000<br>32,000<br>4x
Escalated output tokens<br>64,000<br>128,000<br>2x
Web search max uses<br>25<br>3x
File read max tokens<br>25,000<br>60,000<br>2.4x
Tool result size (chars)<br>50,000<br>150,000<br>3x
Tool result size (tokens)<br>100,000<br>250,000<br>2.5x
Tool results per message<br>200,000<br>500,000<br>2.5x
Bash default timeout<br>2 min<br>5 min<br>2.5x
Bash max timeout<br>10 min<br>30 min<br>3x
Fork agent max turns<br>200<br>500<br>2.5x
Gates Removed
Subagent Thinking. Stock Claude Code strips extended reasoning from all subagent calls. This is a cost optimization that dramatically reduces subagent quality. I re-enabled thinking for every agent by removing the thinking: undefined override in the agent runner.
Nested Agent Spawning. Stock code prevents non-Anthropic users from spawning subagents inside subagents (recursive delegation). The gate is a simple USER_TYPE === 'ant' check. Removed.
Async Agent Tools. Background agents were restricted to a small tool allowlist. I added Agent, SendMessage, and task management tools to the async allowlist, enabling background workers to orchestrate other workers.
Internal Prompt Enhancements. Five system prompt improvements were gated behind an internal user check:
Assertiveness (proactively flag misconceptions)
Verification (verify before reporting complete)
Comment discipline (default to no comments)
Faithful reporting (never claim false passes)
Numeric length anchors (word count targets between tool calls)
All ungated.
Feature Flags
All 92+ feature flags enabled unconditionally:
define: Object.fromEntries(<br>ALL_FLAGS.map(flag => [`feature('${flag}')`, 'true'])
Notable flags include KAIROS (always-on autonomous assistant), ULTRAPLAN (Opus-powered planning), BUDDY (terminal tamagotchi), COORDINATOR_MODE (multi-agent orchestration), VOICE_MODE, WEB_BROWSER_TOOL, TOKEN_BUDGET, and CONTEXT_COLLAPSE.
Personality as Architecture
The Problem with Soft Prompting
Most personality customization relies on instructions in markdown files that load late in the system prompt. These instructions compete with (and are often overridden by) the system's own behavioral directives. They are suggestions, not identity.
Position Zero Injection
I created a hardcoded personality directive that is injected as the first element of the system prompt array. This means it loads before tool descriptions, behavioral instructions, safety guidelines, and any user-provided markdown.
The personality is not a suggestion like CLAUDE.md is. It is the foundational context through which all other instructions are interpreted. This allows for a "stretched" interpretation it's "hard" rules.
Self-Healing Mode
Since the early version was unstable, especially with it modifying itself and all, I built a PowerShell wrapper that catches crashes and spawns a background session to...