Claude Auto-Concise v1.1.0
This version of the Claude Auto-Concise user script adds a new feature.
Script Content
// ==UserScript==
// @name Claude Auto Concise
// @namespace https://www.timhilton.xyz/user-scripts
// @version 1.1.1
// @description Automatically set Claude to use the Concise style if no other style is selected
// @author Tim Hilton using Jules
// @match https://claude.ai/
// @match https://claude.ai/new
// @match https://claude.ai/chat/*
// @match https://claude.ai/project/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const LOG_PREFIX = '[Claude: Auto Concise]';
const MAX_RETRIES = 10;
const RETRY_DELAY_MS = 2000; // Increased delay
console.debug(`${LOG_PREFIX} Script initialized`);
function selectConciseStyle() {
console.debug(`${LOG_PREFIX} Checking if style is already selected`);
// Check if a style is already selected
const styleSelected = document.querySelector('button[aria-pressed="true"] svg path[d*="M15.5117"]');
if (styleSelected) {
console.log(`${LOG_PREFIX} ⏭️ Style already selected`);
return;
}
console.debug(`${LOG_PREFIX} Searching for tools menu button`);
// Open the tools menu
const openToolsMenuButton = document.querySelector('[aria-label="Open tools menu"]');
if (!openToolsMenuButton) {
console.log(`${LOG_PREFIX} ❌ Tools menu button not found`);
return;
}
openToolsMenuButton.click();
console.debug(`${LOG_PREFIX} Tools menu opened`);
// Use a short delay to allow the menu to open
setTimeout(() => {
console.debug(`${LOG_PREFIX} Searching for style button in menu`);
// Find the style button in the menu (the one with the specific SVG path for the feather icon)
const styleButtons = document.querySelectorAll('button');
let styleButton;
for (const button of styleButtons) {
const svgPath = button.querySelector('svg path[d*="M15.5117"]');
if (svgPath) {
styleButton = button;
break;
}
}
if (!styleButton) {
console.log(`${LOG_PREFIX} ❌ Style button in menu not found`);
openToolsMenuButton.click(); // Close the menu
return;
}
styleButton.click();
console.debug(`${LOG_PREFIX} Style button clicked`);
// Use a short delay to allow the style options to appear
setTimeout(() => {
console.debug(`${LOG_PREFIX} Searching for Concise option`);
// Find the "Concise" option button
const paragraphs = document.querySelectorAll('p');
let conciseButton;
for (const p of paragraphs) {
if (p.textContent.trim() === 'Concise') {
conciseButton = p.closest('button');
break;
}
}
if (conciseButton) {
// Check if the "Concise" option is already selected by looking for the checkmark SVG
const isSelected = conciseButton.querySelector('svg path[d*="M232.49"]');
if (isSelected) {
console.log(`${LOG_PREFIX} ⏭️ Concise style already selected`);
// If it's already selected, close the main tools menu and we're done.
openToolsMenuButton.click();
} else {
// If it's not selected, click it to select it.
conciseButton.click();
console.log(`${LOG_PREFIX} 🎉 Concise style selected successfully`);
}
} else {
console.log(`${LOG_PREFIX} ❌ Concise option not found`);
// Close the main tools menu as we can't proceed.
openToolsMenuButton.click();
}
}, 500);
}, 500);
}
function waitForChatInterface(retryCount = 0) {
console.debug(`${LOG_PREFIX} Waiting for chat interface (attempt ${retryCount + 1}/${MAX_RETRIES})`);
const sendMessageButton = document.querySelector('[aria-label="Send message"]');
if (sendMessageButton) {
console.debug(`${LOG_PREFIX} ✅ Chat interface loaded`);
selectConciseStyle();
} else if (retryCount < MAX_RETRIES) {
setTimeout(() => waitForChatInterface(retryCount + 1), RETRY_DELAY_MS);
} else {
console.log(`${LOG_PREFIX} ❌ Chat interface not found after ${MAX_RETRIES} retries`);
}
}
// Start checking for the chat interface
waitForChatInterface();
})();