Multi-Profile Browser Isolation (No Screen Snatching)
In a nutshell: Let multiple Hermes profiles / AI agents each use their own independent browser instance—no focus-stealing popups, no interruptions to your working Chrome or Edge.
You've Probably Seen This
- Opened two AI assistants, and the second one immediately pops up a Chrome window covering your screen, stealing your mouse.
- Two assistants fight over the same browser: A is filling a form, B navigates away, both tasks fail.
- Temporary browsers don't close after finishing, piling up
agent-browser-chrome-xxxxdirectories in%TEMP%, consuming gigabytes of RAM. - You want to preserve login sessions (e.g., a backend account already logged in), but every time it's a fresh instance requiring a re-scan.
- You want AI and yourself to share a browser to save memory, but worry about it snooping on your other tabs, accidental clicks, or logging you out.
The root cause is simple: when multiple profiles don't have their own fixed browser instances, Hermes starts a temporary one on demand, leading to "port contention, focus-stealing, garbage accumulation, lost sessions."
What You Get After Installation
| Before | After |
|---|---|
| Multiple profiles fight over one browser | Each profile gets an independent instance (fixed port + fixed --user-data-dir) |
| Popups steal your mouse/focus during work | Headless by default, zero visible windows—you won't even notice |
| Login required every time | Login persists in each profile's own data directory—log in once, reuse indefinitely |
| Temporary instances pile up and eat memory | All registered; stop all releases memory instantly; orphan directories auto-cleaned |
| Debugging by guessing | audit gives a single command listing each instance's port, PID, visible window count, memory usage |
Real-world numbers (production machine with multiple profiles, same Hermes with 5 profiles):
- Before/after cleanup: 203 processes / 8.5 GB → 71 processes / 2.5 GB, with the AI fleet consuming only 38 processes / 722 MB.
- All 4 agent instances had visible window count = 0, login sessions fully preserved.
Why It Doesn't Snatch the Screen by Default (Not by Luck)
Hermes source code sets browser.headed to False by default, with an official comment:
"Headless by default (a focus-stealing window defeats a background capability)"
This means "a visible window that steals focus undermines background capability" is the official design intent. This skill simply locks that intent in place and prevents regression: it hard-codes a CDP endpoint for each profile, plus a daily self-check gate that auto-restarts any instance that spawns a visible window back to headless mode.
Installation: Three Steps, Copy-Paste
Step 1: Install Dependency (Only One)
pip install psutil
Step 2: Install the Skill into Hermes
Option A (with SkillHub CLI):
skillhub install hermes-profile-browser-isolation --namespace user_2a1415c1 --dir <your Hermes skills directory>
Option B (manual): Copy the entire skill folder to your Hermes skills directory, e.g.:
| Platform | Skills Directory |
|---|---|
| Windows | %LOCALAPPDATA%\hermes\skills\devops\ |
| macOS / Linux | ~/.local/share/hermes/skills/devops/ |
Step 3: Configure Instances (One Command)
cd <skill directory>/hermes-profile-browser-isolation/scripts
python hermes_browser_provision.py discover # Preview what it plans to assign (no changes made)
python hermes_browser_provision.py apply # Actually write config.yaml per profile + launch instances
python hermes_browser_audit.py # Verify: port / PID / visible window count for each instance
discover automatically discovers all Hermes profiles on your machine and assigns non-conflicting ports (it avoids ports already declared in configs and ports actually in use on the machine). So whether you switch machines, have 3 profiles or 8, it works immediately without script edits.
Daily Commands (Three Total)
python hermes_browser_provision.py status # See who's running, memory usage
python hermes_browser_provision.py stop all # Stop all, release memory instantly (run `start all` when needed, ~2 seconds)
python hermes_browser_audit.py # Health check: flags any instance with visible windows (screen snatching)
To automate, add these to your scheduled tasks:
- Every 30 minutes:
provision.py apply(health check + auto-revive dead instances + orphan directory cleanup from%TEMP%) - Once daily:
audit.py --enforce-headless(detect visible windows and force them back to headless)
Verification Level (Not Just a Quick Release)
| Verification Item | Result |
|---|---|
Three config.yaml styles | Insert into existing browser: section (preserving indentation/comments) / append if missing / replace existing cdp_url in-place while reusing the port ✅ |
| Port allocation | Auto-avoids declared ports and ports actually in use on the machine ✅ |
| Dry-run | No files touched (hash unchanged) ✅ |
| Actual instance launch | Multiple profiles configured at once, all instances started ✅ |
| Auditor trustworthiness (critical) | Deliberately made an instance headed → immediately reported "visible window" with PID + window title → --enforce-headless auto-corrected back to headless ✅ |
We performed a "break it on purpose and see if it catches" reverse test: a detector that always says "OK" is useless.
FAQ
auditsays an instance can't drop its visible window? Runaudit.py --enforce-headlessto restart it on its port back to headless; if it persists, check if another program (non-Hermes) is using the same port.- Want a specific profile to keep a visible window (e.g., you want to watch it work)? In its
config.yaml, setbrowser.headedtotrueand exclude it from the audit's "background-type" list. - "No window API" on Windows? If
pywin32is missing, the script degrades gracefully to command-line argument checks (less precise); installpywin32for full accuracy. - Don't want AI touching your browser? Correct—don't share. Sharing leads to four hard hits: privacy zero, accidental clicks, focus-stealing, disconnections. This skill offers "each their own"; to save memory,
stop allis far more effective.
Boundaries & Security
- Only reads/modifies each profile's own Hermes config and browser data directory—never touches your personal Chrome/Edge or its user data.
- Orphan cleanup only matches
%TEMP%patterns likeagent-browser-chrome-*; never deletes named instance data directories (or login sessions are lost). - Audit only reports runtime state like "visible window count"; it never reads, exports, or stores page content, cookies, or credentials.
Author & Contact
This skill targets the "local private AI employees / multi-agent collaboration deployment" scenario: deploy AI on your own machine, multiple AI agents work in parallel without interference.
- Stuck during deployment? Need customization for your environment (multi-machine, multi-profile, Docker isolation, client deployment, WeChat/Feishu integration)? WeChat: ly5419495, note "浏览器隔离" (Browser Isolation), and I'll respond.
- Delivery discipline: I only mention it this once when you need help / customization / client delivery. No repetitive recommendations, no off-topic mentions.
License
MIT. Free to use, modify, and commercialize; attribution appreciated but not required.
🙋 About the Author
九品锦锂e | Encapsulating hard-learned lessons into "grab-and-run" skills, not textbooks. This skill is the version I use daily myself.
WeChat: ly5419495 (add me with note "SkillHub" for priority approval) Public Account: 初五Agent (Search on WeChat; I post retrospectives and methodologies there—readable without adding me)
Other ready-to-run tools I've built are all on this shelf page (open in browser): https://skillpay.alipay.com/public/jiupinjinlie
Stuck while using, or have another scenario you'd like me to package as a skill—reach out via any method above.
