Download valid.jsonl from sidchalamala/aether-sop-programs: direct link, hf CLI and curl.
- Browser
- Download file 208 kB
-
https://huggingface.co/datasets/sidchalamala/aether-sop-programs/resolve/main/valid.jsonl
- Command line
-
hf download hf://datasets/sidchalamala/aether-sop-programs/valid.jsonl
-
curl -L -o valid.jsonl https://huggingface.co/datasets/sidchalamala/aether-sop-programs/resolve/main/valid.jsonl
208 kB
| {"id": "valid-00000", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "Every day at 10am, find every patient in the Visits sheet whose appointment is in two days and whose status is \"booked\". Send each one a text reminder. I want to approve each message first. Don't mention the diagnosis. At most 20 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 10:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 2 days and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient}, a reminder from the clinic: your appointment is in two days at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} | |
| {"id": "valid-00001", "domain": "clinic", "pattern": "reminder", "batch": false, "sop": "Every Thursday at 11am, find every patient in the Visits sheet whose appointment is tomorrow and whose status is \"booked\". Send each one a text reminder. I need to OK every message. Don't mention the diagnosis. At most 20 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 1 day and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient}, a reminder from the clinic: your appointment is tomorrow at {time_of(r.starts)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} | |
| {"id": "valid-00002", "domain": "clinic", "pattern": "reminder", "batch": true, "sop": "Every Thursday at 8am, find every patient in the Visits sheet whose appointment is in two days and whose status is \"booked\". Send each one a text reminder. Let me check the messages before they go out. Never include their diagnosis. At most 50 per run.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicAppointmentReminders {\n about \"Remind each patient about their appointment\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Visits\n let due = filter all where date_of(starts) == today() + 2 days and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.patient default 'there'}, a reminder from the clinic: your appointment is in two days at {time_of(r.starts)}.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00003", "domain": "clinic", "pattern": "followup", "batch": false, "sop": "Every day at 11am, look for patients marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every day at 11:00\n\n let all = fetch Visits\n let recent = filter all where status == \"no-show\" and days_between(starts, today()) <= 2 and days_between(starts, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.patient}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00004", "domain": "clinic", "pattern": "lapsed", "batch": false, "sop": "On Thursdays at 8am, find patients whose starts was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }", "program": "procedure ClinicWinBack {\n about \"Nudge patients whose appointment was long ago\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n trigger every thursday at 08:00\n\n let all = fetch Visits\n let old = filter all where days_between(starts, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by starts first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, it's been a while! We'd love to see you again at the clinic.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} | |
| {"id": "valid-00005", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Rooms calendar for 30 minutes, and mark it confirmed. Keep the diagnosis out of the message.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 50 per day\n send only between 09:00 and 21:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 24 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 30 minutes }\n update r set status = \"confirmed\"\n}"} | |
| {"id": "valid-00006", "domain": "clinic", "pattern": "confirm_new", "batch": false, "sop": "When a new appointment is added to Visits: if it's less than 12 hours away, tell me and stop. Otherwise send a confirmation (nothing goes out until i've approved it), put it on the Rooms calendar for 90 minutes, and mark it confirmed. Don't mention the diagnosis.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, copay, diagnosis)\n allow write Visits(status)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow calendar Rooms\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\ncalendar Rooms \"Rooms\"", "program": "procedure ClinicConfirmNewAppointment {\n about \"Confirm a new appointment and add it to the calendar\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n calendar Rooms \"Rooms\"\n trigger when new row r in Visits\n\n if r.starts < now() + 12 hours {\n notify owner \"Short-notice appointment for {r.patient} at {r.starts}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, your appointment with the clinic is confirmed for {r.starts}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Rooms { title: \"{r.patient}\", at: r.starts, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} | |
| {"id": "valid-00007", "domain": "clinic", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Nothing goes out until I've approved it. Never include their diagnosis. No more than 50.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 200 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00008", "domain": "clinic", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find patients marked \"cancelled\" whose starts was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Never include their diagnosis. No more than 50.", "policy": "policy ClinicPolicy {\n allow read Visits(patient, phone, starts, status, diagnosis)\n allow contact Visits.phone\n deny reveal Visits.diagnosis\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure ClinicOutreachCampaign {\n about \"On request, contact recent cancelled patients\"\n policy ClinicPolicy\n sheet Visits \"Visits\" { patient: Text, phone: Phone, starts: DateTime, status: Text, copay: Money, diagnosis: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Visits\n let targets = filter all where status == \"cancelled\" and days_between(starts, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.patient default 'there'}, come back to the clinic! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00009", "domain": "dental", "pattern": "followup", "batch": true, "sop": "Each morning at 8am, look for patients marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalNoShowFollowUp {\n about \"Follow up with patients marked no-show\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 08:00\n\n let all = fetch Patients\n let recent = filter all where status == \"no-show\" and days_between(next_visit, today()) <= 3 and days_between(next_visit, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show patients\"\n }\n notify owner \"No-show patients to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.mobile: \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00010", "domain": "dental", "pattern": "lapsed", "batch": false, "sop": "Each morning at 9am, find patients whose next visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, next_visit, status, medical_history)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalWinBack {\n about \"Nudge patients whose cleaning was long ago\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger every day at 09:00\n\n let all = fetch Patients\n let old = filter all where days_between(next_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_visit first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.mobile: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the office.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} | |
| {"id": "valid-00011", "domain": "dental", "pattern": "wait_followup", "batch": false, "sop": "When a new patient is added to Patients, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Never include their medical history.", "policy": "policy DentalPolicy {\n allow read Patients(name, mobile, status)\n allow write Patients(status)\n allow contact Patients.mobile\n deny reveal Patients.medical_history\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }", "program": "procedure DentalFollowUpAfterWait {\n about \"Contact a new patient, then follow up once\"\n policy DentalPolicy\n sheet Patients \"Patients\" { name: Text, mobile: Phone, next_visit: DateTime, status: Text, balance: Money, medical_history: Text private }\n trigger when new row r in Patients\n\n let first = draft sms to r.mobile: \"Hi {r.name default 'there'}, thanks for choosing the office! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Patients\n let now_r = find all where mobile == r.mobile else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.mobile: \"Hi {now_r.name default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00012", "domain": "tutoring", "pattern": "reminder", "batch": false, "sop": "Each Tuesday at 6pm, find every student in the Students sheet whose session is in two days and whose status is \"scheduled\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Keep the learning notes out of the message. At most 30 per run.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringSessionReminders {\n about \"Remind each student about their session\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Students\n let due = filter all where date_of(next_session) == today() + 2 days and status == \"scheduled\"\n for each r in due up to 30 {\n let m = draft email to r.parent_email subject \"Your session in two days\": \"Hi {r.student default 'there'}, a reminder from the center: your session is in two days at {time_of(r.next_session)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} | |
| {"id": "valid-00013", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "Each morning at 10am, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Never include their learning notes.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00014", "domain": "tutoring", "pattern": "followup", "batch": false, "sop": "Daily at 9am, look for students marked \"missed\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow write Students(status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringMissedFollowUp {\n about \"Follow up with students marked missed\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Students\n let recent = filter all where status == \"missed\" and days_between(next_session, today()) <= 2 and days_between(next_session, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no missed students\"\n }\n notify owner \"Missed students to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.parent_email subject \"Let's find a new time\": \"Hi {r.student default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00015", "domain": "tutoring", "pattern": "lapsed", "batch": true, "sop": "Each morning at 9am, find students whose next session was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I need to OK every message. Keep the learning notes out of the message.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status, learning_notes)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 30 minutes max 15 preview 5\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }", "program": "procedure TutoringWinBack {\n about \"Nudge students whose session was long ago\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Students\n let old = filter all where days_between(next_session, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by next_session first 15\n let msgs = draft each r in oldest up to 15 email to r.parent_email subject \"We miss you\": \"Hi {r.student}, it's been a while! We'd love to see you again at the center.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00016", "domain": "tutoring", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Don't mention the learning notes. No more than 100.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student default 'there'}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00017", "domain": "tutoring", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"cancelled\" whose next session was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Keep the learning notes out of the message. No more than 50.", "policy": "policy TutoringPolicy {\n allow read Students(student, parent_email, next_session, status)\n allow contact Students.parent_email\n deny reveal Students.learning_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure TutoringOutreachCampaign {\n about \"On request, contact recent cancelled students\"\n policy TutoringPolicy\n sheet Students \"Students\" { student: Text, parent_email: Email, next_session: DateTime, status: Text, balance: Money, learning_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Students\n let targets = filter all where status == \"cancelled\" and days_between(next_session, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.parent_email subject \"We'd love to see you\": \"Hi {r.student}, come back to the center! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00018", "domain": "restaurant", "pattern": "reminder", "batch": false, "sop": "Each Thursday at 10am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Don't mention the allergy notes. At most 20 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every thursday at 10:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n for each r in due up to 20 {\n let m = draft sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} | |
| {"id": "valid-00019", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Every day at 6pm, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them reminded. Don't mention the allergy notes. At most 20 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 18:00\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"reminded\"\n }\n}"} | |
| {"id": "valid-00020", "domain": "restaurant", "pattern": "reminder", "batch": true, "sop": "Daily at 8:30am, find every guest in the Bookings sheet whose reservation is tomorrow and whose status is \"booked\". Send each one a text reminder. Show me the messages for approval first. Then mark them reminded. Don't mention the allergy notes. At most 50 per run.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantReservationReminders {\n about \"Remind each guest about their reservation\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every day at 08:30\n\n let all = fetch Bookings\n let due = filter all where date_of(at) == today() + 1 day and status == \"booked\"\n let msgs = draft each r in due up to 50 sms to r.phone: \"Hi {r.guest}, a reminder from the restaurant: your reservation is tomorrow at {time_of(r.at)}.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 50 {\n update r set status = \"reminded\"\n }\n}"} | |
| {"id": "valid-00021", "domain": "restaurant", "pattern": "followup", "batch": false, "sop": "Each Monday at 10am, look for guests marked \"no-show\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 10:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 1 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft sms to r.phone: \"Hi {r.guest}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00022", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "On Thursdays at 11am, look for guests marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"contacted\". Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every thursday at 11:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 2 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.guest}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00023", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "On Mondays at 10am, look for guests marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Show me the messages for approval first. Mark each one \"followed-up\". Never include their allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every monday at 10:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 2 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00024", "domain": "restaurant", "pattern": "followup", "batch": true, "sop": "Each Wednesday at 11am, look for guests marked \"no-show\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"contacted\". Don't mention the allergy notes.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantNoShowFollowUp {\n about \"Follow up with guests marked no-show\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Bookings\n let recent = filter all where status == \"no-show\" and days_between(at, today()) <= 2 and days_between(at, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show guests\"\n }\n notify owner \"No-show guests to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.guest default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00025", "domain": "restaurant", "pattern": "lapsed", "batch": true, "sop": "On Tuesdays at 6pm, find guests whose at was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 10 preview 5\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantWinBack {\n about \"Nudge guests whose reservation was long ago\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every tuesday at 18:00\n\n let all = fetch Bookings\n let old = filter all where days_between(at, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by at first 10\n let msgs = draft each r in oldest up to 10 sms to r.phone: \"Hi {r.guest default 'there'}, it's been a while! We'd love to see you again at the restaurant.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00026", "domain": "restaurant", "pattern": "summary", "batch": false, "sop": "Every Tuesday at 8:30am, count the guests in Bookings whose status is \"seated\", and send the numbers to me only. Don't message any guests.", "policy": "policy RestaurantPolicy {\n allow read Bookings(status, deposit, guest, phone, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }", "program": "procedure RestaurantDailySummary {\n about \"Tell the owner how many guests are seated\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n trigger every tuesday at 08:30\n\n let all = fetch Bookings\n let these = filter all where status == \"seated\"\n let n = summarize count of these\n notify owner \"Seated guests today: {n}\"\n}"} | |
| {"id": "valid-00027", "domain": "restaurant", "pattern": "confirm_new", "batch": false, "sop": "When a new reservation is added to Bookings: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Tables calendar for 60 minutes, and mark it confirmed. Keep the allergy notes out of the message.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, deposit, allergies)\n allow write Bookings(status)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow calendar Tables\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\ncalendar Tables \"Tables\"", "program": "procedure RestaurantConfirmNewReservation {\n about \"Confirm a new reservation and add it to the calendar\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n calendar Tables \"Tables\"\n trigger when new row r in Bookings\n\n if r.at < now() + 24 hours {\n notify owner \"Short-notice reservation for {r.guest} at {r.at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.guest}, your reservation with the restaurant is confirmed for {r.at}.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Tables { title: \"{r.guest}\", at: r.at, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} | |
| {"id": "valid-00028", "domain": "restaurant", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find guests marked \"cancelled\" whose at was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Nothing goes out until I've approved it. Never include their allergy notes. No more than 50.", "policy": "policy RestaurantPolicy {\n allow read Bookings(guest, phone, at, status, allergies)\n allow contact Bookings.phone\n deny reveal Bookings.allergies\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RestaurantOutreachCampaign {\n about \"On request, contact recent cancelled guests\"\n policy RestaurantPolicy\n sheet Bookings \"Bookings\" { guest: Text, phone: Phone, at: DateTime, status: Text, deposit: Money, allergies: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Bookings\n let targets = filter all where status == \"cancelled\" and days_between(at, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.guest}, come back to the restaurant! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00029", "domain": "retail", "pattern": "reminder", "batch": false, "sop": "Each Friday at 5:30pm, find every customer in the Orders sheet whose order is in a week and whose status is \"new\". Send each one a email reminder. Show me the messages for approval first. Then mark them notified. Don't mention the payment notes. At most 30 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow write Orders(status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every friday at 17:30\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 7 days and status == \"new\"\n for each r in due up to 30 {\n let m = draft email to r.email subject \"Your order in a week\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} | |
| {"id": "valid-00030", "domain": "retail", "pattern": "reminder", "batch": true, "sop": "Each day at 6pm, find every customer in the Orders sheet whose order is in two days and whose status is \"new\". Send each one a email reminder. I want to approve each message first. Keep the payment notes out of the message. At most 30 per run.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 30 minutes max 30 preview 5\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailOrderReminders {\n about \"Remind each customer about their order\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every day at 18:00\n\n let all = fetch Orders\n let due = filter all where ordered_on == today() + 2 days and status == \"new\"\n let msgs = draft each r in due up to 30 email to r.email subject \"Your order in two days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your order is in two days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00031", "domain": "retail", "pattern": "lapsed", "batch": false, "sop": "On Wednesdays at 4pm, find customers whose ordered on was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their payment notes.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }", "program": "procedure RetailWinBack {\n about \"Nudge customers whose order was long ago\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n trigger every wednesday at 16:00\n\n let all = fetch Orders\n let old = filter all where days_between(ordered_on, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by ordered_on first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00032", "domain": "retail", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ordered on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the payment notes out of the message. No more than 50.", "policy": "policy RetailPolicy {\n allow read Orders(customer, email, ordered_on, status)\n allow contact Orders.email\n deny reveal Orders.card_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n allow append Outreach\n}", "sheets": "sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure RetailOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy RetailPolicy\n sheet Orders \"Orders\" { customer: Text, email: Email, ordered_on: Date, status: Text, total: Money, card_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Orders\n let targets = filter all where status == \"cancelled\" and days_between(ordered_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00033", "domain": "salon", "pattern": "reminder", "batch": false, "sop": "Each Monday at 4pm, find every client in the Clients sheet whose last visit is in a week and whose status is \"active\". Send each one a text reminder. I need to OK every message. Then mark them notified. Keep the color formula out of the message. At most 50 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow write Clients(status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every monday at 16:00\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 7 days and status == \"active\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"notified\"\n }\n}"} | |
| {"id": "valid-00034", "domain": "salon", "pattern": "reminder", "batch": true, "sop": "Each Thursday at 5:30pm, find every client in the Clients sheet whose last visit is in two days and whose status is \"active\". Send each one a text reminder. I want to approve each message first. Keep the color formula out of the message. At most 30 per run.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonLastVisitReminders {\n about \"Remind each client about their last visit\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Clients\n let due = filter all where last_visit == today() + 2 days and status == \"active\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.name default 'there'}, a reminder from the salon: your last visit is in two days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00035", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Daily at 10am, find clients whose last visit was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every day at 10:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by last_visit first 15\n for each r in oldest up to 15 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00036", "domain": "salon", "pattern": "lapsed", "batch": false, "sop": "Every Wednesday at 10am, find clients whose last visit was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the color formula.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by last_visit first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} | |
| {"id": "valid-00037", "domain": "salon", "pattern": "lapsed", "batch": true, "sop": "On Thursdays at 5:30pm, find clients whose last visit was at least 60 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. Show me the messages for approval first. Keep the color formula out of the message.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonWinBack {\n about \"Nudge clients whose last visit was long ago\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every thursday at 17:30\n\n let all = fetch Clients\n let old = filter all where days_between(last_visit, today()) >= 60 and status != \"cancelled\"\n let oldest = sort old by last_visit first 15\n let msgs = draft each r in oldest up to 15 sms to r.phone: \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the salon.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00038", "domain": "salon", "pattern": "summary", "batch": false, "sop": "On Wednesdays at 11am, count the clients in Clients whose status is \"lapsed\" and the total tab, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy SalonPolicy {\n allow read Clients(status, tab, name, phone, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }", "program": "procedure SalonDailySummary {\n about \"Tell the owner how many clients are lapsed\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n trigger every wednesday at 11:00\n\n let all = fetch Clients\n let these = filter all where status == \"lapsed\"\n let n = summarize count of these\n let total = summarize sum tab of these\n if n == 0 {\n stop \"no lapsed clients\"\n }\n notify owner \"Lapsed clients: {n}, total tab: {total}\"\n}"} | |
| {"id": "valid-00039", "domain": "salon", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose last visit was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Don't mention the color formula. No more than 50.", "policy": "policy SalonPolicy {\n allow read Clients(name, phone, last_visit, status, color_formula)\n allow contact Clients.phone\n deny reveal Clients.color_formula\n limit sends 150 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure SalonOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy SalonPolicy\n sheet Clients \"Clients\" { name: Text, phone: Phone, last_visit: Date, status: Text, tab: Money, color_formula: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Clients\n let targets = filter all where status == \"cancelled\" and days_between(last_visit, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.name}, come back to the salon! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00040", "domain": "gym", "pattern": "reminder", "batch": false, "sop": "Daily at 6pm, find every member in the Members sheet whose renewal date is in three days and whose status is \"active\". Send each one a email reminder. Let me check the messages before they go out. Never include their health notes. At most 100 per run.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymRenewalDateReminders {\n about \"Remind each member about their renewal date\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Members\n let due = filter all where renews_on == today() + 3 days and status == \"active\"\n for each r in due up to 100 {\n let m = draft email to r.email subject \"Your renewal date in three days\": \"Hi {r.name default 'there'}, a reminder from the gym: your renewal date is in three days.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00041", "domain": "gym", "pattern": "followup", "batch": false, "sop": "Each morning at 9am, look for members marked \"frozen\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 2 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00042", "domain": "gym", "pattern": "followup", "batch": false, "sop": "Every day at 6pm, look for members marked \"frozen\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Keep the health notes out of the message.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow write Members(status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }", "program": "procedure GymFrozenFollowUp {\n about \"Follow up with members marked frozen\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n trigger every day at 18:00\n\n let all = fetch Members\n let recent = filter all where status == \"frozen\" and days_between(renews_on, today()) <= 1 and days_between(renews_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no frozen members\"\n }\n notify owner \"Frozen members to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00043", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Show me the messages for approval first. Keep the health notes out of the message. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00044", "domain": "gym", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the health notes out of the message. No more than 100.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status, health_notes)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00045", "domain": "gym", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find members marked \"expired\" whose renews on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the health notes out of the message. No more than 50.", "policy": "policy GymPolicy {\n allow read Members(name, email, renews_on, status)\n allow contact Members.email\n deny reveal Members.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure GymOutreachCampaign {\n about \"On request, contact recent expired members\"\n policy GymPolicy\n sheet Members \"Members\" { name: Text, email: Email, renews_on: Date, status: Text, dues: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Members\n let targets = filter all where status == \"expired\" and days_between(renews_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the gym! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00046", "domain": "autorepair", "pattern": "reminder", "batch": false, "sop": "Each morning at 11am, find every customer in the Jobs sheet whose pickup time is in two days and whose status is \"open\". Send each one a text reminder. Show me the messages for approval first. Then mark them reminded. Never include their VIN. At most 50 per run.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickupTimeReminders {\n about \"Remind each customer about their pickup time\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let due = filter all where date_of(promised) == today() + 2 days and status == \"open\"\n for each r in due up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, a reminder from the shop: your pickup time is in two days at {time_of(r.promised)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} | |
| {"id": "valid-00047", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "On Tuesdays at 4pm, look for customers marked \"picked-up\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every tuesday at 16:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 7 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00048", "domain": "autorepair", "pattern": "followup", "batch": false, "sop": "Each Friday at 10am, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every friday at 10:00\n\n let all = fetch Jobs\n let recent = filter all where status == \"picked-up\" and days_between(promised, today()) <= 1 and days_between(promised, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00049", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "Every Wednesday at 10am, find customers whose promised was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Let me check the messages before they go out. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every wednesday at 10:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by promised first 20\n for each r in oldest up to 20 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00050", "domain": "autorepair", "pattern": "lapsed", "batch": false, "sop": "Every day at 11am, find customers whose promised was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I need to OK every message. Never include their VIN.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, vin)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairWinBack {\n about \"Nudge customers whose pickup time was long ago\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(promised, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by promised first 10\n for each r in oldest up to 10 {\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00051", "domain": "autorepair", "pattern": "reorder", "batch": false, "sop": "Daily at 8:30am, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 5 items per run.", "policy": "policy AutorepairStockPolicy {\n allow read Parts(part, count, minimum, reorder_qty, supplier, unit_price)\n allow supplier Parts.supplier\n limit order $100 per action\n limit order $500 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }", "program": "procedure AutorepairReorder {\n about \"Reorder parts below their minimum\"\n policy AutorepairStockPolicy\n sheet Parts \"Parts\" { part: Text, count: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_price: Money }\n trigger every day at 08:30\n\n let all = fetch Parts\n let low = filter all where count < minimum\n for each i in low up to 5 {\n let cost = i.reorder_qty * i.unit_price\n if cost > $100.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 1 day else skip\n log \"ordered {i.part}\"\n }\n}"} | |
| {"id": "valid-00052", "domain": "autorepair", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy AutorepairRefundPolicy {\n allow read RefundRequests(request_id, owner_name, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure AutorepairRefunds {\n about \"Handle refund requests within limits\"\n policy AutorepairRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, owner_name: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00053", "domain": "autorepair", "pattern": "confirm_new", "batch": false, "sop": "When a new pickup time is added to Jobs: if it's less than 2 hours away, tell me and stop. Otherwise send a confirmation (let me check the messages before they go out), put it on the Bays calendar for 90 minutes, and mark it confirmed. Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status, estimate, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 200 per day\n send only between 08:00 and 20:00\n allow calendar Bays\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\ncalendar Bays \"Bays\"", "program": "procedure AutorepairConfirmNewPickupTime {\n about \"Confirm a new pickup time and add it to the calendar\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n calendar Bays \"Bays\"\n trigger when new row r in Jobs\n\n if r.promised < now() + 2 hours {\n notify owner \"Short-notice pickup time for {r.owner_name} at {r.promised}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.phone: \"Hi {r.owner_name default 'there'}, your pickup time with the shop is confirmed for {r.promised}.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Bays { title: \"{r.owner_name}\", at: r.promised, length: 90 minutes }\n update r set status = \"confirmed\"\n}"} | |
| {"id": "valid-00054", "domain": "autorepair", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Show me the messages for approval first. Keep the VIN out of the message.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, status, vin)\n allow write Jobs(status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }", "program": "procedure AutorepairFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n trigger when new row r in Jobs\n\n let first = draft sms to r.phone: \"Hi {r.owner_name}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.owner_name}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00055", "domain": "autorepair", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose promised was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Keep the VIN out of the message. No more than 50.", "policy": "policy AutorepairPolicy {\n allow read Jobs(owner_name, phone, promised, status)\n allow contact Jobs.phone\n deny reveal Jobs.vin\n limit sends 100 per day\n send only between 08:00 and 18:00\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure AutorepairOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy AutorepairPolicy\n sheet Jobs \"Jobs\" { owner_name: Text, phone: Phone, promised: DateTime, status: Text, estimate: Money, vin: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(promised, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner_name}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00056", "domain": "bakery", "pattern": "reminder", "batch": false, "sop": "Daily at 11am, find every customer in the CakeOrders sheet whose pickup date is in a week and whose status is \"new\". Send each one a email reminder. I need to OK every message. Keep the home address out of the message. At most 20 per run.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryPickupDateReminders {\n about \"Remind each customer about their pickup date\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every day at 11:00\n\n let all = fetch CakeOrders\n let due = filter all where pickup == today() + 7 days and status == \"new\"\n for each r in due up to 20 {\n let m = draft email to r.email subject \"Your pickup date in a week\": \"Hi {r.customer default 'there'}, a reminder from the bakery: your pickup date is in a week.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} | |
| {"id": "valid-00057", "domain": "bakery", "pattern": "followup", "batch": false, "sop": "On Wednesdays at 5:30pm, look for customers marked \"ready\" in the last 7 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"contacted\". Don't mention the home address.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, pickup, status, address)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryReadyFollowUp {\n about \"Follow up with customers marked ready\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger every wednesday at 17:30\n\n let all = fetch CakeOrders\n let recent = filter all where status == \"ready\" and days_between(pickup, today()) <= 7 and days_between(pickup, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no ready customers\"\n }\n notify owner \"Ready customers to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00058", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $120 per day\n refund without approval up to $10\n limit sends 30 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00059", "domain": "bakery", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BakeryRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n limit sends 80 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BakeryRefunds {\n about \"Handle refund requests within limits\"\n policy BakeryRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00060", "domain": "bakery", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to CakeOrders, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"confirmed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Keep the home address out of the message.", "policy": "policy BakeryPolicy {\n allow read CakeOrders(customer, email, status)\n allow write CakeOrders(status)\n allow contact CakeOrders.email\n deny reveal CakeOrders.address\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }", "program": "procedure BakeryFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BakeryPolicy\n sheet CakeOrders \"CakeOrders\" { customer: Text, email: Email, pickup: Date, status: Text, price: Money, address: Text private }\n trigger when new row r in CakeOrders\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the bakery! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch CakeOrders\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"confirmed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00061", "domain": "landscaping", "pattern": "reminder", "batch": false, "sop": "Every Thursday at 8:30am, find every customer in the Quotes sheet whose quote is in a week and whose status is \"draft\". Send each one a email reminder. I want to approve each message first. Then mark them notified. Keep the gate code out of the message. At most 50 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingQuoteReminders {\n about \"Remind each customer about their quote\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Quotes\n let due = filter all where sent_on == today() + 7 days and status == \"draft\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your quote in a week\": \"Hi {r.customer}, a reminder from the company: your quote is in a week.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"notified\"\n }\n}"} | |
| {"id": "valid-00062", "domain": "landscaping", "pattern": "followup", "batch": false, "sop": "Every day at 8:30am, look for customers marked \"accepted\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the gate code out of the message.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 1 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00063", "domain": "landscaping", "pattern": "followup", "batch": true, "sop": "On Mondays at 9am, look for customers marked \"accepted\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"contacted\". Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingAcceptedFollowUp {\n about \"Follow up with customers marked accepted\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every monday at 09:00\n\n let all = fetch Quotes\n let recent = filter all where status == \"accepted\" and days_between(sent_on, today()) <= 3 and days_between(sent_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no accepted customers\"\n }\n notify owner \"Accepted customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00064", "domain": "landscaping", "pattern": "summary", "batch": false, "sop": "Each day at 4pm, count the customers in Quotes whose status is \"sent\" and the total quote amount, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy LandscapingPolicy {\n allow read Quotes(status, amount, customer, email, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingDailySummary {\n about \"Tell the owner how many customers are sent\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 16:00\n\n let all = fetch Quotes\n let these = filter all where status == \"sent\"\n let n = summarize count of these\n let total = summarize sum amount of these\n if n == 0 {\n stop \"no sent customers\"\n }\n notify owner \"Sent customers: {n}, total amount: {total}\"\n}"} | |
| {"id": "valid-00065", "domain": "landscaping", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Quotes, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"sent\" or \"declined\", stop. Otherwise send one check-in message. I want to approve each message first. Don't mention the gate code.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, status)\n allow write Quotes(status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger when new row r in Quotes\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the company! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Quotes\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"sent\" or now_r.status == \"declined\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00066", "domain": "landscaping", "pattern": "escalation", "batch": false, "sop": "Daily at 8am: for customers with a quote amount above zero whose quote passed more than 5 days ago, send a polite reminder with the amount. Nothing goes out until I've approved it. If it's more than 30 days late, don't message them; tell me so I can call. Don't mention the gate code. At most 30 per run.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, amount, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }", "program": "procedure LandscapingLateBalance {\n about \"Remind late customers; escalate very late ones\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Quotes\n let late = filter all where amount > $0.00 and days_between(sent_on, today()) > 5\n for each r in late up to 30 {\n if days_between(r.sent_on, today()) > 30 {\n notify owner \"{r.customer} is very late ({r.amount}). Please call.\"\n } else {\n let m = draft email to r.email subject \"A friendly reminder\": \"Hello {r.customer}, our records show a amount of {r.amount}. Questions? Just reply.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n }\n}"} | |
| {"id": "valid-00067", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I need to OK every message. Keep the gate code out of the message. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status, gate_code)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 30 minutes max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the company! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00068", "domain": "landscaping", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"declined\" whose sent on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their gate code. No more than 50.", "policy": "policy LandscapingPolicy {\n allow read Quotes(customer, email, sent_on, status)\n allow contact Quotes.email\n deny reveal Quotes.gate_code\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure LandscapingOutreachCampaign {\n about \"On request, contact recent declined customers\"\n policy LandscapingPolicy\n sheet Quotes \"Quotes\" { customer: Text, email: Email, sent_on: Date, status: Text, amount: Money, gate_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Quotes\n let targets = filter all where status == \"declined\" and days_between(sent_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the company! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00069", "domain": "daycare", "pattern": "followup", "batch": false, "sop": "Each morning at 10am, look for familys marked \"withdrawn\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Let me check the messages before they go out. Mark each one \"followed-up\". Don't mention the health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWithdrawnFollowUp {\n about \"Follow up with familys marked withdrawn\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Families\n let recent = filter all where status == \"withdrawn\" and days_between(due_date, today()) <= 3 and days_between(due_date, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no withdrawn familys\"\n }\n notify owner \"Withdrawn familys to follow up: {n}\"\n for each r in recent up to 30 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.parent}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00070", "domain": "daycare", "pattern": "lapsed", "batch": true, "sop": "Every Thursday at 6pm, find familys whose due date was at least 42 days ago, skipping anyone marked \"paused\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareWinBack {\n about \"Nudge familys whose tuition due date was long ago\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Families\n let old = filter all where days_between(due_date, today()) >= 42 and status != \"paused\"\n let oldest = sort old by due_date first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.parent default 'there'}, it's been a while! We'd love to see you again at the daycare.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00071", "domain": "daycare", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the family know (I approve that message too).", "policy": "policy DaycareRefundPolicy {\n allow read RefundRequests(request_id, parent, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $50 per action\n limit refund $250 per day\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure DaycareRefunds {\n about \"Handle refund requests within limits\"\n policy DaycareRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, parent: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.parent}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00072", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. I need to OK every message. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00073", "domain": "daycare", "pattern": "wait_followup", "batch": false, "sop": "When a new family is added to Families, send a welcome note and mark them \"contacted\". Wait 2 days. If by then they're marked \"waitlist\" or \"paused\", stop. Otherwise send one check-in message. Let me check the messages before they go out. Never include their health notes.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, status, health_notes)\n allow write Families(status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }", "program": "procedure DaycareFollowUpAfterWait {\n about \"Contact a new family, then follow up once\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n trigger when new row r in Families\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.parent}, thanks for choosing the daycare! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 2 days\n let all = fetch Families\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"waitlist\" or now_r.status == \"paused\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.parent}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00074", "domain": "daycare", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Never include their health notes. No more than 100.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.parent default 'there'}, come back to the daycare! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00075", "domain": "daycare", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find familys marked \"paused\" whose due date was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. I want to approve each message first. Don't mention the health notes. No more than 50.", "policy": "policy DaycarePolicy {\n allow read Families(parent, email, due_date, status, health_notes)\n allow contact Families.email\n deny reveal Families.health_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure DaycareOutreachCampaign {\n about \"On request, contact recent paused familys\"\n policy DaycarePolicy\n sheet Families \"Families\" { parent: Text, email: Email, due_date: Date, status: Text, balance: Money, health_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Families\n let targets = filter all where status == \"paused\" and days_between(due_date, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 email to r.email subject \"We'd love to see you\": \"Hi {r.parent default 'there'}, come back to the daycare! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00076", "domain": "cleaning", "pattern": "followup", "batch": false, "sop": "Each morning at 8am, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Never include their door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 100 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft sms to r.phone: \"Hi {r.client}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00077", "domain": "cleaning", "pattern": "followup", "batch": true, "sop": "Every day at 8:30am, look for clients marked \"skipped\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the door code.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow write Cleanings(status)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 40 preview 5\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningSkippedFollowUp {\n about \"Follow up with clients marked skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Cleanings\n let recent = filter all where status == \"skipped\" and days_between(scheduled, today()) <= 3 and days_between(scheduled, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients to follow up: {n}\"\n let msgs = draft each r in recent up to 40 sms to r.phone: \"Hi {r.client}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00078", "domain": "cleaning", "pattern": "summary", "batch": false, "sop": "Every day at 8am, count the clients in Cleanings whose status is \"skipped\" and the total fee, and send the numbers to me only. Don't message any clients. If there are none, don't bother me.", "policy": "policy CleaningPolicy {\n allow read Cleanings(status, fee, client, phone, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 50 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }", "program": "procedure CleaningDailySummary {\n about \"Tell the owner how many clients are skipped\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n trigger every day at 08:00\n\n let all = fetch Cleanings\n let these = filter all where status == \"skipped\"\n let n = summarize count of these\n let total = summarize sum fee of these\n if n == 0 {\n stop \"no skipped clients\"\n }\n notify owner \"Skipped clients: {n}, total fee: {total}\"\n}"} | |
| {"id": "valid-00079", "domain": "cleaning", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find clients marked \"cancelled\" whose scheduled was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the door code out of the message. No more than 50.", "policy": "policy CleaningPolicy {\n allow read Cleanings(client, phone, scheduled, status, door_code)\n allow contact Cleanings.phone\n deny reveal Cleanings.door_code\n limit sends 150 per day\n send only between 07:30 and 19:00\n allow append Outreach\n}", "sheets": "sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure CleaningOutreachCampaign {\n about \"On request, contact recent cancelled clients\"\n policy CleaningPolicy\n sheet Cleanings \"Cleanings\" { client: Text, phone: Phone, scheduled: DateTime, status: Text, fee: Money, door_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Cleanings\n let targets = filter all where status == \"cancelled\" and days_between(scheduled, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.client}, come back to the service! Use code WELCOME10 on your next visit.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00080", "domain": "music", "pattern": "reminder", "batch": false, "sop": "Each morning at 10am, find every student in the Lessons sheet whose lesson is in three days and whose status is \"scheduled\". Send each one a text reminder. I want to approve each message first. Then mark them reminded. Don't mention the progress notes. At most 50 per run.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicLessonReminders {\n about \"Remind each student about their lesson\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let due = filter all where date_of(lesson_at) == today() + 3 days and status == \"scheduled\"\n for each r in due up to 50 {\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, a reminder from the school: your lesson is in three days at {time_of(r.lesson_at)}.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"reminded\"\n }\n}"} | |
| {"id": "valid-00081", "domain": "music", "pattern": "summary", "batch": false, "sop": "Daily at 10am, count the students in Lessons whose status is \"done\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone, progress_notes)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are done\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every day at 10:00\n\n let all = fetch Lessons\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no done students\"\n }\n notify owner \"Done students: {n}, total balance: {total}\"\n}"} | |
| {"id": "valid-00082", "domain": "music", "pattern": "summary", "batch": false, "sop": "On Mondays at 9am, count the students in Lessons whose status is \"done\" and the total balance, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy MusicPolicy {\n allow read Lessons(status, balance, student, parent_phone)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicDailySummary {\n about \"Tell the owner how many students are done\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger every monday at 09:00\n\n let all = fetch Lessons\n let these = filter all where status == \"done\"\n let n = summarize count of these\n let total = summarize sum balance of these\n if n == 0 {\n stop \"no done students\"\n }\n notify owner \"Done students: {n}, total balance: {total}\"\n}"} | |
| {"id": "valid-00083", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $40 per action\n limit refund $240 per day\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 2 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 2 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00084", "domain": "music", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $50, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the student know (I approve that message too).", "policy": "policy MusicRefundPolicy {\n allow read RefundRequests(request_id, student, parent_phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.parent_phone\n limit refund $50 per action\n limit refund $150 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure MusicRefunds {\n about \"Handle refund requests within limits\"\n policy MusicRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, student: Text, parent_phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $50.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $50. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 6 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.parent_phone: \"Hi {r.student}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 6 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00085", "domain": "music", "pattern": "confirm_new", "batch": false, "sop": "When a new lesson is added to Lessons: if it's less than 24 hours away, tell me and stop. Otherwise send a confirmation (show me the messages for approval first), put it on the Studios calendar for 60 minutes, and mark it confirmed. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, lesson_at, status, balance, progress_notes)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 200 per day\n send only between 08:00 and 18:00\n allow calendar Studios\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\ncalendar Studios \"Studios\"", "program": "procedure MusicConfirmNewLesson {\n about \"Confirm a new lesson and add it to the calendar\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n calendar Studios \"Studios\"\n trigger when new row r in Lessons\n\n if r.lesson_at < now() + 24 hours {\n notify owner \"Short-notice lesson for {r.student} at {r.lesson_at}. Please handle it.\"\n stop \"short notice goes to owner\"\n }\n let m = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, your lesson with the school is confirmed for {r.lesson_at}.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"confirmation not approved\"\n send ok\n let ev = book Studios { title: \"{r.student}\", at: r.lesson_at, length: 60 minutes }\n update r set status = \"confirmed\"\n}"} | |
| {"id": "valid-00086", "domain": "music", "pattern": "wait_followup", "batch": false, "sop": "When a new student is added to Lessons, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"done\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Never include their progress notes.", "policy": "policy MusicPolicy {\n allow read Lessons(student, parent_phone, status)\n allow write Lessons(status)\n allow contact Lessons.parent_phone\n deny reveal Lessons.progress_notes\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }", "program": "procedure MusicFollowUpAfterWait {\n about \"Contact a new student, then follow up once\"\n policy MusicPolicy\n sheet Lessons \"Lessons\" { student: Text, parent_phone: Phone, lesson_at: DateTime, status: Text, balance: Money, progress_notes: Text private }\n trigger when new row r in Lessons\n\n let first = draft sms to r.parent_phone: \"Hi {r.student default 'there'}, thanks for choosing the school! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 6 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Lessons\n let now_r = find all where parent_phone == r.parent_phone else stop \"row was removed\"\n if now_r.status == \"done\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.parent_phone: \"Hi {now_r.student}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 6 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00087", "domain": "bikeshop", "pattern": "reminder", "batch": true, "sop": "Daily at 6pm, find every customer in the Repairs sheet whose repair is in two days and whose status is \"waiting\". Send each one a text reminder. Show me the messages for approval first. Then mark them notified. Never include their lock code. At most 30 per run.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 30 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopRepairReminders {\n about \"Remind each customer about their repair\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 18:00\n\n let all = fetch Repairs\n let due = filter all where ready_on == today() + 2 days and status == \"waiting\"\n let msgs = draft each r in due up to 30 sms to r.phone: \"Hi {r.customer default 'there'}, a reminder from the shop: your repair is in two days.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in due up to 30 {\n update r set status = \"notified\"\n }\n}"} | |
| {"id": "valid-00088", "domain": "bikeshop", "pattern": "followup", "batch": false, "sop": "Each day at 5:30pm, look for customers marked \"picked-up\" in the last 1 day. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 17:30\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 1 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n for each r in recent up to 40 {\n let m = draft sms to r.phone: \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00089", "domain": "bikeshop", "pattern": "followup", "batch": true, "sop": "Each morning at 8:30am, look for customers marked \"picked-up\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 50 per day\n send only between 09:00 and 21:00\n approval batch valid 1 hour max 20 preview 5\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopPickedUpFollowUp {\n about \"Follow up with customers marked picked-up\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger every day at 08:30\n\n let all = fetch Repairs\n let recent = filter all where status == \"picked-up\" and days_between(ready_on, today()) <= 2 and days_between(ready_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no picked-up customers\"\n }\n notify owner \"Picked-up customers to follow up: {n}\"\n let msgs = draft each r in recent up to 20 sms to r.phone: \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 20 {\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00090", "domain": "bikeshop", "pattern": "reorder", "batch": false, "sop": "Daily at 4pm, check Parts. For anything below its minimum, order the usual reorder amount from its supplier. Always ask me first. Never spend more than $100 on one order; if it would cost more, just tell me. Handle at most 3 items per run.", "policy": "policy BikeshopStockPolicy {\n allow read Parts(part, qty, minimum, reorder_qty, supplier, unit_cost)\n allow supplier Parts.supplier\n limit order $100 per action\n limit order $300 per day\n}", "sheets": "sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }", "program": "procedure BikeshopReorder {\n about \"Reorder parts below their minimum\"\n policy BikeshopStockPolicy\n sheet Parts \"Parts\" { part: Text, qty: Number, minimum: Number, reorder_qty: Number, supplier: Text, unit_cost: Money }\n trigger every day at 16:00\n\n let all = fetch Parts\n let low = filter all where qty < minimum\n for each i in low up to 3 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $100.00 {\n notify owner \"Reorder of {i.part} would cost {cost}, over the $100 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.part}\" from i.supplier cost cost, ask owner first timeout 6 hours else skip\n log \"ordered {i.part}\"\n }\n}"} | |
| {"id": "valid-00091", "domain": "bikeshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BikeshopRefundPolicy {\n allow read RefundRequests(request_id, customer, phone, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.phone\n limit refund $40 per action\n limit refund $240 per day\n refund without approval up to $20\n limit sends 30 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }", "program": "procedure BikeshopRefunds {\n about \"Handle refund requests within limits\"\n policy BikeshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, phone: Phone, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft sms to r.phone: \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00092", "domain": "bikeshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Repairs, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"ready\" or \"cancelled\", stop. Otherwise send one check-in message. Nothing goes out until I've approved it. Don't mention the lock code.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, status, lock_code)\n allow write Repairs(status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }", "program": "procedure BikeshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n trigger when new row r in Repairs\n\n let first = draft sms to r.phone: \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Repairs\n let now_r = find all where phone == r.phone else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft sms to now_r.phone: \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00093", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Keep the lock code out of the message. No more than 100.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 100 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00094", "domain": "bikeshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose ready on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. Nothing goes out until I've approved it. Keep the lock code out of the message. No more than 100.", "policy": "policy BikeshopPolicy {\n allow read Repairs(customer, phone, ready_on, status, lock_code)\n allow contact Repairs.phone\n deny reveal Repairs.lock_code\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BikeshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy BikeshopPolicy\n sheet Repairs \"Repairs\" { customer: Text, phone: Phone, ready_on: Date, status: Text, estimate: Money, lock_code: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Repairs\n let targets = filter all where status == \"cancelled\" and days_between(ready_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 sms to r.phone: \"Hi {r.customer default 'there'}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00095", "domain": "bookstore", "pattern": "reminder", "batch": true, "sop": "Daily at 9am, find every customer in the Holds sheet whose hold is tomorrow and whose status is \"waiting\". Send each one a email reminder. I need to OK every message. Keep the private notes out of the message. At most 50 per run.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 50 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreHoldReminders {\n about \"Remind each customer about their hold\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every day at 09:00\n\n let all = fetch Holds\n let due = filter all where held_until == today() + 1 day and status == \"waiting\"\n let msgs = draft each r in due up to 50 email to r.email subject \"Your hold tomorrow\": \"Hi {r.customer}, a reminder from the store: your hold is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00096", "domain": "bookstore", "pattern": "followup", "batch": true, "sop": "On Mondays at 11am, look for customers marked \"collected\" in the last 2 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. Nothing goes out until I've approved it. Mark each one \"followed-up\". Keep the private notes out of the message.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreCollectedFollowUp {\n about \"Follow up with customers marked collected\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every monday at 11:00\n\n let all = fetch Holds\n let recent = filter all where status == \"collected\" and days_between(held_until, today()) <= 2 and days_between(held_until, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no collected customers\"\n }\n notify owner \"Collected customers to follow up: {n}\"\n let msgs = draft each r in recent up to 30 email to r.email subject \"Let's find a new time\": \"Hi {r.customer default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00097", "domain": "bookstore", "pattern": "lapsed", "batch": true, "sop": "Every Thursday at 6pm, find customers whose held until was at least 60 days ago, skipping anyone marked \"expired\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. I want to approve each message first. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 30 minutes max 10 preview 5\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreWinBack {\n about \"Nudge customers whose hold was long ago\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger every thursday at 18:00\n\n let all = fetch Holds\n let old = filter all where days_between(held_until, today()) >= 60 and status != \"expired\"\n let oldest = sort old by held_until first 10\n let msgs = draft each r in oldest up to 10 email to r.email subject \"We miss you\": \"Hi {r.customer}, it's been a while! We'd love to see you again at the store.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00098", "domain": "bookstore", "pattern": "reorder", "batch": false, "sop": "Each Tuesday at 6pm, check Inventory. For anything below its minimum, order the usual reorder amount from its distributor. Always ask me first. Never spend more than $200 on one order; if it would cost more, just tell me. Handle at most 4 items per run.", "policy": "policy BookstoreStockPolicy {\n allow read Inventory(title, copies, minimum, reorder_qty, distributor, unit_cost)\n allow supplier Inventory.distributor\n limit order $200 per action\n limit order $800 per day\n}", "sheets": "sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }", "program": "procedure BookstoreReorder {\n about \"Reorder books below their minimum\"\n policy BookstoreStockPolicy\n sheet Inventory \"Inventory\" { title: Text, copies: Number, minimum: Number, reorder_qty: Number, distributor: Text, unit_cost: Money }\n trigger every tuesday at 18:00\n\n let all = fetch Inventory\n let low = filter all where copies < minimum\n for each i in low up to 4 {\n let cost = i.reorder_qty * i.unit_cost\n if cost > $200.00 {\n notify owner \"Reorder of {i.title} would cost {cost}, over the $200 limit.\"\n skip\n }\n order \"{i.reorder_qty} x {i.title}\" from i.distributor cost cost, ask owner first timeout 2 hours else skip\n log \"ordered {i.title}\"\n }\n}"} | |
| {"id": "valid-00099", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 14 days ago, tell me and stop. If it's over $40, I'll handle it myself. Every refund needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $40 per action\n limit refund $240 per day\n limit sends 30 per day\n send only between 08:00 and 20:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 14 {\n notify owner \"Refund request {r.request_id} is older than 14 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $40.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $40. Please review.\"\n stop \"over refund limit\"\n }\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00100", "domain": "bookstore", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $20 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy BookstoreRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $225 per day\n refund without approval up to $20\n limit sends 50 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure BookstoreRefunds {\n about \"Handle refund requests within limits\"\n policy BookstoreRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $20.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 1 day else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 1 day else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00101", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 5 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. I need to OK every message. Don't mention the private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 5 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00102", "domain": "bookstore", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Holds, send a welcome note and mark them \"contacted\". Wait 7 days. If by then they're marked \"ready\" or \"expired\", stop. Otherwise send one check-in message. I need to OK every message. Never include their private notes.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, status, phone_note)\n allow write Holds(status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 50 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }", "program": "procedure BookstoreFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n trigger when new row r in Holds\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the store! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 7 days\n let all = fetch Holds\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"ready\" or now_r.status == \"expired\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00103", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I need to OK every message. Keep the private notes out of the message. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 100 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the store! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 2 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00104", "domain": "bookstore", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. I want to approve each message first. Keep the private notes out of the message. No more than 50.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 150 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code RETURN20 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00105", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Keep the private notes out of the message. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 100 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer default 'there'}, come back to the store! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00106", "domain": "bookstore", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"expired\" whose held until was within that many days. Write down in my Outreach sheet how many you found, then send each one the code RETURN20. Show me the messages for approval first. Keep the private notes out of the message. No more than 100.", "policy": "policy BookstorePolicy {\n allow read Holds(customer, email, held_until, status, phone_note)\n allow contact Holds.email\n deny reveal Holds.phone_note\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure BookstoreOutreachCampaign {\n about \"On request, contact recent expired customers\"\n policy BookstorePolicy\n sheet Holds \"Holds\" { customer: Text, email: Email, held_until: Date, status: Text, prepaid: Money, phone_note: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Holds\n let targets = filter all where status == \"expired\" and days_between(held_until, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the store! Use code RETURN20 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00107", "domain": "yoga", "pattern": "followup", "batch": false, "sop": "Every Monday at 11am, look for students marked \"paused\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"followed-up\". Keep the injury notes out of the message.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every monday at 11:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 3 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n for each r in recent up to 20 {\n let m = draft email to r.email subject \"Let's find a new time\": \"Hi {r.name}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00108", "domain": "yoga", "pattern": "followup", "batch": true, "sop": "Daily at 9am, look for students marked \"paused\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I need to OK every message. Mark each one \"followed-up\". Don't mention the injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status)\n allow write Passes(status)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 50 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 40 preview 5\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaPausedFollowUp {\n about \"Follow up with students marked paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 09:00\n\n let all = fetch Passes\n let recent = filter all where status == \"paused\" and days_between(expires_on, today()) <= 3 and days_between(expires_on, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students to follow up: {n}\"\n let msgs = draft each r in recent up to 40 email to r.email subject \"Let's find a new time\": \"Hi {r.name default 'there'}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n for each r in recent up to 40 {\n update r set status = \"followed-up\"\n }\n}"} | |
| {"id": "valid-00109", "domain": "yoga", "pattern": "lapsed", "batch": false, "sop": "Every day at 11am, find students whose expires on was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 10. Send a friendly note inviting them back. Nothing goes out until I've approved it. Never include their injury notes.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaWinBack {\n about \"Nudge students whose class pass was long ago\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let old = filter all where days_between(expires_on, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by expires_on first 10\n for each r in oldest up to 10 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.name default 'there'}, it's been a while! We'd love to see you again at the studio.\"\n let ok = request approval of m from owner timeout 1 day else skip\n send ok\n }\n}"} | |
| {"id": "valid-00110", "domain": "yoga", "pattern": "summary", "batch": false, "sop": "Daily at 11am, count the students in Passes whose status is \"paused\" and the total credit, and send the numbers to me only. Don't message any students. If there are none, don't bother me.", "policy": "policy YogaPolicy {\n allow read Passes(status, credit, name, email, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }", "program": "procedure YogaDailySummary {\n about \"Tell the owner how many students are paused\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n trigger every day at 11:00\n\n let all = fetch Passes\n let these = filter all where status == \"paused\"\n let n = summarize count of these\n let total = summarize sum credit of these\n if n == 0 {\n stop \"no paused students\"\n }\n notify owner \"Paused students: {n}, total credit: {total}\"\n}"} | |
| {"id": "valid-00111", "domain": "yoga", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find students marked \"expired\" whose expires on was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I need to OK every message. Never include their injury notes. No more than 100.", "policy": "policy YogaPolicy {\n allow read Passes(name, email, expires_on, status, injury_notes)\n allow contact Passes.email\n deny reveal Passes.injury_notes\n limit sends 150 per day\n send only between 08:00 and 18:00\n approval batch valid 1 hour max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure YogaOutreachCampaign {\n about \"On request, contact recent expired students\"\n policy YogaPolicy\n sheet Passes \"Passes\" { name: Text, email: Email, expires_on: Date, status: Text, credit: Money, injury_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Passes\n let targets = filter all where status == \"expired\" and days_between(expires_on, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.name default 'there'}, come back to the studio! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 2 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00112", "domain": "petgroomer", "pattern": "followup", "batch": true, "sop": "Each day at 5:30pm, look for pet owners marked \"no-show\" in the last 3 days. If there are none, stop. Otherwise tell me how many, then send each one a note offering a new time. I want to approve each message first. Mark each one \"contacted\". Never include their behavior notes.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow write Grooms(status)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 09:00 and 21:00\n approval batch valid 2 hours max 30 preview 5\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }", "program": "procedure PetgroomerNoShowFollowUp {\n about \"Follow up with pet owners marked no-show\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n trigger every day at 17:30\n\n let all = fetch Grooms\n let recent = filter all where status == \"no-show\" and days_between(appointment, today()) <= 3 and days_between(appointment, today()) >= 0\n let n = summarize count of recent\n if n == 0 {\n stop \"no no-show pet owners\"\n }\n notify owner \"No-show pet owners to follow up: {n}\"\n let msgs = draft each r in recent up to 30 sms to r.phone: \"Hi {r.owner}, we're sorry we missed you. Reply to set up a new time.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n for each r in recent up to 30 {\n update r set status = \"contacted\"\n }\n}"} | |
| {"id": "valid-00113", "domain": "petgroomer", "pattern": "outreach", "batch": false, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Show me the messages for approval first. Keep the behavior notes out of the message. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 50 per day\n send only between 08:00 and 20:00\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n for each r in targets up to 50 {\n let m = draft sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00114", "domain": "petgroomer", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find pet owners marked \"cancelled\" whose appointment was within that many days. Write down in my Outreach sheet how many you found, then send each one the code COMEBACK15. Let me check the messages before they go out. Keep the behavior notes out of the message. No more than 50.", "policy": "policy PetgroomerPolicy {\n allow read Grooms(owner, phone, appointment, status, behavior_notes)\n allow contact Grooms.phone\n deny reveal Grooms.behavior_notes\n limit sends 200 per day\n send only between 08:00 and 20:00\n approval batch valid 1 hour max 50 preview 5\n allow append Outreach\n}", "sheets": "sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PetgroomerOutreachCampaign {\n about \"On request, contact recent cancelled pet owners\"\n policy PetgroomerPolicy\n sheet Grooms \"Grooms\" { owner: Text, phone: Phone, appointment: DateTime, status: Text, price: Money, behavior_notes: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Grooms\n let targets = filter all where status == \"cancelled\" and days_between(appointment, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 50 sms to r.phone: \"Hi {r.owner default 'there'}, come back to the salon! Use code COMEBACK15 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 1 day else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00115", "domain": "printshop", "pattern": "reminder", "batch": false, "sop": "Daily at 10am, find every customer in the Jobs sheet whose print job is in a week and whose status is \"queued\". Send each one a email reminder. I need to OK every message. Keep the file link out of the message. At most 50 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 7 days and status == \"queued\"\n for each r in due up to 50 {\n let m = draft email to r.email subject \"Your print job in a week\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is in a week.\"\n let ok = request approval of m from owner timeout 12 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00116", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "Every day at 10am, find every customer in the Jobs sheet whose print job is in three days and whose status is \"queued\". Send each one a email reminder. Let me check the messages before they go out. Then mark them notified. Never include their file link. At most 20 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 08:00 and 18:00\n approval batch valid 2 hours max 20 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 10:00\n\n let all = fetch Jobs\n let due = filter all where due == today() + 3 days and status == \"queued\"\n let msgs = draft each r in due up to 20 email to r.email subject \"Your print job in three days\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is in three days.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n for each r in due up to 20 {\n update r set status = \"notified\"\n }\n}"} | |
| {"id": "valid-00117", "domain": "printshop", "pattern": "reminder", "batch": true, "sop": "Daily at 5:30pm, find every customer in the Jobs sheet whose print job is tomorrow and whose status is \"queued\". Send each one a email reminder. I want to approve each message first. Keep the file link out of the message. At most 100 per run.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 150 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 100 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopPrintJobReminders {\n about \"Remind each customer about their print job\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 17:30\n\n let all = fetch Jobs\n let due = filter all where due == today() + 1 day and status == \"queued\"\n let msgs = draft each r in due up to 100 email to r.email subject \"Your print job tomorrow\": \"Hi {r.customer default 'there'}, a reminder from the shop: your print job is tomorrow.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00118", "domain": "printshop", "pattern": "lapsed", "batch": false, "sop": "Every day at 11am, find customers whose due was at least 90 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 20. Send a friendly note inviting them back. Nothing goes out until I've approved it. Don't mention the file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every day at 11:00\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 90 and status != \"cancelled\"\n let oldest = sort old by due first 20\n for each r in oldest up to 20 {\n let m = draft email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request approval of m from owner timeout 6 hours else skip\n send ok\n }\n}"} | |
| {"id": "valid-00119", "domain": "printshop", "pattern": "lapsed", "batch": true, "sop": "Each Thursday at 8:30am, find customers whose due was at least 30 days ago, skipping anyone marked \"cancelled\". Start with the oldest and contact at most 15. Send a friendly note inviting them back. I want to approve each message first. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 20:00\n approval batch valid 2 hours max 15 preview 5\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopWinBack {\n about \"Nudge customers whose print job was long ago\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Jobs\n let old = filter all where days_between(due, today()) >= 30 and status != \"cancelled\"\n let oldest = sort old by due first 15\n let msgs = draft each r in oldest up to 15 email to r.email subject \"We miss you\": \"Hi {r.customer default 'there'}, it's been a while! We'd love to see you again at the shop.\"\n let ok = request batch approval of msgs from owner timeout 6 hours else stop \"batch not approved\"\n send ok\n}"} | |
| {"id": "valid-00120", "domain": "printshop", "pattern": "summary", "batch": false, "sop": "Every Thursday at 8:30am, count the customers in Jobs whose status is \"queued\" and the total quote, and send the numbers to me only. Don't message any customers. If there are none, don't bother me.", "policy": "policy PrintshopPolicy {\n allow read Jobs(status, quote, customer, email, file_link)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 50 per day\n send only between 08:00 and 18:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopDailySummary {\n about \"Tell the owner how many customers are queued\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger every thursday at 08:30\n\n let all = fetch Jobs\n let these = filter all where status == \"queued\"\n let n = summarize count of these\n let total = summarize sum quote of these\n if n == 0 {\n stop \"no queued customers\"\n }\n notify owner \"Queued customers: {n}, total quote: {total}\"\n}"} | |
| {"id": "valid-00121", "domain": "printshop", "pattern": "refund", "batch": false, "sop": "When a new refund request is added, check it. If the purchase was more than 30 days ago, tell me and stop. If it's over $75, I'll handle it myself. Refunds of $10 or less can go through without me; anything bigger needs my OK. After refunding, mark it refunded and let the customer know (I approve that message too).", "policy": "policy PrintshopRefundPolicy {\n allow read RefundRequests(request_id, customer, email, amount, purchased)\n allow write RefundRequests(status)\n allow contact RefundRequests.email\n limit refund $75 per action\n limit refund $375 per day\n refund without approval up to $10\n limit sends 80 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }", "program": "procedure PrintshopRefunds {\n about \"Handle refund requests within limits\"\n policy PrintshopRefundPolicy\n sheet RefundRequests \"RefundRequests\" { request_id: Text, customer: Text, email: Email, amount: Money, purchased: Date, status: Text }\n trigger when new row r in RefundRequests\n\n if days_between(r.purchased, today()) > 30 {\n notify owner \"Refund request {r.request_id} is older than 30 days.\"\n stop \"outside refund window\"\n }\n if r.amount > $75.00 {\n notify owner \"Refund request {r.request_id} is {r.amount}, over $75. Please review.\"\n stop \"over refund limit\"\n }\n if r.amount <= $10.00 {\n refund r.amount for r.request_id reason \"refund request\"\n } else {\n refund r.amount for r.request_id reason \"refund request\", ask owner first timeout 12 hours else stop \"refund not approved\"\n }\n update r set status = \"refunded\"\n let m = draft email to r.email subject \"Your refund\": \"Hi {r.customer default 'there'}, your refund of {r.amount} has been issued.\"\n let ok = request approval of m from owner timeout 12 hours else stop \"message not approved\"\n send ok\n}"} | |
| {"id": "valid-00122", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. I want to approve each message first. Keep the file link out of the message.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 09:00 and 21:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 2 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 2 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00123", "domain": "printshop", "pattern": "wait_followup", "batch": false, "sop": "When a new customer is added to Jobs, send a welcome note and mark them \"contacted\". Wait 3 days. If by then they're marked \"printed\" or \"cancelled\", stop. Otherwise send one check-in message. I need to OK every message. Never include their file link.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, status)\n allow write Jobs(status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 200 per day\n send only between 07:30 and 19:00\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }", "program": "procedure PrintshopFollowUpAfterWait {\n about \"Contact a new customer, then follow up once\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n trigger when new row r in Jobs\n\n let first = draft email to r.email subject \"Welcome\": \"Hi {r.customer default 'there'}, thanks for choosing the shop! Reply with any questions.\"\n let ok1 = request approval of first from owner timeout 12 hours else stop \"first message not approved\"\n send ok1\n update r set status = \"contacted\"\n wait 3 days\n let all = fetch Jobs\n let now_r = find all where email == r.email else stop \"row was removed\"\n if now_r.status == \"printed\" or now_r.status == \"cancelled\" {\n stop \"already handled\"\n }\n let second = draft email to now_r.email subject \"Checking in\": \"Hi {now_r.customer default 'there'}, just checking in. Is there anything we can help with?\"\n let ok2 = request approval of second from owner timeout 12 hours else stop \"follow-up not approved\"\n send ok2\n}"} | |
| {"id": "valid-00124", "domain": "printshop", "pattern": "outreach", "batch": true, "sop": "When I ask, and give a number of days, find customers marked \"cancelled\" whose due was within that many days. Write down in my Outreach sheet how many you found, then send each one the code WELCOME10. I want to approve each message first. Don't mention the file link. No more than 100.", "policy": "policy PrintshopPolicy {\n allow read Jobs(customer, email, due, status)\n allow contact Jobs.email\n deny reveal Jobs.file_link\n limit sends 100 per day\n send only between 07:30 and 19:00\n approval batch valid 2 hours max 100 preview 5\n allow append Outreach\n}", "sheets": "sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\nsheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }", "program": "procedure PrintshopOutreachCampaign {\n about \"On request, contact recent cancelled customers\"\n policy PrintshopPolicy\n sheet Jobs \"Jobs\" { customer: Text, email: Email, due: Date, status: Text, quote: Money, file_link: Text private }\n sheet Outreach \"Outreach\" { day: Date, campaign: Text, targeted: Number }\n trigger when requested(days: Number)\n\n let all = fetch Jobs\n let targets = filter all where status == \"cancelled\" and days_between(due, today()) <= days\n let n = summarize count of targets\n append Outreach { day: today(), campaign: \"comeback\", targeted: n }\n let msgs = draft each r in targets up to 100 email to r.email subject \"We'd love to see you\": \"Hi {r.customer}, come back to the shop! Use code WELCOME10 on your next visit.\"\n let ok = request batch approval of msgs from owner timeout 12 hours else stop \"batch not approved\"\n send ok\n}"} | |