From 28a368326d1bdaa63573e7094c3c64182da78cc6 Mon Sep 17 00:00:00 2001 From: KS Jannette Date: Wed, 18 Feb 2026 06:21:04 -0500 Subject: [PATCH] more --- src/index.ts | 16 +++++++++++++++- src/prompts/take-action-on-emails.txt | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 1fc3650..9b0a473 100644 --- a/src/index.ts +++ b/src/index.ts @@ -740,10 +740,24 @@ server.registerTool( }, async ({ account, title, startDateTime, durationMinutes, description, location }) => { try { + const start = new Date(startDateTime); + + if (start.getTime() < Date.now()) { + return { + content: [ + { + type: "text" as const, + text: + `Skipped calendar event "${title}" — the proposed date ` + + `(${start.toISOString()}) is in the past.`, + }, + ], + }; + } + const calendar = getCalendarClient(account); const calendarId = getCalendarId(account); - const start = new Date(startDateTime); const end = new Date(start.getTime() + (durationMinutes ?? 60) * 60_000); const event = await calendar.events.insert({ diff --git a/src/prompts/take-action-on-emails.txt b/src/prompts/take-action-on-emails.txt index 0667650..c22bbe3 100644 --- a/src/prompts/take-action-on-emails.txt +++ b/src/prompts/take-action-on-emails.txt @@ -38,6 +38,7 @@ When an email indicates advancement beyond the recruiter screen to a company int STRICT CONSTRAINTS: - Do not make up phone numbers, links, dates, or anything at all. If it does not exist in text wihtin a verifiable email, IT DOES NOT EXIST. +- PAST-DATE CHECK: Before creating a calendar event, compare the proposed meeting date/time against today's date. If the meeting date has already passed, do NOT create a calendar event for it. Still log it to the spreadsheet, but skip the calendar step. The tool will also enforce this server-side. - As described in more detail below, each new date/time value in a scheduling column = one new calendar event. Never skip this. - Always use the same account for calendar events as was used for email fetching. - Do not create duplicate calendar events for the same meeting.