Guide · In-House AI Marketing Engine

Use AI to write the questions buyers ask AI assistants, without your brand in them

Python2026-11-03Script ran before publishing, PDF by email

The short answer

Give Claude your product page and ask for ten questions a stranger would type into an AI assistant. A small Python script does this. Then plain code, not a second AI, checks each question and stops any that name the brand terms you list. You get a list a person approves.

The four steps the script runsYour product page goes in, Claude writes ten questions, plain code checks each one, and you approve the list.1 Your product pagepasted into the script2 Claude writes the questionsten, each with its evidence3 Plain code checks each onesix checks, no second AI4 You approve the listapproved-questions.csv
The four steps buyer_questions.py runs, in order. Your page goes in, Claude writes the questions, plain code checks each one, and a person approves what is left. Watch the run step by step.

What you will have at the end

One Python file, buyer_questions.py. It sends one product page to Claude, gets back ten buyer questions that each carry a stage and a phrase quoted from the page, runs six plain-code checks on them and writes approved-questions.csv. It also writes run-view.html, which plays the run one question at a time, and it saves Claude’s raw answer to buyer_questions-answers.json, so anyone can run the checks again with --replay, no key and no cost. The full guide, with every step in detail and a checklist, is a PDF: get it by email.

The demo product page is invented: a made-up product called Larkspur Ledger, with no real company behind it. Nothing here is a measurement of how real buyers search.

What you will need

  • Python 3 (tested on 3.12) and the anthropic package (pip install anthropic). Nothing else is needed.
  • An Anthropic API key in ANTHROPIC_API_KEY. The saved demo answers work with --replay, no key needed, only on the unchanged demo page. Your own page needs a key.
  • The text of one product page of yours, for the step where you run it on your own product.

Why the brand check matters most

A question that names your company is mostly typed by people who already know you. The questions worth finding are the ones a stranger types while shopping for the category. If Claude lets the product name slip into one of those questions, any later count of who gets named is quietly skewed. So the script treats a branded question in the unbranded list as a failure and stops it with plain code.

How it works, step by step

1. Set the four settings

The top of the script holds your product name, the ways your brand is written, the category and the product page text. This is the block as shipped, with the page text shortened here:

# ---- SETTINGS: change these four for your own product -------------------------------------
PRODUCT_NAME = "Larkspur Ledger"
BRAND_TERMS = ["Larkspur Ledger", "Larkspur", "larkspur-ledger.example.com"]
CATEGORY = "accounts payable automation software"
PAGE_TEXT = """
(the invented product page: 803 characters)
"""

2. Ask Claude once

The script makes one call to the Messages API with a system prompt and a user prompt that holds your page between <page> tags (Anthropic Messages API reference (read 2026-11-03), which documents system and max_tokens). The prompt asks for exactly ten questions from a buyer who has never heard of the product, says never to use the product name, company name or a web address, and asks for a stage and a phrase copied exactly from the page for each question. The model is one constant at the top, claude-haiku-5-5. We used a small model here because plain code does the policing. The script prices the call at Anthropic’s published rates, $0.10 in and $0.50 out per million tokens (Anthropic pricing (read 2026-11-03)), and stops before a run whose estimated cost passes $2.00.

The script asks for temperature 0 so answers vary as little as possible. On 2026-11-03 the API rejected that setting for this model, so the script retries without it and records that in the answers file. A live run of yours may word the questions differently from the run below. --replay reproduces runs 1 and 2 below exactly.

The answer must be JSON in the shape the script expects. An answer that does not parse is reported, with nothing approved, and never skipped.

3. Check every question with plain code

No second AI reads the answer. These are ordinary Python functions. Each check, and the planted fault that trips it:

CheckWhat it requiresPlanted fault that trips it
fieldsQuestion, stage and evidence are all filled in.A question whose evidence is empty.
shapeA real question: 5 to 30 words, ends with a question mark.The three words “invoice approval software”, with no question mark.
stageThe stage is category, comparison or implementation.A question tagged “pricing”.
brandAn unbranded question names none of your brand terms, as a whole word or joined without spaces.A question naming Larkspur Ledger, and one that writes it as LarkspurLedger.
duplicateNo question repeats an earlier one once punctuation and capitals are ignored.A copy of question 1.
evidenceThe phrase Claude quoted is on the product page, ignoring capitals and punctuation, and is at least four words long.A quote about a “patented quantum engine” that the page never says.

Seven faults are planted, because the brand check gets two: the name as written, and the name joined into one word. Here are the two functions that do most of the work:

def names_brand(question, term_tokens):
    """The first brand term the question names, or ''. Matches whole words ('Larkspur's' counts),
    and a multi-word term written without spaces ('LarkspurLedger')."""
    qt = tokens(question)
    joined = "".join(qt)
    for t in term_tokens:
        n = len(t)
        if any(qt[i:i + n] == t for i in range(len(qt) - n + 1)) or (n > 1 and "".join(t) in joined):
            return " ".join(t)
    return ""


def check_item(item, n, earlier, page_tokens, term_tokens):
    """[(check, reason)] for one item. Empty means the item passed every check."""
    q, stage, ev = (item.get(k) for k in ("question", "stage", "evidence"))
    empty = [k for k, v in (("question", q), ("stage", stage), ("evidence", ev)) if not (isinstance(v, str) and v.strip())]
    if empty:
        return [("fields", "missing or empty: " + ", ".join(empty))]
    out = []
    words = len(q.split())
    if not q.strip().endswith("?") or not 5 <= words <= 30:
        out.append(("shape", f"a question of 5 to 30 words that ends with ?; this has {words} words"))
    if stage not in STAGES:
        out.append(("stage", f'"{stage}" is not one of {", ".join(STAGES)}'))
    hit = names_brand(q, term_tokens)
    if hit:
        out.append(("brand", f'an unbranded question names the brand ("{hit}")'))
    key = " ".join(tokens(q))
    if key in earlier:
        out.append(("duplicate", f"same question as item {earlier[key]}"))
    et = tokens(ev)
    if len(et) < 4 or f" {' '.join(et)} " not in page_tokens:
        out.append(("evidence", "the evidence is not a phrase on the product page"))
    return out

4. A person approves the list

Questions that pass every check are written to approved-questions.csv. Questions that fail are printed with the check and the reason. A person reads both before anything is used: a passing question can still be a poor one, because the checks test form, not judgment. For a stopped question, change the prompt or drop it.

5. Ask the questions

The script does not ask any AI assistant anything and cannot tell you whether an assistant names your company. Take the approved list and ask each question in the assistants your buyers use, by hand or with a script that uses that assistant’s own API and key. Nobody controls what assistants say, so a list of questions is a place to start measuring, not a result.

Run 1. Claude’s questions, checked

A live run on the invented page, with no planted faults. Claude wrote ten questions and every one passed.

Buyer questions for AI assistants: the checks
Model claude-haiku-5-5, answers recorded 2026-11-03, temperature not set (the model refuses it)
Software (as recorded): Python 3.12.15, anthropic 0.125.0
Product page: Larkspur Ledger, 803 characters, SHA-256 9953619f7898
Category: accounts payable automation software
Brand terms: 3
Tokens: 587 in, 1889 out. Cost $0.001003 (at $0.10 and $0.50 per million tokens)

  1 PASS  [category]        What software can read supplier invoices from email and PDF and match them to purchase orders?
  2 PASS  [category]        Which accounts payable automation tools catch duplicate supplier invoices before they get paid?
  3 PASS  [category]        What are the best accounts payable automation platforms for mid-sized companies?
  4 PASS  [comparison]      Is it better to use three-way matching software or manual checks to approve supplier invoices?
  5 PASS  [category]        Which accounts payable tool lets approvers sign off invoices from their phone?
  6 PASS  [comparison]      Should I choose an accounts payable tool with a full audit trail of approvals or a cheaper basic one?
  7 PASS  [implementation]  How do I set department-specific approval limits for supplier invoices?
  8 PASS  [implementation]  How do I connect invoice approval software to my accounting system through an API?
  9 PASS  [implementation]  How do approved invoices get posted to the general ledger and scheduled for payment?
 10 PASS  [implementation]  What happens to supplier invoices that don't match their purchase order and goods receipt?

Result: 10 approved, 0 stopped
Next: a person reads approved-questions.csv and approves it.

Run 2. Seven planted faults the checks must stop

The same saved answers, replayed with --plant, which adds seven faulty questions after Claude’s ten (items 11 to 17). Each is marked (planted) in the output.

Buyer questions for AI assistants: the checks
Model claude-haiku-5-5, answers recorded 2026-11-03, temperature not set (the model refuses it)
Software (as recorded): Python 3.12.15, anthropic 0.125.0
Product page: Larkspur Ledger, 803 characters, SHA-256 9953619f7898
Category: accounts payable automation software
Brand terms: 3
Tokens: 587 in, 1889 out. Cost $0.001003 (at $0.10 and $0.50 per million tokens)

  1 PASS  [category]        What software can read supplier invoices from email and PDF and match them to purchase orders?
  2 PASS  [category]        Which accounts payable automation tools catch duplicate supplier invoices before they get paid?
  3 PASS  [category]        What are the best accounts payable automation platforms for mid-sized companies?
  4 PASS  [comparison]      Is it better to use three-way matching software or manual checks to approve supplier invoices?
  5 PASS  [category]        Which accounts payable tool lets approvers sign off invoices from their phone?
  6 PASS  [comparison]      Should I choose an accounts payable tool with a full audit trail of approvals or a cheaper basic one?
  7 PASS  [implementation]  How do I set department-specific approval limits for supplier invoices?
  8 PASS  [implementation]  How do I connect invoice approval software to my accounting system through an API?
  9 PASS  [implementation]  How do approved invoices get posted to the general ledger and scheduled for payment?
 10 PASS  [implementation]  What happens to supplier invoices that don't match their purchase order and goods receipt?
 11 STOP  [category]        (planted) Is Larkspur Ledger worth it for a small finance team?
      -> brand: an unbranded question names the brand ("larkspur ledger")
 12 STOP  [category]        (planted) How does LarkspurLedger handle three-way invoice matching?
      -> brand: an unbranded question names the brand ("larkspur ledger")
 13 STOP  [category]        (planted) What software can read supplier invoices from email and PDF and match them to purchase orders?
      -> duplicate: same question as item 1
 14 STOP  [category]        (planted) Which accounts payable automation software features do buyers regret not asking about?
      -> evidence: the evidence is not a phrase on the product page
 15 STOP  [pricing]         (planted) What does accounts payable automation software usually cost per month for a small team?
      -> stage: "pricing" is not one of category, comparison, implementation
 16 STOP  [category]        (planted) invoice approval software
      -> shape: a question of 5 to 30 words that ends with ?; this has 3 words
 17 STOP  [implementation]  (planted) What is the difference between two-way and three-way invoice matching?
      -> fields: missing or empty: evidence

Result: 10 approved, 7 stopped
Planted faults: 7 planted, 7 stopped by the check each was built for
Questions Claude wrote that were stopped: 0
Next: a person reads approved-questions.csv and approves it.

How to read the results

  • Result: 10 approved, 0 stopped (run 1) means every question passed every check. It does not mean the questions are good.
  • Planted faults: 7 planted, 7 stopped by the check each was built for (run 2) means each check caught the fault made for it, and the second line shows none of Claude’s own questions was stopped. None of Claude’s ten questions was stopped by a check in the live run. Your run may differ, and a stopped question is the check doing its job.
  • The cost line shows the tokens and the price of the one Claude call. The replay prints the figures recorded with the answers, so a replay without --plant matches run 1 line for line.
Watch the run step by step

Run it on your own product

To run it on your own product, open buyer_questions.py and change the settings between the SETTINGS and END SETTINGS comments. Set PRODUCT_NAME to your product name. List every way your company and product are written in BRAND_TERMS: full name, short name, joined spelling and web address. Set CATEGORY to the kind of product you sell. Paste the text of your product page between the triple quotes of PAGE_TEXT. Leave HOW_MANY and the rest as they are. Run it with --plant once to see the checks stop the seven planted faults, then run it without --plant to get your questions. Each of those runs makes its own Claude call and overwrites the answers file, the CSV and the run view in the script folder, so copy any you want to keep. The saved demo answers work with --replay only while the page text is unchanged.

Blank or empty entries in BRAND_TERMS are dropped and counted, because an empty term would match every question. If no usable term is left, the script stops, since the brand check could not run. --plant quotes the first sentence of your page that has at least eight words, so give it a page with one.

Run 3. The same script on a second product

We also ran the script, edited only as above, on a second invented product, Nimbus Pay, with its name also listed in a joined spelling, two blank entries in BRAND_TERMS and a curly apostrophe in the page text, with --plant. This is a separate live call, so Claude’s questions differ from run 1. The second page is not published, so this run cannot be replayed. The planted questions use fixed wording about invoices, so some read oddly for a payroll page. They exist only to trip the checks. Each planted fault was stopped.

Buyer questions for AI assistants: the checks
Model claude-haiku-5-5, answers recorded 2026-11-03, temperature not set (the model refuses it)
Software (as recorded): Python 3.12.15, anthropic 0.125.0
Product page: Nimbus Pay, 505 characters, SHA-256 6c3e63ea6af6
Category: payroll software for small businesses
Brand terms: 3 (2 blank dropped)
Tokens: 515 in, 2258 out. Cost $0.001180 (at $0.10 and $0.50 per million tokens)

  1 PASS  [category]        Which payroll software works out tax withholding for every state for a small business?
  2 PASS  [category]        Which payroll services are best for small businesses with up to 200 staff?
  3 PASS  [comparison]      Is payroll software that files quarterly returns for me better than paying an accountant to file them?
  4 PASS  [implementation]  How do I set up payroll so managers can approve overtime from their phones?
  5 PASS  [category]        Which small business payroll tools let employees view their pay slips in a mobile app?
  6 PASS  [implementation]  How can I see a history of every change made to employee pay rates in my payroll system?
  7 PASS  [comparison]      Is payroll software that shows a bookkeeper who changed what better than tracking pay changes in a spreadsheet?
  8 PASS  [comparison]      Is payroll software that exports journal entries to accounting systems better than entering payroll figures by hand?
  9 PASS  [implementation]  How do I add a contractor and pay them in the same payroll run as my employees?
 10 PASS  [category]        What payroll software can pay staff by direct deposit for a small company with no finance team?
 11 STOP  [category]        (planted) Is Nimbus Pay worth it for a small finance team?
      -> brand: an unbranded question names the brand ("nimbus pay")
 12 STOP  [category]        (planted) How does NimbusPay handle three-way invoice matching?
      -> brand: an unbranded question names the brand ("nimbuspay")
 13 STOP  [category]        (planted) Which payroll software works out tax withholding for every state for a small business?
      -> duplicate: same question as item 1
 14 STOP  [category]        (planted) Which payroll software for small businesses features do buyers regret not asking about?
      -> evidence: the evidence is not a phrase on the product page
 15 STOP  [pricing]         (planted) What does payroll software for small businesses usually cost per month for a small team?
      -> stage: "pricing" is not one of category, comparison, implementation
 16 STOP  [category]        (planted) invoice approval software
      -> shape: a question of 5 to 30 words that ends with ?; this has 3 words
 17 STOP  [implementation]  (planted) What is the difference between two-way and three-way invoice matching?
      -> fields: missing or empty: evidence

Result: 10 approved, 7 stopped
Planted faults: 7 planted, 7 stopped by the check each was built for
Questions Claude wrote that were stopped: 0
Next: a person reads approved-questions.csv and approves it.

Get the full guide as a PDF

We'll email you a link to it. Please use your work email.

Limits

  • The questions are Claude’s guesses from one page. They are not measured buyer behavior, and the script holds no search volume.
  • The product page is invented. The result shows the checks work on a demo, not that your questions will be good.
  • The checks test form and traceability, not judgment. A question can pass every check and still be one no buyer asks.
  • The brand check knows only the terms you list. A misspelling or nickname you did not list gets through. A short term can also match a word it was never meant to, so read each stop.
  • The evidence check proves a phrase is on the page, not that the question follows from it.
  • The checks read plain English letters and digits. A brand term or page written in another script, or with accented letters, is not matched reliably.
  • It does not tell you whether any assistant names your company, and nothing here promises that one will.

Tested on

Tested on

Platform
Python 3.12.15 with the anthropic package 0.125.0, both recorded by the script in its run output
Model
claude-haiku-5-5 through the Anthropic API
Date
2026-11-03
Dataset
Two invented product pages: Larkspur Ledger, written in the script, and a second one for run 3 that is not published. No public dataset. Nothing real was sent to Claude.
Code
buyer_questions.py
Run record
buyer_questions-answers.json (model, date, prompt, raw answer, tokens), approved-questions.csv

When this is not enough

  • You need real buyer language. Claude invents plausible questions. Questions from your own sales calls, support tickets and site search are real, and this script does not read them.
  • You need to know who gets named. That means asking each assistant each question, again and again over time, and counting the answers. This script stops at the list.
  • You need the list kept current. Products and categories change, so the list does too. Re-run the script when your page changes.

Want this running on your own category?

Data Meaning's In-House AI Marketing Engine has six parts at fixed fees. Part three is AI search visibility. We use it ourselves: we track 214 of our own buyer questions every week across five AI assistants.

Each quarter we choose one company for a free, 4-week AI search visibility check. We choose by fit and reply to every application by email. It is for US companies with 20 to 250 employees that pay a marketing agency. We can't promise an assistant will name you. Nobody controls what AI assistants say.

Apply for the free AI search visibility check