Google AI Studio | Clear Chat Button
After their August 2025 interface revamp, Google removed the native clear button, making it difficult to quickly clear conversation history. This userscript restores the missing clear chat button in Google AI Studio.
Features
- Restores Missing Functionality: Brings back the clear chat button that Google removed in their August 2025 AI Studio revamp
- One-Click Clearing: Instantly clear all chat turns in your current prompt session
- Integrated UI: Seamlessly integrates into the existing toolbar with native Material Design styling
- Visual Feedback: Uses a refresh icon (🔄) with clear tooltip for easy identification
- Error Handling: Robust error handling with console logging for debugging
- Non-Intrusive: Doesn't modify existing functionality, only adds the clear feature
Installation
Requirements
- A userscript manager browser extension:
Steps
- Install one of the userscript managers listed above
- Click the install link for this script
- The script will automatically activate on
https://aistudio.google.com/prompts/*
Important Note: Google AI Studio is a single-page application (SPA). This means when you navigate from one section to a prompt page (without a full page reload), the userscript may not initialize properly. If the clear button doesn't appear after navigation, simply reload the page (F5 or Ctrl+R) to activate the script and display the button.
Usage
- Navigate to any prompt page in Google AI Studio (see important note above).
- Look for the new refresh button (🔄) in the top toolbar
- Click the button to clear all chat turns in the current session
- The script will automatically click the option buttons and delete buttons for you
How It Works
The script automates the manual process of:
- Clicking the options menu (⋯) on each chat turn
- Selecting the delete option from the dropdown menu
- Confirming the deletion
This process is now reduced to a single button click in the toolbar.
Compatibility
- Browser: Chrome, Firefox, Safari, Edge
- Userscript Manager: Violentmonkey, Tampermonkey, Greasemonkey
- Platform: Google AI Studio (aistudio.google.com)
Technical Details
- Language: JavaScript (ES6+)
- Framework: None (vanilla JavaScript)
- Dependencies: None
- CSP Compliant: Uses DOM manipulation instead of innerHTML to avoid Content Security Policy restrictions
Configuration
The script includes configurable selectors in case Google changes their DOM structure:
const CHAT_TURN_OPTIONS_SELECTOR = 'ms-chat-turn-options span[class="material-symbols-outlined notranslate ms-button-icon-symbol ng-star-inserted"]';
const DELETE_BUTTON_MENU_SELECTOR = 'div.mat-mdc-menu-content > button:first-of-type';
const DELETE_BUTTON_TEXT = "delete Delete";
Troubleshooting
Button Not Appearing
Script Not Working
- Open browser console (F12)
- Look for error messages starting with
[Gemini Chat Cleaner]
- Verify the page structure hasn't changed (Google may update their interface)
Console Logs
The script provides detailed logging:
[Gemini Chat Cleaner] Script loaded and starting...
[Gemini Chat Cleaner] Current URL: [URL]
[Gemini Chat Cleaner] Toolbar found, creating button...
[Gemini Chat Cleaner] Button successfully added to toolbar
Changelog
v1.0
- Initial release to restore clear chat functionality after Google's August 2025 AI Studio revamp
- Toolbar integration with refresh icon
- Error handling and logging
- CSP-compliant DOM manipulation
- Addresses the removal of native clear chat button
License
This userscript is provided as-is for personal use. Feel free to modify and distribute according to your needs.
Support
If you encounter issues:
- Check the troubleshooting section above
- Verify you're using a compatible userscript manager
- Ensure you're on the correct Google AI Studio URL
- Check browser console for error messages
Author
Created with assistance from AI tools for enhanced productivity in Google AI Studio workflows.