From 4192bb9dee7ae9fb0ca596f80da76f5a050b744a Mon Sep 17 00:00:00 2001 From: KS Jannette Date: Tue, 17 Feb 2026 13:53:48 -0500 Subject: [PATCH 1/2] more --- .gitignore | 2 +- src/index.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index b8da958..acb05ac 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ accounts.json # Runtime output summary.json -token-secondary.json +summary-secondary.json diff --git a/src/index.ts b/src/index.ts index 24a43ce..4c4bead 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,11 +54,13 @@ function getSummaryPath(account: string): string { } const VALID_ACCOUNTS = ["work", "secondary"] as const; +const accounts = loadAccounts(); +const accountDescription = VALID_ACCOUNTS + .map((key) => `"${key}" (${accounts[key]?.label ?? key})`) + .join(" or "); const accountSchema = z .enum(VALID_ACCOUNTS) - .describe( - "Which email account to use: \"work\" (sj@sjdev.co) or \"secondary\" (ken.jannette@gmail.com)" - ); + .describe(`Which email account to use: ${accountDescription}`); // --------------------------------------------------------------------------- // Load classification prompt @@ -169,7 +171,7 @@ server.registerPrompt( "review_emails", { description: - "Review WORK inbox (sj@sjdev.co): classify job application emails (A/B/C/D), delete A+C, summarize B+D.", + `Review WORK inbox (${accounts.work?.label ?? "work"}): classify job application emails (A/B/C/D), delete A+C, summarize B+D.`, }, () => { const instructions = loadClassificationPrompt(); @@ -197,7 +199,7 @@ server.registerPrompt( "review_secondary_emails", { description: - "Review SECONDARY inbox (ken.jannette@gmail.com): classify job application emails (A/B/C/D), delete A+C, summarize B+D.", + `Review SECONDARY inbox (${accounts.secondary?.label ?? "secondary"}): classify job application emails (A/B/C/D), delete A+C, summarize B+D.`, }, () => { const instructions = loadClassificationPrompt(); From 31be44a3b9c2b00a657e626dbb8d4155bf6ff277 Mon Sep 17 00:00:00 2001 From: KS Jannette Date: Tue, 17 Feb 2026 13:56:02 -0500 Subject: [PATCH 2/2] more --- src/index.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4c4bead..fe2dc36 100644 --- a/src/index.ts +++ b/src/index.ts @@ -425,15 +425,30 @@ server.registerTool( summary = JSON.parse(fs.readFileSync(summaryPath, "utf-8")); } - const now = new Date().toISOString(); + const now = new Date(); + const nowIso = now.toISOString(); const newEntries: SummaryEntry[] = entries.map((e) => ({ ...e, - addedAt: now, + addedAt: nowIso, })); summary.push(...newEntries); + + // Purge entries older than 30 days + const RETENTION_MS = 30 * 24 * 60 * 60 * 1000; + const cutoff = now.getTime() - RETENTION_MS; + const beforePurge = summary.length; + summary = summary.filter( + (entry) => new Date(entry.addedAt).getTime() >= cutoff + ); + const purged = beforePurge - summary.length; + fs.writeFileSync(summaryPath, JSON.stringify(summary, null, 2)); + const purgeNote = purged > 0 + ? `\nPurged ${purged} entry/entries older than 30 days.` + : ""; + return { content: [ { @@ -441,7 +456,8 @@ server.registerTool( text: `Appended ${newEntries.length} entry/entries to summary.\n` + `Total entries in summary: ${summary.length}\n` + - `Summary file: ${summaryPath}`, + `Summary file: ${summaryPath}` + + purgeNote, }, ], };