Hi HN,
A couple of months ago I posted an early version of this Chrome extension. Since then I’ve refined it, fixed a bunch of stability issues, and it was recently featured on the Chrome Web Store’s “Featured” section, which was a nice surprise.
What the extension does:
– Detects the active tweet or thread directly in the browser
– Collects relevant context (parent tweet, author info, thread shape)
– Formats a prompt and sends it to the OpenAI API
– Inserts the generated reply straight into Twitter’s native reply box
All of this happens inside the X.com DOM, without storing any user data.
Technical bits:
– Uses MutationObserver to track X.com’s constantly changing DOM
– Handles dynamically inserted tweet nodes, shadow DOM, and thread expansions
– Debounces context extraction to avoid unnecessary re-runs
– Simulates native input events to inject the reply so it feels built-in
– Avoids backend state; everything is read client-side except the final API call
Challenges:
– X.com changes UI structure often, so selectors break unpredictably
– Preventing duplicate injections when the DOM re-renders
– Keeping prompt size small enough for fast generation
– Reducing overhead so the extension doesn’t slow down the page
Recent improvements:
– More stable tweet/thread detection
– Better context selection logic
– Cleaner UI in the reply popup
– Small performance fixes and race-condition fixes
Chrome Store page: https://chromewebstore.google.com/detail/xinsightai-ai-reply...
Would appreciate feedback from people who’ve built browser extensions or dealt with X.com’s DOM patterns. Happy to discuss any details.