diff --git a/apps/events/CHANGELOG.md b/apps/events/CHANGELOG.md
index bf29906..e3cda04 100644
--- a/apps/events/CHANGELOG.md
+++ b/apps/events/CHANGELOG.md
@@ -33,6 +33,22 @@ and this project follows [Semantic Versioning](https://semver.org/).
phone numbers and ID numbers in what's sent are swapped for placeholders and put back in the
answer, so they never leave the site. Two checks are worked out in code as well as by the AI: a
weekday that doesn't match its date, and costs a full event can't cover.
+- **AI buttons in the app** (only where the licence has AI; supervisors and admins):
+ - New event → **Describe your event**: a few sentences fill in the form (details, dates, tickets,
+ early bird; course dates as sessions), with the checks and a budget from the notes to look at
+ first. Nothing changes until "Fill in the form".
+ - **Improve / Shorter / Fix mistakes** under the event description, the site banner, and the
+ email and WhatsApp message boxes; the suggestion replaces the text only with "Use this".
+ - **Draft with AI** in Email attendees and WhatsApp attendees: a short note becomes the email's
+ subject and body, or the WhatsApp message, with `{{name}}` and the event's details.
+ - **Summarise this report** on reports without people in them, and **Summarise feedback** per
+ event on the Feedback summary report.
+ - Every suggestion says "AI suggestion — check it before saving".
+- **Privacy notice:** the built-in text says how the AI helpers use information and where requests
+ go (sections 4 and 9). Sites with their own published notice see the change in the notice
+ editor.
+- `npm run ai:eval` (backend): the helpers' eval set — fixed examples run through the site's Hub
+ connection, with automatic checks on the facts and every answer printed to read.
## [1.51.17] - 2026-10-30 — security release
diff --git a/apps/events/backend/package.json b/apps/events/backend/package.json
index 970b39e..6941722 100644
--- a/apps/events/backend/package.json
+++ b/apps/events/backend/package.json
@@ -17,7 +17,8 @@
"set-demo": "node scripts/set-demo.js",
"build": "tsc -p tsconfig.json && node -e \"require('fs').writeFileSync('dist/build.json', JSON.stringify({ version: require('./package.json').version, builtAt: new Date().toISOString() }))\"",
"typecheck": "tsc -p tsconfig.json --noEmit",
- "openapi": "tsx scripts/openapi.ts"
+ "openapi": "tsx scripts/openapi.ts",
+ "ai:eval": "tsx scripts/ai-eval.ts"
},
"dependencies": {
"@cj-tech-master/excelts": "^10.2.0",
diff --git a/apps/events/backend/scripts/ai-eval.ts b/apps/events/backend/scripts/ai-eval.ts
new file mode 100644
index 0000000..c1b3549
--- /dev/null
+++ b/apps/events/backend/scripts/ai-eval.ts
@@ -0,0 +1,167 @@
+/**
+ * The AI helpers' eval set (roadmap §15): `npm run ai:eval` in backend/.
+ *
+ * Runs fixed examples of all five helpers through this site's real Hub connection (so the site must
+ * be connected and its licence must have an AI allowance), checks the facts that matter
+ * automatically, and prints every answer for a person to read. Run it after changing a helper's
+ * instructions or the model on the Hub, and compare with the last run. It costs about R1 a run
+ * with Claude Sonnet 5.5; the calls count against this site's allowance.
+ *
+ * The examples come from the October 2026 model trial; the inputs are made up and hold no
+ * personal information.
+ */
+import { prisma } from '../src/v2/legacy';
+import { draftEvent, summariseReport, draftMessage, summariseFeedback, improveText } from '../src/ai/helpers';
+
+type Check = [label: string, ok: boolean];
+type Case = { name: string; run: (userId: string) => Promise<{ output: unknown; checks: Check[] }> };
+
+const has = (text: unknown, re: RegExp) => re.test(JSON.stringify(text));
+const near = (n: number, target: number, give = 1) => Math.abs(n - target) <= give;
+
+const CAMP_NOTES = 'Youth camp for grades 8–12, Fri 14 March 18:00 to Sun 16 March 14:00 at Camp Wartburg near Pietermaritzburg. 60 places. R450 per person, R400 if they book by 31 January. Parents must give consent. Theme "Rooted" (Colossians 2:7). Costs: venue R180 per person per night including meals, bus hire R6 500 return, speaker gift R1 000, T-shirts R95 each. Friday evening worship, Saturday sessions morning and evening with sport in the afternoon, Sunday morning service before we leave. Bring a sleeping bag, Bible and a torch.';
+
+const FEEDBACK_COMMENTS = [
+ 'The keynote on Saturday morning was exactly what I needed this year.', 'Could not hear a thing in Hall B, the sound kept cutting out.',
+ 'Lunch queue took 40 minutes, we missed the start of the afternoon session.', 'Loved the worship, so good to be together again.',
+ 'Breakouts were too short, just as it got deep we had to leave.', 'Check-in with the QR code was so quick, well done.',
+ 'Parking was a nightmare, we parked on the road and walked.', 'Please have childcare next year, I almost could not come.',
+ 'Speaker in the parenting breakout was brilliant.', 'Sound in Hall B again, the mic was crackling the whole time.',
+ 'Food ran out of vegetarian options by the time we got there.', 'The whole day felt so well organised.',
+ 'More time for breakouts please, and maybe fewer of them.', 'Lunch took forever.', 'Loved the gift bags!',
+ 'Hall A was freezing, the aircon was too cold.', 'The app reminders the day before were really helpful.',
+ 'Would love a longer Q&A with the main speaker.', 'Queue for lunch was very long, maybe stagger the breakouts?',
+ 'Parking marshals would help a lot.', 'Worship team was amazing.', 'Childcare or a kids programme would let young moms come.',
+ 'Some of the slides were hard to read from the back.', 'Best conference yet, thank you to the whole team.',
+ 'I would pay a bit more for a better lunch.', 'Hall B sound please fix it.',
+];
+
+const CASES: Case[] = [
+ {
+ name: 'Draft an event — full notes with costs',
+ async run(userId) {
+ const r = await draftEvent(userId, CAMP_NOTES);
+ const d = r.draft;
+ return {
+ output: r,
+ checks: [
+ ['price R450, early bird R400 until 31 January', d.ticketOptions[0]?.priceRand === 450 && d.ticketOptions[0]?.earlyBirdPriceRand === 400 && d.ticketOptions[0]?.earlyBirdUntil.endsWith('-01-31')],
+ ['60 places, parental consent', d.capacity === 60 && d.needsParentalConsent],
+ ['budget R34 800, break-even 78', r.totalCostRand === 34800 && r.breakEvenPlaces === 78],
+ ['warns the camp is short even when full', r.warnings.some(w => w.includes('short'))],
+ ['times not in the notes left empty (only 18:00 and 14:00 given)', d.sessions.every(s => !s.startTime || s.startTime === '18:00')],
+ ],
+ };
+ },
+ },
+ {
+ name: 'Summarise a report — a month of payments',
+ async run(userId) {
+ const { summary } = await summariseReport(userId, {
+ reportKey: 'revenue', title: 'Revenue summary — October 2026 (September for comparison)',
+ columns: ['Method', 'October payments', 'October amount', 'September payments', 'September amount'],
+ rows: [['Card', 96, 'R42 300', 81, 'R35 100'], ['EFT', 14, 'R18 000', 17, 'R21 500'], ['Cash at the door', 31, 'R6 250', 22, 'R4 100'], ['Refunds', 4, 'R2 700', 2, 'R450']],
+ stats: [{ label: 'Card payments waiting for the provider over 2 days', value: '3 (R1 350)' }],
+ });
+ return {
+ output: summary,
+ checks: [
+ ['October total R66 550', has(summary, /66[\s ]?550/)],
+ ['up on September (R60 700)', has(summary, /60[\s ]?700|5[\s ]?850|9[.,]6/)],
+ ['the 3 waiting card payments need checking', has(summary.watchOut, /1[\s ]?350|3 (online |card )?payments/i)],
+ ],
+ };
+ },
+ },
+ {
+ name: 'Summarise feedback — women\'s conference',
+ async run(userId) {
+ const { summary } = await summariseFeedback(userId, {
+ event: { title: 'Women\'s Conference 2026' }, responses: 112, invited: 186,
+ questions: [
+ { label: 'Overall', type: 'rating', answered: 112, average: 4.4 }, { label: 'Venue', type: 'rating', answered: 110, average: 3.9 },
+ { label: 'Food', type: 'rating', answered: 108, average: 3.6 }, { label: 'Comments', type: 'text', answered: FEEDBACK_COMMENTS.length, texts: FEEDBACK_COMMENTS },
+ ],
+ });
+ const count = (re: RegExp) => summary.improve.find(t => re.test(t.theme))?.mentions ?? -1;
+ return {
+ output: summary,
+ checks: [
+ ['lunch/food raised by about 5', near(count(/lunch|food|queue/i), 5)],
+ ['Hall B sound raised by 3', near(count(/sound|hall b/i), 3, 0)],
+ ['quotes copied exactly', summary.quotes.every(q => FEEDBACK_COMMENTS.includes(q))],
+ ],
+ };
+ },
+ },
+ {
+ name: 'Draft a message — WhatsApp reminder',
+ async run(userId) {
+ const { message } = await draftMessage(userId, { channel: 'whatsapp', note: 'Youth camp this weekend: remind them to bring a sleeping bag; the bus leaves at 7:30 on Friday from the church car park.' });
+ return {
+ output: message,
+ checks: [
+ ['uses {{name}}', message.body.includes('{{name}}')],
+ ['keeps 7:30, sleeping bag, car park', /7:30/.test(message.body) && /sleeping bag/i.test(message.body) && /car park/i.test(message.body)],
+ ['no "reminda" (seen with Haiku)', !/reminda/i.test(message.body)],
+ ],
+ };
+ },
+ },
+ {
+ name: 'Draft a message — email about a venue change',
+ async run(userId) {
+ const { message } = await draftMessage(userId, { channel: 'email', note: 'Men\'s breakfast this Saturday is moving from the church hall to the Protea Hotel on Main Road because the hall is being renovated. Same time, 7:00. Park at the back of the hotel. Price stays R120, nothing to do if you\'ve paid. Speaker is still Pastor Mike. Questions: events@church.example.org' });
+ return {
+ output: message,
+ checks: [
+ ['has a subject', message.subject.trim().length > 5],
+ ['keeps the facts', /Protea/.test(message.body) && /7:00/.test(message.body) && /R120/.test(message.body)],
+ ['the email address came back intact', message.body.includes('events@church.example.org')],
+ ],
+ };
+ },
+ },
+ {
+ name: 'Improve this text — a messy description',
+ async run(userId) {
+ const { result } = await improveText(userId, { text: 'join us for are anual family fun day!!! theres jumping castles, food stalls and a talent show for the kids. Bring the hole family its going to be awesome. tickets R50 for adults kids under 12 free. starts 9 till 2 on the church field, if it rains we move inside to the hall. please register so we know how many boerewors rolls to make lol', mode: 'improve', where: 'description' });
+ return {
+ output: result,
+ checks: [
+ ['spelling fixed', /annual/i.test(result.text) && /whole family/i.test(result.text) && !/\bare anual\b/.test(result.text)],
+ ['every fact kept (R50, under 12, 9 to 2, hall)', /R50/.test(result.text) && /12/.test(result.text) && /\b9\b/.test(result.text) && /\b2\b/.test(result.text) && /hall/i.test(result.text)],
+ ],
+ };
+ },
+ },
+];
+
+(async () => {
+ const admin = await prisma.user.findFirst({ where: { role: 'admin', isActive: true }, select: { id: true } });
+ if (!admin) throw new Error('No active admin to log the calls against.');
+ let passed = 0;
+ let total = 0;
+ for (const c of CASES) {
+ console.log(`\n━━ ${c.name}`);
+ try {
+ const { output, checks } = await c.run(admin.id);
+ for (const [label, ok] of checks) {
+ total++;
+ if (ok) passed++;
+ console.log(` ${ok ? '✓' : '✗'} ${label}`);
+ }
+ console.log(JSON.stringify(output, null, 2).split('\n').map(l => ` ${l}`).join('\n'));
+ } catch (e) {
+ total++;
+ console.log(` ✗ failed: ${(e as Error).message}`);
+ }
+ }
+ console.log(`\n${passed} of ${total} checks passed. Read the answers too: the checks only cover the facts.`);
+ await prisma.$disconnect();
+ process.exit(passed === total ? 0 : 1);
+})().catch(async e => {
+ console.error(e);
+ await prisma.$disconnect();
+ process.exit(1);
+});
diff --git a/apps/events/backend/src/utils/privacyNotice.js b/apps/events/backend/src/utils/privacyNotice.js
index 155e01e..c22dc20 100644
--- a/apps/events/backend/src/utils/privacyNotice.js
+++ b/apps/events/backend/src/utils/privacyNotice.js
@@ -96,6 +96,7 @@ const DEFAULT_SECTIONS = [
'• Tell you when a new event in a series you follow comes out. This counts as news, so it\'s only sent if you get news and announcements.',
'• Offer places from a waitlist, arrange rooms and groups, and ask for parental consent on youth events.',
'• Send you an optional feedback form after an event, with one reminder.',
+ '• If we use the AI helpers: our staff can ask an AI service to help draft event details and messages, improve text, and summarise reports and event feedback. A person checks every suggestion before anything is saved or sent. Only what a task needs is sent — never your name, contact details, or medical or children\'s information — and feedback comments are sent without who wrote them (see section 9).',
'• Manage user accounts and event attendance records, and give support when you ask for help.',
'• Improve our events and website (using anonymous statistics, and only with your permission).',
'• Comply with legal obligations.',
@@ -166,6 +167,7 @@ const DEFAULT_SECTIONS = [
'We do not sell or rent your personal information. Outside our organisation, it is shared only with these service providers ("operators"), each only for its purpose:',
'{operators}',
'• Anyone we are required to share it with under South African law.',
+ 'If we use the AI helpers, requests go through our software provider\'s service to Anthropic (the Claude AI service) in the United States, which is listed above. Our software provider does not keep what was sent. Anthropic handles it under its commercial terms, which do not allow it to be used to train AI; it may be kept for a short time for safety checks. Because this is outside South Africa, it is only done under the protections POPIA requires for such transfers.',
'If we connect another system — for example our church-management software — through a webhook, it is listed above with what it receives. It gets only the updates we chose (such as new registrations, payments and check-ins), and never children\'s details from kids check-in.',
'Within our organisation, people see only what they need:',
"• Door staff see a ticket's holder name, ticket type and check-in status when scanning.",
@@ -279,6 +281,14 @@ const BUILT_IN_UPDATES = [
],
sections: ['summary', 'information', 'use', 'whatsapp', 'retention', 'sharing', 'cookies', 'changes'],
},
+ {
+ revision: '2.0.0',
+ summary: [
+ 'AI helpers: staff can ask an AI service (Anthropic\'s Claude, through the software provider) to draft events and messages, improve text and summarise reports and feedback; a person checks every suggestion, and no names, contact details, medical or children\'s information are sent.',
+ 'Where AI requests go (the United States), that the provider doesn\'t keep them, and that they aren\'t used to train AI.',
+ ],
+ sections: ['use', 'sharing'],
+ },
];
const BUILT_IN_REVISION = BUILT_IN_UPDATES[BUILT_IN_UPDATES.length - 1].revision;
const REVIEWED_KEY = 'privacy_notice_builtin_reviewed';
diff --git a/apps/events/frontend/src/app/dashboard/supervisor/email-attendees/page.tsx b/apps/events/frontend/src/app/dashboard/supervisor/email-attendees/page.tsx
index 75a62bf..1c3bda0 100644
--- a/apps/events/frontend/src/app/dashboard/supervisor/email-attendees/page.tsx
+++ b/apps/events/frontend/src/app/dashboard/supervisor/email-attendees/page.tsx
@@ -14,6 +14,8 @@ import { MessageKindPicker, matchedText, type MessageKind } from "@/components/s
import { CampusAudiencePicker } from "@/components/shared/CampusAudiencePicker";
import { EventPicker } from "@/components/shared/EventPicker";
import { apiV2Data } from "@/lib/apiV2";
+import { AiDraftMessage } from "@/components/shared/AiDraftMessage";
+import { AiImprove } from "@/components/shared/AiImprove";
type Attendee = { id: string; name: string; email: string; pref: string };
type TemplateKey = 'custom'|'payment_reminder'|'event_reminder'|'tickets';
@@ -614,9 +616,13 @@ function EmailAttendeesPageInner() {
{templateKey !== 'tickets' ? (
diff --git a/apps/events/frontend/src/app/set-banner/page.tsx b/apps/events/frontend/src/app/set-banner/page.tsx
index adefba6..ccf140f 100644
--- a/apps/events/frontend/src/app/set-banner/page.tsx
+++ b/apps/events/frontend/src/app/set-banner/page.tsx
@@ -6,6 +6,7 @@ import { useRouter } from "next/navigation";
import { Megaphone } from "lucide-react";
import { errorMessage } from "@/lib/utils";
import { apiV2Data } from "@/lib/apiV2";
+import { AiImprove } from "@/components/shared/AiImprove";
type BannerType = "info" | "warning" | "success" | "danger";
@@ -124,6 +125,7 @@ export default function SetBannerPage() {
value={message}
onChange={e => setMessage(e.target.value)}
/>
+
diff --git a/apps/events/frontend/src/components/events/AiEventDraft.tsx b/apps/events/frontend/src/components/events/AiEventDraft.tsx
new file mode 100644
index 0000000..99d1163
--- /dev/null
+++ b/apps/events/frontend/src/components/events/AiEventDraft.tsx
@@ -0,0 +1,107 @@
+"use client";
+
+import React, { useId, useState } from "react";
+import { AlertTriangle, Sparkles } from "lucide-react";
+import { useAuth } from "@/hooks/useAuth";
+import { useAiStatus } from "@/hooks/useAiStatus";
+import { runAi } from "@/lib/ai";
+import type { V2Result } from "@/lib/apiV2";
+import { errorMessage } from "@/lib/utils";
+import { AiButton, AiNotice } from "@/components/shared/AiButton";
+
+export type AiEventDraftResult = V2Result<"/ai/draft-event", "post">["data"]["output"];
+export type AiEventDraftFields = AiEventDraftResult["draft"];
+
+const money = (n: number) => `R${Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ")}`;
+
+/**
+ * "Describe your event": a few sentences in, the event form filled in (after a person checks the
+ * suggestion). Hidden on sites without AI. The budget from the notes is shown, not saved — costs
+ * are entered on the event by admins.
+ */
+export function AiEventDraft({ onApply }: { onApply: (draft: AiEventDraftFields) => void }) {
+ const { token } = useAuth();
+ const status = useAiStatus();
+ const notesId = useId();
+ const [notes, setNotes] = useState("");
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState(null);
+ const [result, setResult] = useState(null);
+ if (!status?.enabled) return null;
+
+ const run = async () => {
+ if (!token || notes.trim().length < 10) { setError("Describe the event in a sentence or two first."); return; }
+ setBusy(true);
+ setError(null);
+ try {
+ setResult(await runAi("draft_event", { notes }, token));
+ } catch (e) { setError(errorMessage(e) || "The AI couldn't draft this event."); }
+ setBusy(false);
+ };
+
+ const d = result?.draft;
+ const checks = result ? [...result.warnings, ...d!.checks] : [];
+ return (
+
+
+
+ );
+}
diff --git a/apps/events/frontend/src/components/reports/AiFeedbackSummary.tsx b/apps/events/frontend/src/components/reports/AiFeedbackSummary.tsx
new file mode 100644
index 0000000..ab1fe29
--- /dev/null
+++ b/apps/events/frontend/src/components/reports/AiFeedbackSummary.tsx
@@ -0,0 +1,71 @@
+"use client";
+
+import React, { useState } from "react";
+import { useAuth } from "@/hooks/useAuth";
+import { useAiStatus } from "@/hooks/useAiStatus";
+import { runAi } from "@/lib/ai";
+import type { V2Result } from "@/lib/apiV2";
+import { errorMessage } from "@/lib/utils";
+import { AiButton, AiNotice } from "@/components/shared/AiButton";
+
+type Summary = V2Result<"/ai/summarise-feedback", "post">["data"]["output"];
+
+const Themes = ({ title, list }: { title: string; list: { theme: string; mentions: number }[] }) => (
+
+
{title}
+ {list.length === 0 ?
—
: (
+
+ {list.map(t =>
{t.theme}{t.mentions}
)}
+
+ )}
+
+);
+
+/**
+ * "Summarise feedback" for one event: how it went, what people liked and want improved (with how
+ * many said so), a few quotes and suggestions. The server sends the answers without who gave them
+ * and records it in the access log. Hidden on sites without AI.
+ */
+export function AiFeedbackSummary({ eventId, responses }: { eventId: string; responses: number }) {
+ const { token } = useAuth();
+ const status = useAiStatus();
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState(null);
+ const [summary, setSummary] = useState(null);
+ if (!status?.enabled || responses < 1) return null;
+
+ const run = async () => {
+ if (!token) return;
+ setBusy(true);
+ setError(null);
+ try { setSummary(await runAi("summarise_feedback", { eventId }, token)); } catch (e) { setError(errorMessage(e) || "The AI couldn't summarise this feedback."); }
+ setBusy(false);
+ };
+
+ return (
+