Build an Evidence-Linked Newsletter Voice Audit with Firecrawl and Claude (Python)

A useful newsletter voice audit is not a one-shot “brand DNA” guess. It is a small set of observations tied to words that actually appeared in the issues you supplied.

The workflow below reads only the newsletter URLs you own or have permission to analyze, asks Claude for structured observations, and then checks every quoted phrase against the scraped source. If a quote is missing—or points to a URL outside your list—the script refuses to save the result.

✅ The practical goal: produce an evidence-linked editorial brief that a human can review, not an automated verdict about a brand.

Decide what you are allowed to analyze

Start with an explicit list of issue URLs. Use your own public archive, a client archive covered by your agreement, or material whose owner has clearly allowed this kind of analysis. A public page is technically reachable, but that alone does not settle copyright, contract, privacy, or acceptable-use questions.

This tutorial deliberately does not discover more pages, crawl an entire domain, bypass access controls, or analyze a competitor’s private material. The input file is an allow-list: one approved HTTPS issue URL per line.

Create issue_urls.txt:

https://newsletter.example.com/issues/welcome
https://newsletter.example.com/issues/october-update
https://newsletter.example.com/issues/year-end-checklist

Five to fifteen representative issues are often easier to inspect than hundreds. Include different dates and content types if you want to see whether an observation survives outside one unusually strong issue. The script caps a run at 25 URLs so the human review remains manageable.

Build an evidence-first output contract

A model can produce a plausible description that is not supported by the sample. The way to reduce that risk is to define the evidence contract before asking for analysis.

This example asks for five sections:

Section Question it should answer
Audience Who does the text explicitly address?
Value proposition What outcome does the copy actually promise?
Voice traits What repeatable language choices appear?
Content patterns How are ideas commonly organized?
CTA patterns What action does the reader get asked to take?

Each observation must have a short claim plus one or more evidence objects containing the exact source url and a verbatim quote. There is also an uncertainties list for conclusions the supplied sample cannot support.

That last field matters. Three issues may reveal recurring wording, but they cannot prove that the same style appeared in every issue, improved conversion, or caused reader loyalty. The output needs room to say “not established.”

Collect only the approved issue URLs

Install the two client libraries:

py -m pip install "firecrawl>=4,<5" "anthropic>=0.40,<1"

Keep credentials in environment variables instead of putting them in the script:

$env:FIRECRAWL_API_KEY = "your-firecrawl-key"
$env:ANTHROPIC_API_KEY = "your-anthropic-key"
$env:CLAUDE_MODEL = "a-model-name-enabled-for-your-account"

The model name is also an environment variable. Model availability changes, and an old hard-coded identifier can turn a tutorial into a broken copy-and-paste example.

The collection function uses the current Firecrawl Python client and requests main-content Markdown:

from dataclasses import dataclass
from urllib.parse import urlparse


@dataclass(frozen=True)
class Document:
    url: str
    markdown: str


def approved_https_url(value):
    parsed = urlparse(value)
    return parsed.scheme == "https" and bool(parsed.netloc)


def scrape_documents(urls, firecrawl):
    documents = []
    for url in urls:
        if not approved_https_url(url):
            raise ValueError(f"Only explicit HTTPS issue URLs are allowed: {url!r}")
        result = firecrawl.scrape(
            url,
            formats=["markdown"],
            only_main_content=True,
        )
        markdown = getattr(result, "markdown", None)
        if not isinstance(markdown, str) or not markdown.strip():
            raise ValueError(f"No Markdown returned for {url}")
        documents.append(Document(url=url, markdown=markdown.strip()))
    return documents

The scraper receives the exact list and returns the URL beside the Markdown. Keeping those two values together makes it harder to lose the source identity later.

⚠️ A successful scrape does not prove that the text is complete. Cookie banners, paywalls, client-side rendering, navigation text, or a changed page layout can alter what was captured. Inspect several collected documents before treating the sample as ready.

Ask for claims and quotes together

Anthropic’s prompt guidance recommends separating multi-document inputs with clear source tags. The local prompt builder wraps every document in a <source> block with its URL and tells the model to return JSON only.

It also limits the number of characters per issue. When a document is cut, the prompt contains [TRUNCATED BY LOCAL SCRIPT]; truncation is not hidden from the model or the reviewer.

def build_prompt(documents, max_chars_each=20_000):
    source_blocks = []
    for index, document in enumerate(documents, start=1):
        text = document.markdown
        truncated = len(text) > max_chars_each
        excerpt = text[:max_chars_each]
        marker = "\n[TRUNCATED BY LOCAL SCRIPT]" if truncated else ""
        source_blocks.append(
            f'<source id="{index}" url="{document.url}">\n'
            f"{excerpt}{marker}\n</source>"
        )

    return (
        "Analyze only the supplied newsletter issues. Return JSON only. "
        "Do not infer intent, demographics, performance, or consistency beyond the sample. "
        "Every claim must include at least one short verbatim quote and its exact source URL.\n\n"
        + "\n\n".join(source_blocks)
    )

The complete script includes the full JSON shape for all five sections. Supplying the shape helps with parsing, but it is not proof that the answer is true. The next local check is what turns the quotes into testable evidence.

Reject unsupported evidence before saving

For each result, the validator confirms three things:

  1. the section is a list;
  2. every claim has at least one evidence object; and
  3. every URL belongs to the input and every quote occurs verbatim in that URL’s scraped Markdown.

The central check is intentionally plain:

def validate_profile(profile, documents):
    by_url = {document.url: document.markdown for document in documents}

    for section in (
        "audience",
        "value_proposition",
        "voice_traits",
        "content_patterns",
        "cta_patterns",
    ):
        claims = profile.get(section)
        if not isinstance(claims, list):
            raise ValueError(f"{section} must be a list")

        for item in claims:
            evidence = item.get("evidence")
            if not evidence:
                raise ValueError(f"{section} claim needs evidence")

            for citation in evidence:
                url = citation.get("url")
                quote = citation.get("quote")
                if url not in by_url:
                    raise ValueError(f"Evidence cites an unknown URL: {url!r}")
                if not quote or quote.strip() not in by_url[url]:
                    raise ValueError(
                        f"Quote was not found verbatim in {url}: {quote!r}"
                    )

This check catches invented quotations and citations to unapproved sources. It does not establish that the claim is the best interpretation of the quote. A sentence may be real but taken out of context, and a model can still overgeneralize from one example. Human review remains necessary.

💡 A useful review question is: “Would I make the same claim if I saw only this quote and the paragraphs around it?” If not, narrow the claim or add evidence from another issue.

Run the audit and inspect the JSON

Save the full program as newsletter_voice_audit.py, then run:

py newsletter_voice_audit.py issue_urls.txt reports/voice-audit.json

The program performs these steps in order:

  1. reads the explicit URL allow-list;
  2. rejects non-HTTPS entries and runs over 25 issues;
  3. asks Firecrawl for main-content Markdown;
  4. builds source-tagged input for the Messages API;
  5. parses the returned JSON;
  6. validates every cited URL and quotation; and
  7. writes the report only after validation succeeds.

Open the JSON beside the original issues. Look at the paragraphs before and after every quote, remove claims that rely on one odd example, and separate stable editorial rules from experiments that appeared once.

A validated item might look like this:

{
  "claim": "The issue gives the reader a time-bounded action",
  "evidence": [
    {
      "url": "https://newsletter.example.com/issues/year-end-checklist",
      "quote": "Review these three settings before Friday"
    }
  ]
}

Do not publish this sample as if it came from a real newsletter; it only illustrates the required shape.

Test the guardrail without spending API credits

The included unit tests use fixed local strings. They do not call Firecrawl or Anthropic, and they do not prove that your credentials, billing, or live pages work.

def test_valid_verbatim_evidence_passes(self):
    validate_profile(
        profile_with(self.url, "Try the checklist"),
        [Document(self.url, "Welcome back. Try the checklist before Friday.")],
    )


def test_quote_not_in_source_is_rejected(self):
    with self.assertRaisesRegex(ValueError, "not found verbatim"):
        validate_profile(
            profile_with(self.url, "Guaranteed growth"),
            [Document(self.url, "Welcome back. Try the checklist before Friday.")],
        )

Run them with:

py -m unittest -v test_newsletter_voice_audit.py

Four local tests passed while preparing this tutorial. They cover valid evidence, a fabricated quote, an unknown source URL, and the prompt’s truncation marker. They do not make a claim about the quality of a live model response.

What the audit can and cannot establish

This workflow can help you assemble a reviewable inventory of repeated language choices, content structures, reader instructions, and explicit promises in the supplied sample. Because every observation carries a quote, an editor can challenge it without rerunning the model.

It cannot measure whether the style caused opens, clicks, conversions, or reader trust. It also cannot recover context that the scraper did not capture, decide whether your sample represents the full archive, or grant permission to reuse someone else’s writing.

📌 Treat the output as a draft editorial hypothesis. Keep an observation only when the quotations are representative, the wording is narrow enough, and a human editor would be comfortable applying it to the next issue.

Documentation used for collection and analysis

The real improvement is not adding another agent label. It is making the analysis inspectable: approved inputs, visible truncation, source-linked claims, rejected fake quotations, and a final human decision.

Comments