This skill turns the agent into a video DJ for Kosmi watch party rooms. It uses agent-browser (Chromium automation via accessibility-tree snapshots) to navigate to a Kosmi room, queue videos by URL, and auto-loop playback.
agent-browser CLI installed and on PATH ( npm install -g agent-browser or available in the environment).env file at ${CLAUDE_PLUGIN_ROOT}/.env containing room URL and credentialsAGENT_BROWSER_SESSION_NAME env var (keeps cookies/localStorage between runs)Load from ${CLAUDE_PLUGIN_ROOT}/.env before any agent-browser calls:
VariableRequiredDescriptionKOSMI_ROOM_URLYesFull URL to the Kosmi room (e.g. https://app.kosmi.io/room/XXXXX)KOSMI_EMAILNoLogin email (skip if using persistent session)KOSMI_PASSWORDNoLogin password (skip if using persistent session)KOSMI_BOT_NAMENoDisplay name in room (default: clawdbot)AGENT_BROWSER_SESSION_NAMEYesSession persistence key (default: kosmi-dj-session)AGENT_BROWSER_ENCRYPTION_KEYNoHex key to encrypt stored session data
Execute ${CLAUDE_PLUGIN_ROOT}/skills/kosmi-dj/scripts/kosmi-connect.sh to:
KOSMI_BOT_NAME and click JoinExecute ${CLAUDE_PLUGIN_ROOT}/skills/kosmi-dj/scripts/kosmi-play.sh <VIDEO_URL> to:
Execute ${CLAUDE_PLUGIN_ROOT}/skills/kosmi-dj/scripts/kosmi-loop.sh to:
The loop script writes a PID file at /tmp/kosmi-dj-loop.pid for stop/status commands.
All browser automation goes through the agent-browser CLI. Key commands:
CommandUsagePurposeopen <url>``agent-browser open "$URL"Navigate to URLsnapshot``agent-browser snapshot -i -C --jsonGet interactive elements as JSONclick <ref>``agent-browser click @ref123Click an element by ref IDfill <ref> <text>``agent-browser fill @ref123 "text"Fill a textboxpress <key>``agent-browser press EnterPress a keyboard keywait <ms>``agent-browser wait 1000Wait/settle delay
Snapshot output is JSON with data.refs — a map of refId → { role, name }. Use role + name matching to find UI elements. Always use the -i (interactive-only) and -C (cursor-interactive) flags for cleaner snapshots.
For detailed command reference, see references/agent-browser-commands.md.
Kosmi's UI is dynamic. Element ref IDs change between page loads. The correct approach:
agent-browser snapshot -i -C --jsondata.refsrole (button, textbox, link) and name (case-insensitive substring match)@) for click/fill actionsFor the Kosmi-specific UI element map (button names, modal flow), see references/kosmi-ui-map.md.
Run ${CLAUDE_PLUGIN_ROOT}/skills/kosmi-dj/scripts/kosmi-snapshot-debug.sh to dump a human-readable snapshot of all interactive elements currently visible. Use this to discover exact button names and textbox labels in the Kosmi room.
agent-browser is not installed, install it: npm install -g agent-browserwait 1500 and retryreferences/kosmi-ui-map.md.env or delete the session to force re-auth:
agent-browser session delete kosmi-dj-sessionFor long-running DJ loops, minimize token burn:
crontab or watch) instead of agent idle-polling/dj-start command which launches the loop as a background processreferences/agent-browser-commands.md — Full agent-browser CLI reference with examplesreferences/kosmi-ui-map.md — Kosmi room UI element names, modal flows, and snapshot patternsscripts/kosmi-connect.sh — Connect/join a Kosmi roomscripts/kosmi-play.sh — Play a single video by URLscripts/kosmi-loop.sh — Auto-loop DJ mode (background process)scripts/kosmi-snapshot-debug.sh — Dump interactive elements for debugging