Compress CLAUDE.md Files to Reduce System Prompt Bloat in Claude Code

Optimizing Claude Context Usage
Claude Code injects CLAUDE.md files into every conversation as system prompt context, including project-level CLAUDE.md, global files at ~/.claude/CLAUDE.md, and persistent memory system files. Every character in these files consumes context that Claude processes before addressing user requests, potentially reducing performance when signal-to-noise ratio is low.
The Compression Approach
The author proposes stripping human-readable decoration and keeping only machine-readable signal using these rules:
- Strip markdown decoration: Headers (##), bold (**), italic (*), horizontal rules (---)
- Collapse prose to notation: Use compact key-value pairs or pipe-delimited lists instead of explanatory sentences
- Remove redundant framing: Eliminate sentences like "This section contains..." or "The following table shows..."
- Deduplicate cross-file context: Keep identical information in one canonical location
- Compress table formatting: Replace verbose markdown tables with compact notation
Before and After Examples
Directory Index Table Example:
Before (markdown table):
## Directories | Directory | What | When to read | |-------------|-----------------------------|---------------------------------------| | src/ | Application source code | Working on application logic | | infra/ | Terraform and Ansible files | Modifying infrastructure | | docs/ | Architecture documentation | Understanding system design | | scripts/ | Deployment and utility scripts | Running or editing deploy workflows |
After compression:
Dirs: src/=application source | infra/=terraform+ansible | docs/=architecture docs | scripts/=deploy+utility scripts
Memory System Instructions Example:
Before:
## Memory System Persistent memory lives at `/path/to/memory/`. **Session start**: Read `memory/_index.md` to re-establish context when doing substantive work in this repo. **During work** — Write to memory when something significant happens: - A discovery or non-obvious finding → append to `memory/discoveries.md` - A new skill applied or learned → update `memory/skills.md`
After compression:
Memory: /path/to/memory/ session-start: read _index.md for substantive work during-work (write on significant events only, signal not noise): discovery → append memory/discoveries.md skill learned → update memory/skills.md
Compression Results
The author achieved the following reductions across files:
- _index.md: 3,560 → 2,036 characters (43% reduction)
- discoveries.md: 11,260 → 5,609 characters (50% reduction)
- interests.md: 4,315 → 2,561 characters (41% reduction)
- skills.md: 16,176 → 5,353 characters (67% reduction)
- career-timeline.md: 17,882 → 5,027 characters (72% reduction)
- ~/.claude/CLAUDE.md: 2,350 → 1,495 characters (36% reduction)
Total compressed memory system: 60,264 characters with roughly 60-70% reduction across the board. The project CLAUDE.md compressed even more aggressively.
📖 Read the full source: HN AI Agents
👀 See Also

OpenClaw Debugs ESP32+CC1101 433 MHz Setup Using HackRF on Raspberry Pi 5
After failed attempts with direct GPIO and ESP32 flashing, OpenClaw used a HackRF to diagnose swapped Tx/Rx pins on the CC1101, finally getting autonomous 433 MHz signal capture and replay on a Pi 5.

WhatsApp on OpenClaw: Save Yourself 2 Hours by Updating to 5.7 First
Setting up WhatsApp on OpenClaw requires Baileys library, 24/7 uptime, and version 5.7+ to avoid ghost chats, TUI degradation, and double-send bugs.

OpenClaw Discord proxy fix for REST API timeout issues
A user reports fixing OpenClaw Discord connection issues where WebSocket connects but REST API calls fail with "fetch failed UND_ERR_CONNECT_TIMEOUT" errors. The solution involves creating a proxy-preload.cjs file and setting global undici proxy settings.

10 Practical Tips for Using Claude Code from Reddit User
A Reddit user shares specific techniques for Claude Code including using /effort high with 'ultrathink' for extended thinking, creating isolated conversation branches with /fork, and setting up custom hooks in .claude/settings.json.