A lightweight, extensible framework for automating interactions within the Claude AI interface.
This framework allows you to automate repetitive actions in Claude's UI by defining custom "actions" that execute when specific conditions are met. It uses a mutation observer to monitor DOM changes and triggers your defined actions automatically.
- Registry System: Centralized management of multiple automation actions
- Standardized Action Pattern: Consistent check/execute implementation across actions
- Global Cooldown: Prevents action flooding with configurable timeouts
- Error Handling: Robust error management for individual actions
- Open Claude Desktop
- Go to Help -> Enable Developer Mode
- Navigate to Developer Tools window named "Developer Tools - https://claude.ai"
- Go to "Console" tab
- Type "allow pasting" and hit Enter
- Paste the setup script (
1-setup.js
) - Paste any action implementations (e.g.,
2-action-auto-confirm.js
)
This is a unified copy/paste version of the scripts below.
(()=>{class BaseAction{constructor(e){if(!e)throw new Error("Action must have a name.");this.name=e}check(){console.warn(`Action "${this.name}" is missing check() implementation.`);return!1}execute(e){console.warn(`Action "${this.name}" is missing execute() implementation.`)}}let t=0,e=2e3;window.autoActionsRegistry=window.autoActionsRegistry||[],window.myMutationObserver&&window.myMutationObserver.disconnect(),console.log("Setting up new Mutation Observer...");let o=new MutationObserver(o=>{let n=Date.now();if(n-t<e)return console.log("🕒 Global cooldown active, skipping mutation check."),void 0;for(let i of window.autoActionsRegistry)try{let o=i.check();if(o){console.log(`✅ [${i.name}] Conditions met. Preparing to execute.`),i.execute(o),t=n,console.log(`⏱️ [${i.name}] Action executed. Cooldown started.`);break}}catch(e){console.error(`Error during action check/execute for "${i.name}":`,e)}});o.observe(document.body,{childList:!0,subtree:!0}),window.myMutationObserver=o,console.log("✅ Observer started. Watching for changes..."),console.log("Registered actions:",window.autoActionsRegistry.map(e=>e.name));class n extends BaseAction{constructor(){super("AutoConfirmTool")}check(){console.log(`[${this.name}] Checking conditions...`);let e=document.querySelector('[role="dialog"]');if(!e)return null;let t=e.querySelector("button div");if(!t)return null;let o=t.textContent;if(!o||!o.includes("Run ")||!o.includes(" from"))return null;let n=o.match(/Run (\S+) from/),r=n?n[1]:"Unknown Tool";console.log(`[${this.name}] Found potential tool request dialog for: ${r}`);let a=Array.from(e.querySelectorAll("button")).find(e=>e.textContent.toLowerCase().includes("allow for this chat"));return a?(console.log(`[${this.name}] Found 'Allow' button.`),{button:a,toolName:r}):null}execute(e){if(!e||!e.button)return void console.error(`[${this.name}] Execute called without valid data.`);console.log(`🚀 [${this.name}] Auto-approving tool: ${e.toolName}`),e.button.click()}}window.autoActionsRegistry.some(e=>"AutoConfirmTool"===e.name)||(window.autoActionsRegistry.push(new n),console.log("🤖 Added AutoConfirmToolAction to registry."))})();
Automatically clicks "Allow for this chat" when Claude requests permission to run tools - eliminating repetitive approvals during development and testing.
To extend the framework, create a new action class that implements:
check()
- Determines if conditions are met to execute the actionexecute()
- Performs the actual DOM interaction
Then register it with the framework:
window.autoActionsRegistry.push(new YourCustomAction());
Created by me, @rvanbaalen
Inspired by @RafalWilinski's original auto-approve script
Start with copy/pasting step 1, and then add each tool (e.g. AutoConfirm, or create your own) by copy/pasting that one.