Skip to content
Back to skills

Cmux Socket Policy

ASecurity

Socket command threading and focus policy for cmux CLI/socket work. Use when adding or changing socket commands, CLI commands, telemetry commands, focus/select/open/close/send-key behavior, or automation that could steal app focus.

  • 27,663 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added August 31, 2026
ai-agentsshellsecurity

Works with

  • terminal
  • cli

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 29, 2026

npx -y skills add manaflow-ai/cmux --skill cmux-socket-policy --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cmux Socket Policy?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cmux Socket Policy
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/manaflow-ai-cmux-socket-policy/badge)](https://www.skillsdirectory.com/skills/manaflow-ai-cmux-socket-policy)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cmux-socket-policy
description: "Socket command threading and focus policy for cmux CLI/socket work. Use when adding or changing socket commands, CLI commands, telemetry commands, focus/select/open/close/send-key behavior, or automation that could steal app focus."
---

# cmux Socket Policy

## Threading policy

- Do not use `DispatchQueue.main.sync` for high-frequency socket telemetry commands such as `report_*`, `ports_kick`, status/progress updates, or log metadata updates.
- For telemetry hot paths, parse and validate arguments off-main.
- Dedupe and coalesce off-main first.
- Schedule minimal UI/model mutation with `DispatchQueue.main.async` only when needed.
- Commands that directly manipulate AppKit/Ghostty UI state are allowed to run on the main actor.
- If adding a new socket command, default to off-main handling and require an explicit reason in code comments when main-thread execution is necessary.

## Focus policy

- Socket/CLI commands must not steal macOS app focus.
- Do not activate the app or raise windows unless the command has explicit focus intent.
- Only explicit focus-intent commands may mutate in-app focus/selection.
- Explicit focus-intent commands include `window.focus`, `workspace.select/next/previous/last`, `surface.focus`, `pane.focus/last`, browser focus commands, and v1 focus equivalents.
- All non-focus commands should preserve the current user focus context while still applying data/model changes.
- Open commands (`vm`/`cloud` shell, tui, open, new, base, workspace new/open, agent; `surface open`/`new-terminal`; `cmux open`; `cmux ssh`) focus only when run interactively and stay in the background when run by an agent or script (`defaultFocusForUserOpen`); `--focus` opts in, `--no-focus` opts out. Their socket methods default `focus` to false, and a pane opened without focus is marked unread.

## Remote relay authorization

Every v2 method is a potential `cmux ssh` relay payload. `RemoteRelayCommandPolicy` denies by default; allowlisting a method needs the security analysis and policy tests in [remote relay authorization](references/remote-relay-authorization.md).

## Detailed references

- Read [references/threading-and-focus.md](references/threading-and-focus.md) when adding a command, changing command execution context, or deciding whether focus changes are allowed.
- Read [references/remote-relay-authorization.md](references/remote-relay-authorization.md) when adding or changing a v2 method, a remote CLI command, or the relay policy.

Files in this skill

  • SKILL.md1.6 KB
  • agents/openai.yaml348 B
  • references/threading-and-focus.md1.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.