Skip to content

Extension: per-tab panels, conversations with memory, faster answers - #41

Merged
ahamsel merged 1 commit into
mainfrom
claude/extension-per-tab
Sep 28, 2026
Merged

ahamsel merged 1 commit into
mainfrom
claude/extension-per-tab

Conversation

@ahamsel

@ahamsel ahamsel commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

Per-tab WebPilot. Every tab gets its own side panel, conversation and running task.

  • The engine moved into the background service worker (extension/src/engine.ts), with one session per tab. Tasks keep running when the panel closes or the user switches tabs.
  • Panels are tab-specific (sidePanel.setOptions({ tabId, path })) and are views connected over a port.
  • Ctrl+Shift+Space opens WebPilot for the current tab. The input is focused on open, Esc stops a task, and answers stream in.

Conversations that remember.

  • Each turn keeps hidden memory (pages visited, where it ended, actions taken) that follow-ups use. The router is told to navigate back to that page when the tab has moved on.
  • Conversations are saved locally (chrome.storage.local, last 100, never synced).
  • A History view reopens and continues them in any tab; + starts a new one.

Faster answers (lib/core/run-task.ts, lib/jev/gates.ts, lib/model-client.ts):

  • Jev's preflight also decides whether the request is about the open page and whether reading it is enough. "Summarize this page" skips the start-page LLM call, navigation and clicks, and streams the answer (new generateTextStream, SSE).
  • When a fast-mode answer is unsupported, Jev gets a second pass in which finishing on that page is ruled out, so it opens the item instead of answering from a list. The LLM planner takes over only after that. The relocation email went from 12-21s (planner) to 9-12s (Jev only).
  • Cancel on a confirmation ends the task with a summary ("I stopped before clicking Checkout…") and keeps its memory, so "go ahead" can continue. Previously the planner looked for another route.

Dev bridge for testing in real browsers (dev builds only):

  • extension/src/dev-bridge.ts long-polls scripts/extension-bridge.ts and only trusts a server holding the build's random secret (extension/.dev-bridge-token, gitignored).
  • Tasks run in their own window, which is closed afterwards.
  • extension-bridge.ts reload <browser> picks up a rebuild without clicking.
  • bench:fast-mode -- --engine extension --browser chrome|edge runs the scenario suite in the user's real browser.
  • Release builds (npm run extension:build) compile the bridge out (verified: no bridge code in background.js) and keep only sidePanel, debugger, tabs, storage, identity + https://openrouter.ai/*.

Testing

  • npm run build, npm run extension:build (release) and extension:build:dev
  • npm test (48 pass: new tests/run-task.test.ts checks that a decline ends the task and keeps memory; new second-pass test), npm run lint, npx tsc --noEmit
  • npm run extension:smoke: 7/7, including a two-message follow-up ("find that email where i was asked about relocation" → "when did they send it, and what's their job title?"). Each case now gets a fresh tab and conversation; the harness previously reused a tab the extension had navigated.
  • In the user's real Chrome and Edge through the dev bridge, realistic suite in fast mode: Chrome 9/9 (median 7.6s), Edge 9/9 (median 7.0s). Cheapest tent 1.9-2.7s, Arrival 1.7-2.1s, Kijiji 8.8-11.9s, injection email ignored, purchase stopped at the confirmation.
  • The toolbar/shortcut per-tab panel opening needs a user gesture, so it was not automated; the panel logic is exercised through sidepanel.html?tabId= in the smoke test.

Checklist

  • No API keys, cookies, browser profile data, or local run artifacts are included
  • Documentation is updated when behavior or setup changed
  • Screenshots or video are attached for meaningful UI changes

🤖 Generated with Claude Code

…swers

Extension:
- The task engine runs in the background service worker with one session
  per tab (conversation, running task, pending confirmation); tasks keep
  running when the panel closes or the user switches tabs. Panels are
  tab-specific (sidePanel.setOptions per tab) and connect over a port.
- Conversations are saved locally (chrome.storage.local, last 100) with
  a History view to reopen and continue them; + starts a new one.
- Each turn keeps hidden memory (pages visited, where it ended, actions)
  that follow-ups use, navigating back when the tab has moved on.
- Ctrl+Shift+Space opens WebPilot for the current tab; the input is
  focused on open; Esc stops a task; answers stream in.
- Dev builds include a test bridge (dev-bridge.ts + scripts/
  extension-bridge.ts) so the scenario harness can run in the user's
  real browsers and reload the extension after a rebuild; it only
  trusts a server holding the build's random secret. Release builds
  compile it out and drop its permissions.

Core (lib/core/run-task.ts, lib/jev, lib/model-client.ts):
- Jev's preflight also decides whether the request is about the open
  page and whether reading it is enough; "summarize this page" skips
  navigation and clicks and streams the answer.
- Streaming text generation (generateTextStream, SSE).
- When a fast-mode answer is unsupported, Jev gets a second pass that
  may not finish on that page (e.g. opens the email instead of
  answering from the search list) before the LLM planner takes over.
- Cancel on a confirmation ends the task with a summary and memory, so
  "go ahead" can continue.

Results in the user's real browsers through the dev bridge (realistic
suite, fast mode): Chrome 9/9 median 7.6s, Edge 9/9 median 7.0s.
Extension smoke 7/7 including a follow-up conversation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ahamsel
ahamsel merged commit 7afb8b8 into main Sep 28, 2026
1 check passed
@ahamsel
ahamsel deleted the claude/extension-per-tab branch September 29, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant