agent-loop-ext
Crash-resilient external agent loop with state persistence and CI/CD integration
Interactive wizard that wires up @playwright/mcp end-to-end — detects the user's browsers, walks through Playwright MCP Bridge extension install, captures the per-install token, registers the MCP server in the AIWG registry with --extension and the env block, injects into the
$ npx -y skills add jmagly/aiwg --skill browser-setup --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/browser-setupContext preview
The summary Claude sees to decide when to auto-load this skill.
Interactive wizard that wires up @playwright/mcp end-to-end — detects the user's browsers, walks through Playwright MCP Bridge extension install, captures the per-install token, registers the MCP server in the AIWG registry with --extension and the env block, injects into the
namespace: aiwg name: browser-setup description: Interactive wizard that wires up @playwright/mcp end-to-end — detects the user's browsers, walks through Playwright MCP Bridge extension install, captures the per-install token, registers the MCP server in the AIWG registry with --extension and the env block, injects into the active provider's config, and verifies the connection. version: 0.1.0-draft status: draft platforms: [all] triggers: - "set up browser control" - "install playwright mcp" - "wire up browser automation" - "configure playwright extension" - "drive my browser from the agent" - "let the agent open my browser"
> Status: DRAFT — scaffolded from PoC. Implementation pending Inception outputs.
End-to-end interactive wizard that takes a user from "AIWG agent can't drive a browser" to "AIWG agent is connected to my real, logged-in browser via the Playwright MCP Bridge extension" without the user needing to know the underlying MCP plumbing, token semantics, or AIWG CLI surface.
| Field | Source | Notes | |---|---|---| | Provider | `aiwg runtime-info` | Auto-detect; user can override | | Target browser | OS-specific detection | Recommend based on `--extension` support | | Token | Interactive (AskUserQuestion) | Pasted by user after installing extension |
Confirm AIWG is initialized in the workspace and the active provider supports MCP servers with `env` blocks. Bail with explicit guidance if not.
Linux:
macOS:
Windows:
Classify each detected browser by extension-mode support:
Present detected browsers ranked by: 1. Already installed AND supports `--extension` 2. Already installed but needs CDP fallback (note caveats) 3. Not installed (provide install URL but don't auto-install)
Recommend the dedicated-agent-browser pattern: keep your daily browser separate. Suggest the apt-installed Chrome (if present) or Edge as the agent's browser; leave Flatpak Chromium etc. for personal use.
Print:
Use `AskUserQuestion` (or markdown prompt on providers without native UX): > "Click the Playwright MCP Bridge extension icon in your browser. Copy the token shown there and paste it below."
Validate: non-empty, alphanumeric-with-hyphens-and-underscores, length ≥ 16.
mkdir -p ~/.config/playwright-mcp chmod 700 ~/.config/playwright-mcp # Write token to ~/.config/playwright-mcp/token (mode 600) chmod 600 ~/.config/playwright-mcp/token
Per `token-security` rule: never echo, never log, never include in error output.
TOKEN=$(cat ~/.config/playwright-mcp/token)
aiwg mcp add playwright \
--type stdio \
--command npx \
--args '-y,@playwright/mcp@latest,--extension' \
--env "PLAYWRIGHT_MCP_EXTENSION_TOKEN=${TOKEN}" \
--description 'Playwright MCP — browser automation via accessibility tree' \
|| aiwg mcp update playwright \
--command npx \
--args '-y,@playwright/mcp@latest,--extension' \
--env "PLAYWRIGHT_MCP_EXTENSION_TOKEN=${TOKEN}"**Known gap**: the token lands in plaintext in `~/.aiwg/mcp-servers.json`. Final addon release depends on AIWG core supporting `${file:...}` substitution. Document this in the setup-complete report.
PROVIDER=$(aiwg runtime-info --json | jq -r '.provider') aiwg mcp inject --provider "$PROVIDER" --servers playwright
Spawn a probe MCP process briefly with env var set, send JSON-RPC `initialize` + `tools/list`, check for `browser_tabs` in the response. Kill the probe.
If probe succeeds: setup-complete report. If probe fails: collect diagnostics and hand off to `browser-doctor`.
| Field | Value | |---|---| | Browser | `<binary path>` | | Token file | `~/.config/playwright-mcp/token` | | MCP registered | `playwright` | | Provider injected | `<provider name>` | | Next | Restart the provider; ask agent to "list browser tabs" |
Reset / rotate instructions: `aiwg run skill browser-reset` Health check: `aiwg run skill browser-doctor`
1. Should the wizard scaffold `.aiwg/browser-allowlist.yaml` immediat
Reusable project context and specialist workflows for the AI tools you already use. Plan software, coordinate specialist reviews, prepare campaigns, investigate incidents, organize research, curate media, and maintain operational knowledge.
Repo: jmagly/aiwg
Crash-resilient external agent loop with state persistence and CI/CD integration
Detect requests for iterative autonomous agent loops and route to the appropriate loop executor
Automatically execute tests when code-generating agents modify source files, enforcing the execute-before-return pattern
Enable agent loops to learn from similar past tasks and share patterns across loops
Query and manage the executable feedback debug memory
Execute tests on generated code and iterate until passing