[PROPOSAL] Golang Rewrite to Address Critical Memory Usage (1.5-2GB per session)
Problem: Excessive Memory Usage Makes Claude Code Unusable on Standard Hardware
Current State on macOS (2.0.17):
Each Claude Code session consumes 1.5-2GB of active memory:
Process Active Compressed
claude heap-keeper 2.16GB 371MB
claude iterm2-fork 1.76GB 295MB
claude gw-audit 1.66GB 271MB
claude iterm2-fork 1.46GB 251MB
claude hubspot 1.02GB 173MB
Real-World Impact:
- 16GB Mac: Cannot run more than 3-4 concurrent Claude sessions
- Had to upgrade to Mac Studio 64GB just to work with multiple projects
- Memory pressure forces constant session restarts
- Swap usage degrades performance significantly
Related Issues:
- #4953: Process grows to 120GB+ RAM and gets OOM killed (Linux)
- #8706: Resource exhaustion with Sonnet 4.5 (WSL2)
- #9579: Autocompacting loop causing massive token usage
- Multiple other
perf:memorytagged issues
Proposal: Golang Rewrite
I'm offering to rewrite the Claude Code client in Go (under NDA if required) to address these fundamental performance issues:
Why Golang?
Memory Efficiency:
- Go binaries typically use 10-50MB vs Node.js 500MB-2GB
- Efficient garbage collection with lower overhead
- No V8 engine overhead (100-200MB baseline)
- Static compilation eliminates runtime dependencies
Performance:
- 5-10x faster startup time (no JIT warmup)
- Lower CPU usage (compiled vs interpreted)
- Better concurrency primitives (goroutines vs async/promises)
Production Examples:
- Docker CLI: ~30MB memory footprint
- kubectl: ~50MB memory footprint
- GitHub CLI (
gh): ~40MB memory footprint - All handle complex terminal UIs, API interactions, and concurrent operations
Estimated Improvements
- Memory: 1.5-2GB → 30-100MB per session (15-50x reduction)
- Startup: 2-3s → 100-300ms (10x faster)
- CPU: Significantly lower idle and active usage
- Disk: Single ~20MB binary vs 200MB+ node_modules
Implementation Approach
Phase 1: Core Rewrite (3-4 months)
- API client (using official
anthropic-sdk-go) - Terminal UI (using
bubbleteaortview) - File operations and git integration
- MCP server protocol
Phase 2: Feature Parity (2-3 months)
- Hooks system
- All current features and flags
- Migration tooling for existing configs
Phase 3: Testing & Migration (1-2 months)
- Beta testing with community
- Performance benchmarking
- Gradual rollout
About Me
- Experienced Go developer (can provide references)
- Willing to work under NDA
- Can commit 20-30 hours/week
- No compensation required (contribution to open source)
Questions for Anthropic Team
- Would you be open to a Golang rewrite?
- What are the technical constraints/requirements?
- How can we structure this collaboration?
- Is there existing internal work in this direction?
---
The current Node.js implementation is a major barrier to adoption. Multiple users have reported needing to upgrade hardware just to use Claude Code effectively. A memory-efficient rewrite would make this tool accessible on standard development machines.
I'm ready to start immediately if there's interest.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗