Skip navigation
I reverse-engineered Claude Code's binary to add a feature I always wanted:
0:00 / 0:59

I reverse-engineered Claude Code's binary to add a feature I always wanted:

Convergence Boy

@0x7962.8K followers

Visit on X
1,530 likesDownloadOriginal post

198,414 views

I reverse-engineered Claude Code's binary to add a feature I always wanted: When context fills up - instead of nuking everything with /compact - I can now surgically strip tool calls/results and thinking blocks while keeping all actual messages intact.

68 Comments

Comments from the original post on X (Twitter)

  • Convergence Boy's profile picture

    @0x796

    The problem was: when you're deep in a session, context is 96% full, and your options are: - /compact: summarizes everything, loses detail, costs an API call - /clear: nuclear option, start over I wanted to strip the heavy garbage and leave only user/agent messages instead.

    84 likes

  • Convergence Boy's profile picture

    @0x796

    So I cracked open the binary. Claude Code is a Bun-compiled executable: ~183MB. All JS is embedded in a __BUN Mach-O section - 4,945 modules, fully minified. Even with `--bytecode`, Bun always stores the full JS source alongside. The bytecode is just a startup optimization.

    55 likes

  • Convergence Boy's profile picture

    @0x796

    What I found inside: Claude already HAS a microcompact() system. It runs before every API call, strips old tool results, saves them to disk, replaces images with placeholders. But it doesn't touch everything and leaves many of the thinking intact...

    58 likes

  • Convergence Boy's profile picture

    @0x796

    It has limitations: - 20K token minimum savings - only kicks in near context limits - keeps last 3 tool results - never removes tool_use blocks. Even after it runs, tons of tool artifacts remain in context. That's by design, but it's not enough when you're running out of space.

    36 likes

  • Convergence Boy's profile picture

    @0x796

    There's also a thinking cleanup before every API call: - filterOrphanedThinking(): removes messages that are ONLY thinking - removeTrailingThinking(): strips thinking from end of last message But thinking blocks inside messages with tool_use? Those survive. They pile up.

    30 likes

  • Convergence Boy's profile picture

    @0x796

    So I built two new commands: /microcompact: strips ALL tool calls + results + media. No thresholds, no "keep last 3". Picker lets you choose how far back to strip. /clear-thinking: strips ALL thinking blocks backward from selected message. Both instant with no LLM calls.

    47 likes

  • Convergence Boy's profile picture

    @0x796

    The meta part: I reverse-engineered Claude Code using Claude Code :) 48 sessions over several days. Built 20 tools: binary extraction, module splitting, vendor fingerprinting, AI renaming (23,105 identifiers via Gemini for ~$2), and a full round-trip pipeline.

    52 likes

  • Convergence Boy's profile picture

    @0x796

    I also built bun-demincer - a generic toolkit for cracking open ANY Bun-compiled binary. Extract embedded JS, split into modules, identify npm packages (fingerprint DB is 1,668 packages rn), deobfuscate, organize into directories and reassemble it back!

    228 likes

  • Convergence Boy's profile picture

    @0x796

    The irony: Claude couldn't finish the job - started forgetting things after another Plan mode run :) After 42 sessions it hit a wall kept looping the full pipeline instead of isolating the failing stage. Classic. Switched to Codex for the final stretch. One shot of course :)

    42 likes

  • Convergence Boy's profile picture

    @0x796

    For the Claude-specific patches (microcompact, clear-thinking) - I'm holding off on publishing them for now. Don't want to step on anyone's toes, unless @AnthropicAI are cool with it. cc: @alexalbert__

    47 likes

  • Convergence Boy's profile picture

    @0x796

    But would love these to be built-in honestly - the code paths are already there, just need manual triggers and looser thresholds. Also /compact should let you pick a message: summarize everything before it, keep everything after. Right now it just nukes the whole conversation.

    32 likes

  • Convergence Boy's profile picture

    @0x796

    All this reverse engineering really helped me to understand what's under the hood of Claude Code. I will be posting more about my explorations... Hold on for new Memory threads!

    43 likes

  • 0xSero's profile picture

    @0xSero

    @vicnaum @banteg @claudeai everything with /compact - I can now surgically strip tool calls/results and thinking blocks while keeping all actual messages intact. You’d be destroying the cache which will cost you tons of tokens and make the model less reliable

    21 likes

  • Convergence Boy's profile picture

    @0x796

    @banteg @claudeai Yes. But it still wins over going in circles with the model that forgot what project it was working on... And actually, If I strip 195k tokens context into 5k (just user/agent conversation) - then who cares about cache?

    12 likes

  • 0xSero's profile picture

    @0xSero

    @vicnaum @banteg @claudeai Mainly that it will usually just reread all the files you stripped out again anyway. I’m not arguing with you it’s something I was interested in exploring too but I never quite got it right

    7 likes

  • Convergence Boy's profile picture

    @0x796

    @banteg @claudeai I usually ask it to use sub-agents for file reading & modifications, and report back. but sometimes it still does things itself..

    5 likes

  • Pascal Brokmeier's profile picture

    @PascalBrokmeier

    @vicnaum @claudeai I built this thing maybe this will also be helpful for you @vicnaum Basically per git repo backup of AI convos.

    18 likes

  • Convergence Boy's profile picture

    @0x796

    @claudeai Oh yeah! I had a simple skill with a script for that: But yours is on a whole new level!

    7 likes

  • Alessio Masucci's profile picture

    @SucciMas

    @vicnaum @claudeai Cool hack, but we're essentially writing manual garbage collection for LLM context now. /compact is a grenade. This is a scalpel. But the real question is why we're still doing memory management by hand in 2026

    6 likes

  • Convergence Boy's profile picture

    @0x796

    @claudeai Exactly! Memory and context management is in such an infancy phase right now that I’m surprised this is still an untackled problem

    6 likes