Atris

Build the weekly numbers report.
Done by an agent. Checked twice.

Weekly orders, sales, refunds and change from the week before, rebuilt from the raw export with every dropped row named.

Have Atris do this for you›

1

Real files in

  • transactions.csv
    Seventy seven rows from a shop's sales export covering four weeks, with refunds, cancelled orders, repeated rows and two date formats. 78 lines, 4 KB.

Sample data written by Atris. Not a real company.

2

Three steps

  1. 1.Read and clean the export
  2. 2.Add up each week
  3. 3.Write the report

Claude Sonnet 5.5, 25 seconds. No web. It never saw the check.

3

Checked twice

  • ✓Passed: 4 of 4 weeks appear in weekly.csv, each named by its Monday and oldest first
  • ✓Passed: 20 of 20 weekly figures (orders, gross sales, refunds, net sales, average order) equal the figures rebuilt from the export
  • ✓Passed: 3 of 3 week over week changes are right and the first week is left blank
  • ✓Passed: 12 of 12 channel totals by week equal the totals rebuilt from the export
  • ✓Passed: report.md opens with the latest week 2026-10-26, net sales 1,224.00 and the change +14.0 percent
  • ✓Passed: 3 of 3 rows dropped as a repeat or for a missing amount are named in report.md and 7 of 7 ids written there are rows that were left out
  • ✓Passed: 3 of 3 other statuses carry the right count of rows left out in report.md (cancelled 2, pending 1, test 1)
  • ✓Passed: 17 of 17 figures and 4 of 4 dates written in report.md are found in the tables rebuilt from the export

Second review by Claude Opus 5.5: pass.

Then we broke a copy of the output 9 ways on purpose. The check caught 9.

What it wrote. Lines 3 to 14 of report.md, copied from the file.
Latest week: 2026-10-26
Net sales: 1224.00
Change from the week before: 14.0%

Net sales rose from 1073.50 to 1224.00 as orders went from 14 to 18, even though refunds were 113.00 against 0.00 the week before. Phone grew most, from 113.00 to 339.00, while web fell from 559.25 to 514.00 and store slipped from 401.25 to 371.00.

## Rows left out

- Duplicate transaction_id (first row kept, repeat dropped): T-4125, T-4154.
- Paid row with no amount: T-4167 (its sale is not in any total).
- Other statuses: cancelled 2 (T-4120, T-4157), pending 1 (T-4145), test 1 (T-4162).
- Caution: the export's last date is 2026-10-31, so the week of 2026-10-26 may not include Sunday 2026-11-01, and refunds count in the week they were issued, not the week of the sale.

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 made stricter after it. It 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 25 seconds. Run 1 passed both checks and the job was run again later. 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

  • Rebuilt all 4 weekly rows from input/transactions.csv: every figure matches weekly.csv, e.g. 2026-10-26 has 18 orders, gross 1337.00, refunds 113.00 (T-4301 49.00 + T-4302 64.00), net 1224.00, average 74.28 and +14.0% on 1073.50
  • Rebuilt all 12 week/channel net_sales rows: every one matches by_channel.csv, e.g. 2026-10-26 phone 339.00, store 371.00 (with ' store' T-4170 included), web 514.00
  • Rows left out are all named: duplicates T-4125 and T-4154, no-amount T-4167, cancelled 2 (T-4120, T-4157), pending 1 (T-4145), test 1 (T-4162). Nothing was missed or added
  • The top three lines of report.md (2026-10-26, 1224.00, 14.0%) equal the last row of weekly.csv. The paragraph has 2 sentences and every number in it (1073.50, 14, 18, 113.00, 0.00, 113.00, 339.00, 559.25, 514.00, 401.25, 371.00) appears in the CSVs

What this run does not show

  • The transactions were written for this run with the repeats, the blank amount and the odd statuses placed on purpose.
  • The check shows every figure in the paragraph exists in the rebuilt tables. Whether it is tied to the right week or channel is read only by the second review.
  • This is the second run. The first passed but its commentary ran longer than the flow allows, so the flow was made clearer and run again.

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 9 of 9. The check was made stricter after the first try at this, and the same untouched output was graded again.

Open every file

flow.md · the three steps the agent followed
# Build the weekly numbers report

function: data
for: the person who sends the weekly sales numbers to the owner
goal: Every week in the export has its orders, sales, refunds and change from the week before with every row left out named.

## 1. Read and clean the export
Read input/transactions.csv. Apply these rules before any adding up:
- Dates come written two ways, 2026-10-07 and 10/07/2026 (month first). Read both.
- When a transaction_id appears more than once, keep the first row and drop the rest.
- Only rows with status `paid` or `refunded` count. Every other status is left out.
- A paid or refunded row with no amount cannot be counted. Leave it out.
- Channel names differ in capital letters and stray spaces. Remove the spaces and use lowercase.

## 2. Add up each week
A week runs Monday to Sunday and is named by the date of its Monday. A refund belongs to the week of its
own date, not the week of the sale. For each week work out:
- orders: the number of paid rows.
- gross_sales: the sum of the paid amounts.
- refunds: the sum of the refunded amounts, written as a positive number.
- net_sales: gross_sales minus refunds.
- average_order: gross_sales divided by orders.
- net_change_pct: net_sales against the week before, as (this week minus last week) divided by last
  week, times 100. Blank for the first week.
Also work out net_sales for each channel in each week (paid minus refunded for that channel).

## 3. Write the report
Write output/weekly.csv, one row per week, oldest first, with columns
week_start,orders,gross_sales,refunds,net_sales,average_order,net_change_pct. Dates as 2026-10-05,
money with two decimals, net_change_pct with one decimal.
Write output/by_channel.csv with columns week_start,channel,net_sales, one row for each week and channel.
Write output/report.md for the owner. Start with these three lines for the latest week in the export:
`Latest week:` with its Monday, `Net sales:` and `Change from the week before:` with the percent. Then
one paragraph on what moved. It has two or three sentences, never more than three. Every number
in it comes from weekly.csv or by_channel.csv. Write no other commentary. End with a section
"Rows left out" that names every dropped duplicate transaction_id, every row with no amount and the
count of rows left out for each other status. A caution the owner needs to read the numbers right
belongs in that section, in one sentence.

## Done looks like
- Every week in the export has one row in weekly.csv and every figure can be rebuilt from the export.
- The three lines at the top of report.md equal the last row of weekly.csv.
- Every row that was left out is named or counted in report.md.
input/transactions.csv · 78 lines, 4 KB
transaction_id,date,channel,product,amount,status,refund_of
T-4101,2026-10-06,store,Refill pack,18.50,paid,
T-4102,2026-10-06,Web,Travel case,81.75,paid,
T-4103,2026-10-06,store,Refill pack,18.50,paid,
T-4104,2026-10-06,phone,Gift box,64.00,paid,
T-4105,10/07/2026,store,Starter kit,49.00,paid,
T-4106,2026-10-07,store,Travel case,27.25,paid,
T-4107,2026-10-07,store,Travel case,27.25,paid,
T-4108,2026-10-08,web,Starter kit,98.00,paid,
T-4109,2026-10-08,web,Travel case,27.25,paid,
T-4110,2026-10-08,store,Travel case,27.25,paid,
T-4111,10/08/2026,Phone,Gift box,192.00,paid,
T-4112,2026-10-09,web,Refill pack,55.50,paid,
T-4113,2026-10-09,phone,Travel case,27.25,paid,
T-4114,2026-10-09,web,Refill pack,18.50,paid,
T-4115,2026-10-10,store,Pro kit,129.00,paid,
T-4116,2026-10-11,web,Pro kit,129.00,paid,
T-4117,10/11/2026,web,Refill pack,37.00,paid,
T-4118,2026-10-12,web,Gift box,64.00,paid,
T-4119,2026-10-12,web,Gift box,64.00,paid,
T-4120,2026-10-12,web,Travel case,54.50,cancelled,
T-4121,2026-10-12,store,Pro kit,129.00,paid,
T-4122,2026-10-13,phone,Pro kit,129.00,paid,
T-4123,10/13/2026,web,Gift box,64.00,paid,
T-4124,2026-10-13,web,Starter kit,49.00,paid,
T-4125,2026-10-14,web,Starter kit,49.00,paid,
T-4125,2026-10-14,web,Starter kit,49.00,paid,
T-4300,2026-10-14,phone,Gift box,-64.00,refunded,T-4104
T-4126,2026-10-15,web,Travel case,54.50,paid,
T-4127,10/15/2026,web,Gift box,64.00,paid,
T-4128,2026-10-15,store,Starter kit,49.00,paid,
T-4129,2026-10-16,WEB ,Refill pack,37.00,paid,
T-4130,2026-10-16,phone,Refill pack,55.50,paid,
T-4131,2026-10-16,store,Starter kit,49.00,paid,
T-4132,2026-10-16,web,Refill pack,37.00,paid,
T-4133,10/16/2026,web,Pro kit,387.00,paid,
T-4134,2026-10-17,store,Starter kit,49.00,paid,
T-4135,2026-10-17,store,Travel case,54.50,paid,
T-4136,2026-10-18,phone,Gift box,128.00,paid,
T-4137,2026-10-19,store,Pro kit,129.00,paid,
T-4138,2026-10-20,web,Starter kit,49.00,paid,
T-4139,10/20/2026,Store,Starter kit,49.00,paid,
T-4140,2026-10-20,web,Starter kit,49.00,paid,
T-4141,2026-10-21,web,Gift box,64.00,paid,
T-4142,2026-10-22,phone,Starter kit,49.00,paid,
T-4143,2026-10-22,store,Starter kit,49.00,paid,
T-4144,2026-10-22,store,Starter kit,147.00,paid,
T-4145,10/22/2026,web,Gift box,64.00,pending,
T-4146,2026-10-23,store,Travel case,27.25,paid,
T-4147,2026-10-23,phone,Gift box,64.00,paid,
T-4148,2026-10-24,web,Gift box,192.00,paid,
T-4149,2026-10-24,web,Starter kit,49.00,paid,
T-4150,2026-10-25,web,Travel case,27.25,paid,
T-4151,10/25/2026,web,Pro kit,129.00,paid,
T-4152,2026-10-26,web,Gift box,192.00,paid,
T-4153,2026-10-26,phone,Gift box,192.00,paid,
T-4154,2026-10-26,web,Starter kit,98.00,paid,
T-4154,2026-10-26,web,Starter kit,98.00,paid,
T-4155,2026-10-26,phone,Starter kit,98.00,paid,
T-4156,10/26/2026,store,Starter kit,49.00,paid,
T-4157,2026-10-26,store,Refill pack,18.50,cancelled,
T-4158,2026-10-27,web,Gift box,128.00,paid,
T-4159,2026-10-27,store,Starter kit,98.00,paid,
T-4160,2026-10-27,web,Refill pack,37.00,paid,
T-4301,2026-10-27,web,Starter kit,-49.00,refunded,T-4140
T-4161,10/28/2026,phone,Starter kit,49.00,paid,
T-4162,2026-10-28,store,Starter kit,147.00,test,
T-4163,2026-10-28,web,Refill pack,18.50,paid,
T-4164,2026-10-29,web,Refill pack,18.50,paid,
T-4165,2026-10-30,web,Refill pack,37.00,paid,
T-4166,2026-10-30,store,Refill pack,37.00,paid,
T-4167,10/30/2026,store,Pro kit,,paid,
T-4168,2026-10-30,store,Refill pack,18.50,paid,
T-4169,2026-10-30,store,Gift box,64.00,paid,
T-4170,2026-10-30, store,Refill pack,55.50,paid,
T-4302,2026-10-30,web,Gift box,-64.00,refunded,T-4141
T-4171,2026-10-31,store,Starter kit,49.00,paid,
T-4172,10/31/2026,web,Starter kit,98.00,paid,
output/by_channel.csv · written by the agent, 13 lines
week_start,channel,net_sales
2026-10-05,phone,283.25
2026-10-05,store,296.75
2026-10-05,web,447.00
2026-10-12,phone,248.50
2026-10-12,store,330.50
2026-10-12,web,869.50
2026-10-19,phone,113.00
2026-10-19,store,401.25
2026-10-19,web,559.25
2026-10-26,phone,339.00
2026-10-26,store,371.00
2026-10-26,web,514.00
output/report.md · written by the agent, 14 lines
# Weekly numbers report

Latest week: 2026-10-26
Net sales: 1224.00
Change from the week before: 14.0%

Net sales rose from 1073.50 to 1224.00 as orders went from 14 to 18, even though refunds were 113.00 against 0.00 the week before. Phone grew most, from 113.00 to 339.00, while web fell from 559.25 to 514.00 and store slipped from 401.25 to 371.00.

## Rows left out

- Duplicate transaction_id (first row kept, repeat dropped): T-4125, T-4154.
- Paid row with no amount: T-4167 (its sale is not in any total).
- Other statuses: cancelled 2 (T-4120, T-4157), pending 1 (T-4145), test 1 (T-4162).
- Caution: the export's last date is 2026-10-31, so the week of 2026-10-26 may not include Sunday 2026-11-01, and refunds count in the week they were issued, not the week of the sale.
output/weekly.csv · written by the agent, 5 lines
week_start,orders,gross_sales,refunds,net_sales,average_order,net_change_pct
2026-10-05,17,1027.00,0.00,1027.00,60.41,
2026-10-12,18,1512.50,64.00,1448.50,84.03,41.0
2026-10-19,14,1073.50,0.00,1073.50,76.68,-25.9
2026-10-26,18,1337.00,113.00,1224.00,74.28,14.0
check.py · the check, written before the run
"""Rebuilds the weekly numbers from the transactions export and compares them with what the agent wrote."""
import csv, re, sys
from datetime import date, timedelta
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)
def day(s):
    s = s.strip()
    if "/" in s:
        m, d, y = s.split("/"); return date(int(y), int(m), int(d))
    return date.fromisoformat(s)
def num(s):
    try: return float(str(s).replace(",", "").replace("%", "").replace("$", "").strip())
    except ValueError: return None
seen, dups, blanks, weeks, chan, other, days, othered = set(), [], [], {}, {}, {}, set(), set()
for r in csv.DictReader((root/"input/transactions.csv").open()):
    tid = r["transaction_id"].strip()
    if tid in seen: dups.append(tid); continue
    seen.add(tid)
    st = r["status"].strip().lower()
    days.add(day(r["date"]).isoformat())
    if st not in ("paid", "refunded"): other[st] = other.get(st, 0) + 1; othered.add(tid); continue
    if not r["amount"].strip(): blanks.append(tid); continue
    d = day(r["date"]); wk = (d - timedelta(days=d.weekday())).isoformat()
    w = weeks.setdefault(wk, {"orders": 0, "gross_sales": 0.0, "refunds": 0.0})
    amt = abs(float(r["amount"])); ch = (wk, r["channel"].strip().lower())
    if st == "paid": w["orders"] += 1; w["gross_sales"] += amt; chan[ch] = chan.get(ch, 0) + amt
    else: w["refunds"] += amt; chan[ch] = chan.get(ch, 0) - amt
order = sorted(weeks); prev = None
for wk in order:
    w = weeks[wk]; w["net_sales"] = w["gross_sales"] - w["refunds"]; w["average_order"] = w["gross_sales"] / w["orders"]
    w["net_change_pct"] = None if prev is None else (w["net_sales"] - prev) / prev * 100
    prev = w["net_sales"]
path = root/"output/weekly.csv"
if not path.exists():
    say(False, "output/weekly.csv was not written"); sys.exit(1)
got = {r.get("week_start", "").strip(): r for r in csv.DictReader(path.open())}
say(list(got) == order, f"{len(set(got) & set(order))} of {len(order)} weeks appear in weekly.csv, each named by its Monday and oldest first")
cols = ["orders", "gross_sales", "refunds", "net_sales", "average_order"]
def near(a, b, tol): return a is not None and abs(a - b) <= tol
right = sum(1 for wk in order for c in cols if wk in got and near(num(got[wk].get(c)), weeks[wk][c], 0.006))
say(right == len(order) * len(cols), f"{right} of {len(order) * len(cols)} weekly figures (orders, gross sales, refunds, net sales, average order) equal the figures rebuilt from the export")
chg = [wk for wk in order if weeks[wk]["net_change_pct"] is not None]
cr = sum(1 for wk in chg if wk in got and near(num(got[wk].get("net_change_pct")), weeks[wk]["net_change_pct"], 0.051))
first_blank = order[0] in got and not (got[order[0]].get("net_change_pct") or "").strip()
say(cr == len(chg) and first_blank, f"{cr} of {len(chg)} week over week changes are right and the first week is left blank")
cgot = {}
if (root/"output/by_channel.csv").exists():
    for r in csv.DictReader((root/"output/by_channel.csv").open()):
        cgot[(r.get("week_start", "").strip(), r.get("channel", "").strip())] = num(r.get("net_sales"))
chr_ = sum(1 for k, v in chan.items() if near(cgot.get(k), v, 0.006))
say(chr_ == len(chan) and len(cgot) == len(chan), f"{chr_} of {len(chan)} channel totals by week equal the totals rebuilt from the export")
report = (root/"output/report.md").read_text() if (root/"output/report.md").exists() else ""
last = weeks[order[-1]]
def line(label):
    m = re.search(re.escape(label) + r"[^\n]*", report, re.I); return m.group(0) if m else ""
nums = lambda s: [abs(float(x.replace(",", ""))) for x in re.findall(r"\d[\d,]*\.?\d*", s)]
top = (order[-1] in line("Latest week:") and any(abs(x - last["net_sales"]) < 0.006 for x in nums(line("Net sales:")))
       and any(abs(x - abs(last["net_change_pct"])) < 0.051 for x in nums(line("Change from the week before:"))))
say(top, f"report.md opens with the latest week {order[-1]}, net sales {last['net_sales']:,.2f} and the change {last['net_change_pct']:+.1f} percent")
out = sorted(set(dups)) + blanks
named = sum(1 for t in out if t in report)
ids = re.findall(r"\b[A-Za-z]+-\d+\b", report)
idr = sum(1 for t in ids if t in out or t in othered)
say(named == len(out) and idr == len(ids), f"{named} of {len(out)} rows dropped as a repeat or for a missing amount are named in report.md and {idr} of {len(ids)} ids written there are rows that were left out")
# the count of rows left out for each other status, read beside the status name
plain = re.sub(r"\b[A-Za-z]+-\d+\b", " ", report)   # a transaction id is a name, not a figure
def beside(name):
    after = re.search(r"\b" + re.escape(name) + r"\b[^\d\n]{0,12}(\d+)", plain, re.I)
    before = re.search(r"(\d+)\s+" + re.escape(name) + r"\b", plain, re.I)
    return {int(m.group(1)) for m in (after, before) if m}
sc = sum(1 for name, cnt in other.items() if cnt in beside(name))
say(sc == len(other), f"{sc} of {len(other)} other statuses carry the right count of rows left out in report.md ({', '.join(f'{k} {v}' for k, v in sorted(other.items()))})")
# every other figure in the report has to be a figure of the rebuilt tables or one of the counts above
dated = re.findall(r"\d{4}-\d{2}-\d{2}", plain)
ends = {(date.fromisoformat(wk) + timedelta(days=6)).isoformat() for wk in order}
dr = sum(1 for d in dated if d in days or d in order or d in ends)
known = [w[c] for w in weeks.values() for c in cols] + [abs(w["net_change_pct"]) for w in weeks.values() if w["net_change_pct"] is not None]
known += [abs(v) for v in chan.values()]
counts = list(other.values()) + [len(set(dups)), len(blanks), len(order)]   # a count is never written with decimals
figs = re.findall(r"(?<![\w.])\d[\d,]*(?:\.\d+)?", re.sub(r"\d{4}-\d{2}-\d{2}", " ", plain))
def traced(tok):
    tok = tok.rstrip(","); places = len(tok.split(".")[1]) if "." in tok else 0
    tol = 1e-9 if places == 0 else 0.051 if places == 1 else 0.0051
    return any(abs(float(tok.replace(",", "")) - k) <= tol for k in (known if places else known + counts))
fr = sum(1 for t in figs if traced(t))
say(len(figs) > 0 and fr == len(figs) and dr == len(dated), f"{fr} of {len(figs)} figures and {dr} of {len(dated)} dates written in report.md are found in the tables rebuilt from the export")
sys.exit(0 if ok else 1)

transactions.csv: sample data written by Atris. Fingerprint 6244248db180.

by_channel.csv: written by the agent. Fingerprint 0b9c43ef7ab7.

report.md: written by the agent. Fingerprint 4fab56b12ac5.

weekly.csv: written by the agent. Fingerprint bc6a6b371f9f.


More data and analysis work, and every other desk job

For agentsGitHub
What is AtrisBlogApp StorePricingPrivacyTerms