Claude Auto-Concise v1.0.0
This is the first version of the Claude Auto-Concise user script. It automatically selects the "concise" option in the Claude AI chat interface.
Script Content
// ==UserScript==
// @name Claude: Auto Concise
// @namespace https://github.com/tjhleeds/user-scripts/
// @version 1.0.0
// @description Automatically set Claude to use the Concise style if no other style is selected
// @author tjhleeds
// @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 = 1000;
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)
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.');
return;
}
styleButton.click();
// Use a short delay to allow the style options to appear
setTimeout(() => {
// Find and click the "Concise" option
const paragraphs = document.querySelectorAll('p');
let conciseOption;
for (const p of paragraphs) {
if (p.textContent.trim() === 'Concise') {
conciseOption = p;
break;
}
}
if (conciseOption) {
const buttonToClick = conciseOption.closest('button');
if (buttonToClick) {
buttonToClick.click();
console.log('Claude Auto Concise: "Concise" style selected.');
} else {
console.log('Claude Auto Concise: Could not find button for "Concise" option.');
}
} else {
console.log('Claude Auto Concise: "Concise" option not found.');
}
}, 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();
})();