An LLM-based content moderator
Firefox extension to block webpages unrelated to work, based on page title and URL. Local LLMs with Ollama and Langchain to ensure your browsing history never leaves your device, for complete privacy. Google Gemini also supported.

- Blocks webpages automatically on page load
- Displays a block page with the page URL and title, along with an explanation for blocking
- For non-blocked pages, the explanation for not blocking is available in the developer console
- Now works with local LLMs. Your browsing history stays completely private!
- Tested with LLama 3.2:1b and 3.2:3b
- Implemented using Ollama and Langchain
- No GPU required! Tested on a consumer-grade Intel CPU laptop.
- Install python packages
pip install -r requirements.txt
- Put your Google Gemini API key in
.env
or as environment variableGEMINI_API_KEY
- Start the WorkBuddy server
python workbuddy_server.py
- Go to
about:debugging
in Firefox ->Load Temporary Addons
-> Select themanifest.json
file under extension/firefox - Open any non-work relaed webpage (e.g. reddit.com). WorkBuddy should block it
Change the text in prompts/system_instruction.txt
to customize which webpages get blocked. Current contents are:
Your task is to classify a webpage as "work" or "non-work", based on the page title, page body text, and page URL. This will be used to moderate content on a user's web browser using an extension, to help them stay focused on work-related activities only. Some of those fields may be empty. Input format is json, like: { "page_title" : "", "page_body" : "", page_url : "" } . You should only output a json containing the classification, and an explanation to the end-user for why the page belongs to that category. Output format: { "category" : "", "explanation" : ""} .
The person is mainly involved in Computer Science and Artificial Intelligence related Research and Engineering, which may also include software development. Front pages of search engines or video search websites, such as Google and YouTube, are categorized as work. Relevant lecture videos are considered work, but pop-science videos are not. Forums such as Reddit or Twitter are considered non-work. However, discussion threads on very particular subjects may be considered work, such as a thread on matrix factorization techniques, or on enabling particular VSCode features. Gmail and other email sites are considered work. News sites, including Tech news, are considered non-work. Relevant academic publications are considered work.
- Server runs on Flask
- uses Google Gemini API
- No auth needed as of now
- REST API
- POST /classify, with json content, containing { "page_title" : "", "page_body" : "", page_url : "" }
- In response, return {"category" : "", "explanation" : ""}
- Workflow:
- WorkBuddy Firefox addon extracts title and URL upon page load, and sends it to the WorkBuddy server
- WorkBUddy server contacts Google Gemini via API and asks it to return page category and an explanation for the categorization, and relays it back to the addon
- The addon replaces current page with block page if category is "non-work", and displays the explanation on the block page
Interactive cli-based chat can be used for testing out the system prompt. Uses prompt-toolkit
.
python workbuddy_cli_gemini.py