Browser automation should scope actions to specific tab ID and close tabs when done

Resolved 💬 3 comments Opened Jan 17, 2026 by Schapansky Closed Jan 21, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When Claude Code opens a browser tab for automation, it receives a tab ID but has two critical issues:

1. Tabs are never closed after use

  • Each automation step opens a new tab
  • - Tabs accumulate (5-10+ tabs during autonomous sessions)
  • - - User must manually close all orphaned tabs

2. Actions aren't scoped to the opened tab

  • With multiple Claude instances running autonomously, clicks can hit the wrong tab
  • - Wrong information gets captured and returned to Claude Code
  • - - Different Claude sessions interfere with each other
  • - - - User's personal browsing tabs can also get affected

Real-world scenario:
Running 2-3 Claude Code instances autonomously, each opening browser tabs for testing. Within minutes there are 10+ tabs open. Claude instances start clicking on each other's tabs, gathering wrong data, and the automation becomes unreliable.

Proposed Solution

1. Scope all browser actions to the specific tab ID

  • When Claude opens a tab and gets an ID, ALL subsequent actions (clicks, screenshots, form inputs) should target ONLY that tab
  • - Claude should never interact with tabs it didn't open
  • - - This isolates each Claude instance to its own tab(s)

2. Automatically close tabs when done

  • When Claude completes a browser automation task, it should close the tab(s) it opened
  • - This prevents tab accumulation during long autonomous sessions

3. Tab isolation between Claude instances

  • Each Claude Code instance should only see/interact with tabs it created
  • - User's personal browsing tabs should be invisible to Claude automation

Expected behavior:

1. Claude opens tab → gets tab_id "abc123"
2. 2. All clicks/screenshots scoped to tab "abc123" only
3. 3. Task completes → Claude closes tab "abc123"
4. 4. Browser is clean, other Claude instances unaffected
5. ```

### Alternative Solutions

**Current workarounds (all inadequate):**

1. **Manual tab cleanup** - User must periodically close accumulated tabs during autonomous sessions
2. 2. **Run only one Claude instance** - Defeats the purpose of parallel autonomous work
3. 3. **Close browser between tasks** - Disruptive and loses user's personal tabs
**Why these don't work:**
- Manual intervention defeats autonomous operation
- - Single-instance limitation severely reduces productivity
- - - Users running multiple Claude Code instances in parallel is a common workflow that should be supported

### Priority

High - Significant impact on productivity

### Feature Category

API and model interactions

### Use Case Example

**Scenario:** Developer running 3 Claude Code instances in parallel

**Current behavior (problematic):**
1. Claude #1 opens tab for Project A testing → tab stays open
2. 2. Claude #2 opens tab for Project B testing → now 2 tabs
3. 3. Claude #3 opens tab for Project C testing → now 3 tabs
4. 4. Claude #1 needs another page → opens 4th tab
5. 5. Claude #2 takes a screenshot → might capture Claude #1's tab by mistake
6. 6. 10 minutes later: 12 tabs open, Claudes clicking on wrong tabs, chaos ensues
**Expected behavior (with this feature):**
1. Claude #1 opens tab (id: "a1") → works ONLY on "a1" → closes "a1" when done
2. 2. Claude #2 opens tab (id: "b2") → works ONLY on "b2" → closes "b2" when done
3. 3. Claude #3 opens tab (id: "c3") → works ONLY on "c3" → closes "c3" when done
4. 4. Each Claude isolated, no cross-contamination, browser stays clean

### Additional Context

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗