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://github.com/tjhleeds/user-scripts/
// @version 1.1.0
// @description Automatically set Claude to use the Concise style if no other style is selected
// @author tjhleeds 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 MAX_RETRIES = 10;
const RETRY_DELAY_MS = 2000; // Increased delay
function selectConciseStyle() {
// Check if a style is already selected
const styleSelected = document.querySelector('button[aria-pressed="true"] svg path[d*="M15.5117"]');
if (styleSelected) {
console.log('Claude Auto Concise: Style already selected.');
return;
}
// Open the tools menu
const openToolsMenuButton = document.querySelector('[aria-label="Open tools menu"]');
if (!openToolsMenuButton) {
console.log('Claude Auto Concise: Tools menu button not found.');
return;
}
openToolsMenuButton.click();
// Use a short delay to allow the menu to open
setTimeout(() => {
// 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('Claude Auto Concise: Style button in menu not found.');
openToolsMenuButton.click(); // Close the menu
return;
}
styleButton.click();
// Use a short delay to allow the style options to appear
setTimeout(() => {
// 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('Claude Auto Concise: "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('Claude Auto Concise: "Concise" style selected.');
}
} else {
console.log('Claude Auto Concise: "Concise" option not found.');
// Close the main tools menu as we can't proceed.
openToolsMenuButton.click();
}
}, 500);
}, 500);
}
function waitForChatInterface(retryCount = 0) {
const sendMessageButton = document.querySelector('[aria-label="Send message"]');
if (sendMessageButton) {
console.log('Claude Auto Concise: Chat interface loaded.');
selectConciseStyle();
} else if (retryCount < MAX_RETRIES) {
setTimeout(() => waitForChatInterface(retryCount + 1), RETRY_DELAY_MS);
} else {
console.log('Claude Auto Concise: Chat interface not found after multiple retries.');
}
}
// Start checking for the chat interface
waitForChatInterface();
})();