GrepBoard/Manuals
605 manuals ·

Turn a blog post into a newsletter and verify links and numbers

·Tested on Claude Sonnet 5.5 · 2026-10·Test scope ↓·6 steps

Shorten a blog post into a newsletter by quoting it first, then check by script that every URL and number in the newsletter is in the post. Six runs shown.

A newsletter that goes out with a link the post never had, or a changed number, cannot be recalled. This shortens a made-up budgeting app's blog post (five figures, three outside links, one link to its own service) into a newsletter of 100 words or fewer, quoting first and then checking URLs and numbers.

[1] The post is post.en.txt. Part of it:

post.en.txt
Title: Three weeks of tracking makes it a habit: results from 2,800 users Tidy Ledger surveyed 2,800 users who had joined within the past year in October 2026. The survey asked one question: how long did it take before you stopped skipping days? In the first month, 58% of users kept logging without a break. For those users the…

[2] The prompt wraps the post in <post> tags so it cannot blend into the instructions (OpenAI's prompt engineering guide recommends marking where reference material starts and ends). It first has the model quote the post word for word, then write only from those quotes, which is the quote-grounding approach in Claude's docs for long documents.

text
<post>{full post.en.txt}</post> <reader>A user who installed the budgeting app but keeps dropping the habit. They read one short email a week and click a link if it looks useful.</reader> Turn the <post> above into a weekly newsletter. Follow this order.1. First, inside <quotes>, pick the sentences from <post> you will rely on, copied word for word, one per line, numbered.2. Then write the newsletter inside <newsletter> using only those quotes. Structure: one subject line, one sentence with the main claim, a list of key points, and one call to action line, and a read-the-full-post link as the last line. <newsletter> is 100 words or fewer. Rules:- Use numbers and URLs only as they appear in <post>, written the same way. Do not round, convert or change units, and do not create new links. The person who sends the email checks them against the post with a text search, and one mismatch means it cannot be sent.- If the post states its own limitation (self-reported figures, so no cause can be claimed), keep it in the newsletter as one sentence.- The post does not contain its own address, so write [full post link] in place of that link's address.- Do not write the number of key points as a figure (for example, "3 tips").- Output only the <quotes> and <newsletter> blocks and nothing else.

[3] The first result (only the first 2 quotes shown):

output
<quotes>1. Once someone passes the three-week mark, drop-off falls sharply.2. Users who skipped two or more days in the first week were far more likely to miss the rest of the month.…</quotes> <newsletter>Subject: Pass the three-week mark and logging sticks Once someone passes the three-week mark, drop-off falls sharply. - Skipping two or more days in week one made a missed month far more likely.- People who used receipt photos were 2.1 times as likely to keep logging.- Users logging three months or more had spending $85 lower. This is self-reported, so it does not show that the app reduces spending.- If logging feels hard at first, start with one entry a day. To start with Tidy Ledger, go to https://example.com/tidy/start.Read the full post: [full post link]</newsletter>

[4] The script checks that every URL and number in the newsletter (as a value and unit pair; English distinguishes only % and $) is in <quotes> (or in the whole post when there are no quotes), that every line in <quotes> appears in the post word for word, that the post's own start link is present, and that the word count is between 40 and the limit. Any failure exits with code 1.

check_newsletter.py
import sys, repost = open(sys.argv[1], encoding="utf-8").read()out = open(sys.argv[2], encoding="utf-8").read()lang, max_words, must = sys.argv[3], int(sys.argv[4]), sys.argv[5]URL = re.compile(r"https?://[A-Za-z0-9._~:/?#@!$&*+;=%-]+")def urls(s): return {u.rstrip(".,;:)") for u in URL.findall(s)}m = re.search(r"<newsletter>(.*?)</newsletter>", out, re.S)nl = m.group(1) if m else outq = re.search(r"<quotes>(.*?)</quotes>", out, re.S)WORDS = {"two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9, "ten": 10, "eleven": 11, "twelve": 12}KO = {"두": 2, "세": 3, "석": 3, "네": 4, "넉": 4, "다섯": 5, "여섯": 6, "일곱": 7, "여덟": 8, "아홉": 9, "열": 10}def facts(s):    s = URL.sub(" ", s)    s = re.sub(r"(?m)^\s*(?:\d+[.)]|[-*•])\s+", "", s)    r = set()    for m in re.finditer(r"(\$)?(\d[\d,]*(?:\.\d+)?)\s?(%|[가-힣]|[A-Za-z]+)?", s):        v = float(m.group(2).rstrip(",").replace(",", "")); u = "$" if m.group(1) else (m.group(3) or "")        if lang == "en" and u not in ("%", "$"): u = ""        r.add((v, u))    if lang == "en":        for m in re.finditer(r"\b(" + "|".join(WORDS) + r")\b[\s-]*([A-Za-z]*)", s, re.I):            r.add((float(WORDS[m.group(1).lower()]), ""))    else:        for m in re.finditer("(" + "|".join(KO) + r")\s*(번|달|가지|개|주|배|명|건|곳|일)", s):            r.add((float(KO[m.group(1)]), m.group(2)))    return rbad = []if lang and not m and ("<quotes>" in out or "<newsletter>" in out): bad.append("tags not closed")src, label = (q.group(1), "quotes") if q else (post, "post")   # with quotes, only quoted sentences count as the sourceinv = sorted(urls(nl) - urls(src))if inv: bad.append(f"URL not in the {label}: {inv}")extra = sorted(facts(nl) - facts(src))if extra: bad.append(f"number/unit not in the {label}: {extra}")if must not in urls(nl): bad.append(f"required link missing: {must}")words = len([w for w in re.sub(r"(?m)^\s*(?:\d+[.)]|[-*•])\s+", "", nl).split() if re.search(r"\w", w)])if not 40 <= words <= max_words: bad.append(f"{words} words (allowed 40-{max_words})")norm = lambda s: " ".join(s.split())if q:    lines = [re.sub(r"^\s*(?:\d+[.)]|[-*•])\s*", "", l).strip().strip("\"'“”「」") for l in q.group(1).splitlines() if l.strip()]    nf = [l for l in lines if norm(l) not in norm(post)]    if not lines: bad.append("empty <quotes>")    if nf: bad.append(f"{len(nf)}/{len(lines)} quotes not found verbatim: {[x[:30] for x in nf[:2]]}")elif m: bad.append("no <quotes>")print(("FAIL " if bad else "PASS ") + sys.argv[2] + f" ({words} words)" + ("  " + "; ".join(bad) if bad else ""))sys.exit(1 if bad else 0)

[5] Run it on 6 runs of the rule prompt (better.en.txt) and 6 runs of a prompt with no rules, just "Shorten … Add a read-the-full-post link at the end." (naive.en.txt).

console
$ for k in 1 2 3 4 5 6; do python3 -I check_newsletter.py post.en.txt better.en.$k.out.txt en 100 https://example.com/tidy/start; done | grep -v '^PASS'FAIL better.en.6.out.txt (97 words)  required link missing: https://example.com/tidy/start$ for k in 1 2 3 4 5 6; do python3 -I check_newsletter.py post.en.txt naive.en.$k.out.txt en 9999 https://example.com/tidy/start; done | grep -c '^PASS'3
Out of 6One-line instructionWith rules
URL in the newsletter that is not in the post00
Start link missing31
Script passes35
Words206-22390-97

Neither prompt invented a URL or used a number outside the post, and both left a placeholder for the post's own address. The start link was missing in 3 of 6 one-line runs and 1 of 6 rule runs; neither prompt asked for it explicitly (the rules said "one call to action line"). An earlier version of the script compared URLs and numbers with the whole post, not the quotes, and did not require the start link; it reported no problems for this set, and that was corrected.

[6] To see whether the script catches errors, one passing result was edited by hand in 13 ways: changed URL, changed number or unit, new number, a number whose quote was removed, start link removed, edited quote, over the word limit and so on, plus one control that only turns the bullets into numbers. Results for both languages are in run/mutation-results.txt: the control passed, and so did one other case; the remaining 11 were caught. One example, with $85 changed to 85% in the newsletter (not model output):

console
$ python3 -I check_newsletter.py post.en.txt mut_en/m4_unit_swapped.txt en 100 https://example.com/tidy/startFAIL mut_en/m4_unit_swapped.txt (95 words)  number/unit not in the quotes: [(85.0, '%')]

The script confirms URLs, numbers and quotes exist. Whether a caveat from the post (self-reported, so no cause) survived into the key points is for you to read.

#newsletter#content-repurposing#marketing#claude