sso-watcher
Skill4 starsChanged 7 months agoMITView on GitHub
Install and manage the Hammerspoon-based SSO auto-picker for Clawpilot (or any Electron app). Automatically dismisses the Microsoft Entra ID account picker by selecting the configured account and clicking Continue. macOS only. Triggers include: 'sso watcher', 'install sso', 'sso auto-picker', 'setup sso', 'hammerspoon sso', or any request to auto-dismiss the SSO login dialog.
- Installs packages
In this repository11 other files it gives its agents.
- architectureSkill
- azure-answerSkill
- capture-meetingSkill
- connectSkill
- copilot-babysitterSkill
- crm-activity-syncSkill
- customer-repoSkill
- daily-activity-logSkill
- followupsSkill
- meeting-prepSkill
- msx-crmSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
Run the install script with the target Microsoft account email:
- Distinctive: line 60
After installation, Hammerspoon needs Accessibility access:
- Very specific: line 90
After editing, reload Hammerspoon: click the Hammerspoon menu bar icon → Reload Config, or run hs -c "hs.reload()" from terminal.
- Distinctive: line 97
Check Hammerspoon is running: look for the hammer icon in the menu bar
- Distinctive: line 115
When the user asks to install or manage the SSO watcher via Clawpilot:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/sso-watcher — Hammerspoon SSO Auto-Picker
Automatically dismisses the Microsoft Entra ID / SSO account picker modal that appears inside Clawpilot (or any Electron app) by selecting the configured account and clicking Continue.
macOS only — uses Hammerspoon for Accessibility API access with zero TCC headaches.
How It Works
- The SSO account picker is NOT inside Clawpilot — it's rendered by
AppSSOAgent (
com.apple.AppSSOAgent), the macOS Enterprise SSO broker from Company Portal - Hammerspoon polls AppSSOAgent's AX (Accessibility) tree every 3 seconds
- Also triggers on any app activation (SSO agent may pop up for any app)
- Looks for SSO dialog markers: "Accounts found", "Sign in to your account", etc.
- Finds the AXRow containing the configured email and clicks it
- Waits 0.8s then clicks the "Continue" button
- 15-second cooldown after each successful click to avoid loops
Files
| File | Location | Purpose |
sso-watcher.lua | ~/.hammerspoon/sso-watcher.lua | Main Hammerspoon module |
sso-watcher-config.lua | ~/.hammerspoon/sso-watcher-config.lua | Configuration (account, app name, intervals) |
init.lua | ~/.hammerspoon/init.lua | Hammerspoon entry point (loads the module) |
| Log | ~/Scripts/sso-watcher-hammerspoon.log | Runtime log |
Installation
Run the install script with the target Microsoft account email:
bash "$HOME/customer-skills/sso-watcher/install.sh" user@microsoft.comOr for a custom app name:
bash "$HOME/customer-skills/sso-watcher/install.sh" user@microsoft.com "MyElectronApp"The installer:
- Installs Hammerspoon via Homebrew (if missing)
- Copies
sso-watcher.luato~/.hammerspoon/ - Creates config with the account email
- Adds
require("sso-watcher")to~/.hammerspoon/init.lua - Enables Hammerspoon auto-launch at login
- Launches/reloads Hammerspoon
macOS Permissions
After installation, Hammerspoon needs Accessibility access:
System Settings → Privacy & Security → Accessibility → Toggle ON: Hammerspoon
Without this, the watcher cannot read or interact with the SSO dialog.
Uninstallation
bash "$HOME/customer-skills/sso-watcher/uninstall.sh"Removes the module, config, and log. Does NOT uninstall Hammerspoon itself.
Configuration
Edit ~/.hammerspoon/sso-watcher-config.lua:
return {
account = "user@microsoft.com", -- email to auto-select
poll_interval = 3, -- seconds between checks
cooldown = 15, -- seconds after successful click
log_file = os.getenv("HOME") .. "/Scripts/sso-watcher-hammerspoon.log",
}The watcher always monitors AppSSOAgent (com.apple.AppSSOAgent) — the system SSO
broker. No need to configure which app triggers the SSO dialog.
After editing, reload Hammerspoon: click the Hammerspoon menu bar icon → Reload Config,
or run hs -c "hs.reload()" from terminal.
Troubleshooting
Watcher not triggering
- Check Hammerspoon is running: look for the hammer icon in the menu bar
- Check Accessibility: System Settings → Privacy & Security → Accessibility → Hammerspoon must be ON
- Check logs:
tail -f ~/Scripts/sso-watcher-hammerspoon.log - Check config:
cat ~/.hammerspoon/sso-watcher-config.lua— verify the email is correct - Reload: Click Hammerspoon menu bar → Reload Config
"SSO markers found but account element not found"
The dialog was detected but your email wasn't in the AX tree yet. This is usually a timing issue — the watcher will retry on the next poll (3s).
Account clicked but Continue button not found
The 0.8s delay may not be enough on a slow machine. Edit the config to increase
cooldown or modify sso-watcher.lua to increase the doAfter delay.
Skill Invocation
When the user asks to install or manage the SSO watcher via Clawpilot:
Install (first time on a new Mac)
- Detect the user's Microsoft email:
Or ask the user.m365_get_my_profile() → email - Run the installer:
bash "$HOME/customer-skills/sso-watcher/install.sh" "user@microsoft.com" - Remind the user to grant Accessibility to Hammerspoon.
Check status
pgrep -x Hammerspoon && echo "Running" || echo "Not running"
cat ~/.hammerspoon/sso-watcher-config.lua
tail -5 ~/Scripts/sso-watcher-hammerspoon.logChange account
bash "$HOME/customer-skills/sso-watcher/install.sh" "newemail@microsoft.com"Uninstall
bash "$HOME/customer-skills/sso-watcher/uninstall.sh"Prerequisite Auto-Install
This skill has no sibling skill dependencies. It only requires:
| Tool | Check | Install |
| Homebrew | command -v brew | https://brew.sh |
| Hammerspoon | ls /Applications/Hammerspoon.app | brew install --cask hammerspoon |
The install script handles Hammerspoon installation automatically.
Platform Note
This skill is macOS only. Hammerspoon does not exist on Linux or Windows. On other platforms, the SSO picker must be handled differently (e.g., browser extension, AutoHotkey on Windows).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

