Created
February 1, 2026 07:40
-
-
Save Fuwn/40187bbf7140696d7d64230220973e74 to your computer and use it in GitHub Desktop.
Hide project chats in Claude's sidebar. Starred chats remain visible. (Inspired by vmotta8/claude-hide)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Claude Hide Project Chats | |
| // @namespace fuwn-claude-hide | |
| // @version 1.0.0 | |
| // @description Hide project chats in Claude's sidebar. Starred chats remain visible. | |
| // @author Fuwn | |
| // @match https://claude.ai/* | |
| // @run-at document-start | |
| // @license GPL-3.0-only | |
| // ==/UserScript== | |
| (() => { | |
| "use strict"; | |
| const projectChatUUIDs = new Set(); | |
| const isInsideProject = () => window.location.pathname.includes("/project/"); | |
| const debounce = (callback, delay) => { | |
| let timeout; | |
| return (...args) => { | |
| clearTimeout(timeout); | |
| timeout = setTimeout(() => callback(...args), delay); | |
| }; | |
| }; | |
| const hideProjectChats = () => { | |
| if (isInsideProject()) return; | |
| document.querySelectorAll('a[href^="/chat/"]').forEach((link) => { | |
| const href = link.getAttribute("href"); | |
| if (!href) return; | |
| const chatUUID = href.replace("/chat/", "").split("?")[0]; | |
| const chatItem = link.closest("li"); | |
| if (chatItem && projectChatUUIDs.has(chatUUID)) | |
| chatItem.style.display = "none"; | |
| }); | |
| }; | |
| const debouncedHide = debounce(hideProjectChats, 50); | |
| const originalFetch = window.fetch; | |
| window.fetch = async (...args) => { | |
| const response = await originalFetch.apply(window, args); | |
| try { | |
| const url = typeof args[0] === "string" ? args[0] : args[0]?.url; | |
| if (url?.includes("/chat_conversations")) { | |
| const data = await response.clone().json(); | |
| if (Array.isArray(data)) { | |
| data | |
| .filter((chat) => chat.project_uuid) | |
| .forEach((chat) => projectChatUUIDs.add(chat.uuid)); | |
| setTimeout(hideProjectChats, 100); | |
| } | |
| } | |
| } catch {} | |
| return response; | |
| }; | |
| const startObserver = () => { | |
| new MutationObserver(debouncedHide).observe(document.body, { | |
| childList: true, | |
| subtree: true, | |
| }); | |
| }; | |
| document.readyState === "loading" | |
| ? document.addEventListener("DOMContentLoaded", startObserver) | |
| : startObserver(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment