Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This plugin includes the following skills (see `skills/` for details):
| [safe-browser](skills/safe-browser/SKILL.md) | Build local Claude Agent SDK browser agents whose only browser capability is a CDP-gated `safe_browser` tool with domain allowlist enforcement |
| [webmcp-gen](skills/webmcp-gen/SKILL.md) | Author, compile, and validate site-specific WebMCP init scripts with the Stagehand WebMCP runtime |
| [cookie-sync](skills/cookie-sync/SKILL.md) | Sync cookies from local Chrome to a Browserbase persistent context so the browse CLI can access authenticated sites |
| [context-sync](skills/context-sync/SKILL.md) | Sync durable local Chrome profile state—including cookies, site storage, service workers, bookmarks, and history—to a Browserbase Context |
| [fetch](skills/fetch/SKILL.md) | Fetch HTML or JSON from static pages without a browser session — inspect status codes, headers, follow redirects |
| [search](skills/search/SKILL.md) | Search the web and return structured results (titles, URLs, metadata) without a browser session |
| [ui-test](skills/ui-test/SKILL.md) | AI-powered adversarial UI testing — analyzes git diffs to test changes, or explores the full app to find bugs |
Expand Down
21 changes: 21 additions & 0 deletions skills/context-sync/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Browserbase, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
74 changes: 74 additions & 0 deletions skills/context-sync/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
name: context-sync
description: Sync durable state from a local Chromium profile into a Browserbase Context, including cookies, localStorage, IndexedDB, Cache Storage, service workers, bookmarks, history, preferences, and extension data. Use when a user wants a cloud browser to retain more than cookies or asks to copy, migrate, upload, or refresh their local Chrome profile in Browserbase.
license: MIT
allowed-tools: Bash
---

# Context Sync — Local Chrome → Browserbase Context

Copy a selected local Chromium profile into a Browserbase Context. Use the bundled script; do not manually copy individual storage APIs.

## Safety contract

- Explain that the profile can contain authenticated sessions and sensitive browsing data.
- Ask before closing Chrome. Use `--close-browser` only after the user agrees.
- Prefer a dedicated Chrome profile over a personal primary profile.
- Never print cookie values, storage contents, the encrypted archive, or the signed upload URL.
- Do not claim that open tabs, live DOM/JavaScript state, back-forward stacks, active connections, saved passwords, or `sessionStorage` will resume.

## Setup

```bash
cd .claude/skills/context-sync
npm install
export BROWSERBASE_API_KEY="..."
```

Enable remote debugging in Chrome and restart it. If automatic discovery is unavailable, set `CDP_URL` and pass `--user-data-dir`.

## Run

First show what will be included without uploading:

```bash
node .claude/skills/context-sync/scripts/context-sync.mjs --dry-run --profile Default
```

For a consistent snapshot, get permission to close Chrome, then run:

```bash
node .claude/skills/context-sync/scripts/context-sync.mjs --close-browser --profile Default
```

The command exports cookies over CDP, closes Chrome, archives the selected profile as Browserbase's `Default` profile, encrypts and uploads it, starts a persistent Browserbase session, injects the portable cookie values, and prints the Context ID.

Use another local profile with `--profile "Profile 1"`. If `CDP_URL` is set explicitly, also pass `--user-data-dir "/path/to/User Data"`.

Refresh a Context only when custom Context uploads are enabled for the project:

```bash
node .claude/skills/context-sync/scripts/context-sync.mjs --context <context-id> --close-browser
```

If the update API reports that uploads are unavailable, create a new Context by omitting `--context`.

## Use the Context

```bash
SESSION_JSON="$(browse cloud sessions create --context-id <context-id> --persist --keep-alive)"
SESSION_ID="$(echo "$SESSION_JSON" | jq -r .id)"
CONNECT_URL="$(echo "$SESSION_JSON" | jq -r .connectUrl)"
browse open https://example.com --cdp "$CONNECT_URL"
# When done:
browse stop
browse cloud sessions update "$SESSION_ID" --status REQUEST_RELEASE
```

Always use `--persist` when changes made in cloud sessions should flow back into the Context.

## Alternative for a running browser

`--allow-live-copy` avoids closing Chrome but can capture inconsistent SQLite or LevelDB files. Use it only when the user explicitly accepts that risk. Prefer `--close-browser`.

Read [references/state-matrix.md](references/state-matrix.md) before making claims about what survives. Read [references/implementation.md](references/implementation.md) when debugging uploads, encryption, profile discovery, or cross-platform behavior.
7 changes: 7 additions & 0 deletions skills/context-sync/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
interface:
display_name: "Context Sync"
short_description: "Sync a local Chrome profile to Browserbase"
default_prompt: "Use $context-sync to copy my local Chrome profile state into a Browserbase Context."

policy:
allow_implicit_invocation: true
Loading