Subzero Labs

Free code · Subzero Labs

Trademark pre-screen for Etsy and print-on-demand

From the Subzero Labs video "Your AI Has Amnesia. This Free Code Makes It Remember".

Free, no sign-up. Copy it, use it, share it.

For: Etsy and print-on-demand sellers

The job: A listing that uses a brand, character or celebrity name can be reported and removed - better to catch it before it goes live.

You give it: Etsy listings export and your own watchlist.txt.

It is one agent of the free AI OS starter (https://subzero.bodymindbeing.me/free/ai-os-starter/) - download the whole starter, it runs on sample data out of the box. Nothing is sent anywhere: replies come out as drafts.

Download the AI OS starter (zip) 65 KB

MIT licence. Python 3.10+, no other installs. Unzip, then follow README.md.

Run this one

  1. Set up the starter (the steps on the starter page).
  2. python -m aios run trademark_check
  3. Edit config.json: point "trademark_check" at your own files (paths relative to config.json).

Check it yourself

  1. Every flagged name really appears in your listing text - a name the AI 'finds' that is not there is dropped by the code.
  2. Look each one up yourself at https://tmsearch.uspto.gov (or your country's trademark office).
  3. A pre-screen to catch obvious problems early - not legal advice.

agents/trademark_check.py

"""ETSY + PRINT-ON-DEMAND - trademark pre-screen. Before a listing gets reported or your shop gets a strike, this reads
your listings export (titles, tags, descriptions) and checks two ways:
  1. plain code: every word or phrase on YOUR watchlist (watchlist.txt) found in a listing -> HIGH;
  2. the AI lists names in the text that may belong to someone else (brands, characters, celebrities, teams, slogans).
     The code keeps only names that really appear in the listing - an AI 'finding' that is not in your text is dropped.
Each hit comes with a link to the official USPTO trademark search so YOU check it. This is a pre-screen to catch
obvious problems early - it is not legal advice and it does not prove that anything is safe to use."""
from aios import llm
from aios.config import path

from ._common import col, in_text, table

TITLE = "Trademark pre-screen"
SEARCH = "https://tmsearch.uspto.gov"  # the official US trademark search (other countries have their own office)


def watchlist(cfg, rel_path):
    f = path(cfg, rel_path)
    if not f.exists():
        return []
    return [ln.strip().lower() for ln in f.read_text(encoding="utf-8").splitlines() if ln.strip() and not ln.startswith("#")]


def run(cfg, data, s):
    words = watchlist(cfg, s.get("watchlist", ""))
    items, attention, listings = [], [], []
    for r in table(cfg, s["listings"]):
        title = col(r, "title")
        text = " ".join([title, col(r, "tags"), col(r, "description")])
        listings.append((title, text))
    ask = "\n".join(f"{n}. {t}" for n, (_t, t) in enumerate(listings, 1))
    found = llm.ask_json(f"Etsy listings (title, tags, description):\n{ask}\n\nFor each listing, list any words in it that "
                         "may be a trademark, brand, fictional character, celebrity, sports team or famous slogan owned "
                         "by someone else. Copy the words exactly as written. Generic words are fine - do not list them. "
                         'JSON: {"1": ["..."], "2": []}')
    found = found if isinstance(found, dict) else {}
    flagged = 0
    for n, (title, text) in enumerate(listings, 1):
        high = [w for w in words if in_text(w, text)]
        ai = [str(x) for x in found.get(str(n), []) if isinstance(x, str)]
        maybe = [x for x in dict.fromkeys(ai) if in_text(x, text) and x.lower() not in high]  # only names really there
        if not high and not maybe:
            continue
        flagged += 1
        parts = []
        if high:
            parts.append("HIGH (on your watchlist): " + ", ".join(high))
        if maybe:
            parts.append("check: " + ", ".join(maybe))
        items.append(f"{title[:70]} -> {'; '.join(parts)} | look each up at {SEARCH}")
        if high:
            attention.append(f"'{title[:60]}' uses {', '.join(high)} - check before it gets reported")
    return {"summary": f"{len(listings)} listings screened, {flagged} with names to check (a pre-screen, not legal advice).",
            "items": items, "attention": attention}

Shared as shown in the video. Replace any <PLACEHOLDERS> with your own values.