1 Commits

Author SHA1 Message Date
KS Jannette
d2be350c88 more 2026-02-17 13:27:50 -05:00
3 changed files with 10 additions and 28 deletions

2
.gitignore vendored
View File

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

View File

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

View File

@@ -54,13 +54,11 @@ 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: ${accountDescription}`);
.describe(
"Which email account to use: \"work\" (sj@sjdev.co) or \"secondary\" (ken.jannette@gmail.com)"
);
// ---------------------------------------------------------------------------
// Load classification prompt
@@ -171,7 +169,7 @@ server.registerPrompt(
"review_emails",
{
description:
`Review WORK inbox (${accounts.work?.label ?? "work"}): classify job application emails (A/B/C/D), delete A+C, summarize B+D.`,
"Review WORK inbox (sj@sjdev.co): classify job application emails (A/B/C/D), delete A+C, summarize B+D.",
},
() => {
const instructions = loadClassificationPrompt();
@@ -199,7 +197,7 @@ server.registerPrompt(
"review_secondary_emails",
{
description:
`Review SECONDARY inbox (${accounts.secondary?.label ?? "secondary"}): classify job application emails (A/B/C/D), delete A+C, summarize B+D.`,
"Review SECONDARY inbox (ken.jannette@gmail.com): classify job application emails (A/B/C/D), delete A+C, summarize B+D.",
},
() => {
const instructions = loadClassificationPrompt();
@@ -425,30 +423,15 @@ server.registerTool(
summary = JSON.parse(fs.readFileSync(summaryPath, "utf-8"));
}
const now = new Date();
const nowIso = now.toISOString();
const now = new Date().toISOString();
const newEntries: SummaryEntry[] = entries.map((e) => ({
...e,
addedAt: nowIso,
addedAt: now,
}));
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: [
{
@@ -456,8 +439,7 @@ server.registerTool(
text:
`Appended ${newEntries.length} entry/entries to summary.\n` +
`Total entries in summary: ${summary.length}\n` +
`Summary file: ${summaryPath}` +
purgeNote,
`Summary file: ${summaryPath}`,
},
],
};