Atris

Draft ticket replies from help articles.
Done by an agent. Checked twice.

Each ticket gets a draft reply backed by a quoted help article, or a plain note that no article covers it.

Have Atris do this for you›

1

Real files in

  • help_articles.md
    Thirteen help articles for a booking product, two of which disagree on the refund window. 104 lines, 6 KB.
  • tickets.csv
    Twenty two customer questions, six that no article answers and two that an article answers only in part. 23 lines, 3 KB.

Sample data written by Atris. Not a real company.

2

Three steps

  1. 1.Read the articles and the tickets
  2. 2.Match each question to an article
  3. 3.Write the replies and the gap list

Claude Sonnet 5.5, 1 min 8 s. No web. It never saw the check.

3

Checked twice

  • ✓Passed: 22 of 22 tickets have one drafted reply
  • ✓Passed: 22 of 22 covered marks equal a keyword match of the question against the article titles
  • ✓Passed: 16 of 16 replies cite the article that covers the question and 6 of 6 replies with no article cite nothing
  • ✓Passed: 16 of 16 quotes appear word for word in the cited article
  • ✓Passed: 22 of 22 replies use only numbers found in the cited article or the customer's message
  • ✓Passed: 8 of 8 tickets with a question no article answers are listed in not_covered.md and 0 fully answered tickets are listed
  • ✓Passed: 22 of 22 replies start with the customer's first name and run two to five sentences, 16 of 16 that rest on an article name it by id and title and 8 of 8 others say an article does not cover the question

Second review by Claude Opus 5.5: pass.

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

What it wrote. Lines 7 to 12 of replies.csv, copied from the file.
R-506,yes,HA-11,A charge for a monthly plan can be refunded within 30 days of the charge.,"Bao, no, it is not too late. Our current article says a charge for a monthly plan can be refunded within 30 days of the charge, so the 14 days you were told is out of date. Please note we do not refund part of a month. See HA-11: Plan changes, cancelling and refunds."
R-507,yes,HA-09,"Set the number of visits, from 2 to 50, the price and how long the pass lasts, from 1 to 12 months after purchase.","Imani, yes. When you set up a pass you choose how long it lasts, from 1 to 12 months after purchase, so six months is possible. Passes are included on the premier plan, and you set them up under Services > Passes. See HA-09: Set up class passes and packages."
R-508,yes,HA-05,Text reminders are included on the team and premier plans only.,"Dani, text reminders are included on the team and premier plans only, so they are not available on the starter plan. Every plan does send an email reminder 24 hours before the appointment by default. See HA-05: Send reminder texts and emails."
R-509,yes,HA-11,Your plan stays active until the end of the period you have paid for and you will not be charged again.,"Hollis, no, you do not lose access straight away. Your plan stays active until the end of the period you have paid for, and you will not be charged again. To cancel, go to Settings > Plan and choose ""Cancel plan"". See HA-11: Plan changes, cancelling and refunds."
R-510,yes,HA-08,Larger exports are emailed to you within 1 hour.,"Ingrid, go to Clients > Export to download your client list as a spreadsheet file, which includes each client's phone number. Exports of up to 5,000 clients are ready straight away, and larger ones are emailed to you within 1 hour, so your list will be emailed. Exports are open to the owner and manager roles. See HA-08: Export your client list and bookings."
R-511,yes,HA-12,"The starter plan has 1 location, the team plan includes 2 locations and the premier plan includes up to 10.","Chiara, no, you do not need to move up. The team plan includes 2 locations, so your second location fits. Go to Settings > Locations and choose ""Add location"". See HA-12: Add a second location."

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 1 of 1 on 1 December 2026. The agent took 1 min 8 s.

What the second review verified

  • R-506: the reply correctly uses HA-11 (updated 2026-08-21) over HA-04 (2025-09-15), saying a monthly charge "can be refunded within 30 days of the charge". The customer was charged three weeks ago, so they are still in time, and the reply says the 14 days they were told is out of date
  • All 16 quotes appear word for word in the articles they cite, for example R-521 "Go to Settings > Staff and choose "Add staff member"." from HA-06 and R-522 "Set a cut-off from 1 to 72 hours before the appointment." from HA-13
  • Every number in the replies comes from the cited article or the customer's message: R-510 uses 5,000 and 1 hour from HA-08 against the customer's 6,200 clients, and R-511 uses 2 locations on the team plan from HA-12
  • The 6 tickets marked no (R-515 to R-520) and the 2 marked partly (R-521 two-step verification, R-522 automatic barring) are all listed in not_covered.md. The 'no' rows leave article_id and quote empty, and every reply starts with the customer's first name and runs 2 to 5 sentences

What this run does not show

  • Whether an article covers a question is tested by keyword against the article titles. The check cannot tell whether a reply answers the question well.
  • Quotes and numbers are traced to the cited article. The rest of each reply is read only by the second review.
  • On this run the second review worked in a folder where it could see the check file. It was not fully independent of the check.

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 3 of 3. 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
# Draft ticket replies from help articles

function: support
for: the support agent who answers the day's product questions
goal: Every ticket has a draft reply that rests on one published help article, or says plainly that no article covers the question.

## 1. Read the articles and the tickets
Read input/help_articles.md and input/tickets.csv. The help articles are the only source of facts
about the product. Nothing you know from anywhere else may go into a reply. When two articles
disagree, the one with the later Updated date is the one to use.

## 2. Match each question to an article
For each ticket decide `covered`:
- `yes` when one article states the answer to everything the customer asked. The answer may be "no, you cannot". That still counts as covered.
- `partly` when an article answers one part of the message and no article answers another part.
- `no` when no article states the fact the customer needs. An article about a nearby subject does not count.
For `yes` and `partly` pick the one article the reply rests on.

## 3. Write the replies and the gap list
Write output/replies.csv with columns ticket_id,covered,article_id,quote,reply. One row per ticket.
- article_id is the id of the article the reply rests on. Leave it empty when covered is `no`.
- quote is one sentence copied word for word from that article, the sentence the answer rests on. Leave it empty when covered is `no`.
- reply is two to five plain sentences to the customer, starting with their first name. Answer the question that was asked. Name the article by its id and title so the customer can read more.
- Every number in a reply must appear in the cited article or in the customer's own message. Do not work out new numbers. Do not promise when anyone will follow up.
- When covered is `partly`, answer the covered part and say plainly which part no help article covers.
- When covered is `no`, say plainly that no help article covers the question and that a teammate will pick it up. Do not guess at an answer.

Write output/not_covered.md for the person who owns the help centre: one line for each ticket marked
`no` or `partly`, with the ticket id and the question that no article answers.

## Done looks like
- Every ticket has one row in replies.csv.
- Every quote can be found word for word in the article it cites.
- Every ticket marked `no` or `partly` is listed in not_covered.md.
input/help_articles.md · 104 lines, 6 KB
# Fernwick Bookings help centre

All published help articles as of 30 November 2026.

## HA-01: Reset your password
Updated: 2026-03-04

On the sign-in page choose "Forgot password" and enter your login email. We send a reset link within 5 minutes. The link works for 60 minutes and can be used once.

If the email does not arrive, check your spam folder first. You can ask for a new link up to 3 times an hour. A new password must be at least 12 characters long.

If you no longer have access to your login email, the account owner can change it for you under Settings > Staff.

## HA-02: Sync bookings with Google Calendar
Updated: 2026-05-19

Go to Settings > Calendar sync and choose "Connect Google". New and changed bookings appear in your Google Calendar within 10 minutes.

Sync is one way on the starter plan: bookings go from Fernwick to Google. Two way sync, where events you add in Google block time in Fernwick, is included on the team and premier plans.

Each staff member connects their own Google Calendar. Disconnecting removes the synced copies from Google but never deletes a booking in Fernwick.

## HA-03: Take a deposit when a client books
Updated: 2026-06-02

Go to Settings > Payments > Deposits. You can ask for a fixed amount or a share of the price, from 10% to 100%. The deposit is taken by card at the moment of booking.

Deposits are available on every plan. For cards issued in the United States the card processing fee is 2.9% plus 30 cents per payment. Payouts reach your bank within 2 business days.

If you cancel a booking yourself, the deposit goes back to the client in full.

## HA-04: Refunds on Fernwick plans
Updated: 2025-09-15

A charge for a monthly plan can be refunded within 14 days of the charge. A charge for an annual plan can be refunded within 30 days. Write to support from your login email to ask for a refund.

## HA-05: Send reminder texts and emails
Updated: 2026-04-11

Go to Settings > Reminders. Every plan sends an email reminder 24 hours before the appointment by default. You can set up to 3 reminders for each booking.

Text reminders are included on the team and premier plans only. The team plan includes 500 texts a month and the premier plan includes 2,000 texts a month. Extra texts cost 3 cents each.

Reminder times follow the time zone set under Settings > Business details.

## HA-06: Add staff and set their hours
Updated: 2026-02-27

Go to Settings > Staff and choose "Add staff member". The starter plan includes 1 staff calendar, the team plan includes up to 10 and the premier plan has no limit.

Each staff member has their own working hours and their own sign-in. The invite email is valid for 7 days. There are three roles: owner, manager and staff. Only the owner can change the plan.

## HA-07: Block time off and holidays
Updated: 2026-07-08

Open the calendar and choose "Block time". You can block a single slot, a whole day or a range of dates up to 60 days long. Blocked days show as unavailable on your booking page.

Bookings that already sit inside a blocked range are not cancelled. You need to move or cancel them yourself. To block the same time every week, such as a lunch break, tick "Repeat weekly".

## HA-08: Export your client list and bookings
Updated: 2026-06-30

Go to Clients > Export to download your client list as a spreadsheet file. It includes each client's name, email, phone number, notes and last visit.

Exports of up to 5,000 clients are ready straight away. Larger exports are emailed to you within 1 hour. To export bookings go to Reports > Bookings, where you can export up to 12 months at a time.

Exports are open to the owner and manager roles.

## HA-09: Set up class passes and packages
Updated: 2026-09-10

Go to Services > Passes and choose "New pass". Set the number of visits, from 2 to 50, the price and how long the pass lasts, from 1 to 12 months after purchase.

Passes are included on the team and premier plans. Clients buy a pass on your booking page and each booking takes one visit off the pass. Visits left on a pass when it runs out are lost and are not refunded automatically.

## HA-10: Find and download your invoices
Updated: 2026-01-20

Go to Settings > Plan > Invoices. Every invoice from the last 24 months is listed there as a PDF. We also email each invoice to the owner's login email on the day of the charge.

To add a tax number or change the business address, go to Settings > Plan > Billing details. Changes apply to future invoices only.

## HA-11: Plan changes, cancelling and refunds
Updated: 2026-08-21

To cancel, go to Settings > Plan and choose "Cancel plan". Your plan stays active until the end of the period you have paid for and you will not be charged again.

A charge for a monthly plan can be refunded within 30 days of the charge. A charge for an annual plan can be refunded within 60 days. We do not refund part of a month.

A move to a lower plan takes effect on your next billing date. A move to a higher plan takes effect at once.

## HA-12: Add a second location
Updated: 2026-10-05

Go to Settings > Locations and choose "Add location". The starter plan has 1 location, the team plan includes 2 locations and the premier plan includes up to 10.

Each location has its own address, opening hours and booking page link. A staff member can work at more than one location.

## HA-13: Late cancellation and no-show fees
Updated: 2026-05-05

Go to Settings > Booking rules > Cancellation. Set a cut-off from 1 to 72 hours before the appointment. A client who cancels after the cut-off can be charged a late fee of up to 100% of the price.

A no-show fee can only be charged when the client saved a card at booking. Fees are charged to that card and appear in your next payout.
input/tickets.csv · 23 lines, 3 KB
ticket_id,from_name,plan,question
R-501,Tessa Marlow,team,I asked for a password reset twice this morning and no email has come through. What should I do?
R-502,Lena Vasquez,starter,"Can I ask clients for a deposit of half the lesson price when they book? I am on the starter plan, is that allowed?"
R-503,Omar Haddad,team,We are hiring two more barbers. How many staff members can I add on the team plan?
R-504,Ruth Abernathy,team,"We close for nine days over the holidays. How do I block those days so nobody can book, and what happens to bookings already sitting in those days?"
R-505,Anneke de Vries,team,My bookkeeper needs our September invoice. Where do I find it?
R-506,Bao Tran,starter,I was charged for my monthly plan three weeks ago and have not used it since. Someone told me a refund is only possible for 14 days. Is it too late to ask for a refund?
R-507,Imani Achebe,premier,Can I make a class pass run out six months after a client buys it?
R-508,Dani Kowalczyk,starter,Can I turn on text reminders for my clients? I am on the starter plan.
R-509,Hollis Brandt,team,"If I cancel my plan today do I lose access straight away, and will I be charged again next month?"
R-510,Ingrid Solheim,premier,"How do I export my whole client list with phone numbers? We have about 6,200 clients, so will it take long?"
R-511,Chiara Benedetti,team,I am opening a second location in January and I am on the team plan. Do I need to move to a bigger plan first?
R-512,Mei-Lin Zhou,team,"Clients keep not turning up. Can I charge a no-show fee, and is there anything the client has to do first?"
R-513,Sam Oyelaran,starter,"If I connect Google Calendar, how quickly do new bookings show up there?"
R-514,Priya Raghunathan,premier,How many reminders can we send for one booking?
R-515,Farid Nasser,premier,Our studio runs on Outlook. Can Fernwick send our bookings to an Outlook calendar?
R-516,Kwame Mensah,team,Many of our parents pay with cards from overseas. What is the processing fee for a card issued outside the United States?
R-517,Jo Castellanos,starter,I have 300 clients in a spreadsheet from my old system. Can I import them into Fernwick in one go?
R-518,Margit Lindqvist,premier,Can clients buy a gift voucher on my booking page?
R-519,Noor Al-Sayed,starter,Can I put my logo on the booking page and change its colours to match my shop?
R-520,Kai Fonoti,starter,Is there a Fernwick app for Android tablets? I want one on the front desk.
R-521,Beatrix Onwudiwe,team,"How do I add a new staff member? Also, can I make two-step verification compulsory for every sign-in?"
R-522,Callum Reyes-Whitlock,premier,I want a cancellation cut-off of 48 hours with a late fee. And can Fernwick automatically bar a client who misses three appointments?
output/not_covered.md · written by the agent, 10 lines
# Questions no help article answers

- R-515: Can Fernwick send bookings to an Outlook calendar? (HA-02 covers Google Calendar only.)
- R-516: What is the card processing fee for cards issued outside the United States? (HA-03 gives the fee for US-issued cards only.)
- R-517: Can a client list from a spreadsheet be imported into Fernwick in one go? (HA-08 covers export only.)
- R-518: Can clients buy a gift voucher on the booking page? (No article; HA-09 covers class passes only.)
- R-519: Can a logo be added to the booking page and its colours changed? (No article.)
- R-520: Is there a Fernwick app for Android tablets? (No article.)
- R-521: Can two-step verification be made compulsory for every sign-in? (Partly covered: adding staff is in HA-06; two-step verification is in no article.)
- R-522: Can Fernwick automatically bar a client who misses three appointments? (Partly covered: cut-off and late fee are in HA-13; automatic barring is in no article.)
output/replies.csv · written by the agent, 23 lines
ticket_id,covered,article_id,quote,reply
R-501,yes,HA-01,"If the email does not arrive, check your spam folder first.","Tessa, please check your spam folder first, as that is the first step when a reset email does not arrive. If it is not there, you can ask for a new link up to 3 times an hour from ""Forgot password"" on the sign-in page. The link is sent within 5 minutes and works for 60 minutes. More detail is in HA-01: Reset your password."
R-502,yes,HA-03,Deposits are available on every plan.,"Lena, yes, deposits are available on every plan, so the starter plan is fine. You can ask for a fixed amount or a share of the price from 10% to 100%, which covers half the lesson price. Set it up under Settings > Payments > Deposits. See HA-03: Take a deposit when a client books."
R-503,yes,HA-06,"The starter plan includes 1 staff calendar, the team plan includes up to 10 and the premier plan has no limit.","Omar, the team plan includes up to 10 staff calendars. To add someone, go to Settings > Staff and choose ""Add staff member"". The help article does not say how many you have now, so please check that against the limit of 10. See HA-06: Add staff and set their hours."
R-504,yes,HA-07,Bookings that already sit inside a blocked range are not cancelled.,"Ruth, open the calendar, choose ""Block time"" and pick the range of dates; a range can be up to 60 days long, so your nine days fit. Blocked days show as unavailable on your booking page. Bookings that already sit inside the blocked range are not cancelled, so you need to move or cancel them yourself. See HA-07: Block time off and holidays."
R-505,yes,HA-10,Every invoice from the last 24 months is listed there as a PDF.,"Anneke, go to Settings > Plan > Invoices, where every invoice from the last 24 months is listed as a PDF. We also email each invoice to the owner's login email on the day of the charge. See HA-10: Find and download your invoices."
R-506,yes,HA-11,A charge for a monthly plan can be refunded within 30 days of the charge.,"Bao, no, it is not too late. Our current article says a charge for a monthly plan can be refunded within 30 days of the charge, so the 14 days you were told is out of date. Please note we do not refund part of a month. See HA-11: Plan changes, cancelling and refunds."
R-507,yes,HA-09,"Set the number of visits, from 2 to 50, the price and how long the pass lasts, from 1 to 12 months after purchase.","Imani, yes. When you set up a pass you choose how long it lasts, from 1 to 12 months after purchase, so six months is possible. Passes are included on the premier plan, and you set them up under Services > Passes. See HA-09: Set up class passes and packages."
R-508,yes,HA-05,Text reminders are included on the team and premier plans only.,"Dani, text reminders are included on the team and premier plans only, so they are not available on the starter plan. Every plan does send an email reminder 24 hours before the appointment by default. See HA-05: Send reminder texts and emails."
R-509,yes,HA-11,Your plan stays active until the end of the period you have paid for and you will not be charged again.,"Hollis, no, you do not lose access straight away. Your plan stays active until the end of the period you have paid for, and you will not be charged again. To cancel, go to Settings > Plan and choose ""Cancel plan"". See HA-11: Plan changes, cancelling and refunds."
R-510,yes,HA-08,Larger exports are emailed to you within 1 hour.,"Ingrid, go to Clients > Export to download your client list as a spreadsheet file, which includes each client's phone number. Exports of up to 5,000 clients are ready straight away, and larger ones are emailed to you within 1 hour, so your list will be emailed. Exports are open to the owner and manager roles. See HA-08: Export your client list and bookings."
R-511,yes,HA-12,"The starter plan has 1 location, the team plan includes 2 locations and the premier plan includes up to 10.","Chiara, no, you do not need to move up. The team plan includes 2 locations, so your second location fits. Go to Settings > Locations and choose ""Add location"". See HA-12: Add a second location."
R-512,yes,HA-13,A no-show fee can only be charged when the client saved a card at booking.,"Mei-Lin, yes, you can charge a no-show fee, but only when the client saved a card at booking. The fee is charged to that card and appears in your next payout. The rules are under Settings > Booking rules > Cancellation. See HA-13: Late cancellation and no-show fees."
R-513,yes,HA-02,New and changed bookings appear in your Google Calendar within 10 minutes.,"Sam, new and changed bookings appear in your Google Calendar within 10 minutes. To connect, go to Settings > Calendar sync and choose ""Connect Google"". On the starter plan sync is one way, from Fernwick to Google. See HA-02: Sync bookings with Google Calendar."
R-514,yes,HA-05,You can set up to 3 reminders for each booking.,"Priya, you can set up to 3 reminders for each booking. You set them under Settings > Reminders. See HA-05: Send reminder texts and emails."
R-515,no,,,"Farid, no help article covers whether Fernwick can send bookings to an Outlook calendar. A teammate will pick it up."
R-516,no,,,"Kwame, no help article covers the processing fee for cards issued outside the United States. A teammate will pick it up."
R-517,no,,,"Jo, no help article covers importing a client list into Fernwick. A teammate will pick it up."
R-518,no,,,"Margit, no help article covers gift vouchers on the booking page. A teammate will pick it up."
R-519,no,,,"Noor, no help article covers adding a logo or changing colours on the booking page. A teammate will pick it up."
R-520,no,,,"Kai, no help article covers a Fernwick app for Android tablets. A teammate will pick it up."
R-521,partly,HA-06,"Go to Settings > Staff and choose ""Add staff member"".","Beatrix, to add a staff member go to Settings > Staff and choose ""Add staff member"". The invite email is valid for 7 days. No help article covers making two-step verification compulsory for every sign-in, so a teammate will pick up that part. See HA-06: Add staff and set their hours."
R-522,partly,HA-13,Set a cut-off from 1 to 72 hours before the appointment.,"Callum, a cut-off of 48 hours is possible: go to Settings > Booking rules > Cancellation and set a cut-off from 1 to 72 hours before the appointment. A client who cancels after the cut-off can be charged a late fee of up to 100% of the price. No help article covers automatically barring a client who misses three appointments, so a teammate will pick up that part. See HA-13: Late cancellation and no-show fees."
check.py · the check, written before the run
"""Checks every drafted reply against the help articles it claims to rest on.

Which article should cover a ticket is worked out from the input files: each subject below has
words to look for in the customer's question and words to look for in the article titles. A subject
with no matching article title is a question no article answers. When two articles match, the one
with the later Updated date wins.
"""
import csv, re, sys
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)

SUBJECTS = [  # (words in the question, words in an article title)
    (r"password", r"password"), (r"deposit", r"deposit"), (r"staff member", r"staff"),
    (r"block those days", r"block time"), (r"invoice", r"invoice"),
    (r"refund|cancel my plan", r"refunds"), (r"class pass", r"passes"), (r"reminder", r"reminder"),
    (r"export", r"export"), (r"second location", r"location"), (r"no-show|cut-off|late fee", r"no-show"),
    (r"google calendar", r"google calendar"), (r"outlook", r"outlook"),
    (r"overseas|outside the united states", r"overseas|international"), (r"import", r"import"),
    (r"gift voucher", r"voucher"), (r"logo|colours", r"logo|brand|colour"), (r"android", r"android|app\b"),
    (r"two-step", r"two-step|verification"), (r"bar a client", r"\bbar\b|\bban\b"),
]
def squash(s):
    s = s.replace("’", "'").replace("‘", "'").replace("“", '"').replace("”", '"')
    return re.sub(r"\s+", " ", s).strip()
def numbers(s):
    return {n.replace(",", "") for n in re.findall(r"\d+(?:[.,]\d+)*", s)}

text = (root/"input/help_articles.md").read_text()
arts = {}
for m in re.finditer(r"^## (HA-\d+): ([^\n]+)\nUpdated: (\S+)\n(.*?)(?=^## |\Z)", text, re.S | re.M):
    arts[m.group(1)] = {"title": m.group(2).strip(), "updated": m.group(3), "body": squash(m.group(2) + " " + m.group(4))}
tickets = list(csv.DictReader((root/"input/tickets.csv").open()))
want = {}
for t in tickets:
    q = t["question"].lower()
    hits = []
    for q_words, title_words in SUBJECTS:
        if re.search(q_words, q):
            match = [a for a, v in arts.items() if re.search(title_words, v["title"].lower())]
            hits.append(max(match, key=lambda a: arts[a]["updated"]) if match else None)
    found = [h for h in hits if h]
    mark = "no" if not found else ("yes" if len(found) == len(hits) else "partly")
    want[t["ticket_id"]] = (mark, found[0] if found else "")

path = root/"output/replies.csv"
if not path.exists():
    say(False, "output/replies.csv was not written"); sys.exit(1)
rows = list(csv.DictReader(path.open()))
got = {(r.get("ticket_id") or "").strip(): r for r in rows}
def cell(k, col):
    return (got.get(k, {}).get(col) or "").strip()
n = len(want)
have = sum(1 for k in want if sum(1 for r in rows if (r.get("ticket_id") or "").strip() == k) == 1 and len(cell(k, "reply")) > 40)
say(have == n and len(rows) == n, f"{have} of {n} tickets have one drafted reply")
right = sum(1 for k, w in want.items() if cell(k, "covered").lower() == w[0])
say(right == n, f"{right} of {n} covered marks equal a keyword match of the question against the article titles")
cited = {k: w for k, w in want.items() if w[0] != "no"}
bare = [k for k, w in want.items() if w[0] == "no"]
right = sum(1 for k, w in cited.items() if cell(k, "article_id").upper() == w[1])
empty = sum(1 for k in bare if not cell(k, "article_id") and not cell(k, "quote"))
say(right == len(cited) and empty == len(bare), f"{right} of {len(cited)} replies cite the article that covers the question and {empty} of {len(bare)} replies with no article cite nothing")
real = 0
for k in cited:
    quote = squash(cell(k, "quote")).strip('"\'')
    art = arts.get(cell(k, "article_id").upper())
    if art and len(quote.split()) >= 5 and quote in art["body"]:
        real += 1
say(real == len(cited), f"{real} of {len(cited)} quotes appear word for word in the cited article")
clean = 0
by_id = {t["ticket_id"]: t for t in tickets}
for k in want:
    reply = re.sub(r"\b(HA|R)-\d+", " ", cell(k, "reply"))
    art = arts.get(cell(k, "article_id").upper())
    allowed = numbers(by_id[k]["question"]) | (numbers(art["body"]) if art else set())
    if numbers(reply) <= allowed and cell(k, "reply"):
        clean += 1
say(clean == n, f"{clean} of {n} replies use only numbers found in the cited article or the customer's message")
gaps = (root/"output/not_covered.md").read_text() if (root/"output/not_covered.md").exists() else ""
need = [k for k, w in want.items() if w[0] != "yes"]
listed = sum(1 for k in need if k in gaps)
wrong = sum(1 for k, w in want.items() if w[0] == "yes" and k in gaps)
say(listed == len(need) and wrong == 0, f"{listed} of {len(need)} tickets with a question no article answers are listed in not_covered.md and {wrong} fully answered tickets are listed")
shaped = named = plain = 0
for k, w in want.items():
    reply = squash(cell(k, "reply"))
    first = by_id[k]["from_name"].split()[0]
    sentences = len(re.findall(r"[.!?][\"')]*(?:\s|$)", reply))
    shaped += reply.startswith(first) and 2 <= sentences <= 5
    art = arts.get(cell(k, "article_id").upper())
    if w[0] != "no": named += bool(art) and cell(k, "article_id").upper() in reply and squash(art["title"]) in reply
    if w[0] != "yes": plain += any(re.search(r"\barticles?\b", x, re.I) and re.search(r"\b(no|not|none|nothing)\b|n't\b", x, re.I) for x in re.split(r"(?<=[.!?])\s+", reply))
say(shaped == n and named == len(cited) and plain == len(need),
    f"{shaped} of {n} replies start with the customer's first name and run two to five sentences, {named} of {len(cited)} that rest on an article name it by id and title and {plain} of {len(need)} others say an article does not cover the question")
sys.exit(0 if ok else 1)

help_articles.md: sample data written by Atris. Fingerprint 244c022dfde1.

tickets.csv: sample data written by Atris. Fingerprint cd1e3addc0ad.

not_covered.md: written by the agent. Fingerprint eba32a16f0fd.

replies.csv: written by the agent. Fingerprint 9422a786661f.


More customer support work, and every other desk job

For agentsGitHub
What is AtrisBlogApp StorePricingPrivacyTerms