dotfiles / hammerspoon
AGENTS.md16 starsChanged 48 days agoMITView on GitHub
Most Spoons load at the top of init.lua, before the scripts; AutoKeyboardLayout and BirmanLayer load after link_router because they only need to be up, not referenced. Third-party Spoons are tracked in git even when install/18-spoons.sh installs them from a release (since 7d5e6c8f, 2026-10-07): a fresh clone works without network, and the install step re-downloads the pinned releases over them. A git diff after running it means the release and the committed copy disagree — commit the new build or fix…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository50 other files it gives its agents.
- ableton/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- aichat/AGENTS.mdAGENTS.md
- aider/AGENTS.mdAGENTS.md
- annepro2/AGENTS.mdAGENTS.md
- applesauce/AGENTS.mdAGENTS.md
- atuin/AGENTS.mdAGENTS.md
- btop/AGENTS.mdAGENTS.md
- chromium-vimium-extension/AGENTS.mdAGENTS.md
- claude-code/AGENTS.mdAGENTS.md
- codex/AGENTS.mdAGENTS.md
- constants/AGENTS.mdAGENTS.md
- contextMenu/AGENTS.mdAGENTS.md
- cron/AGENTS.mdAGENTS.md
- docker/AGENTS.mdAGENTS.md
- docker-logger/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- dotfiles_tests/AGENTS.mdAGENTS.md
- eza/AGENTS.mdAGENTS.md
- firefox-vimium-addon/AGENTS.mdAGENTS.md
- fork/AGENTS.mdAGENTS.md
- git/AGENTS.mdAGENTS.md
- heroic/AGENTS.mdAGENTS.md
- homebrew/AGENTS.mdAGENTS.md
- iina/AGENTS.mdAGENTS.md
- install/AGENTS.mdAGENTS.md
- iterm/AGENTS.mdAGENTS.md
- jetbrains rider/AGENTS.mdAGENTS.md
- karabiner/AGENTS.mdAGENTS.md
- lazydocker/AGENTS.mdAGENTS.md
- lazygit/AGENTS.mdAGENTS.md
- macos/AGENTS.mdAGENTS.md
- macos_cleanup/AGENTS.mdAGENTS.md
- macos_shortcuts/AGENTS.mdAGENTS.md
- macos_update/AGENTS.mdAGENTS.md
- marta/AGENTS.mdAGENTS.md
- noti/AGENTS.mdAGENTS.md
- npm/AGENTS.mdAGENTS.md
- opencode/AGENTS.mdAGENTS.md
- python/AGENTS.mdAGENTS.md
- qdrant/AGENTS.mdAGENTS.md
- rtk/AGENTS.mdAGENTS.md
- tmux/AGENTS.mdAGENTS.md
- uv/AGENTS.mdAGENTS.md
- voiceink/AGENTS.mdAGENTS.md
- vscode/AGENTS.mdAGENTS.md
- xcode/AGENTS.mdAGENTS.md
- zap/AGENTS.mdAGENTS.md
- zsh/AGENTS.mdAGENTS.md
- claude-code/CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Check bundleID() not app name
- Distinctive: line 31
Add 50ms delay before switching to avoid race conditions
- Very specific: line 53
Check console for errors: open -a "Hammerspoon Console"
- Distinctive: line 58
Don't modify Spoon files without checking their init.lua
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md 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
Hammerspoon Configuration Rules
Structure
- init.lua: Main entry point - loads all Spoons and requires scripts
- Spoons/: Custom functionality modules (*.spoon directories)
- Scripts:
link_router.lua,game_mode.lua,reload_hammerspoon_on_script_changed.lua - Spoons/BirmanLayer.spoon: right-⌥ typographic layer (Birman ⌥ / ⇧⌥ layers and dead keys over Apple's layouts), a third-party Spoon installed from its GitHub release by
install/18-spoons.sh(never edit it in place).init.luaalways loads it and hands itbaseFixups = true,excludedLayouts= Greek (Apple's own Greek ⌥ layer) andexcludedBundlesfromgame_mode.lua; nooverrides. It knows no input source names — the ⌥ layers are positional, dead keys compose by typed character. The keyboard SVGs and lint D2 read itstypography_table.lua(and Apple's ⌥ dumps for excluded layouts) throughdocs/keyboard/parse_birman.py. - Layout names come from
LAYOUT_PRIMARY/LAYOUT_SECONDARY/LAYOUT_TERTIARYinconstants.env— named by role, not by language; never write"ABC"in a call site. - actions/: personal hotkey actions registered into
spoon.HotKeys(actions/init.lualists the modules;actions/lib/holds their helpers). Loaded byrequire "actions"right beforespoon.HotKeys:start().
Spoon Loading Pattern
hs.loadSpoon("SpoonName") -- Loads from Spoons/SpoonName.spoon/Most Spoons load at the top of init.lua, before the scripts; AutoKeyboardLayout and BirmanLayer load after link_router because they only need to be up, not referenced.
Third-party Spoons are tracked in git even when install/18-spoons.sh installs them from a release (since 7d5e6c8f, 2026-10-07): a fresh clone works without network, and the install step re-downloads the pinned releases over them. A git diff after running it means the release and the committed copy disagree — commit the new build or fix the pin; install/check.sh compares the installed versions with the pins.
HotKeys is two-phase: hs.loadSpoon("HotKeys") only loads chords; spoon.HotKeys:start() binds them and must come after require "actions".
Auto-Switching Features
- Layout per app (AutoKeyboardLayout.spoon, configured in
init.lua): every app →LAYOUT_PRIMARY; Telegram clients (the Spoon's built-insecondaryAppslist) →LAYOUT_SECONDARY - Karabiner profiles (
game_mode.lua): games use the "Empty" profile (disables shortcuts), others "Default"; itsbundleslist is also what BirmanLayer is told to stay out of - URL routing: work domains (
WORK_LINK_PATTERNSinconstants.env, plus xd.adobe.com) → Firefox, localhost and private ranges → Chrome, everything else → the browser named byAPP_BROWSER
Application Watcher Pattern
Uses hs.application.watcher to detect app focus changes:
- Check
bundleID()not app name - Get bundle ID:
osascript -e 'id of app "AppName"' - Add 50ms delay before switching to avoid race conditions
Installed Spoons
- AudioSwitcher
- AutoKeyboardLayout — a keyboard layout per app, applied when the app comes to the front. A third-party Spoon (never edit it in place). Source:
~/projects/autokeyboardlayout/AutoKeyboardLayout.spoon. Installed from its GitHub release byinstall/18-spoons.sh. Replacedset_language_on_app_focused.luaon 2026-10-01. - BirmanLayer — right-⌥ typographic layer (from its GitHub release,
install/18-spoons.sh) - BrowserTabOpener —
open(name)/open(pattern, url[, { prefer = js }]): jump to a site's open tab, cycle on repeat, open the address when there is none. A third-party Spoon (never edit it in place). Source:~/projects/browsertabopener/BrowserTabOpener.spoon. Installed from its GitHub release byinstall/18-spoons.sh.spoon.BrowserTabOpener:check()in the console says what works with the current browser.init.luasets itsbrowserfromAPP_BROWSER_BUNDLE; the sites are inactions/browser.lua. - Displays
- Fresh4kWallpaper — a new 4K wallpaper on every load, then daily; keeps one file in
~/Pictures/Fresh4kWallpaper. A third-party Spoon (never edit it in place). Source:~/projects/fresh4kwallpaper/Fresh4kWallpaper.spoon. Installed from its GitHub release byinstall/18-spoons.sh. Needs no GitHub token: file lists are cached for a week in~/Pictures/Fresh4kWallpaper/cache. Replaced the in-repo GruvboxWallpapers.spoon on 2026-10-01. - GlobalProtectToggle — GlobalProtect VPN on a key (
toggle/connect/disconnect/status), by clicking its menu bar panel. A third-party Spoon (never edit it in place). Source:~/projects/globalprotecttoggle/GlobalProtectToggle.spoon. The GitHub repository is private for now (v0.1.0, not verified live), soinstall/18-spoons.shhas no line for it — its unauthenticated download would 404 — and the dir here is a committed copy of the checkout's last commit (refresh withgit -C ~/projects/globalprotecttoggle/GlobalProtectToggle.spoon archive HEAD | tar -x -C hammerspoon/Spoons/GlobalProtectToggle.spoon). Itsnotifyis replaced with glasswings banners inactions/system.lua. Replacedactions/lib/vpn_globalprotect.luaon 2026-10-02; never run itstogglefrom an agent session — VPN is the owner's to switch. - HotKeys
- KSheet
- PopupTranslateSelection
- PowerWindows — window layout, a third-party Spoon installed from its GitHub release by
install/18-spoons.sh(never edit it in place). Source:/Volumes/SanDisk/projects/powerwindows/lab/spoon(external drive;~/projects/powerwindowslinks there).lab/ship.shturns a finished change into one commit of the public repository next to it,lab/release.sh <version> --installputs a release build here; the installed dir is always such a build, so Hammerspoon works with the drive unplugged. To develop, replace the installed dir with a symlink tolab/spoon, and install a build again when done. Configured bywindow_rules.lua+window_focus_sets.lua. - ScreenGlow — edge glow while an agent drives the desktop;
hs -c 'spoon.ScreenGlow:pulse(45)'/:stop(). A third-party Spoon installed from its GitHub release byinstall/18-spoons.sh(never edit it in place). Source:~/projects/screenglow/ScreenGlow.spoon. - LinkRouter — each clicked link to the browser its rule names; Hammerspoon is the system browser. A third-party Spoon; never edit it in place. Source:
~/projects/linkrouter/LinkRouter.spoon. Not published yet, soinstall/18-spoons.shhas no line for it: the dir here is a committed copy of the checkout's last commit (refresh withgit -C ~/projects/linkrouter/LinkRouter.spoon archive HEAD | tar -x -C hammerspoon/Spoons/LinkRouter.spoon). Without itlink_router.luahands the system-browser role back toAPP_BROWSER. Rules live inlink_router.lua; check one withspoon.LinkRouter:route(url)in the console. Replaced URLDispatcher on 2026-10-07. - YouTrackTasks
- YouTrackTicket
- YouTubeStream
Critical Rules
- Always reload after changes:
hs -c "hs.reload()" - Check console for errors:
open -a "Hammerspoon Console" - Spoon names are case-sensitive
- Scripts in root use
require, Spoons usehs.loadSpoon()
Anti-Patterns
- Don't modify Spoon files without checking their init.lua
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.

