create-harness-vibe-coding 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-CN.md +103 -155
- package/README.md +213 -175
- package/bin/create-harness-vibe-coding.js +2 -2
- package/package.json +45 -43
- package/src/generator.js +115 -77
- package/src/index.js +159 -49
- package/src/prompts.js +95 -27
- package/templates/common/.claude/agents/architect-manager.md +45 -45
- package/templates/common/.claude/agents/context-master.md +77 -77
- package/templates/common/.claude/agents/debugger.md +41 -41
- package/templates/common/.claude/agents/explore-manager.md +41 -41
- package/templates/common/.claude/agents/implement-manager.md +49 -49
- package/templates/common/.claude/agents/implementer.md +40 -40
- package/templates/common/.claude/agents/memory-master.md +66 -66
- package/templates/common/.claude/agents/planner.md +34 -34
- package/templates/common/.claude/agents/researcher.md +41 -41
- package/templates/common/.claude/agents/review-manager.md +56 -56
- package/templates/common/.claude/agents/test-writer.md +38 -38
- package/templates/common/.claude/agents/verifier.md +32 -32
- package/templates/common/.claude/rules/ecc/common.md +45 -45
- package/templates/common/.claude/settings.json +68 -68
- package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +36 -31
- package/templates/common/.claude/skills/wf/SKILL.md +36 -0
- package/templates/common/.claude/skills/wf-learn/SKILL.md +13 -28
- package/templates/common/.claude/skills/wf-max/SKILL.md +24 -88
- package/templates/common/.claude/skills/wf-readme/SKILL.md +49 -49
- package/templates/common/.claude/skills/wf-remove/SKILL.md +17 -38
- package/templates/common/.claude/skills/wf-review/SKILL.md +19 -69
- package/templates/common/.claude/skills/wf-update/SKILL.md +19 -61
- package/templates/common/.codex/config.toml +2 -2
- package/templates/common/.codex/hooks.json +37 -37
- package/templates/common/.harness-version +53 -51
- package/templates/common/AGENTS.md +30 -30
- package/templates/common/CLAUDE.md +94 -94
- package/templates/common/{docs/harness → Harness}/PROGRESS.md +17 -17
- package/templates/common/{docs → Harness}/README.md +18 -17
- package/templates/common/{docs/harness → Harness}/WF-MAX.md +223 -223
- package/templates/common/Harness/WF.md +217 -0
- package/templates/common/{docs/harness → Harness}/architecture.md +126 -126
- package/templates/common/{docs/harness → Harness}/dispatch.md +99 -99
- package/templates/common/{docs → Harness}/research/research-results.md +66 -66
- package/templates/common/{docs/harness → Harness}/subagents.md +194 -194
- package/templates/common/{docs → Harness}/tasks/_template/ARTIFACTS.md +3 -3
- package/templates/common/{docs → Harness}/tasks/_template/NOTES.md +3 -3
- package/templates/common/{docs → Harness}/tasks/_template/PLAN.md +40 -40
- package/templates/common/{docs → Harness}/tasks/_template/PROGRESS.md +29 -29
- package/templates/common/MEMORY.md +68 -66
- package/templates/common/README.md +44 -37
- package/templates/common/SETUP.md +67 -47
- package/templates/common/memory/agent-lessons-patterns.md +21 -21
- package/templates/common/memory/tool-usage-reflections.md +21 -21
- package/templates/common/memory/user-corrections-preferences.md +21 -21
- package/templates/common/scripts/scan-clean.mjs +450 -449
- package/templates/common/scripts/validate-harness.mjs +56 -34
- package/templates/common/scripts/wf-mode-hook.mjs +318 -318
- package/templates/common/scripts/wf-remove.mjs +400 -384
- package/templates/common/scripts/wf-statusline.ps1 +38 -38
- package/templates/common/scripts/wf-statusline.sh +48 -48
- package/templates/common/scripts/wf-update-check.mjs +389 -389
- package/templates/optional/catalog.json +63 -29
- package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +194 -194
- package/templates/optional/skills/browser-e2e/{docs → Harness}/workflows/browser-e2e.md +75 -75
- package/templates/optional/skills/github-pr-review/{docs → Harness}/workflows/github-pr-review.md +28 -28
- package/templates/optional/skills/python-backend/{docs → Harness}/workflows/python-backend.md +34 -34
- package/templates/optional/skills/ts-react-frontend/{docs → Harness}/workflows/ts-react-frontend.md +35 -35
- package/templates/optional/skills/ui-ux-review/{docs → Harness}/workflows/ui-ux-review.md +26 -26
- package/templates/common/.claude/commands/wf-learn.md +0 -17
- package/templates/common/.claude/commands/wf-max.md +0 -49
- package/templates/common/.claude/commands/wf-remove.md +0 -23
- package/templates/common/.claude/commands/wf-review.md +0 -25
- package/templates/common/.claude/commands/wf-update.md +0 -17
- package/templates/common/.claude/commands/wf.md +0 -31
- package/templates/common/commands/wf-max.toml +0 -18
- package/templates/common/commands/wf-review.toml +0 -15
- package/templates/common/docs/harness/WF.md +0 -174
- package/templates/optional/skills/browser-e2e/.claude/commands/wf-browser.md +0 -25
- /package/templates/common/{docs/harness → Harness}/agent-workflow.md +0 -0
- /package/templates/common/{docs/harness → Harness}/context-loading.md +0 -0
- /package/templates/common/{docs/harness → Harness}/extension.md +0 -0
- /package/templates/common/{docs/harness → Harness}/lifecycle.md +0 -0
- /package/templates/common/{docs → Harness}/research/PRD.md +0 -0
- /package/templates/common/{docs → Harness}/research/README.md +0 -0
|
@@ -1,43 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"skills": [
|
|
3
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"skills": [
|
|
3
|
+
{
|
|
4
4
|
"id": "browser-e2e",
|
|
5
5
|
"title": "Browser E2E",
|
|
6
6
|
"description": "Mandatory real-browser smoke workflow using Playwright, Chrome DevTools/CDP, or documented manual evidence.",
|
|
7
7
|
"files": ["skills/browser-e2e"],
|
|
8
8
|
"tags": ["e2e", "browser", "playwright", "cdp"]
|
|
9
|
-
},
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "ui-ux-review",
|
|
12
|
+
"title": "UI/UX Review",
|
|
13
|
+
"description": "Screenshot-driven responsive, accessibility, and visual polish review workflow.",
|
|
14
|
+
"files": ["skills/ui-ux-review"],
|
|
15
|
+
"tags": ["ui", "ux", "accessibility", "review"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "github-pr-review",
|
|
19
|
+
"title": "GitHub PR Review",
|
|
20
|
+
"description": "GitHub CLI based PR diff, checks, review findings, and CI evidence workflow.",
|
|
21
|
+
"files": ["skills/github-pr-review"],
|
|
22
|
+
"tags": ["github", "pr", "review", "ci"]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "python-backend",
|
|
26
|
+
"title": "Python Backend",
|
|
27
|
+
"description": "Python backend workflow for FastAPI or similar APIs with unittest or pytest verification.",
|
|
28
|
+
"files": ["skills/python-backend"],
|
|
29
|
+
"tags": ["python", "fastapi", "unittest", "pytest", "api"]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "ts-react-frontend",
|
|
33
|
+
"title": "TypeScript React Frontend",
|
|
34
|
+
"description": "TypeScript React workflow for typecheck, component tests, builds, and browser smoke.",
|
|
35
|
+
"files": ["skills/ts-react-frontend"],
|
|
36
|
+
"tags": ["typescript", "react", "vite", "frontend"]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"presets": {
|
|
40
|
+
"web-app": ["ts-react-frontend", "browser-e2e", "ui-ux-review"],
|
|
41
|
+
"fullstack": ["ts-react-frontend", "python-backend", "browser-e2e", "github-pr-review"]
|
|
42
|
+
},
|
|
43
|
+
"externalRecommendations": [
|
|
10
44
|
{
|
|
11
|
-
"id": "
|
|
12
|
-
"title": "
|
|
13
|
-
"description": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
45
|
+
"id": "superpowers",
|
|
46
|
+
"title": "Superpowers",
|
|
47
|
+
"description": "Community skill registry for agent workflows and reusable coding skills.",
|
|
48
|
+
"installMode": "recommend-only",
|
|
49
|
+
"url": "https://github.com/obra/Superpowers",
|
|
50
|
+
"tags": ["skills", "community", "subagents"]
|
|
16
51
|
},
|
|
17
52
|
{
|
|
18
|
-
"id": "
|
|
19
|
-
"title": "
|
|
20
|
-
"description": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
53
|
+
"id": "caveman",
|
|
54
|
+
"title": "Caveman",
|
|
55
|
+
"description": "External terse-agent capability to evaluate for low-token behavior and memory compression.",
|
|
56
|
+
"installMode": "recommend-only",
|
|
57
|
+
"url": "https://github.com/JuliusBrussee/caveman",
|
|
58
|
+
"tags": ["workflow", "implementation", "style"]
|
|
23
59
|
},
|
|
24
60
|
{
|
|
25
|
-
"id": "
|
|
26
|
-
"title": "
|
|
27
|
-
"description": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
61
|
+
"id": "agent-research",
|
|
62
|
+
"title": "Agent Research",
|
|
63
|
+
"description": "External research-agent capability for broader product, dependency, and ecosystem investigation.",
|
|
64
|
+
"installMode": "recommend-only",
|
|
65
|
+
"url": "https://github.com/lingzhi227/agent-research-skills",
|
|
66
|
+
"tags": ["research", "agents", "discovery"]
|
|
30
67
|
},
|
|
31
68
|
{
|
|
32
|
-
"id": "
|
|
33
|
-
"title": "
|
|
34
|
-
"description": "
|
|
35
|
-
"
|
|
36
|
-
"
|
|
69
|
+
"id": "codegraph",
|
|
70
|
+
"title": "Code Graph",
|
|
71
|
+
"description": "External code graph or repository map capability for dependency and architecture exploration.",
|
|
72
|
+
"installMode": "recommend-only",
|
|
73
|
+
"url": "https://github.com/colbymchenry/codegraph",
|
|
74
|
+
"tags": ["code graph", "architecture", "analysis"]
|
|
37
75
|
}
|
|
38
|
-
]
|
|
39
|
-
"presets": {
|
|
40
|
-
"web-app": ["ts-react-frontend", "browser-e2e", "ui-ux-review"],
|
|
41
|
-
"fullstack": ["ts-react-frontend", "python-backend", "browser-e2e", "github-pr-review"]
|
|
42
|
-
}
|
|
76
|
+
]
|
|
43
77
|
}
|
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: wf-browser
|
|
3
|
-
description: AI-driven browser automation for E2E testing, web scraping, form filling, and UI verification. Powered by Browser Use (89.1% WebVoyager benchmark). Use for /wf-browser, browser testing, web automation, page interaction, form filling, screenshot verification, or any task requiring real browser control. Dual mode: CLI (fast iteration, no LLM needed) + Python Agent API (complex multi-step workflows with AI reasoning).
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# WF Browser — AI Browser Automation
|
|
7
|
-
|
|
8
|
-
Load:
|
|
9
|
-
|
|
10
|
-
- `Harness/workflows/browser-e2e.md`
|
|
11
|
-
- Official `browser-use` skill at `~/.claude/skills/browser-use/SKILL.md` (auto-installed if missing)
|
|
12
|
-
- `Harness/PROGRESS.md` when work is active
|
|
13
|
-
|
|
14
|
-
## Modes
|
|
15
|
-
|
|
16
|
-
Choose based on task complexity:
|
|
17
|
-
|
|
18
|
-
### Mode 1: CLI (fast iteration, ~50ms per call)
|
|
19
|
-
|
|
20
|
-
Best for: single-page checks, quick screenshots, form fills, element inspection. No LLM needed — Claude Code reasons and issues CLI commands.
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
browser-use --headed open https://example.com # Open page (headed = visible browser)
|
|
24
|
-
browser-use state # Get page title, text, interactive elements with indices
|
|
25
|
-
browser-use screenshot evidence.png # Capture screenshot as evidence
|
|
26
|
-
browser-use click 5 # Click element by index from state output
|
|
27
|
-
browser-use input 3 "user@example.com" # Fill input field by index
|
|
28
|
-
browser-use eval "document.title" # Run JavaScript in page
|
|
29
|
-
browser-use close # Close browser when done
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Daemon keeps the browser open between commands — no cold-start per action.
|
|
33
|
-
|
|
34
|
-
### Mode 2: Python Agent API (multi-step AI reasoning)
|
|
35
|
-
|
|
36
|
-
Best for: complex multi-page workflows, dynamic navigation, data extraction across pages. Needs LLM API key.
|
|
37
|
-
|
|
38
|
-
```python
|
|
39
|
-
from browser_use.beta import Agent, BrowserProfile
|
|
40
|
-
from browser_use.llm import ChatAnthropic
|
|
41
|
-
|
|
42
|
-
agent = Agent(
|
|
43
|
-
task="Go to github.com, search for 'browser-use', click the first result, and report the star count",
|
|
44
|
-
llm=ChatAnthropic(model="claude-haiku-4-5-20251001"),
|
|
45
|
-
browser_profile=BrowserProfile(headless=False),
|
|
46
|
-
)
|
|
47
|
-
history = await agent.run()
|
|
48
|
-
print(history.final_result())
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Environment Setup
|
|
52
|
-
|
|
53
|
-
Run once per machine:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
# 1. Install browser-use with CLI extras
|
|
57
|
-
pip install "browser-use[cli]"
|
|
58
|
-
|
|
59
|
-
# 2. Install Chromium browser
|
|
60
|
-
browser-use install
|
|
61
|
-
|
|
62
|
-
# 3. Verify installation
|
|
63
|
-
browser-use doctor
|
|
64
|
-
|
|
65
|
-
# 4. (Optional) Set LLM API key for Agent mode
|
|
66
|
-
# Create .env file with: ANTHROPIC_API_KEY=sk-ant-...
|
|
67
|
-
# Or: OPENAI_API_KEY=sk-...
|
|
68
|
-
# Or: BROWSER_USE_API_KEY=bu-...
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Windows GBK Encoding Fix
|
|
72
|
-
|
|
73
|
-
If you see `UnicodeEncodeError: 'gbk' codec can't encode character`, the install is auto-patched. If not, set env var before commands:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
set PYTHONIOENCODING=utf-8
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Windows Daemon Patches
|
|
80
|
-
|
|
81
|
-
Browser Use v0.13.1 has two known issues on Windows that are auto-patched on install. If `browser-use open` fails with "Failed to start daemon" or socket timeout, re-apply:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
python -c "
|
|
85
|
-
import browser_use.skill_cli.main as m
|
|
86
|
-
p = m.__file__
|
|
87
|
-
c = open(p, encoding='utf-8').read()
|
|
88
|
-
# Patch 1: auto-clean stale state on dead PID
|
|
89
|
-
c = c.replace(
|
|
90
|
-
'probe = _probe_session(session)\n\n\t# Socket reachable',
|
|
91
|
-
'probe = _probe_session(session)\n\n\t# Auto-clean stale state\n\tif not probe.socket_reachable and not probe.pid_alive and probe.phase:\n\t\t_clean_session_files(session)\n\t\tprobe = _probe_session(session)\n\n\t# Socket reachable'
|
|
92
|
-
)
|
|
93
|
-
# Patch 2: auto-recover from stale session instead of erroring
|
|
94
|
-
c = c.replace(
|
|
95
|
-
\"f'Error: Session {session!r} is alive (phase={probe.phase}) but socket unreachable.\",\"
|
|
96
|
-
\"f'Warning: Session {session!r} has stale state (phase={probe.phase}), auto-cleaning...\",\"
|
|
97
|
-
)
|
|
98
|
-
c = c.replace(
|
|
99
|
-
\"sys.exit(1)\n\n\t\telif probe.phase == 'shutting_down'\",
|
|
100
|
-
\"_terminate_pid(probe.pid)\n\t\t\t_clean_session_files(session)\n\n\t\telif probe.phase == 'shutting_down'\"
|
|
101
|
-
)
|
|
102
|
-
# Patch 3: extend daemon startup timeout (15s -> 30s)
|
|
103
|
-
c = c.replace('deadline = time.time() + 15', 'deadline = time.time() + 30')
|
|
104
|
-
open(p, 'w', encoding='utf-8').write(c)
|
|
105
|
-
print('Patches applied')
|
|
106
|
-
"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Requirements
|
|
110
|
-
|
|
111
|
-
| Requirement | Version | Check |
|
|
112
|
-
|-------------|---------|-------|
|
|
113
|
-
| Python | >= 3.11 | `python --version` |
|
|
114
|
-
| pip | any | `pip --version` |
|
|
115
|
-
| Chromium | auto-installed | `browser-use doctor` |
|
|
116
|
-
| LLM API key | for Agent mode only | check `.env` |
|
|
117
|
-
|
|
118
|
-
## Common Patterns
|
|
119
|
-
|
|
120
|
-
### Login Persistence
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
# Use real Chrome profile (preserves cookies/logins)
|
|
124
|
-
browser-use --profile "Default" open https://app.target.com
|
|
125
|
-
# Or connect to running Chrome with remote debugging
|
|
126
|
-
browser-use connect
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### E2E Test Flow
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
browser-use --headed open https://yourapp.local
|
|
133
|
-
browser-use state # Verify page loaded
|
|
134
|
-
browser-use screenshot step1-landing.png # Evidence
|
|
135
|
-
browser-use input 3 "test@email.com" # Fill email
|
|
136
|
-
browser-use input 5 "password123" # Fill password
|
|
137
|
-
browser-use click 8 # Click login button
|
|
138
|
-
browser-use wait text "Dashboard" # Wait for navigation text
|
|
139
|
-
browser-use state # Verify logged in
|
|
140
|
-
browser-use screenshot step2-dashboard.png # Evidence
|
|
141
|
-
browser-use close
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Console & Network Log Capture
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
browser-use eval "console.log('checkpoint');" # Inject log marker
|
|
148
|
-
browser-use eval "document.title" # Read page state via JS
|
|
149
|
-
browser-use get text 5 # Get text of element index 5
|
|
150
|
-
browser-use get value 3 # Get value of input element index 3
|
|
151
|
-
# For full console/network: use Python Agent mode with Playwright's page.on('console') and page.on('request')
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Error Recovery
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
# If daemon crashes or gets stuck:
|
|
158
|
-
browser-use close # Clean shutdown
|
|
159
|
-
# Then restart:
|
|
160
|
-
browser-use open <url> # Fresh daemon starts automatically
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Verification Contract
|
|
164
|
-
|
|
165
|
-
Every browser task must produce:
|
|
166
|
-
|
|
167
|
-
1. **State evidence**: `browser-use state` output or screenshot
|
|
168
|
-
2. **Action log**: sequence of commands issued
|
|
169
|
-
3. **Result assertion**: explicit before/after state comparison
|
|
170
|
-
|
|
171
|
-
No browser/UI claim without real-browser evidence.
|
|
172
|
-
|
|
173
|
-
## Architecture Note
|
|
174
|
-
|
|
175
|
-
Browser Use wraps Playwright with AI reasoning. The daemon keeps Chromium running between CLI commands (~50ms latency). The Agent mode adds an LLM observation→decision→action loop on top. This replaces fragile CSS-selector scripts with semantic element targeting via accessibility tree snapshots.
|
|
176
|
-
|
|
177
|
-
Benchmarks: 89.1% WebVoyager (SOTA), 78k+ GitHub stars, MIT license.
|
|
178
|
-
|
|
179
|
-
## Security
|
|
180
|
-
|
|
181
|
-
- **Never log or screenshot credentials** — redact password fields, API keys, tokens before capturing evidence
|
|
182
|
-
- **Chrome profiles contain sensitive data** — only use `--profile` with explicit user approval; never share profile data
|
|
183
|
-
- **Screenshots may capture PII** — review before saving to task evidence directory
|
|
184
|
-
- **Scraping targets need approval** — confirm the target site's ToS allow automated access before scraping
|
|
185
|
-
- **`browser-use input` commands with passwords** — use placeholder values in documentation; never hardcode real credentials
|
|
186
|
-
- **Agent mode sandbox** — run Agent API with `allowed_domains` restriction when possible
|
|
187
|
-
|
|
188
|
-
## Return
|
|
189
|
-
|
|
190
|
-
- CLI commands issued and their output
|
|
191
|
-
- screenshot paths
|
|
192
|
-
- agent history (if Agent mode used)
|
|
193
|
-
- verification pass/fail with evidence
|
|
194
|
-
- remaining risks (flaky selectors, auth issues, CAPTCHAs)
|
|
1
|
+
---
|
|
2
|
+
name: wf-browser
|
|
3
|
+
description: AI-driven browser automation for E2E testing, web scraping, form filling, and UI verification. Powered by Browser Use (89.1% WebVoyager benchmark). Use for /wf-browser, browser testing, web automation, page interaction, form filling, screenshot verification, or any task requiring real browser control. Dual mode: CLI (fast iteration, no LLM needed) + Python Agent API (complex multi-step workflows with AI reasoning).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# WF Browser — AI Browser Automation
|
|
7
|
+
|
|
8
|
+
Load:
|
|
9
|
+
|
|
10
|
+
- `Harness/workflows/browser-e2e.md`
|
|
11
|
+
- Official `browser-use` skill at `~/.claude/skills/browser-use/SKILL.md` (auto-installed if missing)
|
|
12
|
+
- `Harness/PROGRESS.md` when work is active
|
|
13
|
+
|
|
14
|
+
## Modes
|
|
15
|
+
|
|
16
|
+
Choose based on task complexity:
|
|
17
|
+
|
|
18
|
+
### Mode 1: CLI (fast iteration, ~50ms per call)
|
|
19
|
+
|
|
20
|
+
Best for: single-page checks, quick screenshots, form fills, element inspection. No LLM needed — Claude Code reasons and issues CLI commands.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
browser-use --headed open https://example.com # Open page (headed = visible browser)
|
|
24
|
+
browser-use state # Get page title, text, interactive elements with indices
|
|
25
|
+
browser-use screenshot evidence.png # Capture screenshot as evidence
|
|
26
|
+
browser-use click 5 # Click element by index from state output
|
|
27
|
+
browser-use input 3 "user@example.com" # Fill input field by index
|
|
28
|
+
browser-use eval "document.title" # Run JavaScript in page
|
|
29
|
+
browser-use close # Close browser when done
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Daemon keeps the browser open between commands — no cold-start per action.
|
|
33
|
+
|
|
34
|
+
### Mode 2: Python Agent API (multi-step AI reasoning)
|
|
35
|
+
|
|
36
|
+
Best for: complex multi-page workflows, dynamic navigation, data extraction across pages. Needs LLM API key.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from browser_use.beta import Agent, BrowserProfile
|
|
40
|
+
from browser_use.llm import ChatAnthropic
|
|
41
|
+
|
|
42
|
+
agent = Agent(
|
|
43
|
+
task="Go to github.com, search for 'browser-use', click the first result, and report the star count",
|
|
44
|
+
llm=ChatAnthropic(model="claude-haiku-4-5-20251001"),
|
|
45
|
+
browser_profile=BrowserProfile(headless=False),
|
|
46
|
+
)
|
|
47
|
+
history = await agent.run()
|
|
48
|
+
print(history.final_result())
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Environment Setup
|
|
52
|
+
|
|
53
|
+
Run once per machine:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. Install browser-use with CLI extras
|
|
57
|
+
pip install "browser-use[cli]"
|
|
58
|
+
|
|
59
|
+
# 2. Install Chromium browser
|
|
60
|
+
browser-use install
|
|
61
|
+
|
|
62
|
+
# 3. Verify installation
|
|
63
|
+
browser-use doctor
|
|
64
|
+
|
|
65
|
+
# 4. (Optional) Set LLM API key for Agent mode
|
|
66
|
+
# Create .env file with: ANTHROPIC_API_KEY=sk-ant-...
|
|
67
|
+
# Or: OPENAI_API_KEY=sk-...
|
|
68
|
+
# Or: BROWSER_USE_API_KEY=bu-...
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Windows GBK Encoding Fix
|
|
72
|
+
|
|
73
|
+
If you see `UnicodeEncodeError: 'gbk' codec can't encode character`, the install is auto-patched. If not, set env var before commands:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
set PYTHONIOENCODING=utf-8
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Windows Daemon Patches
|
|
80
|
+
|
|
81
|
+
Browser Use v0.13.1 has two known issues on Windows that are auto-patched on install. If `browser-use open` fails with "Failed to start daemon" or socket timeout, re-apply:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -c "
|
|
85
|
+
import browser_use.skill_cli.main as m
|
|
86
|
+
p = m.__file__
|
|
87
|
+
c = open(p, encoding='utf-8').read()
|
|
88
|
+
# Patch 1: auto-clean stale state on dead PID
|
|
89
|
+
c = c.replace(
|
|
90
|
+
'probe = _probe_session(session)\n\n\t# Socket reachable',
|
|
91
|
+
'probe = _probe_session(session)\n\n\t# Auto-clean stale state\n\tif not probe.socket_reachable and not probe.pid_alive and probe.phase:\n\t\t_clean_session_files(session)\n\t\tprobe = _probe_session(session)\n\n\t# Socket reachable'
|
|
92
|
+
)
|
|
93
|
+
# Patch 2: auto-recover from stale session instead of erroring
|
|
94
|
+
c = c.replace(
|
|
95
|
+
\"f'Error: Session {session!r} is alive (phase={probe.phase}) but socket unreachable.\",\"
|
|
96
|
+
\"f'Warning: Session {session!r} has stale state (phase={probe.phase}), auto-cleaning...\",\"
|
|
97
|
+
)
|
|
98
|
+
c = c.replace(
|
|
99
|
+
\"sys.exit(1)\n\n\t\telif probe.phase == 'shutting_down'\",
|
|
100
|
+
\"_terminate_pid(probe.pid)\n\t\t\t_clean_session_files(session)\n\n\t\telif probe.phase == 'shutting_down'\"
|
|
101
|
+
)
|
|
102
|
+
# Patch 3: extend daemon startup timeout (15s -> 30s)
|
|
103
|
+
c = c.replace('deadline = time.time() + 15', 'deadline = time.time() + 30')
|
|
104
|
+
open(p, 'w', encoding='utf-8').write(c)
|
|
105
|
+
print('Patches applied')
|
|
106
|
+
"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Requirements
|
|
110
|
+
|
|
111
|
+
| Requirement | Version | Check |
|
|
112
|
+
|-------------|---------|-------|
|
|
113
|
+
| Python | >= 3.11 | `python --version` |
|
|
114
|
+
| pip | any | `pip --version` |
|
|
115
|
+
| Chromium | auto-installed | `browser-use doctor` |
|
|
116
|
+
| LLM API key | for Agent mode only | check `.env` |
|
|
117
|
+
|
|
118
|
+
## Common Patterns
|
|
119
|
+
|
|
120
|
+
### Login Persistence
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Use real Chrome profile (preserves cookies/logins)
|
|
124
|
+
browser-use --profile "Default" open https://app.target.com
|
|
125
|
+
# Or connect to running Chrome with remote debugging
|
|
126
|
+
browser-use connect
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### E2E Test Flow
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
browser-use --headed open https://yourapp.local
|
|
133
|
+
browser-use state # Verify page loaded
|
|
134
|
+
browser-use screenshot step1-landing.png # Evidence
|
|
135
|
+
browser-use input 3 "test@email.com" # Fill email
|
|
136
|
+
browser-use input 5 "password123" # Fill password
|
|
137
|
+
browser-use click 8 # Click login button
|
|
138
|
+
browser-use wait text "Dashboard" # Wait for navigation text
|
|
139
|
+
browser-use state # Verify logged in
|
|
140
|
+
browser-use screenshot step2-dashboard.png # Evidence
|
|
141
|
+
browser-use close
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Console & Network Log Capture
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
browser-use eval "console.log('checkpoint');" # Inject log marker
|
|
148
|
+
browser-use eval "document.title" # Read page state via JS
|
|
149
|
+
browser-use get text 5 # Get text of element index 5
|
|
150
|
+
browser-use get value 3 # Get value of input element index 3
|
|
151
|
+
# For full console/network: use Python Agent mode with Playwright's page.on('console') and page.on('request')
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Error Recovery
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# If daemon crashes or gets stuck:
|
|
158
|
+
browser-use close # Clean shutdown
|
|
159
|
+
# Then restart:
|
|
160
|
+
browser-use open <url> # Fresh daemon starts automatically
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Verification Contract
|
|
164
|
+
|
|
165
|
+
Every browser task must produce:
|
|
166
|
+
|
|
167
|
+
1. **State evidence**: `browser-use state` output or screenshot
|
|
168
|
+
2. **Action log**: sequence of commands issued
|
|
169
|
+
3. **Result assertion**: explicit before/after state comparison
|
|
170
|
+
|
|
171
|
+
No browser/UI claim without real-browser evidence.
|
|
172
|
+
|
|
173
|
+
## Architecture Note
|
|
174
|
+
|
|
175
|
+
Browser Use wraps Playwright with AI reasoning. The daemon keeps Chromium running between CLI commands (~50ms latency). The Agent mode adds an LLM observation→decision→action loop on top. This replaces fragile CSS-selector scripts with semantic element targeting via accessibility tree snapshots.
|
|
176
|
+
|
|
177
|
+
Benchmarks: 89.1% WebVoyager (SOTA), 78k+ GitHub stars, MIT license.
|
|
178
|
+
|
|
179
|
+
## Security
|
|
180
|
+
|
|
181
|
+
- **Never log or screenshot credentials** — redact password fields, API keys, tokens before capturing evidence
|
|
182
|
+
- **Chrome profiles contain sensitive data** — only use `--profile` with explicit user approval; never share profile data
|
|
183
|
+
- **Screenshots may capture PII** — review before saving to task evidence directory
|
|
184
|
+
- **Scraping targets need approval** — confirm the target site's ToS allow automated access before scraping
|
|
185
|
+
- **`browser-use input` commands with passwords** — use placeholder values in documentation; never hardcode real credentials
|
|
186
|
+
- **Agent mode sandbox** — run Agent API with `allowed_domains` restriction when possible
|
|
187
|
+
|
|
188
|
+
## Return
|
|
189
|
+
|
|
190
|
+
- CLI commands issued and their output
|
|
191
|
+
- screenshot paths
|
|
192
|
+
- agent history (if Agent mode used)
|
|
193
|
+
- verification pass/fail with evidence
|
|
194
|
+
- remaining risks (flaky selectors, auth issues, CAPTCHAs)
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
# Browser E2E Workflow
|
|
2
|
-
|
|
3
|
-
Optional workflow for browser-visible testing and automation. Installed when `browser-use` CLI is available.
|
|
4
|
-
|
|
5
|
-
## When Active
|
|
6
|
-
|
|
7
|
-
This workflow is active when:
|
|
8
|
-
1. `browser-use` CLI is installed and `browser-use doctor` passes
|
|
9
|
-
2. `Harness/workflows/browser-e2e.md` exists (this file)
|
|
10
|
-
3. A task explicitly references `/wf-browser
|
|
11
|
-
|
|
12
|
-
## Contract
|
|
13
|
-
|
|
14
|
-
Browser evidence in this project follows the contract:
|
|
15
|
-
|
|
16
|
-
1. **Every browser claim needs real-browser evidence** — screenshot, state snapshot, or console output
|
|
17
|
-
2. **CLI mode is preferred for deterministic steps** — use `browser-use open/state/click/screenshot` for predictable flows
|
|
18
|
-
3. **Agent mode is for dynamic exploration** — use Browser Use Agent API when the page structure is unknown or changing
|
|
19
|
-
4. **Evidence goes to the task directory** — `Harness/tasks/<task-id>/evidence/*.png`
|
|
20
|
-
5. **Stable UI selector contract** — Stable accessible labels/roles and stable test hooks such as `data-testid` are required for critical UI controls and states: inputs, buttons, filters, rows, empty/error/loading states.
|
|
21
|
-
|
|
22
|
-
## Chrome DevTools / CDP / MCP Checklist
|
|
23
|
-
|
|
24
|
-
- [ ] record the URL and port
|
|
25
|
-
- [ ] Verify available CDP, MCP, browser automation, or manual tooling
|
|
26
|
-
- [ ] Check not just HTTP 200
|
|
27
|
-
- [ ] Verify no runtime exceptions, console errors, and failed network requests
|
|
28
|
-
- [ ] Confirm stable accessible labels/roles or `data-testid` on interactive elements
|
|
29
|
-
- [ ] Test critical flow end-to-end
|
|
30
|
-
- [ ] Capture screenshot, trace, video, or result artifact paths
|
|
31
|
-
- [ ] Clean up any dev server or browser processes
|
|
32
|
-
|
|
33
|
-
## Quick Install
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# One-time setup
|
|
37
|
-
pip install "browser-use[cli]"
|
|
38
|
-
browser-use install
|
|
39
|
-
browser-use doctor
|
|
40
|
-
|
|
41
|
-
# Windows: if you see GBK encoding errors, set:
|
|
42
|
-
set PYTHONIOENCODING=utf-8
|
|
43
|
-
|
|
44
|
-
# Verify
|
|
45
|
-
browser-use open https://example.com
|
|
46
|
-
browser-use state
|
|
47
|
-
browser-use screenshot test.png
|
|
48
|
-
browser-use close
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Fallback
|
|
52
|
-
|
|
53
|
-
If `browser-use` is not installed, fall back to:
|
|
54
|
-
|
|
55
|
-
1. Playwright/Puppeteer MCP server (if configured)
|
|
56
|
-
2. Chrome DevTools Protocol (CDP) manual inspection
|
|
57
|
-
3. `Harness/WF.md#Browser And API Evidence` manual check contract
|
|
58
|
-
|
|
59
|
-
## Integration Points
|
|
60
|
-
|
|
61
|
-
- **WF mode**: when browser-visible changes are made, follow the evidence contract in `Harness/WF.md#Browser And API Evidence`
|
|
62
|
-
- **wf-browser**:
|
|
63
|
-
- **MEMORY.md**: registered as optional workflow skill
|
|
64
|
-
- **README.md**: routing table row "Browser E2E testing or automation" → browser-e2e
|
|
65
|
-
|
|
66
|
-
## File Locations
|
|
67
|
-
|
|
68
|
-
| File | Purpose |
|
|
69
|
-
|------|---------|
|
|
70
|
-
| `.claude/skills/wf-browser/SKILL.md` |
|
|
71
|
-
| `.
|
|
72
|
-
| `Harness/workflows/browser-e2e.md` | This file — workflow contract and install guide |
|
|
73
|
-
| `~/.claude/skills/browser-use/SKILL.md` | Official Browser Use skill (user-level, auto-downloaded) |
|
|
74
|
-
| `pip show browser-use \| findstr Location` | Python package install location (run to find) |
|
|
75
|
-
| `~/.browser-use/` | Daemon state and browser profiles |
|
|
1
|
+
# Browser E2E Workflow
|
|
2
|
+
|
|
3
|
+
Optional workflow for browser-visible testing and automation. Installed when `browser-use` CLI is available.
|
|
4
|
+
|
|
5
|
+
## When Active
|
|
6
|
+
|
|
7
|
+
This workflow is active when:
|
|
8
|
+
1. `browser-use` CLI is installed and `browser-use doctor` passes
|
|
9
|
+
2. `Harness/workflows/browser-e2e.md` exists (this file)
|
|
10
|
+
3. A task explicitly references `/wf-browser`, `$wf-browser`, or browser E2E testing
|
|
11
|
+
|
|
12
|
+
## Contract
|
|
13
|
+
|
|
14
|
+
Browser evidence in this project follows the contract:
|
|
15
|
+
|
|
16
|
+
1. **Every browser claim needs real-browser evidence** — screenshot, state snapshot, or console output
|
|
17
|
+
2. **CLI mode is preferred for deterministic steps** — use `browser-use open/state/click/screenshot` for predictable flows
|
|
18
|
+
3. **Agent mode is for dynamic exploration** — use Browser Use Agent API when the page structure is unknown or changing
|
|
19
|
+
4. **Evidence goes to the task directory** — `Harness/tasks/<task-id>/evidence/*.png`
|
|
20
|
+
5. **Stable UI selector contract** — Stable accessible labels/roles and stable test hooks such as `data-testid` are required for critical UI controls and states: inputs, buttons, filters, rows, empty/error/loading states.
|
|
21
|
+
|
|
22
|
+
## Chrome DevTools / CDP / MCP Checklist
|
|
23
|
+
|
|
24
|
+
- [ ] record the URL and port
|
|
25
|
+
- [ ] Verify available CDP, MCP, browser automation, or manual tooling
|
|
26
|
+
- [ ] Check not just HTTP 200
|
|
27
|
+
- [ ] Verify no runtime exceptions, console errors, and failed network requests
|
|
28
|
+
- [ ] Confirm stable accessible labels/roles or `data-testid` on interactive elements
|
|
29
|
+
- [ ] Test critical flow end-to-end
|
|
30
|
+
- [ ] Capture screenshot, trace, video, or result artifact paths
|
|
31
|
+
- [ ] Clean up any dev server or browser processes
|
|
32
|
+
|
|
33
|
+
## Quick Install
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# One-time setup
|
|
37
|
+
pip install "browser-use[cli]"
|
|
38
|
+
browser-use install
|
|
39
|
+
browser-use doctor
|
|
40
|
+
|
|
41
|
+
# Windows: if you see GBK encoding errors, set:
|
|
42
|
+
set PYTHONIOENCODING=utf-8
|
|
43
|
+
|
|
44
|
+
# Verify
|
|
45
|
+
browser-use open https://example.com
|
|
46
|
+
browser-use state
|
|
47
|
+
browser-use screenshot test.png
|
|
48
|
+
browser-use close
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Fallback
|
|
52
|
+
|
|
53
|
+
If `browser-use` is not installed, fall back to:
|
|
54
|
+
|
|
55
|
+
1. Playwright/Puppeteer MCP server (if configured)
|
|
56
|
+
2. Chrome DevTools Protocol (CDP) manual inspection
|
|
57
|
+
3. `Harness/WF.md#Browser And API Evidence` manual check contract
|
|
58
|
+
|
|
59
|
+
## Integration Points
|
|
60
|
+
|
|
61
|
+
- **WF mode**: when browser-visible changes are made, follow the evidence contract in `Harness/WF.md#Browser And API Evidence`
|
|
62
|
+
- **wf-browser**: Claude Code uses `.claude/skills/wf-browser/SKILL.md`; Codex uses `.agents/skills/wf-browser/SKILL.md`. Both load this workflow.
|
|
63
|
+
- **MEMORY.md**: registered as optional workflow skill
|
|
64
|
+
- **README.md**: routing table row "Browser E2E testing or automation" → browser-e2e
|
|
65
|
+
|
|
66
|
+
## File Locations
|
|
67
|
+
|
|
68
|
+
| File | Purpose |
|
|
69
|
+
|------|---------|
|
|
70
|
+
| `.claude/skills/wf-browser/SKILL.md` | Claude Code skill adapter |
|
|
71
|
+
| `.agents/skills/wf-browser/SKILL.md` | Codex repo skill adapter |
|
|
72
|
+
| `Harness/workflows/browser-e2e.md` | This file — workflow contract and install guide |
|
|
73
|
+
| `~/.claude/skills/browser-use/SKILL.md` | Official Browser Use skill (user-level, auto-downloaded) |
|
|
74
|
+
| `pip show browser-use \| findstr Location` | Python package install location (run to find) |
|
|
75
|
+
| `~/.browser-use/` | Daemon state and browser profiles |
|