Keep ChatGPT fast by keeping only the last N messages in the DOM. Local-only, privacy-first browser extension that fixes UI lag in long conversations.
Long ChatGPT threads are brutal for the browser: the UI keeps every message in the DOM and the tab slowly turns into molasses β scroll becomes choppy, typing lags, devtools crawl.
LightSession fixes that by intercepting API responses and trimming conversation data before React renders it, keeping the actual conversation intact on OpenAI's side.
- Fixes UI lag in long chats
- Keeps model context intact (only the DOM is trimmed)
- 100% local β no servers, no analytics, no tracking
Built after too many coding sessions where a single ChatGPT tab would start eating CPU and turn Firefox into a slideshow.
- People who keep very long ChatGPT threads (100+ messages)
- Developers who use ChatGPT for debugging, code reviews, or long refactors
- Anyone whose ChatGPT tab becomes sluggish after a while in Firefox
Performance
- Fetch Proxy β intercepts API responses and trims JSON before React renders (no flash of untrimmed content)
- Message-based counting β counts conversation messages (aggregated by role), not individual nodes, for accurate limits
- Automatic trimming β keeps only the last N messages visible (configurable range: 1β100)
- Ultra Lean Mode (Experimental) β aggressive CSS optimizations: kills animations, applies containment
User experience
- Configurable β choose how many recent messages to keep (1β100)
- Status indicator β optional on-page pill showing trim statistics
- Reversible β refresh the page to restore the full conversation
Privacy
- Zero network requests β no data leaves your browser
- Local settings only β uses
browser.storage.localfor configuration - No telemetry β no analytics, tracking, or usage reporting
- Domain-scoped β runs only on
chat.openai.comandchatgpt.com
After installation:
- Open any ChatGPT conversation.
- Click the LightSession icon in your Firefox toolbar.
- Make sure the extension is enabled.
- Adjust how many messages to keep if needed.
git clone https://github.com/11me/light-session.git
cd light-session
# Install dependencies
npm install
# Build the extension
npm run buildThen:
- Open
about:debugging#/runtime/this-firefoxin Firefox. - Click Load Temporary Add-on.
- Select
extension/manifest.json.
- Open a long ChatGPT conversation (or create one).
- Click the LightSession toolbar icon.
- Ensure Extension enabled is checked. Trimming will now happen automatically.
- Use the slider to choose how many of the most recent messages to keep (1β100).
When you want to see the full history again:
- Click Refresh in the popup, or
- Reload the ChatGPT page.
- Extension enabled β master on/off toggle.
- Keep last N messages β how many messages remain visible in the DOM (1β100).
- Show status bar β display a floating pill with trim statistics.
- Ultra Lean Mode β aggressive performance mode for very long/laggy chats (experimental).
- Refresh β reloads the page to restore all messages.
- Navigate controls with Tab / Shift+Tab.
- Toggle checkboxes and buttons with Enter / Space.
- Adjust the slider with arrow keys.
No. LightSession only trims the DOM (what the browser renders), not the data stored by OpenAI.
- The conversation on OpenAI's servers remains intact.
- Reloading the page (or using Refresh in the popup) restores the full history.
Yes:
- No external network requests are made by the extension.
- No analytics, tracking, or telemetry.
- Settings are stored locally in
browser.storage.local.
LightSession uses a multi-tier selector strategy and conservative fallbacks, but a major UI redesign may temporarily break trimming. In that case:
- The extension will simply stop trimming (fail-safe).
- Your conversations will continue to work as usual.
- An update will be released to restore trimming behavior.
LightSession uses a Fetch Proxy architecture:
- Injection β at
document_start, injects a script into the page context before ChatGPT loads. - Interception β patches
window.fetchto intercept/backend-api/JSON responses. - Trimming β parses the conversation mapping, counts messages (role transitions), keeps the last N messages.
- Response β returns a modified Response with trimmed JSON; React renders only kept messages.
Message counting: A "message" is a contiguous sequence of nodes from the same role. Consecutive assistant nodes (e.g., from Extended Thinking) are aggregated as ONE message.
Trimming only affects what the browser renders. The conversation itself remains on OpenAI's side and is fully recoverable by reloading the page.
- Node.js >= 24.10.0 (see
.node-version) - npm >= 10
- Firefox >= 115
# Install dependencies
npm install
# Build once
npm run build
# Watch + rebuild on changes
npm run watch
# Run tests
npm run test
# Lint
npm run lint
# Format
npm run format
# Run in Firefox Developer Edition
npm run dev
# Run in Firefox (stable)
npm run dev:stable
# Package for distribution
npm run package
# Clean build artifacts
npm run cleanextension/
βββ src/
β βββ content/ # Content scripts (settings dispatch, status bar)
β βββ page/ # Page script (Fetch Proxy, runs in page context)
β βββ background/ # Background script (settings management)
β βββ popup/ # Popup UI (HTML/CSS/JS)
β βββ shared/ # Shared types, constants, utilities
βββ dist/ # Compiled output (TypeScript β JavaScript)
βββ icons/ # Extension icons
βββ manifest.json # Firefox extension manifest
- Fetch Proxy β patches
window.fetchin page context to intercept API responses - Message-based trimming β counts role transitions (aggregated messages), not individual nodes
- Content β Page communication β CustomEvents for settings dispatch and status updates
- HIDDEN_ROLES β system, tool, thinking nodes excluded from message count
- Browser: Firefox >= 115 (Manifest V3)
- OS: Windows, macOS, Linux
- ChatGPT: Optimized for the current UI (2025), resilient to small layout changes
This repository contains the Firefox implementation. A separate Chrome version is available on the Chrome Web Store.
Pull requests are welcome. For larger changes or new features, please open an issue first to discuss the approach.
MIT License - see LICENSE for details.
- Issues: GitHub Issues
If you find this extension useful, you can support ongoing development:
| Currency | Address |
|---|---|
| BTC | bc1qjs07p0qpa2taaje0044yhjry48qps4dseny4kd |
| ETH | 0x044ffd952D8525bC69E4d5e32267E9a6bac36510 |
| SOL | 9nP1soTcZspCi2K1WWE9N7PkKPMA3eFgsdZ61vrCCKGZ |
Disclaimer: This is an unofficial extension not affiliated with OpenAI.