A command-line tool designed to streamline your browsing experience by intelligently organizing your open tabs from the Brave browser (Works for any chromium-based browser). tabman helps you categorize, tag, and save your browsing sessions, making it easier to find and revisit websites later.
- Tab Retrieval: Fetches all open tabs from Brave using its remote debugging interface.
- Intelligent Categorization: Uses AI-powered language models to categorize your tabs:
- Google Gemini: Employs the Gemini 2.0 Flash model for advanced and fast categorization.
- Mistral AI: Leverages Mistral's large language models as an alternative to Gemini.
- Ollama: Enables local categorization using Ollama, supporting a variety of LLMs (e.g., llama 3.2, Mistral).
- Dynamic Tagging: Generates a list of concise and relevant keywords to describe the content of each tab.
- Flexible Saving:
- Saves the tab data (title, URL, main category, and tags) as a JSON file, organized in date-based subfolders within the
data/directory. - Creates a Markdown version of each tab session, also stored in the date-based subfolders within the
data/directory. - Maintains a central
all_tabs.mdfile in thedata/directory, where all tab data is appended for easy access.
- Saves the tab data (title, URL, main category, and tags) as a JSON file, organized in date-based subfolders within the
- Secure API Key Management: Utilizes a
.envfile to securely store API keys, which can be set using command-line arguments.
-
Clone the repository:
git clone https://github.com/Anshulgada/brave-tab-manager.git
-
Navigate to the project directory:
cd Brave Tab ManagerThis assumes that your project folder is named
Brave Tab Manager. -
Install
pipx(if you don't have it):python -m pip install --user pipx python -m pipx ensurepath
This ensures that
pipxis installed globally and its executables are present in your system's PATH. You may need to restart your terminal for these changes to take effect. -
Install
tabmanusingpipx:pipx install -e .This command installs your tool into an isolated environment and makes the
tabmancommand accessible from anywhere. Make sure you run this command from the root of the project directory, i.e.Brave Tab Manager.
-
Enable Remote Debugging in Brave: To allow
tabmanto connect with your Brave browser, you must enable remote debugging. Here's how:- Windows:
- Right-click on the Brave shortcut in your Start Menu or Taskbar and select "Properties."
- In the "Target" field, add
--remote-debugging-port=9222(or your preferred port number) to the end of the existing path, ensuring there's a space between the path and the flag. For example:"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" --remote-debugging-port=9222 - Click "Apply" and "OK."
- macOS/Linux: Modify the Brave shortcut (or application launcher) to include the
--remote-debugging-port=9222flag in the command line that launches Brave. Consult your system's documentation for the specific method. - After enabling remote debugging, make sure that you have restarted your Brave browser.
- Windows:
-
Run the
tabmantool:tabman [OPTIONS]
You can use the following options:
-h,--help: Displays thehelporinfomenu.-c,--categorize: Categorize your open tabs using the selected LLM model, and save the data. This is not necessary when setting the api keys.-v,--version: Display the version oftabmanand exits.-m,--model <MODEL-NAME>: Specify the LLM model for categorization (gemini,mistral, orollama).--save-keys: Save API keys to the.envfile. Use this in combination with-gkor-mkto set the keys.-mk,--mistral-key <API-KEY>: Provide your Mistral AI API key.-gk,--gemini-key <API-KEY>: Provide your Google Gemini API key.-om,--ollama-model <MODEL-NAME>: Specify the Ollama model name (e.g.,llama3.2,mistral). Default isllama3.2.-o,--output-dir <PATH>: Specify the directory to store the output JSON and Markdown files, as well as the centralall_tabs.mdfile (default:data). You can specify any directory with absolute path as well, but do note that it will remove the directory if the test fails, or any new files with same name are created in that directory.
Examples:
-
Categorize tabs using the default Gemini model:
tabman -c
-
Categorize tabs using Mistral:
tabman -c -m mistral
-
Categorize tabs using Ollama with a specific model:
tabman -c -m ollama -om mistral
-
Save API keys to the
.envfile:tabman --save-keys -gk YOUR_GEMINI_API_KEY -mk YOUR_MISTRAL_API_KEY
Replace
YOUR_GEMINI_API_KEYandYOUR_MISTRAL_API_KEYwith your actual API keys. -
Specify a custom output directory:
tabman -c -o custom_output
This will save the output into a directory named
custom_output, which will be created in the root of your project. -
Specify an absolute path as an output directory:
tabman -c -o "C:\\Users\\<user-name>\\Desktop\\My_Tabs" -
Show help message:
tabman
- API Keys: API keys for Gemini and Mistral can be provided either directly via command-line arguments or saved to a
.envfile for later use. The tool will read keys from environment variables, and then the command line arguments and the.envfile when using the tool. - Ollama: If you select Ollama model, then you will have to install and run ollama on your system with your desired models.
-
To avoid re-installing the package again and again, during local development, you should run the tool inside your virtual environment. For this you have to activate your environment and then run
pip install -e .from the root directory. Now you can use the tool with the activated virtual environment. Whenever you want to update the global version then you have to uninstall the current version usingpipx uninstall tabmanand install again usingpipx install .. -
Running tests:
- The tests are located in the
tabman/testsdirectory. You can run the tests usingpytestrom the root of your project i.e. wheresetup.pyexists.
pytest -v -s tabman/tests
- The tests are located in the
openaiollamamarkdownrequeststenacityplaywrightpython-dotenvbeautifulsoup4google-generativeaigoogle-api-python-client
This project is licensed under the MIT License.