Kosmi Dj
This skill should be used when the user asks to "play a video in Kosmi", "queue a video", "DJ in Kos
- Rating
- 3.8 (281 reviews)
- Downloads
- 8,509 downloads
- Version
- 1.0.0
Overview
This skill should be used when the user asks to "play a video in Kosmi", "queue a video", "DJ in Kosmi", "start.
Complete Documentation
View Source →
Kosmi Video DJ — agent-browser Automation Skill
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.
Prerequisites
agent-browserCLI installed and on PATH (npm install -g agent-browseror available in the environment)- A
.envfile at${CLAUDE_PLUGIN_ROOT}/.envcontaining room URL and credentials - Persistent session support via
AGENT_BROWSER_SESSION_NAMEenv var (keeps cookies/localStorage between runs)
Environment Variables
Load from ${CLAUDE_PLUGIN_ROOT}/.env before any agent-browser calls:
| Variable | Required | Description |
|---|---|---|
| KOSMI_ROOM_URL | Yes | Full URL to the Kosmi room (e.g. https://app.kosmi.io/room/XXXXX) |
| KOSMI_EMAIL | No | Login email (skip if using persistent session) |
| KOSMI_PASSWORD | No | Login password (skip if using persistent session) |
| KOSMI_BOT_NAME | No | Display name in room (default: clawdbot) |
| AGENT_BROWSER_SESSION_NAME | Yes | Session persistence key (default: kosmi-dj-session) |
| AGENT_BROWSER_ENCRYPTION_KEY | No | Hex key to encrypt stored session data |
Core Workflow
1. Connect to Room
Execute ${CLAUDE_PLUGIN_ROOT}/skills/kosmi-dj/scripts/kosmi-connect.sh to:
- Open the Kosmi room URL in agent-browser
- Wait for page load (800ms settle)
- Take an accessibility snapshot to detect the current UI state
- If a nickname/name prompt appears → fill with
KOSMI_BOT_NAMEand click Join - If a login prompt appears and credentials exist → fill email/password and submit
- Verify connection by confirming room UI elements are present
2. Play a Video by URL
Execute ${CLAUDE_PLUGIN_ROOT}/skills/kosmi-dj/scripts/kosmi-play.sh to:
- Ensure connected (runs connect idempotently)
- Open the Apps/media modal in Kosmi
- Select the URL/link input mode
- Fill the URL textbox with the provided video URL
- Click Play (or press Enter as fallback)
- Verify playback started by checking for player UI elements
3. Auto-Loop DJ Mode
Execute ${CLAUDE_PLUGIN_ROOT}/skills/kosmi-dj/scripts/kosmi-loop.sh to:
- Connect to the room
- Enter a fetch→play→wait→repeat cycle:
- Continue until interrupted or a stop signal is received
/tmp/kosmi-dj-loop.pid for stop/status commands.agent-browser CLI Reference (Quick)
All browser automation goes through the agent-browser CLI. Key commands:
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.
Snapshot-Based Element Discovery
Kosmi's UI is dynamic. Element ref IDs change between page loads. The correct approach:
- Take a snapshot:
agent-browser snapshot -i -C --json - Parse refs from
data.refs - Find the target element by matching
role(button, textbox, link) andname(case-insensitive substring match) - Use the ref ID (prefixed with
@) for click/fill actions
references/kosmi-ui-map.md.Debug / Inspect
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.
Error Handling
- If
agent-browseris not installed, install it:npm install -g agent-browser - If snapshot returns no refs, the page may still be loading — add a
wait 1500and retry - If the URL textbox is not found after opening the modal, Kosmi may have updated its UI — run the debug snapshot script and update
references/kosmi-ui-map.md - If login fails, check credentials in
.envor delete the session to force re-auth:
agent-browser session delete kosmi-dj-sessionToken Efficiency
For long-running DJ loops, minimize token burn:
- Use cron-style scheduling (
crontaborwatch) instead of agent idle-polling - The loop script sleeps between polls (configurable interval, default 30s)
- The agent only wakes to: check if video ended → queue next → sleep again
- For fully hands-off operation, use the
/dj-startcommand which launches the loop as a background process
Additional Resources
Reference Files
references/agent-browser-commands.md— Full agent-browser CLI reference with examplesreferences/kosmi-ui-map.md— Kosmi room UI element names, modal flows, and snapshot patterns
Scripts
scripts/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
Installation
openclaw install kosmi-dj
Tags
Quick Info
Ready to Install?
Get started with this skill in seconds
Related Skills
4claw
4claw — a moderated imageboard for AI agents.
Aap Passport
Agent Attestation Protocol - The Reverse Turing Test.
Acestep Lyrics Transcription
Transcribe audio to timestamped lyrics using OpenAI Whisper or ElevenLabs Scribe API.
Adaptive Suite
A continuously adaptive skill suite that empowers Clawdbot.