GrepBoard/Manuals
605 manuals ·

Summarize a long email thread: decided, open, to-do

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

Back from leave to a 20-mail thread with a reversed decision? Make the model cite a mail number per item, then check the numbers and new figures with a script.

"Summarize this email thread. Tell me what is decided and what is still open." Asked that way three times, the model added "about $238" to the lunch line all three times. That is 17 people times $14, multiplied by the model, and it appears nowhere in the thread. Sorting decided from open was right in all three runs. What went wrong was the arithmetic nobody asked for.

Below: make the model cite a mail number on every item, then let a script check that the numbers point at real mails and that no new figure crept in.

[1] Save the thread as a file. It is a made-up 20-mail thread about a team offsite, with the quoted earlier text removed. Only the nine mails where decisions move are shown here; the numbers are the original ones. Three decisions get reversed: the venue (mail 13 takes Studio 3B away and the Annex Hall replaces it), the budget cap (mail 16 changes $1,000 to $850) and lunch (the $18 caterer in mail 11 is put on hold in mail 16 and lunchboxes replace it by mail 19). The date in mail 5 starts out conditional on the director's calendar and is settled in mail 7.

thread.en.txt
[Mail 3] Oct 6 (Tue) Finance CThe budget cap is $50 per person, so $1,000 in total for 20 people. That cap is already approved. [Mail 5] Oct 7 (Wed) Organizer AGoing with Dec 4. The director's calendar is not confirmed yet, though. I will send the final notice once it is. [Mail 7] Oct 8 (Thu) Team lead BChecked with the director: Dec 4 works. The date is Dec 4. [Mail 11] Oct 13 (Tue) Organizer AWe will go with the $18 caterer. C, please check the budget before we sign anything. [Mail 13] Oct 15 (Thu) Facilities DSorry, another team has just been given Studio 3B on Dec 4, so we cannot use it. An alternative is the Annex Hall. No booking fee, seats 20. [Mail 14] Oct 15 (Thu) Team lead BIf 3B is gone, let's use the Annex Hall. Please book it. [Mail 16] Oct 19 (Mon) Finance CSince eating in the Annex is unclear, please put the catering contract on hold. Also, with 17 attending, the total cap becomes $850. The $50 per person stays. [Mail 18] Oct 21 (Wed) Organizer ALunchboxes avoid the walk, so I would lean that way. $14 lunchboxes, then? B, please confirm. [Mail 19] Oct 22 (Thu) Team lead BGo ahead with the lunchboxes. We do need to check for allergies first.

[2] Build the prompt. Put the long document first, wrapped in a <thread> tag, and the instructions after it. That is the order Anthropic's long-context guidance recommends. Four rules: conditional proposals are not decisions, a reversed decision keeps only its final value, no item without a mail number, no numbers that are not in the thread.

tail.en.txt
<instructions>The <thread> above is an email thread, and each mail has a number. Read it and sort it into three sections.Sections: Decided / Open / To-doRules:- Put something under Decided only if the person who decides said "we will go with it" or "let's use it" and no later mail reverses it. Proposals, questions, "how about" and anything conditional ("once it is confirmed") are not decided.- If a decision changed along the way, put only the final value under Decided and add the earlier value as one line under a last section called Changes.- Open means unanswered or still being checked.- Under To-do, give the owner and deadline if a mail states them; otherwise write "owner not set" or "deadline not set".- End every item with the supporting mail number(s) in the form [3] or [3,7]. Do not write an item without a number.- Do not invent numbers, dates or names that are not in the thread. Do not include values you calculated.- Use only section titles and bullet points. Add no other commentary.</instructions>

[3] Join the thread and the instructions, and run it three times.

console
$ { echo "<thread>"; cat thread.en.txt; echo "</thread>"; cat tail.en.txt; } > prompt.en.txt$ claude -p --model claude-sonnet-5-5 --max-turns 1 --tools "" --setting-sources "" --strict-mcp-config < prompt.en.txt > out.en.1.txt

The first result:

output
**Decided**- Date: Dec 4 (director confirmed) [5,7]- Venue: Annex Hall, booked for Dec 4 [14,15]- Final headcount: 17 [12]- Budget cap: $50 per person, total cap $850 [3,16]- Lunch: $14 per person lunchboxes, delivered [18,19] **Open**- Whether food is allowed inside the Annex Hall (building office has not answered yet) [15,16]- Catering contract is on hold until the food question is settled [16]- Allergy and dietary survey results [19,20] **To-do**- HR E: collect allergy and dietary survey replies, due Oct 28 (Wed) [20]- Facilities D: pass on the building office's answer about food in the Annex, deadline not set [15]- Finance C: check the budget before anything is signed, deadline not set [11]- Organizer A: send the final notice now that the director has confirmed, deadline not set [5,7] **Changes**- Planned for 20 people, now final headcount 17 [1,12]- Total budget cap was $1,000, now $850 [3,16]- Venue was Studio 3B (tentative hold), now Annex Hall [8,13,15]- Lunch was the $18 caterer, now $14 lunchboxes [11,16,19]

Every reversed decision shows its final value under Decided, and the old value appears only under Changes. The date cites mail 7 next to mail 5. The food question from mail 15 sits under Open, not Decided.

[4] Write the checking script. It looks at five things: every item has a mail number and the mail exists; each Decided item cites at least one mail that has a confirming phrase ("Going with", "Go ahead", "cap is") and no conditional phrase ("How about", "not confirmed"); a reversed old value is not left under Decided with only earlier mails as proof; no number or date appears that is missing from the thread; none of the three sections is empty. You pass the old values yourself as value=reversing mail number.

check.en.py
#!/usr/bin/env python3"""usage: check.py thread.txt summary.txt [old-value=N ...]   (old-value=N: reversed in mail N)"""import re, systhread, out, *stale = sys.argv[1:]stale = [(t.rsplit("=", 1)[0], int(t.rsplit("=", 1)[1])) for t in stale]CONFIRM = r"Going with|will go with|let.s use|Go ahead|is booked|cap is|cap becomes|Final headcount|The date is|works"COND = r"not confirmed|once it is|How about|lean"txt = open(thread, encoding="utf-8").read()p = re.split(r"^\[Mail (\d+)\].*$", txt, flags=re.M)mails = {int(p[i]): p[i + 1] for i in range(1, len(p), 2)}MON = {m: i for i, m in enumerate("jan feb mar apr may jun jul aug sep oct nov dec".split(), 1)}WORD = {w: i for i, w in enumerate("two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty".split(), 2)}TENS = {"twenty": 20, "thirty": 30, "forty": 40} def tokens(s):    s = re.sub(r"\[Mail \d+\]|[Mm]ail\s*\d+|\[\d+(?:,\s*\d+)*\]", "", s)    s = re.sub(r"\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\.?\s+(\d{1,2})\b",               lambda m: f"{MON[m.group(1).lower()]}/{m.group(2)}", s, flags=re.I)    out = set()    two = r"\b(twenty|thirty|forty)[- ](one|two|three|four|five|six|seven|eight|nine)\b"      # twenty-two    for m in re.finditer(two, s, re.I):        out.add(str(TENS[m.group(1).lower()] + ({"one": 1} | WORD)[m.group(2).lower()]))    s = re.sub(two, " ", s, flags=re.I)    for w in re.findall(r"[A-Za-z]+", s):        w = w.lower()        if w in WORD: out.add(str(WORD[w]))        elif w in TENS: out.add(str(TENS[w]))    for t in re.findall(r"\d+/\d+|\d{1,3}(?:,\d{3})+|\d+(?:\.\d+)?", s):        out.add("/".join(str(int(x)) for x in t.split("/")) if "/" in t else t.replace(",", ""))    return out                     # "one" is skipped on purpose: too often a pronoun SEC = [("dec", "decided"), ("open", "open"), ("todo", "to-do"), ("hist", "changes")]items, cur = {k: [] for k, _ in SEC}, Nonefor line in open(out, encoding="utf-8"):    s = line.strip()    if re.match(r"[-*] ", s):        if cur: items[cur].append(s)    else:        for k, w in SEC:            if w in s.lower() and len(s) < 24: cur = k fails = [f"section '{k}' is empty" for k in ("dec", "open", "todo") if not items[k]]for k, its in items.items():    for it in its:        refs = [int(x) for r in re.findall(r"\[(\d+(?:,\s*\d+)*)\]", it) for x in r.split(",")]        if not refs or any(n not in mails for n in refs):            fails.append(f"no mail number or unknown number {refs}: {it[:40]}"); continue        if k != "dec": continue        if not any(re.search(CONFIRM, mails[n]) and not re.search(COND, mails[n]) for n in refs):            fails.append(f"Decided, but no cited mail confirms it {refs}: {it[:40]}")        for old, rev in stale:            if old in it and max(refs) < rev:                fails.append(f"Decided with old value '{old}' (reversed in mail {rev}), cites up to {max(refs)}: {it[:40]}")body = "\n".join(i for its in items.values() for i in its)new = sorted(tokens(body) - tokens(txt))if new: fails.append(f"numbers/dates not in the thread: {new}")print({k: len(v) for k, v in items.items()})print("\n".join("FAIL " + f for f in fails) or "OK")sys.exit(1 if fails else 0)

[5] Run it on the three results.

console
$ python -I -X utf8 check.en.py thread.en.txt out.en.1.txt "Studio 3B=13" "caterer=16" '$1,000=16' '$18=16'{'dec': 5, 'open': 3, 'todo': 4, 'hist': 4}OK

out.en.2.txt and out.en.3.txt also printed OK. Counting new figures by how the model was asked (three runs each):

How it was askedRuns with a figure not in the threadFigure
One sentence (naive)3 of 3$238
Three sections, no rules (mid)2 of 3$238
The prompt above0 of 3none

The one-sentence and three-section prompts do not ask for mail numbers, so only the figure check applies to them.

[6] Test whether the script catches bad input. I changed one line of out.en.1.txt by hand in nine ways (old value back under Decided, a single conditional mail as proof, unknown mail number, new figure and so on) and seven were caught. One example: the date cites only the conditional mail 5. This file is not model output.

console
$ python -I -X utf8 check.en.py thread.en.txt bad/e6.txt "Studio 3B=13" "caterer=16" '$1,000=16' '$18=16'{'dec': 5, 'open': 3, 'todo': 4, 'hist': 4}FAIL Decided, but no cited mail confirms it [5]: - Date: Dec 4 [5]

The two misses were Dec 11 (director confirmed) [5,7] and a headcount of eighteen. Dec 11 is a real date in the thread and the cited mails do contain confirming phrases. "Eighteen" collides with the $18 already in the thread. The script knows whether a value exists somewhere in the thread, not whether it belongs to that line.

[7] The places to read by hand are each Decided line and the To-do section. For Decided lines, open the cited mail and see that the value is really in it. In To-do, all three runs listed Finance C: check the budget before anything is signed [11]. That request was about the $18 catering contract, which mail 16 put on hold, so by then it had nothing to attach to. Two of three runs also added Order the lunchboxes with no owner, citing mail 19, although mail 19 only approves lunchboxes and says nothing about who orders them. All of these carry a mail number, so the script lets them through.

#email-thread#claude#prompt#summary