其他会话反馈(用户转述):「技能里写了,但说得不完整——这就是我反复踩坑的原因。
正文只写了『起实例 = 丢进常驻后台任务』,没给能直接抄的命令,也没说 Windows 上该用哪个启动器;
真正能跑的入口在技能外的另一个文件里;我照正文起,没做永不退出的循环 ⇒ 任务一结束 Chrome 被连坐。」
真因(读到代码才看清,两节自相矛盾):
- §1 说「要丢进常驻后台任务、且一直不退出」,§2 却直接给了一条 **同步** 的 `chrome.exe` 命令。
照 §2 抄 ⇒ 父进程一退 Chrome 立刻死(实测 `WinError 10061`)。
- 起法真正落在**工作区根**的 `bh_chrome_keepalive.py`(`while True` 守端口那段),而那支脚本**不在技能包里**。
改动
- 新增 `agent-workspace/bh_chrome_keepalive.py`(随包的可复制启动器,行为沿用已实测那支):
幂等(端口已在听 ⇒ 立刻退出)· `while True` 守子进程、退出就重起 · 僵死态**只记日志不自动重启**(保住现场)·
起 Chrome 前清代理 env · `DETACHED|NO_WINDOW|NEW_PROCESS_GROUP` ·
参数化 `--port/--chrome/--profile/--log/--proxy`(默认值与线上一致;`--proxy` 对应文档里那条 socks5)。
- `SKILL.md` §1 改写成**可直接抄的三步**:复制启动器 → `pythonw.exe` 起 → 计划任务兜(动作也用 pythonw、
5 分钟一次、MultipleInstances=IgnoreNew;`schtasks.exe` 在本机黑名单 ⇒ 走 PowerShell ScheduledTasks);
另给校验两条(netstat / curl --noproxy)。
- `SKILL.md` §2 加前置说明:那条 `chrome.exe` 是**启动器脚本内部的那一步**,用途是看懂与排障;
并补 `--proxy` 的用法。
- 顶部那颗「起实例」子弹由「细节见 §1,本处不复述」改成「三步见 §1」——**从"叮嘱"改成"给命令"**。
- 表述按 2026-10-09 的「一律用肯定表述」写:先写要什么(永不退出的循环 / 保住现场),
把踩过的坑放括号里当依据;僵死态那两条由「别把 A 当成 B」改成正向判据「两条都过才叫可用」。
验证
- `--help` 正常;`--chrome Z:/不存在` ⇒ rc=2 且不起浏览器(守卫)。
- 真机幂等:9223 正在听 ⇒ 跑它 rc=0、日志 `port 9223 already listening ⇒ exit (idempotent)`、端口数不变(没新起浏览器)。
- ⚠️ 已知不一致(本次不改,见次日报告):contentm_agent 工作区根的部署副本与 `tmp/bh_keep_chrome.py`
仍是旧的非参数化版本;本次只把**源**落进技能包。
Browser Harness ♞
Connect an LLM directly to your real browser with a thin, editable CDP harness. For browser tasks where you need complete freedom.
One websocket to Chrome, nothing between. The agent writes what's missing during execution. The harness improves itself every run.
Try browser-harness in Browser Use Cloud or paste the setup prompt into your coding agent.
● agent: wants to upload a file
│
● agent-workspace/agent_helpers.py → helper missing
│
● agent writes it agent_helpers.py
│ + custom helper
✓ file uploaded
You will never use the browser again.
Setup prompt
Paste into Claude Code or Codex:
Install or upgrade browser-harness to the latest stable version with uv using Python 3.12, register the skill from `browser-harness skill`, and connect it to my browser. Ask whether I want local browser recordings enabled; default to no and preserve my existing preference on upgrades. Follow https://github.com/browser-use/browser-harness/blob/main/install.md if setup or connection fails.
The agent will open chrome://inspect/#remote-debugging. Tick the checkbox so the agent can connect to your browser:
Click Allow when the per-attach popup appears (Chrome 144+):
See agent-workspace/domain-skills/ for example tasks.
Free Browser Use Cloud browsers
Stealth, sub-agents, or headless deployment.
Browser Use Cloud free tier: 3 concurrent browsers, proxies, captcha solving, and more. No card required.
- Grab a key at cloud.browser-use.com/new-api-key
- Or let the agent sign up itself via docs.browser-use.com/llms.txt (setup flow + challenge context included).
Architecture (~1k lines across 4 core files)
install.md— first-time install and browser bootstrapSKILL.md— day-to-day usagesrc/browser_harness/— protected core package${XDG_CONFIG_HOME:-~/.config}/browser-harness/agent-workspace/agent_helpers.py— helper code the agent edits${XDG_CONFIG_HOME:-~/.config}/browser-harness/agent-workspace/domain-skills/— reusable site-specific skills the agent edits
Plain browser-harness helper calls attach to the running Chrome/Chromium CDP endpoint. For isolated automation, launch Chrome yourself with --remote-debugging-port and pass BU_CDP_URL, or use a Browser Use cloud browser.
Development
From a checkout, use ./browser-harness to run the current working tree without activating a virtualenv or depending on the globally installed command:
./browser-harness <<'PY'
print(page_info())
PY
Normal agent-facing docs should keep using browser-harness; the ./browser-harness launcher is only for local repo testing.
Contributing
PRs and improvements welcome. The best way to help: contribute a new domain skill under agent-workspace/domain-skills/ for a site or task you use often (LinkedIn outreach, ordering on Amazon, filing expenses, etc.). Each skill teaches the agent the selectors, flows, and edge cases it would otherwise have to rediscover.
- Skills are written by the harness, not by you. Just run your task with the agent — when it figures something non-obvious out, it files the skill itself (see SKILL.md). Please don't hand-author skill files; agent-generated ones reflect what actually works in the browser.
- Open a PR with the generated
domain-skills/<site>/folder copied into this repo'sagent-workspace/domain-skills/examples — small and focused is great. - Bug fixes, docs tweaks, and helper improvements are equally welcome.
- Browse existing skills (
github/,linkedin/,amazon/, ...) to see the shape.
If you're not sure where to start, open an issue and we'll point you somewhere useful.
Domain skills
Set BH_DOMAIN_SKILLS=1 to enable domain skills from the agent workspace. This repo's agent-workspace/domain-skills/ directory contains examples to contribute via PR.
The Bitter Lesson of Agent Harnesses · Web Agents That Actually Learn