Check copy against the style guide.
Done by an agent. Checked twice.
Every break of the written style guide listed by line and rule with a tested fix and customer quotes left alone.
Real files in
- copy.md
A draft web page and a delivery email, 74 lines, with 23 breaks of the guide planted in them and three customer quotes that must be left alone. 74 lines, 3 KB. - style_guide.md
A nine rule style guide for an invented bike subscription company, with one stated exception for customer quotes. 39 lines, 2 KB.
Sample data written by Atris. Not a real company.
Three steps
- 1.Read the guide and the copy
- 2.Find every break
- 3.Write the list
Claude Sonnet 5.5, 53 seconds. No web. It never saw the check.
Checked twice
- Passed: 23 of 23 breaks found by applying the guide to the copy again are listed in breaks.csv
- Passed: 0 of 23 listed rows are false alarms
- Passed: 0 breaks are listed on the 3 customer quote lines the guide protects
- Passed: 23 of 23 found texts appear word for word on the line they cite
- Passed: 23 of 23 suggested fixes pass the rule they fix
- Passed: summary.md gives the right count for 9 of 9 rules and the total of 23
Second review by Claude Opus 5.5: pass.
Then we broke a copy of the output 4 ways on purpose. The check caught 4.
line,rule,found,fix 1,R6,The Bike Subscription That Fixes Itself,The bike subscription that fixes itself 11,R3,fee!,fee. 12,R5,users,riders 12,R1,SaltMarsh Flex,Saltmarsh Flex 16,R5,bicycle,bike
How this was run
An AI agent on Claude Sonnet 5.5 was given a folder with the files below and a three-step flow, and nothing else. It had no web access and never saw the check. The check was written before the run and works the answer out again from the input files. Then Claude Opus 5.5 reviewed the result against the inputs. The input files are sample data written by Atris, with the problems a real week has planted in them.
Run 2 of 2 on 1 December 2026. The agent took 53 seconds. Run 1 did not pass the check. Each run starts clean. Between runs the written flow was made clearer, or a check was corrected or made stricter. Nobody edits the output.
What the second review verified
- Word counts by spaces: line 18 has 53 words and line 62 has 40, so both break R7. Line 60 has 28 words and is correctly not listed. The R7 fixes split into sentences of 12/15/24 and 6/24/10 words, all 30 or fewer.
- Every 'found' text appears on the line it cites. Nothing is listed from the quote lines 34, 36 and 70, even though they contain 'Amazing', 'cheap', '100%', 'bicycle' and 'Saltmarsh flex'.
- Went through all 74 lines rule by rule and found no missed breaks. The headings on lines 7, 14, 22, 40 and 52 are in sentence case. £32, £12.50 and £25 on lines 24, 30 and 64 follow R9. The dates on lines 44, 58 and 64 follow R8.
- summary.md counts are R1 2, R2 3, R3 2, R4 2, R5 5, R6 2, R7 2, R8 3, R9 2. They add up to 23, which matches the 23 rows in breaks.csv.
What this run does not show
- The first run failed because one suggested fix still broke the rule it fixed. It passed on run 2 after the flow told the worker to test each fix.
- The check finds breaks with its own code for the nine rules. It was written by the same hand that planted the 23 breaks in the sample copy.
- A fix is tested only against the rule it fixes. Whether it reads well is left to the second review.
Would the check catch a wrong answer?
A check that cannot fail proves nothing. After the run we took a copy of the output, broke it one small way at a time and ran the check again. It caught 4 of 4.
Open every file
flow.md · the three steps the agent followed
# Check copy against the style guide function: marketing for: the editor who signs off copy before it is published goal: Every place the copy breaks a written style rule is listed with its line, the rule and a fix, and nothing is listed that is not a break. ## 1. Read the guide and the copy Read input/style_guide.md and input/copy.md. Each numbered rule in the guide (R1, R2 and so on) is a test to apply to every line of the copy. Note where the guide says its rules do not apply. Line numbers count from 1 at the top of copy.md and blank lines count. ## 2. Find every break Go through the copy one rule at a time, line by line. A break is one place where one rule is broken. Two breaks of the same rule on one line are two breaks. One line can break several rules. Apply each rule exactly as it is written: do not list anything the guide does not forbid and do not list anything in a place the guide protects. ## 3. Write the list Write output/breaks.csv with columns line,rule,found,fix. One row per break, in line order. rule is the rule number, such as R4. found is the exact text copied from that line that breaks the rule: the word or phrase, the whole heading without its # marks, or the whole sentence when the sentence is the problem. fix is found rewritten so that it follows the guide. fix is never empty: when the fix is to drop a word, copy a neighbouring word into found too. Test each fix against the rule it fixes before you save it, counting words where the rule counts words. A fix that still breaks its rule is not a fix. Write output/summary.md with one line per rule in the form `R4: 2`, showing 0 for a rule with no breaks, then a last line in the form `Total: 9`. ## Done looks like - Every break in the copy has a row and every row is a real break. - Each found text can be seen on the line it cites. - The counts in summary.md equal the rows in breaks.csv.
input/copy.md · 74 lines, 3 KB
# The Bike Subscription That Fixes Itself Saltmarsh Flex is a monthly bike subscription for people who ride to work in Bristol and Bath. You pick a bike and we deliver it within three working days. If anything goes wrong we fix it or swap it. ## Why riders choose us - No repair bills. Servicing, punctures and worn parts are all included. - A swap within 24 hours if your bike is stolen or damaged. - Pause or cancel in any month with no fee! - More than 4,000 users in two cities already ride with SaltMarsh Flex. ## How Saltmarsh Flex works Choose a city bike, a folding bicycle or an electric bike and tell us your height. We build it, check it twice and bring it to your door, and because every Saltmarsh Flex bike is tracked and insured from the moment it leaves our workshop you will never pay for a theft that was not your fault, which is something no bike shop in either city will promise you. Sign in with your e-mail address to book a service, report a problem or pause your plan. ## Prices in Bristol and Bath The city bike costs £25.00 a month and the folding bike costs £32 a month. The electric bike costs 59 pounds a month, which is very good value next to a bus pass. Students get 20% off every plan and riders who pay yearly save a further 10%. A helmet and lock set is £12.50 extra, one time. ## What Our Riders Say > "Amazing service! My bicycle was swapped the same day, 100% recommend." Priya, Bath > "I was a Saltmarsh flex sceptic. Two years on I have not paid a single repair bill." Tomasz, Bristol Nine in ten riders stay with us for more than a year. ## Spring offer Join before March 31, 2027 and your first month is free. The offer opens on 1 March 2027 and covers every bike we stock. Deliveries booked after the 28th March 2027 may take up to five working days because of the bank holiday. It is simply the easiest way to own a bike without owning the problems. --- # Email: your Saltmarsh Flex bike is on its way Subject: Your bike arrives on 14/02/2027 Hi Dana, Good news. Your Saltmarsh-Flex city bike is built, checked and booked for delivery on 14 February 2027. Our driver will message you an hour before arrival, so you do not need to wait in all day or take time away from work to be there. Please have your e-mail confirmation ready, as the driver will ask for the six letter code inside it before handing over the bike, the lock, the lights and the printed guide that explains how to book your first free service. Your first payment of £25 was taken today. The next one is due on 14 March 2027. If the bike does not fit, tell us within 14 days and we will swap it, guaranteed. Every user gets a free first service after 90 days. > "The cheap option turned out to be the best one." Hannah, Bristol Ride safe! The Saltmarsh Flex team
input/style_guide.md · 39 lines, 2 KB
# Saltmarsh Bikes style guide for web and email copy Version 4, agreed January 2027. Every rule has a number so an editor can cite it. ## R1 Product name Write the product name as Saltmarsh Flex, with one space and these capitals, every time. Any other way of writing the two words together is a break: a capital M, a small f, a hyphen or no space. ## R2 Words we do not use Do not use these words, in any capitals: amazing, cheap, guaranteed, hassle-free, luxurious, simply, state-of-the-art, very. Only these exact words count. ## R3 Exclamation marks None. Not in headings, not in lists, not in emails. ## R4 Percent Write the word percent. Never use the % sign. ## R5 Preferred words | Write | Not | | --- | --- | | email | e-mail | | rider, riders | user, users | | bike, bikes | bicycle, bicycles | ## R6 Headings A heading is a line that starts with #. Headings are in sentence case: a capital on the first word only. These names keep their capitals anywhere: Saltmarsh, Flex, Bristol, Bath. ## R7 Sentence length No sentence is longer than 30 words. Count words by the spaces between them. ## R8 Dates Day, then the month in full, then the year: 3 March 2027. No ordinals (3rd March 2027), no month first (March 3, 2027) and no all-number dates (03/03/2027). ## R9 Prices The pound sign, then the number: £25. Show pence only when there are some: £12.50 is right and £25.00 is a break. Never write pounds or GBP after a number. ## Where the rules do not apply A customer quote is a line that starts with >. Print it as the customer wrote it. Never list a break in a customer quote.
output/breaks.csv · written by the agent, 24 lines
line,rule,found,fix 1,R6,The Bike Subscription That Fixes Itself,The bike subscription that fixes itself 11,R3,fee!,fee. 12,R5,users,riders 12,R1,SaltMarsh Flex,Saltmarsh Flex 16,R5,bicycle,bike 18,R7,"We build it, check it twice and bring it to your door, and because every Saltmarsh Flex bike is tracked and insured from the moment it leaves our workshop you will never pay for a theft that was not your fault, which is something no bike shop in either city will promise you.","We build it, check it twice and bring it to your door. Every Saltmarsh Flex bike is tracked and insured from the moment it leaves our workshop. You will never pay for a theft that was not your fault, which is something no bike shop in either city will promise you." 20,R5,e-mail,email 24,R9,£25.00,£25 26,R9,59 pounds,£59 26,R2,very good,good 28,R4,20%,20 percent 28,R4,10%,10 percent 32,R6,What Our Riders Say,What our riders say 42,R8,"March 31, 2027",31 March 2027 46,R8,28th March 2027,28 March 2027 48,R2,simply the,the 54,R8,14/02/2027,14 February 2027 58,R1,Saltmarsh-Flex,Saltmarsh Flex 62,R5,e-mail,email 62,R7,"Please have your e-mail confirmation ready, as the driver will ask for the six letter code inside it before handing over the bike, the lock, the lights and the printed guide that explains how to book your first free service.","Please have your email confirmation ready. The driver will ask for the six letter code inside it before handing over the bike, the lock, the lights and the printed guide. The guide explains how to book your first free service." 66,R2,guaranteed,certain 68,R5,user,rider 72,R3,safe!,safe.
output/summary.md · written by the agent, 10 lines
R1: 2 R2: 3 R3: 2 R4: 2 R5: 5 R6: 2 R7: 2 R8: 3 R9: 2 Total: 23
check.py · the check, written before the run
"""Applies every rule in the style guide to the copy again and compares the breaks with the ones the agent listed."""
import csv, re, sys
from collections import Counter
from pathlib import Path
root = Path(sys.argv[1]); ok = True
def say(passed, text):
global ok; ok = ok and passed; print(("PASS " if passed else "FAIL ") + text)
guide = (root/"input/style_guide.md").read_text(encoding="utf-8")
lines = (root/"input/copy.md").read_text(encoding="utf-8").split("\n")
def section(rule): return re.search(r"## %s[^\n]*\n(.*?)(?=\n## |\Z)" % rule, guide, re.S).group(1)
product = re.search(r"product name as ([A-Z]\w+ [A-Z]\w+)", section("R1")).group(1)
banned = [w.strip() for w in re.search(r"capitals:\s*(.+?)\.\n", section("R2")).group(1).split(",")]
avoid = []
for row in re.findall(r"^\|([^|\n]+)\|([^|\n]+)\|$", section("R5"), re.M)[2:]:
avoid += [w.strip() for w in row[1].split(",")]
names = [w.strip() for w in re.search(r"anywhere:\s*(.+?)\.", section("R6")).group(1).split(",")]
limit = int(re.search(r"longer than (\d+) words", section("R7")).group(1))
months = "January|February|March|April|May|June|July|August|September|October|November|December"
def word(w): return r"(?<![\w-])%s(?![\w-])" % re.escape(w)
def sentences(text): return [s for s in re.split(r"(?<=[.?!])\s+", re.sub(r"^\s*([-*>]|#+)\s*", "", text)) if s.strip()]
def breaks(rule, text, heading=False):
"""How many times the text breaks one rule."""
if rule == "R1": return sum(1 for m in re.finditer(product.replace(" ", r"[\s-]*"), text, re.I) if m.group(0) != product)
if rule == "R2": return sum(len(re.findall(word(w), text, re.I)) for w in banned)
if rule == "R3": return text.count("!")
if rule == "R4": return text.count("%")
if rule == "R5": return sum(len(re.findall(word(w), text, re.I)) for w in avoid)
if rule == "R6":
if not heading: return 0
rest = [w.strip(".,:;?!\"'()") for w in text.lstrip("# ").split()[1:]]
return 1 if any(w[:1].isupper() and w not in names for w in rest) else 0
if rule == "R7": return sum(1 for s in sentences(text) if len(s.split()) > limit)
if rule == "R8": return len(re.findall(r"\b(?:%s)\s+\d{1,2}(?:st|nd|rd|th)?\b|\b\d{1,2}(?:st|nd|rd|th)\s+(?:of\s+)?(?:%s)\b|\b\d{1,2}/\d{1,2}/\d{2,4}\b" % (months, months), text))
if rule == "R9": return len(re.findall(r"£\d+\.00\b|\b\d+(?:\.\d+)?\s*pounds\b|\bGBP\b", text))
return 0
rules = ["R%d" % i for i in range(1, 10)]
want, quotes = Counter(), []
for no, text in enumerate(lines, 1):
if text.startswith(">"): quotes.append(no); continue
for r in rules:
n = breaks(r, text, text.startswith("#"))
if n: want[(no, r)] = n
total = sum(want.values())
bpath, spath = root/"output/breaks.csv", root/"output/summary.md"
if not bpath.exists() or not spath.exists():
say(False, "breaks.csv and summary.md were not both written"); sys.exit(1)
rows = [r for r in csv.DictReader(bpath.open(encoding="utf-8")) if any((v or "").strip() for v in r.values())]
def key(r):
no = re.sub(r"\D", "", r.get("line") or ""); rule = re.search(r"R\d", (r.get("rule") or "").upper())
return (int(no) if no else 0, rule.group(0) if rule else "")
got = Counter(key(r) for r in rows)
hit = sum(min(n, got.get(k, 0)) for k, n in want.items())
say(hit == total, f"{hit} of {total} breaks found by applying the guide to the copy again are listed in breaks.csv")
false = sum(max(0, n - want.get(k, 0)) for k, n in got.items())
say(rows and false == 0, f"{false} of {len(rows)} listed rows are false alarms")
on_quotes = sum(n for (no, _), n in got.items() if no in quotes)
say(rows and on_quotes == 0, f"{on_quotes} breaks are listed on the {len(quotes)} customer quote lines the guide protects")
def flat(t): return " ".join((t or "").replace("’", "'").split())
there = sum(1 for r in rows if flat(r.get("found")) and 1 <= key(r)[0] <= len(lines) and flat(r.get("found")).strip("#* ") in flat(lines[key(r)[0] - 1]))
say(rows and there == len(rows), f"{there} of {len(rows)} found texts appear word for word on the line they cite")
fixed = sum(1 for r in rows if flat(r.get("fix")) and key(r)[1] in rules and breaks(key(r)[1], flat(r.get("fix")), key(r)[1] == "R6") == 0)
say(rows and fixed == len(rows), f"{fixed} of {len(rows)} suggested fixes pass the rule they fix")
summary = spath.read_text(encoding="utf-8")
counts = {m.group(1): int(m.group(2)) for m in re.finditer(r"\b(R\d)\b[^\n\d]*(\d+)", summary)}
per_rule = sum(1 for r in rules if counts.get(r) == sum(n for (_, rr), n in want.items() if rr == r))
tot = re.search(r"(?im)^\W*total\b[^\n\d]*(\d+)", summary)
say(per_rule == len(rules) and bool(tot) and int(tot.group(1)) == total,
f"summary.md gives the right count for {per_rule} of {len(rules)} rules and the total of {total}")
sys.exit(0 if ok else 1)
copy.md: sample data written by Atris. Fingerprint ff9eeeb2e3e7.
style_guide.md: sample data written by Atris. Fingerprint fa66cb903626.
breaks.csv: written by the agent. Fingerprint 227ffa7c8050.
summary.md: written by the agent. Fingerprint ea65b85a8c62.