# Expected Domain Arg Fix Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Fix browser_script_skill_tool to pass expected_domain to wrapped JS scripts.

**Architecture:** Insert the normalized expected_domain back into args HashMap after domain normalization, before script wrapping.

**Tech Stack:** Rust, serde_json

---

## Files

- Modify: `src/compat/browser_script_skill_tool.rs:210` - Insert expected_domain back into args

---

### Task 1: Insert expected_domain into args

**Files:**
- Modify: `src/compat/browser_script_skill_tool.rs:210`

- [ ] **Step 1: Add expected_domain to args after normalization**

Edit `src/compat/browser_script_skill_tool.rs`, insert after line 209 (`eprintln!("[execute_browser_script_impl]   expected_domain: {}", expected_domain);`):

```rust
    args.insert("expected_domain".to_string(), Value::String(expected_domain.clone()));
```

The context around line 209-211 should look like this after the edit:

```rust
    eprintln!("[execute_browser_script_impl]   expected_domain: {}", expected_domain);
    args.insert("expected_domain".to_string(), Value::String(expected_domain.clone()));

    for required_arg in tool.args.keys() {
```

- [ ] **Step 2: Run tests to verify the fix**

Run: `cargo test browser_script_skill_tool --no-fail-fast -- --nocapture`

Expected: All tests pass, including `execute_browser_script_tool_runs_packaged_script_with_expected_domain`

- [ ] **Step 3: Commit**

```bash
git add src/compat/browser_script_skill_tool.rs
git commit -m "fix: pass expected_domain to wrapped browser scripts"
```
