Together with

Staying ahead with AI

Right now I have so many tabs open that Chrome has stopped showing their names. Half of them are documentation, a few GitHub repos, and I have no idea why the rest are still open.

Chrome has tab groups, but manually sorting through everything is another task I keep putting off.

So I thought, why not build an extension that does it for me? Let’s dive in.

Before the tabs, a quick word from two tools worth keeping open.

Presented by DeepView

Become An AI Expert In Just 5 Minutes

If you’re a decision maker at your company, you need to be on the bleeding edge of, well, everything. But before you go signing up for seminars, conferences, lunch ‘n learns, and all that jazz, just know there’s a far better (and simpler) way: Subscribing to The Deep View.

This daily newsletter condenses everything you need to know about the latest and greatest AI developments into a 5-minute read. Squeeze it into your morning coffee break and before you know it, you’ll be an expert too.

Subscribe right here. It’s totally free, wildly informative, and trusted by 600,000+ readers at Google, Meta, Microsoft, and beyond.

Presented by Angelino’s

Fresh-Roasted Coffee, Without Leaving the House

A third-generation LA roaster ships 50+ coffees — single origins, flavored favorites, decafs, even teas — days after roasting. Mix and match Keurig®-compatible boxes for tiered savings up to 34% off. First order? Take an extra 15% off, automatically.

How does it work?

Chrome extensions can read information about your open tabs, including their titles and URLs, with the right permissions.

We'll collect that information and send it to an LLM, which will assign categories like Work, Research, Shopping, and Entertainment.

Once we have the categories, Chrome's Tab Groups API handles the organization. The workflow:

Step 1: Set up the extension

Create a folder called ai-tab-organizer with four files:

ai-tab-organizer/
├── manifest.json
├── popup.html
├── popup.js
└── server.mjs

Every Chrome extension needs a manifest.json file. It tells Chrome what permissions the extension needs and which files to load.

We're asking for two permissions: tabs lets us read information about open tabs, while tabGroups allows us to update their groups.

We're also allowing requests to our local Node.js server, which will handle the OpenAI API calls.

Step 2: Let AI figure out the categories

Say you’ve got GitHub, React Docs, YouTube and Amazon open.

The model sends back each tab’s ID with a category (Work, Research, Entertainment, Shopping), and we keep the IDs intact so Chrome knows which tab goes where.

We'll use OpenAI's Structured Outputs to restrict the model's response to categories our extension understands.

Install the dependencies with npm install openai express (you’ll need Node.js 20 or later).

Then inside server.mjs, the classification logic uses the Responses API:

categorySchema limits categories to Work, Research, Shopping, Entertainment and Other. The full code also adds the /organize endpoint, error handling and a check for missing or duplicate IDs.

One more thing: keep your OpenAI API key on the server.

Step 3: Organize the tabs

Now for the Chrome part. First, we need to know which tabs are open.

Inside popup.js, we grab up to 30 ungrouped tabs from the current window, skipping pinned tabs and internal Chrome pages, and send their IDs, titles and URLs to the server.

Next, send their IDs, titles, and URLs to our backend. Once the response comes back, validate it and collect the tab IDs under each category.

Then the fun part:

That's all Chrome needs to create the groups.

chrome.tabs.group() puts the matching tabs together, and chrome.tabGroups.update() assigns a category name and color.

Step 4: See it in action

Set your OPENAI_API_KEY, then run node server.mjs (or npm install and npm start if you’re using the full code, and load the extension/ folder).

Open chrome://extensions and enable Developer mode. Click Load unpacked, select your extension folder, and pin the extension to your toolbar.

Now open a bunch of tabs, and click Organize My Tabs.

organize your tabs

The extension should classify your tabs and arrange them into labeled groups.

groups

For the full implementation, including the backend, validation, and popup logic:

My take

I think Chrome extensions are one of the easiest ways to build useful AI tools without creating an entire app.

You already have access to browser APIs that handle tabs, storage, navigation, and a bunch of other things. The AI only steps in where a little reasoning helps.

For this project, that's figuring out which tabs belong together. I'd also keep the first version simple, with fixed categories, one button and nothing changing unless you click it.

The last thing you need is an AI "fixing" your messy browser and somehow making it worse.

Until next time,
Vaibhav 🤝

Reply

Avatar

or to participate