A Chrome extension that reduces memory usage on AI chat sites by trimming bloated DOM.
- ChatGPT (chatgpt.com)
- Gemini (gemini.google.com, aistudio.google.com)
- Claude (claude.ai)
- Perplexity (perplexity.ai)
- Microsoft Copilot (copilot.microsoft.com)
AI chat interfaces render every message, code block, and syntax-highlighted token into the browser DOM. Long conversations can accumulate 80,000+ DOM nodes and 23,000+ active timers, causing:
- 2-4 GB RAM per tab
- Sluggish typing and scrolling
- Browser tab crashes
Faq DomSlayer monitors the chat DOM and replaces old messages with lightweight placeholders.
| Feature | Description |
|---|---|
| DOM Trimming | Keeps last N messages in DOM, replaces older ones with clickable placeholders |
| 3 Trim Modes | Grouped Placeholder (restore on click), Collapse (CSS height limit), Remove (aggressive) |
| Memory Monitoring | Shows DOM node count and JS heap usage |
| Per-Site Adapters | Tailored CSS selectors for each platform |
| One-Click Restore | Restore all trimmed messages instantly |
| Per-Site Overrides | Enable/disable and tune trim settings individually per platform |
| Debug Mode | Optional namespaced console logs for diagnosis |
- Download or clone this repository
- Open
chrome://extensions/ - Enable Developer mode (top-right toggle)
- Click Load unpacked
- Select the
extension/folder - Navigate to a supported AI chat site
Click the extension icon to open settings:
- Enable/Disable - Global toggle
- Max visible messages - How many recent messages stay in full DOM (5-50)
- Trim mode - How old messages are handled
- Show memory stats - Display heap info in popup
- Debug mode - Print namespaced diagnostic logs in DevTools
- Per-Site Overrides - Enable/disable and tune trim behavior per supported site
- Force Cleanup - Immediate DOM trim and garbage collection
- Restore All - Bring back all trimmed messages
Create a Chrome Web Store upload ZIP from the repository root:
node scripts/package-release.jsTo increment the patch version first, use:
node scripts/package-release.js --bumpRelease ZIPs are written to releases/ and are ignored by Git.
extension/
├── manifest.json # Manifest V3 config
├── background.js # Service worker
├── popup/
│ ├── popup.html # Settings UI
│ ├── popup.css # Dark theme styling
│ └── popup.js # Settings logic
├── content/
│ ├── injector.js # Entry point, site detection
│ ├── core/
│ │ ├── dom-trimmer.js # Generic trim engine
│ │ └── memory-monitor.js # Heap monitoring
│ └── sites/
│ ├── chatgpt.js # ChatGPT adapter
│ ├── gemini.js # Gemini adapter
│ ├── claude.js # Claude adapter
│ ├── perplexity.js # Perplexity adapter
│ └── copilot.js # Copilot adapter
├── utils/
│ └── constants.js # Shared constants
├── tests/
│ └── extension.test.js # Extension unit tests
└── icons/
└── *.png # Extension icons
scripts/
├── package-release.js # Chrome Web Store release packager
├── package-release.test.js # Packaging tests
├── zip-writer.js # Pure-JS ZIP writer
└── zip-writer.test.js # ZIP writer tests
- Manifest V3 - Uses modern Chrome extension architecture
- No remote code - Everything runs locally, no data sent anywhere
- MutationObserver - Watches for new messages and trims automatically
- requestIdleCallback - Non-blocking DOM manipulation during browser idle time
- Adapter pattern - Each site has its own DOM selector strategy
- Open DevTools on a supported site
- Type
window.__aicoin the console - should show the extension object - Run
window.__aico.trimmer.getStats()for live stats - Check the service worker console at
chrome://extensions/for errors
MIT