Home Services Work Blog About Contact Get Started →
<- All project concepts
SEO & organic growth Original tool

A hybrid-search RAG tool that turns a keyword into an SEO content brief

A Streamlit app that pulls the most relevant SEO best practices from a curated set of 25 notes using keyword and vector search, then builds a brief: search intent, meta title and description, a one-H1 heading outline, related keywords and a keyword-density check.

Sector: SEO tooling

  • 25Curated SEO best-practice notes in the knowledge base
  • 2Retrievers merged: BM25 keyword and vector search
  • 4Search intents classified
  • 1-5%Keyword-density range the checker looks for
MOSAIC WEBS / PROJECT ORIGINAL PROJECT
Preview image for A hybrid-search RAG tool that turns a keyword into an SEO content brief

The challenge

Planning a page well means keeping many SEO rules in mind at once, such as metadata length, a single H1 and sensible keyword use, and advice with no source is hard to trust.

Tech Stack

Python, Streamlit, rank_bm25, ChromaDB, sentence-transformers (all-MiniLM-L6-v2), pandas and NumPy, OpenAI, Groq or Ollama (optional)

Tools

Streamlit Community Cloud, GitHub

A practical approach

Retrieve first, then generate. A keyword search (BM25) and a vector search each rank the knowledge base. Their two rankings are merged with reciprocal rank fusion and the top results are re-scored by cosine similarity. Those notes ground the brief, and code then checks the title and description length, the single H1 and the keyword density.

From a keyword to a brief

  1. 01Enter a topic

    Type a keyword or pick one of the preset topics, and set a brand name.

  2. 02Hybrid retrieval

    BM25 finds exact keyword matches while a vector search finds related meaning.

  3. 03Fuse and re-rank

    Reciprocal rank fusion merges both rankings, then cosine similarity re-scores the best notes.

  4. 04Build the brief

    Intent, meta title and description, headings and related keywords are generated and checked against length and H1 rules.

  5. 05Edit and export

    Paste a draft to see keyword density live, then copy the brief or download it as Markdown.

Three decisions that shaped the tool

Retrieve, then generate

Advice comes from a fixed, curated knowledge base, so each recommendation can be traced to a source note shown in the app.

Keywords and meaning together

BM25 is precise on exact terms, vectors catch related wording, and rank fusion merges the two without needing comparable scores.

Works without an API key

A built-in engine runs instantly by default. External language models are optional and use a key the visitor types in.

What it does

This is a Mosaic Webs personal tool. Its advice comes from 25 curated SEO notes, not live search data, so it shows no search volume, rankings or competitor pages. By default it runs a built-in mock engine that needs no API key; OpenAI, Groq or Ollama can be chosen for generated text. The length and density limits are rules of thumb the tool applies, not Google requirements.

Search and retrieval

  • BM25 keyword matching over 25 SEO best-practice notes
  • Vector search with ChromaDB and MiniLM embeddings, with a lightweight fallback
  • Reciprocal rank fusion of the two rankings
  • Cosine re-ranking, with adjustable settings in the sidebar
  • The notes that grounded each brief are shown in the app

The brief

  • Search intent: informational, commercial, transactional or navigational
  • Content format and word-count suggestions, plus featured-snippet guidance
  • Meta title of 55 to 60 characters with the keyword first
  • Meta description of 150 to 170 characters with a call to action
  • Heading outline with exactly one H1 and H2/H3 sections
  • Related keywords to work into the copy

Editing tools

  • A dark-mode Google-style search result preview
  • A draft editor with live keyword density: low, optimal or stuffing
  • Copy the whole brief with one click
  • Download the brief as a Markdown file

Setup

  • Choose the built-in engine, OpenAI, Groq or a local Ollama model
  • Runs as a Streamlit web app, also usable as a Python script
  • Deployed on Streamlit Community Cloud with the code on GitHub