3 Commits

Author SHA1 Message Date
KS Jannette
31be44a3b9 more 2026-02-17 13:56:02 -05:00
KS Jannette
4192bb9dee more 2026-02-17 13:53:48 -05:00
S Jannette
5c29eec50b Merge pull request #1 from kjannette/addSecondaryAccount
more
2026-02-17 13:32:52 -05:00
3 changed files with 28 additions and 10 deletions

2
.gitignore vendored
View File

@@ -9,4 +9,4 @@ accounts.json
# Runtime output # Runtime output
summary.json summary.json
token-secondary.json summary-secondary.json

View File

@@ -10,7 +10,7 @@ Infinitely mod-able. Dead simple. Privacy centric.
# Scope # Scope
## Current implementation contemplates: Claude Desktop + Local Model Context Protocol Server + Commercial SMTP Server (MX'configd properly) + your DNS-configd XXX.YYY ## Current implementation contemplates: Claude Desktop + Custom, Local Model Context Protocol Server + Commercial SMTP Server (MX'configd properly) + your DNS-configd XXX.YYY
--- ---

View File

@@ -54,11 +54,13 @@ function getSummaryPath(account: string): string {
} }
const VALID_ACCOUNTS = ["work", "secondary"] as const; 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 const accountSchema = z
.enum(VALID_ACCOUNTS) .enum(VALID_ACCOUNTS)
.describe( .describe(`Which email account to use: ${accountDescription}`);
"Which email account to use: \"work\" (sj@sjdev.co) or \"secondary\" (ken.jannette@gmail.com)"
);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Load classification prompt // Load classification prompt
@@ -169,7 +171,7 @@ server.registerPrompt(
"review_emails", "review_emails",
{ {
description: 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(); const instructions = loadClassificationPrompt();
@@ -197,7 +199,7 @@ server.registerPrompt(
"review_secondary_emails", "review_secondary_emails",
{ {
description: 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(); const instructions = loadClassificationPrompt();
@@ -423,15 +425,30 @@ server.registerTool(
summary = JSON.parse(fs.readFileSync(summaryPath, "utf-8")); 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) => ({ const newEntries: SummaryEntry[] = entries.map((e) => ({
...e, ...e,
addedAt: now, addedAt: nowIso,
})); }));
summary.push(...newEntries); 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)); fs.writeFileSync(summaryPath, JSON.stringify(summary, null, 2));
const purgeNote = purged > 0
? `\nPurged ${purged} entry/entries older than 30 days.`
: "";
return { return {
content: [ content: [
{ {
@@ -439,7 +456,8 @@ server.registerTool(
text: text:
`Appended ${newEntries.length} entry/entries to summary.\n` + `Appended ${newEntries.length} entry/entries to summary.\n` +
`Total entries in summary: ${summary.length}\n` + `Total entries in summary: ${summary.length}\n` +
`Summary file: ${summaryPath}`, `Summary file: ${summaryPath}` +
purgeNote,
}, },
], ],
}; };