ChatGPT AutoCleaner v5

Bugfix & speed-up for ChatGPT: cleans the conversation chat window by trimming old messages from the Browser DOM. Keeps only the latest N turns visible, preventing lag and excessive DOM size on long sessions. Includes manual “Clean now” button and auto-clean toggle.

Você precisará instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

You will need to install an extension such as Tampermonkey to install this script.

Você precisará instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Você precisará instalar uma extensão como o Tampermonkey para instalar este script.

Você precisará instalar um gerenciador de scripts de usuário para instalar este script.

(Eu já tenho um gerenciador de scripts de usuário, me deixe instalá-lo!)

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

(Eu já possuo um gerenciador de estilos de usuário, me deixar fazer a instalação!)

Autor
Aleksey Maximov
Instalações hoje
0
Total de instalações
49
Avaliações
1 0 0
Versão
1.5
Criado
26/07/2025
Atualizado
18/08/2025
Tamanho
7,65 KB
Licença
MIT
Aplicável a

TL;DR

  • Everyone knows the pain: long ChatGPT sessions → the page gets slower and slower.
  • The UI is a heavy React app with lots of memory leaks, especially in background telemetry.
  • This script applies a safe quick fix: trims old chat messages from the DOM so the interface stays light and responsive.

Problem

In long single-thread chats, the web UI gradually lags: typing slows down, scrolling stutters, sometimes the tab even freezes.
One reason is that the DOM keeps growing with all conversation turns. Large DOM trees are expensive to render and update, especially when streaming tokens.

React also stores its own internal message arrays (including telemetry and unfinished drafts), which keep piling up. But at the moment, trimming those is risky — too many side effects.


Solution

This userscript automatically trims old conversation turns from the DOM only, keeping only the most recent ones (default: 5).
By keeping the DOM short and clean, it reduces rendering overhead and makes the interface smoother, even in long chats.


Features

  • Keeps only the latest N messages visible (configurable)
  • Automatic periodic cleanup (interval configurable)
  • Manual “Clean now” button for instant trim
  • Skips auto-clean when the tab is hidden (no background CPU churn)
  • Compact floating UI for settings
  • Works on both chat.openai.com and chatgpt.com
  • Fully local — no data sent anywhere

Notes

  • This script affects only the browser DOM view of the conversation.
  • It does not touch or delete chat history stored in your OpenAI account.
  • Old turns can always be reloaded by refreshing the page.
  • React’s internal memory still grows over time (messages + telemetry). That problem is more complex and not yet fixed safely here.