Skip to content

Commit 971bf8b

Browse files
committed
docs(ai): clarify browser session choice for verification
1 parent 16764c7 commit 971bf8b

File tree

6 files changed

+74
-1
lines changed

6 files changed

+74
-1
lines changed

.codex/agents/browser-check.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sandbox_mode = "read-only"
44
developer_instructions = """
55
Verify only the route, user flow, and acceptance criteria the parent agent gives you.
66
Use playwright-cli against the already-running local app at http://5chan.localhost:1355 unless the parent agent gives a different URL. Never start, restart, or stop the dev server.
7+
Default to a fresh isolated playwright-cli browser session. If verification depends on auth, cookies, extensions, open tabs, or other existing browser state and the parent agent did not specify session mode, stop and ask whether to use a fresh browser or the contributor's current browser session.
8+
Never attach to a live personal browser session without explicit permission. If current-session reuse is requested, use the supported attach path only when available; otherwise report the limitation instead of silently switching modes.
79
Check desktop and mobile viewport when the request touches layout, responsiveness, or touch interactions.
810
Return concrete PASS/FAIL findings with the route, actions taken, and evidence observed. Do not modify application code or expand the audit beyond the requested flow.
911
"""

.codex/skills/playwright-cli/SKILL.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,34 @@ playwright-cli screenshot
2323
playwright-cli close
2424
```
2525

26+
## Session mode selection
27+
28+
Default to a fresh isolated browser session for reproducible verification.
29+
30+
Before browser work where existing state may matter, explicitly confirm the mode if the user has not already said which one they want:
31+
32+
1. Fresh isolated `playwright-cli` session
33+
2. Current browser session reuse
34+
35+
Existing state usually matters when the task depends on auth, cookies, extensions, open tabs, or reproducing something already happening in the contributor's browser.
36+
37+
Do not attach to a live personal browser session without explicit approval.
38+
39+
If current-session reuse is requested, prefer the supported attach path in the local setup:
40+
41+
```bash
42+
# Fresh isolated browser (default)
43+
playwright-cli -s=verify open https://example.com
44+
45+
# Reusable Playwright-managed profile
46+
playwright-cli -s=verify open https://example.com --persistent
47+
48+
# Attach to an existing browser when the local extension bridge is set up
49+
playwright-cli open --extension
50+
```
51+
52+
If the task requires the contributor's current browser session and the attach path is not available in the current setup, stop and ask whether to switch to a fresh session or provide an explicit CDP-based Playwright script.
53+
2654
## Commands
2755

2856
### Core

.cursor/agents/browser-check.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Use the already-running Portless dev server at `http://5chan.localhost:1355` unl
2323

2424
Do not start, restart, or stop the dev server yourself. If the app is unreachable, report the failure and stop.
2525

26+
Default to a fresh isolated `playwright-cli` browser session. If the requested verification depends on auth, cookies, extensions, open tabs, or other existing browser state and the parent agent did not specify session mode, stop and ask whether to use a fresh browser or the contributor's current browser session.
27+
2628
### Step 2: Navigate and Snapshot
2729

2830
Use playwright-cli to check the relevant page:
@@ -74,4 +76,6 @@ playwright-cli snapshot
7476
- Only check what the parent agent asked you to verify — don't audit the entire app
7577
- If playwright-cli is not installed, report it immediately and stop
7678
- If the dev server is unreachable, report the error and stop
79+
- Never attach to a live personal browser session without explicit permission
80+
- If current-session reuse is requested, use the supported attach path only when available; otherwise report the limitation instead of silently switching to a fresh session
7781
- Don't modify any code — you are read-only, verification only

.cursor/skills/playwright-cli/SKILL.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,34 @@ playwright-cli screenshot
2323
playwright-cli close
2424
```
2525

26+
## Session mode selection
27+
28+
Default to a fresh isolated browser session for reproducible verification.
29+
30+
Before browser work where existing state may matter, explicitly confirm the mode if the user has not already said which one they want:
31+
32+
1. Fresh isolated `playwright-cli` session
33+
2. Current browser session reuse
34+
35+
Existing state usually matters when the task depends on auth, cookies, extensions, open tabs, or reproducing something already happening in the contributor's browser.
36+
37+
Do not attach to a live personal browser session without explicit approval.
38+
39+
If current-session reuse is requested, prefer the supported attach path in the local setup:
40+
41+
```bash
42+
# Fresh isolated browser (default)
43+
playwright-cli -s=verify open https://example.com
44+
45+
# Reusable Playwright-managed profile
46+
playwright-cli -s=verify open https://example.com --persistent
47+
48+
# Attach to an existing browser when the local extension bridge is set up
49+
playwright-cli open --extension
50+
```
51+
52+
If the task requires the contributor's current browser session and the attach path is not available in the current setup, stop and ask whether to switch to a fresh session or provide an explicit CDP-based Playwright script.
53+
2654
## Commands
2755

2856
### Core

AGENTS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Only record items that are repo-specific, likely to recur, and have a concrete m
3232
| Translation key/value changed | Use `docs/agent-playbooks/translations.md` |
3333
| Bug report in a specific file/line | Start with git history scan from `docs/agent-playbooks/bug-investigation.md` before editing |
3434
| `CHANGELOG.md` or package version changed | Run `yarn blotter:check`; if needed add a concise release one-liner |
35-
| UI/visual behavior changed | Verify in browser with `playwright-cli`; test desktop and mobile viewport |
35+
| UI/visual behavior changed | Verify in browser with `playwright-cli`; test desktop and mobile viewport; if existing browser state matters, confirm whether to use a fresh session or the contributor's current browser session |
3636
| Long-running task spans multiple sessions, handoffs, or spawned agents | Use `docs/agent-playbooks/long-running-agent-workflow.md`, keep a machine-readable feature list plus a progress log, and run `./scripts/agent-init.sh --smoke` before starting a fresh feature slice |
3737
| New reviewable feature/fix started while on `master` | Create a short-lived `codex/feature/*`, `codex/fix/*`, `codex/docs/*`, or `codex/chore/*` branch from `master` before editing; use a separate worktree only for parallel tasks |
3838
| New unrelated task started while another task branch is already checked out or being worked on by another agent | Create a separate worktree from `master`, create a new short-lived task branch there, and keep each agent on its own worktree/branch/PR |
@@ -119,6 +119,9 @@ src/
119119
- After React UI logic changes, run: `yarn doctor`.
120120
- Treat React Doctor output as actionable guidance; prioritize `error` then `warning`.
121121
- For UI/visual changes, verify with `playwright-cli` on desktop and mobile viewport.
122+
- For browser automation and verification, default to a fresh isolated `playwright-cli` session for reproducibility.
123+
- If the task depends on existing auth, cookies, extensions, open tabs, or another live browser state, explicitly confirm whether to use a fresh isolated session or the contributor's current browser session.
124+
- Do not assume permission to drive the contributor's active personal browser session.
122125
- The shared hook verification path is strict by default. Only set `AGENT_VERIFY_MODE=advisory` when you intentionally need signal from a broken tree without blocking the session.
123126
- Use `yarn test:coverage` as an advisory check when expanding test coverage or auditing risky logic; do not invent a repo-wide coverage gate unless the user asks for one.
124127
- If verification fails, fix and re-run until passing.

docs/agent-playbooks/skills-and-tools.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ npx skills add https://github.com/vercel-labs/skills --skill find-skills
3232

3333
Use `playwright-cli` for browser automation (navigation, interaction, screenshots, tests, extraction).
3434

35+
Default to a fresh isolated browser session for normal verification. If the task depends on the contributor's existing browser state, ask whether they want:
36+
37+
- a fresh isolated `playwright-cli` session
38+
- their current browser session reused
39+
40+
Do not attach to a live personal browser session without explicit confirmation.
41+
3542
```bash
3643
npm install -g @playwright/cli@latest
3744
playwright-cli install --skills
@@ -48,3 +55,4 @@ Avoid GitHub MCP and browser MCP servers for this project because they add signi
4855

4956
- GitHub operations: use `gh` CLI.
5057
- Browser operations: use `playwright-cli`.
58+
- If current browser reuse is needed, keep using Playwright-based attach paths rather than browser MCP servers.

0 commit comments

Comments
 (0)