Inspiration

Poorly toned emails and PR comments waste time, damage trust, and create avoidable back-and-forth. Existing tone tools feel slow, cloud-dependent, or too configurable for real work. Chrome’s built-in AI changes the equation: on-device rewriting with predictable latency and strong privacy. MirrorMind is a focused experiment in fast, visible correction of tone inside the page you’re already using.

What it does

  • Rewrites selected text into four tones: Assertive, Professional, Empathetic, Friendly.
  • Streams variants in parallel, showing per-tone latency and \( Δ \) since the previous completion.
  • Optional diff view to highlight insertions and deletions.
  • Replace in page (button or double-click a card) with preserved URLs, IDs, and code.
  • Runs entirely on-device via Chrome’s Rewriter API (Gemini Nano); no servers.

How we built it

  • MV3 extension architecture
  1. Popup UI: minimal HTML/CSS/JS; renders cards incrementally.
  2. *** Content script (all frames, match_about_blank ): *** robust Grab Selection and safe Replace.
  3. *** Service worker: *** popup open behavior; no network calls.
  • Model usage
  1. Rewriter API (Gemini Nano) with format: 'plain-text' and outputLanguage: 'en' .
  2. One warm singleton per popup session; four concurrent rewrite() calls with compact, tone-specific contexts.
  • Performance discipline
  1. Hardware acceleration enabled; prefer dGPU when available.
  2. Timers: show per-tone runtime \( t_i \) and inter-arrival \( Δ_i = t_i - t_i-1 \)
  3. Avoided sliders/knobs to keep interaction cost near zero.

Challenges we ran into

  • Availability & gesture gating: the model must download under a trusted user gesture. Fixed by triggering Rewriter.create() inside the click handler and surfacing progress.
  • Performance variance (CPU fallback): when the GPU was disabled, latencies spiked. Solved by forcing Chrome to the high-performance GPU and keeping a warm instance.
  • iframe editors (Gmail, LinkedIn): selections often live in child frames. Solved with an all-frames content script plus an all-frames executeScript fallback.
  • Language requirement: Rewriter requires an explicit output language; enforced at both create() and rewrite() to silence runtime warnings.
  • Scope creep pressure: resisted adding sliders/micro-actions; focused on speed, clarity, and reliability.

Accomplishments that we're proud of

  • Consistent warm performance: four tones completing in a few seconds end-to-end, with visible streaming and per-tone timing.
  • Clean replace flow across common editors without extra configuration.
  • Zero backend: privacy by default, simple permissions, deterministic UX.
  • Readable prompts/guards: concise constraints that preserve meaning and avoid invented commitments.
  • Privacy posture: All rewriting happens locally in Chrome’s built-in AI. No text leaves the browser. Permissions are limited to activeTab, scripting, and host access to support cross-frame selection and in-page replace.

What we learned

  • On-device LLM UX is won by token discipline and persistent instances, not just API calls.
  • Real-world editors require all-frame thinking and careful fallbacks.
  • Exposing latency as a first-class signal (\( ms \) and \( Δ \)) builds trust more than slideware.
  • Minimal UI beats configurability for this task: choose, insert, move on.

What's next for MirrorMind - On-device tone rewriter for Chrome

  • Team presets and org guardrails: curated tone profiles with domain-specific constraints.
  • Inline mini-toolbar: appear near selections inside editors; fewer clicks.
  • Multilingual variants: switch outputLanguage (e.g., es, ja) with localized tone guidance.
  • Local history and undo: privacy-preserving, on-device only; no telemetry.
  • Hardening & tests: structured prompts, regression samples, and perf budgets per environment.

Built With

Share this project:

Updates