/ramtoshiya:windowserver-portsfrom ramtoshiya
Keep macOS tools from filling WindowServer's Mach port space, which kills WindowServer and logs the user out. Every launch of a process that touches the display leaves a name until logout, headless Chrome included. Use before writing, changing, proposing, or reviewing anything on a Mac that starts such processes repeatedly: Swift or AppKit helpers, Vision OCR, Metal, test suites, headless or visible Chrome, Playwright, Vitest browser mode, Storybook, Electron, `screencapture`, `osascript`, or other CLIs called in a loop. That includes advice on a slow check or browser test, such as running it in parallel or adding a test runner, because the skill's rules decide how to do that safely. Also use when a Mac logged out unexpectedly, WindowServer crashed with OS_REASON_PORT_SPACE, or someone asks how many WindowServer ports are in use.
Ships in ramtoshiya. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
On macOS 27.2.1, WindowServer keeps one dead Mach port name for every client process that connected to it and then exited. It never frees them. A clean exit, a kill, and an explicit disconnect before exit all leave the name. When WindowServer's port space reaches its limit (305,834 names on 27.2.1), the kernel kills WindowServer and every GUI session logs out. Nothing outside WindowServer can free the names. Only logout or reboot does. macOS 26.5.1 and 26.6.2 did not keep the names. No later release has been checked yet, so check again after every macOS update, as Check after an update says.
Any process that touches the display connects, including ones that never show a window:
NSApplication.shared connects when it is created.com.apple.windowserver.active. Forcing Vision
to the CPU does not avoid it.screencapture, qlmanage, and system_profiler connect.
A screencapture run left 2 names.A loop that starts such a process once a second adds at least 3,600 names an hour. A test suite that starts a few hundred helpers adds a few hundred names per run.
To see how close this Mac is, run windowserver-ports status --json. Look the
command up on PATH. If it is missing, name it and its install step,
sh tools/windowserver-ports/install.sh from a clone of the repository that
ships this skill, and stop. Never install, update, or build it yourself.
level is warning when the count is at least threshold or is projected to
reach limit within 24 hours. reasons says which. Tell the user, because
only logout or reboot clears the names, and do not start a loop that adds
more.growth and projection are null until the history holds an hour of
readings for the running WindowServer. projection is also null while the
count is not growing. A null is not proof of safety.monitor.installed says whether a LaunchAgent records readings and notifies
the user. monitor.stale says that it stopped.windowserver-ports clients --last 1h counts new connections by client.sandbox-exec -p '(version 1)(allow default)(deny mach-lookup (global-name "com.apple.windowserver.active"))' <command>,
or call CGSSetDenyWindowServerConnections(true) first thing in the
process. Denied, it leaves no name, and Vision OCR gives byte-identical
output. sandbox-exec costs about 5 ms per process and is marked
deprecated. The deny call is private API, which Chromium's renderer also
uses.screencapture per frame.
Ask for the frontmost app or the cursor through NSWorkspace or NSEvent in
that process instead of polling osascript.--no-sandbox would
leave no name but turns off Chrome's isolation.Count names before and after the work you changed, with nothing else running that starts GUI processes. The exact count needs root:
pid=$(pgrep -x WindowServer)
sudo lsmp -p "$pid" | grep DEAD_NAME
Without root, top -l 1 -pid "$pid" -stats pid,command,ports gives the total
port count. It includes the dead names, and it also moves with live ports that
come and go. On a quiet 27.2.1 desktop it moved by 2 or less within seconds, and
20 connecting processes added about 20. Compare it with an idle interval of the
same length, and wait a few seconds after the processes exit, because the count
first overshoots.
Per-process attribution comes from WindowServer's unified log. Each connection
logs a line with New conn 0x and the client's PID. A process that registers as
an app also logs Process creation: with its name. Call /usr/bin/log,
because zsh has a log builtin that takes its place:
/usr/bin/log show --start "<start>" --end "<end>" \
--predicate 'process == "WindowServer" AND (eventMessage CONTAINS "New conn 0x" OR eventMessage CONTAINS "Process creation:")'
After a macOS update, windowserver-ports probe checks without root, and the
installed monitor runs it once by itself. By hand, start a tiny program that
connects (for example one that creates NSApplication.shared and exits) 10
times, and count dead names before and after. 10 more names means the defect remains. 0 means Apple fixed it.
Then the deny rules cost little to keep, but long-lived processes are no
longer required.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ramtoshiya/skills --plugin ramtoshiya14 skills in this plugin
/excalidraw-boardUse when a user asks agents to read, draw, or export selected objects as PNG from a shared excalidraw.com room, or a collaborator references a room id, revision, and element ids. Uses separately installed excalidraw-board and, for PNG export, excalidraw-web-export commands./figma-restUse when reading anything out of a Figma design file — design tokens, colors, type/spacing scales, node structure, or rendered node images — and when a Figma MCP tool returns a rate-limit or "nothing selected" error. Prefer the REST API over the Figma MCP server, which is capped per seat./github-actions-authoringUse before creating or editing .github/workflows/*.yml, .github/workflows/*.yaml, action.yml, or action.yaml anywhere in a repository, even for a small non-version change. Verify every remote uses dependency against its official GitHub releases, enforce a 72-hour release cooldown, inspect compatibility and security, and pin original-repository commit SHAs. Never choose action versions from model memory.Other plugins' skills for the same job