Skip to content

[feat] Chrome extension — bidirectional sync for web LLM sessions #312

Closed

Description

@Sinity

Problem

Web-hosted LLM sessions (ChatGPT, Claude.ai, Gemini) still fall outside
the normal archive flow unless they are exported manually. That leaves an
important but intermittent part of the user's model work disconnected
from the same archive/query surfaces used for local coding-agent
sessions.

Strengthened scope

Treat the browser extension as another capture surface over the same
archive/live-ingestion contract, not as a bespoke sidecar system.

Required outcomes:

  • define a typed capture envelope for browser-observed turns, sessions,
    attachments, provenance, and provider metadata
  • send captured data into the same inbox/live-ingestion path that #308
    standardizes rather than inventing a parallel storage contract
  • establish stable IDs and deduplication semantics so repeated capture,
    refresh, or reconnect does not fork archive records
  • support the highest-value provider paths first while keeping the
    extension architecture provider-adaptable
  • make the "bidirectional" part concrete: the extension should be able to
    reflect archive state back to the user (for example archive links,
    captured-state indicators, or local context lookup), not just fire
    blind uploads

Design requirements

  • Privacy and local-only transport expectations must be explicit.
  • The extension should degrade gracefully when the local receiver is not
    running.
  • Provider DOM adapters should be thin; core capture semantics belong in
    the shared envelope and ingestion contract.
  • Do not let this issue invent a second ingestion model that later has to
    be reconciled with realtime/local-session handling.

Acceptance criteria

  • The issue lands a concrete extension-to-polylogue ingestion contract.
  • At least one provider path works end-to-end into the archive/live path.
  • Repeated observation of the same web session deduplicates cleanly.
  • The extension exposes some minimal archive-aware feedback to the user,
    not just silent background capture.
  • The implementation is clearly layered so additional providers can be
    added without rethinking the ingestion model.

Priority caveat

Chat providers are currently lower-frequency than coding-agent sessions,
so this should stay sequenced after the local/live substrate work. The
point is architectural completeness and cross-surface reach, not jumping
the queue ahead of higher-value local workflows.

Dependency value

This should build on the canonical live/session ingestion contract from
#308, not race ahead with bespoke browser-only machinery.

Source

Thoughtspace: crystal/plans/roadmap-polylogue.md §Loose 1 month and
seed/2026-04-18-001820-llm-budget-constraint.md.

Activity

  1. added
    type:feat
    type:research
    and removed
    type:research
    on Apr 21, 2026
  2. Sinity commented on Apr 24, 2026

    @Sinity
    OwnerAuthor

    Execution expansion for this PR:

    • Treat the extension as a first-class browser capture source, not merely a UI experiment. The durable boundary is a typed browser-capture envelope that can be parsed by the normal source dispatch path and written by a local receiver into the normal inbox tree.
    • Make idempotence explicit at two layers: stable provider/session/turn identifiers in the envelope, and deterministic receiver filenames so repeated observation, page refresh, or retry overwrites the same source artifact instead of forking archive records.
    • Include a browser-capture receiver command with local-only defaults, CORS allowlisting for supported web LLM origins, status reporting, archive-state lookup, and atomic inbox writes. The extension should have a concrete transport target rather than relying on a future daemon.
    • Ship a local-first MV3 extension skeleton that works without a bundler: background queue/retry, popup status, provider adapters, and thin DOM extraction for ChatGPT plus Claude-compatible architecture. DOM selectors are adapter details; provider-neutral semantics live in the envelope.
    • Make bidirectionality minimally real in this slice: the extension can ask the receiver whether the current provider session has already been captured and can surface captured/offline/error state to the user.
    • Document operational setup, privacy boundary, and live Chrome/DevTools expectations. If the existing Chrome MCP configuration cannot attach to the user’s logged-in Chrome profile, fix the Sinnix agent configuration separately and narrowly.

    Acceptance for this expansion:

    • Browser-capture JSON is accepted by detect_provider() / parse_payload() and lands as normal parsed conversations.
    • Receiver tests cover status, CORS rejection/allowance, atomic write shape, deterministic dedup filenames, and archive-state lookup.
    • Parser tests cover session metadata, turn metadata, attachments, provider normalization, and duplicate turn suppression.
    • Extension files are complete enough to load unpacked in Chrome and exercise local capture against supported origins.
    • Focused tests, generated docs checks, full local verification, and a PR-linked completion comment are recorded before merge.
  3. Sinity commented on Apr 24, 2026

    @Sinity
    OwnerAuthor

    Execution log update:

    • Treat browser capture as a normal source artifact. The receiver writes JSON envelopes to the configured Polylogue inbox; provider detection and parsing consume those envelopes through sources.dispatch.
    • Keep provider DOM code thin. Extension adapters emit provider-neutral sessions, turns, attachments, provenance, and provider metadata.
    • Use deterministic receiver filenames derived from provider plus session id. Retry and refresh should replace the same source artifact, not create parallel records.
    • Make bidirectionality minimal but real in this slice: status and archive-state endpoints let the extension show captured/offline/error state.
    • Keep browser extension assets static. No bundler or npm dependency is needed for this first slice.
    • Chrome/DevTools finding: the live Chrome profile is reachable at [::1]:9222, while the current agent MCP config points at 127.0.0.1:9222. If direct MCP use is needed for validation, patch Sinnix config narrowly and leave unrelated dirty Sinnix work untouched.

    Per follow-up direction, I am not keeping this as a project scratch file; the issue thread is the durable execution log for this issue.

  4. Sinity commented on Apr 24, 2026

    @Sinity
    OwnerAuthor

    Scope refinement from follow-up:

    • Treat ChatGPT and Claude.ai as minimum supported providers for this issue, not stretch goals. Both should have concrete adapter code, receiver round-trip behavior, and documented support expectations.
    • The extension UX should be useful and deliberate, not a placeholder popup. It should include clear receiver status, current-page capture state, last capture details, local receiver configuration, retry/check controls, and visual state that is pleasant enough to live with day to day.
    • Archive-aware feedback should be visible in the extension UI and badge state, not only present as an HTTP endpoint.
    • The implementation should leave a provider-adapter structure that can absorb Gemini or other web LLM surfaces without rewriting the shared capture, queue, or UI contracts.
  5. Sinity commented on Apr 24, 2026

    @Sinity
    OwnerAuthor

    Browser MCP validation update:

    • The logged-in Chrome profile is available through CDP at http://[::1]:9222; http://127.0.0.1:9222 does not reach it on this host.
    • I updated Sinnix agent configs so future Codex and Claude sessions start chrome-devtools-mcp with --browserUrl http://[::1]:9222.
    • For this already-running session, I started a temporary local CDP forwarder from 127.0.0.1:9222 to [::1]:9222, which made the existing mcp__chrome_devtools__ namespace immediately usable without restarting the agent.
    • Validation: Chrome DevTools MCP listed live Chrome pages, opened authenticated ChatGPT and Claude.ai pages using the existing cookies/profile, and produced accessibility snapshots for both. Temporary validation tabs were closed afterward.
    • Sinnix local commit: 9bb24dd fix: point browser MCP at live Chrome debugger.
  6. Sinity commented on Apr 24, 2026

    @Sinity
    OwnerAuthor

    Live browser debug validation:

    • Started polylogue browser-capture serve --port 8765 --inbox .local/browser-capture/live-inbox for the validation pass.
    • Used the live logged-in Chrome profile through Chrome DevTools MCP/CDP to open authenticated ChatGPT and Claude.ai pages.
    • Avoided capturing private existing chat text. Instead, injected a small synthetic two-turn fixture into each live page and ran adapter-style selectors there:
      • ChatGPT: extracted 2 turns, roles user, assistant, origin https://chatgpt.com.
      • Claude.ai: extracted 2 turns, roles user, assistant, origin https://claude.ai.
    • Tried posting directly from page context; ChatGPT page fetch was blocked by the live page environment/CSP/fetch wrappers. This validates the architectural choice that page scripts should not be the transport. The extension background path is required.
    • Posted the extracted envelopes from a background-equivalent CDP/Node side with provider origins. Receiver accepted both with HTTP 202 and deterministic artifact paths:
      • chatgpt:live-debug:e4af3c6b
      • claude-ai:live-debug:97de751d
    • Ran those artifacts through isolated Polylogue acquire+parse with ingest_workers=1; result: 2 raw records processed, 2 conversations stored, no parse failures, both with browser_capture=true and the expected live-debug adapter names.
    • Temporary ChatGPT/Claude validation tabs were closed afterward.
    • The current session now has a detached 127.0.0.1:9222 -> [::1]:9222 CDP forwarder so the already-running MCP server can keep attaching to the logged-in Chrome profile. Future sessions should not need that bridge after the Sinnix config change to http://[::1]:9222.
  7. added a commit that references this issue on Apr 24, 2026
    c97b609
  8. Sinity commented on Apr 25, 2026

    @Sinity
    OwnerAuthor

    Browser-extension live-debug correction, 2026-04-25:

    • Earlier validation proved the source package, receiver, parser path, and CDP extraction flow, but it did not prove the unpacked extension was visible in Chrome. That was insufficient.
    • Official Google Chrome 147 ignores --load-extension / --disable-extensions-except for local unpacked extensions in branded builds. The process showed the flags, but chrome://extensions and chrome.developerPrivate.getExtensionsInfo() confirmed Polylogue was absent.
    • Manual UI loading through chrome://extensions reached Chrome's loader; the original /realm/... path surfaced a generic manifest-read error through the portal chooser despite the manifest parsing fine from the shell.
    • Unbranded Chromium 147 loaded the same unpacked extension successfully from /home/sinity/.local/share/polylogue-browser-capture-extension.
    • I copied the logged-in Chrome profile into .local/browser-capture/chromium-cookie-profile and launched Chromium on CDP port 9334 with the Polylogue extension loaded.
    • Live checks performed:
      • extension service worker present: chrome-extension://jnmkkagffllggmdncljcebnlniapemli/src/background.js
      • popup opened at chrome-extension://jnmkkagffllggmdncljcebnlniapemli/src/popup.html
      • popup polylogue.status call reached the local receiver at http://127.0.0.1:8765
      • content script on a https://chatgpt.com/ tab responded to polylogue.capturePage
      • receiver wrote a two-turn DOM smoke capture to /home/sinity/.local/share/polylogue/inbox/browser-capture/chatgpt/chatgpt-e4af3c6b-f5dbd82dca5e.json
    • Claude.ai in headless Chromium currently presents a Cloudflare challenge; this is a headless/debug-profile limitation to solve separately from extension loading.

    Operational state after this comment:

    • official Chrome remains on CDP 9222 for the normal logged-in browser profile, without relying on unpacked-extension CLI flags;
    • debug Chromium is on CDP 9334 with copied cookies/profile plus the Polylogue unpacked extension loaded;
    • local receiver is running on 127.0.0.1:8765.
  9. added a commit that references this issue on May 7, 2026
    0989341
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:pipelinetype:feat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions