Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat([issue-1994]): add opt-in daily POST reminder
Adam Eivy0b5d21a8dc7c
diff --git a/client/src/components/meatspace/post/PostDrillConfig.jsx b/client/src/components/meatspace/post/PostDrillConfig.jsxindex eef01e43ab..8b27da85e9 100644--- a/client/src/components/meatspace/post/PostDrillConfig.jsx+++ b/client/src/components/meatspace/post/PostDrillConfig.jsx@@ -1,5 +1,5 @@import { useState, useEffect } from 'react';-import { ArrowLeft, Save, Brain, TrendingUp, TrendingDown, Minus } from 'lucide-react';+import { ArrowLeft, Save, Brain, Bell, TrendingUp, TrendingDown, Minus } from 'lucide-react';import { updatePostConfig, getProviders, getPostAdaptivePreview } from '../../../services/api';import toast from '../../ui/Toast';import { filterSelectableModels, enabledApiProviderFilter } from '../../../utils/providers';@@ -304,6 +304,13 @@ export default function PostDrillConfig({ config, onSaved, onBack }) {() => config?.adaptive?.enabled === true);const [adaptivePreview, setAdaptivePreview] = useState(null);+ // Opt-in daily reminder — off by default; see server/services/meatspacePostReminder.js.+ const [reminderEnabled, setReminderEnabled] = useState(+ () => config?.reminder?.enabled === true+ );+ const [reminderTime, setReminderTime] = useState(+ () => config?.reminder?.time || '09:00'+ );const [providers, setProviders] = useState([]);const [saving, setSaving] = useState(false);@@ -386,6 +393,7 @@ export default function PostDrillConfig({ config, onSaved, onBack }) {const updated = await updatePostConfig({mentalMath: { drillTypes },adaptive: { enabled: adaptiveEnabled },+ reminder: { enabled: reminderEnabled, time: reminderTime },cognitive: {enabled: cognitiveEnabled,drillTypes: cognitiveDrillTypes@@ -426,6 +434,47 @@ export default function PostDrillConfig({ config, onSaved, onBack }) {</button></div>+ {/* Daily Reminder Section — opt-in, off by default; no LLM calls */}+ <div className="p-4 bg-port-card border border-port-border rounded-lg space-y-3">+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <Bell size={16} className="text-port-accent" />+ <h3 className="text-sm font-medium text-gray-500 uppercase tracking-wider">Daily Reminder</h3>+ </div>+ <button+ type="button"+ role="switch"+ aria-checked={reminderEnabled}+ aria-label="Daily reminder"+ onClick={() => setReminderEnabled(v => !v)}+ className={`shrink-0 w-10 h-5 rounded-full transition-colors relative ${+ reminderEnabled ? 'bg-port-accent' : 'bg-port-border'+ }`}+ >+ <div className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${+ reminderEnabled ? 'translate-x-5' : 'translate-x-0.5'+ }`} />+ </button>+ </div>+ <p className="text-xs text-gray-500">+ Off by default. When enabled, you'll get an in-app nudge at the chosen time if today's POST is still incomplete — nothing fires once you've done a session, and no AI calls are involved.+ </p>+ {reminderEnabled && (+ <div>+ <label htmlFor="postReminderTime" className="block text-xs text-gray-400 mb-1">+ Remind me at+ </label>+ <input+ id="postReminderTime"+ type="time"+ value={reminderTime}+ onChange={e => setReminderTime(e.target.value)}+ className="bg-port-bg border border-port-border rounded px-2 py-1.5 text-sm text-white focus:border-port-accent focus:outline-none"+ />+ </div>+ )}+ </div>+{/* Mental Math Section */}<div className="space-y-3"><div className="flex items-center justify-between">diff --git a/client/src/components/meatspace/post/PostDrillConfig.test.jsx b/client/src/components/meatspace/post/PostDrillConfig.test.jsxindex 5c4a1982d4..a2176c669e 100644--- a/client/src/components/meatspace/post/PostDrillConfig.test.jsx+++ b/client/src/components/meatspace/post/PostDrillConfig.test.jsx@@ -176,4 +176,31 @@ describe('PostDrillConfig', () => {await waitFor(() => expect(updatePostConfig).toHaveBeenCalled());expect(updatePostConfig.mock.calls[0][0].adaptive).toEqual({ enabled: true });});++ it('defaults the Daily Reminder toggle to off, hides the time picker, and persists off on save', async () => {+ render(<PostDrillConfig config={config} onSaved={vi.fn()} onBack={vi.fn()} />);+ const toggle = screen.getByRole('switch', { name: 'Daily reminder' });+ expect(toggle.getAttribute('aria-checked')).toBe('false');+ expect(screen.queryByLabelText('Remind me at')).toBeNull();+ fireEvent.click(screen.getByText('Save'));+ await waitFor(() => expect(updatePostConfig).toHaveBeenCalled());+ expect(updatePostConfig.mock.calls[0][0].reminder).toEqual({ enabled: false, time: '09:00' });+ });++ it('enabling the Daily Reminder reveals the time picker and persists the chosen time', async () => {+ render(<PostDrillConfig config={config} onSaved={vi.fn()} onBack={vi.fn()} />);+ fireEvent.click(screen.getByRole('switch', { name: 'Daily reminder' }));+ const timeInput = screen.getByLabelText('Remind me at');+ fireEvent.change(timeInput, { target: { value: '18:30' } });+ fireEvent.click(screen.getByText('Save'));+ await waitFor(() => expect(updatePostConfig).toHaveBeenCalled());+ expect(updatePostConfig.mock.calls[0][0].reminder).toEqual({ enabled: true, time: '18:30' });+ });++ it('reflects a saved reminder.enabled=true with its stored time', () => {+ const withReminder = { ...config, reminder: { enabled: true, time: '20:15' } };+ render(<PostDrillConfig config={withReminder} onSaved={vi.fn()} onBack={vi.fn()} />);+ expect(screen.getByRole('switch', { name: 'Daily reminder' }).getAttribute('aria-checked')).toBe('true');+ expect(screen.getByLabelText('Remind me at').value).toBe('20:15');+ });});diff --git a/server/index.js b/server/index.jsindex e042797796..e318584255 100644--- a/server/index.js+++ b/server/index.js@@ -182,6 +182,7 @@ import { startOrphanShellGc } from './services/importerOrphanGc.js';import { startImageRefsGc } from './services/imageRefsGc.js';import { initBridge as initBrainMemoryBridge } from './services/brainMemoryBridge.js';import { initDrillCache } from './services/meatspacePostDrillCache.js';+import { registerPostReminderSchedule } from './services/meatspacePostReminder.js';import { createAIToolkit } from './lib/aiToolkit/index.js';import { runMigrations } from '../scripts/run-migrations.js';import { verifyCollectionVersions } from './lib/collectionStore.js';@@ -579,6 +580,9 @@ initBrainMemoryBridge();// Load any on-disk POST drill cache into memory. Does NOT trigger LLM calls —// cache fill only happens on explicit user request (see meatspacePostRoutes.js).initDrillCache().catch(err => console.error(`❌ POST drill cache init failed: ${err.message}`));+// Register the optional daily POST reminder (opt-in, off by default) if the+// user has enabled it — deterministic cron nudge, no LLM calls.+registerPostReminderSchedule().catch(err => console.error(`❌ POST reminder init failed: ${err.message}`));// Initialize backup scheduler for daily data backupsstartBackupScheduler().catch(err => console.error(`❌ Backup scheduler init failed: ${err.message}`));// Initialize CyberCity snapshot scheduler — records periodic city-state framesdiff --git a/server/lib/postValidation.js b/server/lib/postValidation.jsindex 9d0bf78c86..73534d0953 100644--- a/server/lib/postValidation.js+++ b/server/lib/postValidation.js@@ -9,6 +9,9 @@ import { COGNITIVE_DRILL_TYPES } from '../services/meatspacePostCognitive.js';// Tags for session conditions (sleep, caffeine, stress, etc.)export const postTagsSchema = z.record(z.string().max(200));+// 24h "HH:MM" time-of-day, matches the pattern identityValidation.js uses.+const hhmmRegex = /^([01]\d|2[0-3]):[0-5]\d$/;+// Individual question result (math + memory drills)// Math: server recomputes expected/correct via scoreDrill (numeric values)// Memory: client scores with string comparison (text values)@@ -136,6 +139,12 @@ export const postConfigUpdateSchema = z.object({// Default OFF so existing installs are unchanged — additive, no migration.adaptive: z.object({enabled: z.boolean().optional()+ }).optional(),+ // Opt-in daily reminder (default OFF, off by default). `time` is a 24h+ // "HH:MM" string interpreted in the user's configured timezone.+ reminder: z.object({+ enabled: z.boolean().optional(),+ time: z.string().regex(hhmmRegex, 'Must be HH:MM format').optional()}).optional()}).partial();diff --git a/server/lib/postValidation.test.js b/server/lib/postValidation.test.jsindex 8ebf6cf3e6..539c3a655c 100644--- a/server/lib/postValidation.test.js+++ b/server/lib/postValidation.test.js@@ -28,6 +28,19 @@ describe('postConfigUpdateSchema llmDrills', () => {// Additive + optional — a config with no adaptive key stays valid.expect(postConfigUpdateSchema.parse({}).adaptive).toBeUndefined();});++ it('accepts the opt-in daily reminder block with a well-formed HH:MM time', () => {+ const parsed = postConfigUpdateSchema.parse({ reminder: { enabled: true, time: '09:30' } });+ expect(parsed.reminder).toEqual({ enabled: true, time: '09:30' });+ // Additive + optional — a config with no reminder key stays valid.+ expect(postConfigUpdateSchema.parse({}).reminder).toBeUndefined();+ });++ it('rejects a malformed reminder time', () => {+ expect(() => postConfigUpdateSchema.parse({ reminder: { enabled: true, time: '9:30' } })).toThrow();+ expect(() => postConfigUpdateSchema.parse({ reminder: { enabled: true, time: '25:00' } })).toThrow();+ expect(() => postConfigUpdateSchema.parse({ reminder: { enabled: true, time: 'nine am' } })).toThrow();+ });});describe('postLlmScoreRequestSchema', () => {diff --git a/server/routes/meatspacePostRoutes.js b/server/routes/meatspacePostRoutes.jsindex 9326343ed1..e480841d59 100644--- a/server/routes/meatspacePostRoutes.js+++ b/server/routes/meatspacePostRoutes.js@@ -27,6 +27,7 @@ import * as memoryService from '../services/meatspacePostMemory.js';import { generateLlmDrill, scoreLlmDrill } from '../services/meatspacePostLlm.js';import { getCachedDrill, triggerReplenish, getCacheStats, requestCacheFill } from '../services/meatspacePostDrillCache.js';import * as trainingService from '../services/meatspacePostTraining.js';+import { registerPostReminderSchedule } from '../services/meatspacePostReminder.js';const router = Router();@@ -50,6 +51,11 @@ router.get('/post/config', asyncHandler(async (req, res) => {router.put('/post/config', asyncHandler(async (req, res) => {const data = validateRequest(postConfigUpdateSchema, req.body);const config = await postService.updatePostConfig(data);+ // Reschedule the daily reminder immediately (no restart needed) whenever+ // its enabled/time fields change — see meatspacePostReminder.js.+ if (data.reminder) {+ await registerPostReminderSchedule();+ }res.json(config);}));diff --git a/server/routes/meatspacePostRoutes.reminder.test.js b/server/routes/meatspacePostRoutes.reminder.test.jsnew file mode 100644index 0000000000..37e8f0d0f5--- /dev/null+++ b/server/routes/meatspacePostRoutes.reminder.test.js@@ -0,0 +1,54 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';+import express from 'express';+import { request } from '../lib/testHelper.js';++// Scoped to PUT /post/config's reminder-rescheduling wiring — only the two+// services that route touches (postService.updatePostConfig and+// meatspacePostReminder.registerPostReminderSchedule) are mocked. Mirrors the+// scoping rationale in meatspacePostRoutes.drillCache.test.js.+vi.mock('../services/meatspacePost.js', () => ({+ getPostConfig: vi.fn(),+ updatePostConfig: vi.fn(),+}));++vi.mock('../services/meatspacePostReminder.js', () => ({+ registerPostReminderSchedule: vi.fn(),+}));++import * as postService from '../services/meatspacePost.js';+import { registerPostReminderSchedule } from '../services/meatspacePostReminder.js';+import { errorMiddleware } from '../lib/errorHandler.js';+import meatspacePostRoutes from './meatspacePostRoutes.js';++function makeApp() {+ const app = express();+ app.use(express.json());+ app.use('/api/meatspace', meatspacePostRoutes);+ app.use(errorMiddleware);+ return app;+}++describe('PUT /api/meatspace/post/config — reminder rescheduling', () => {+ let app;+ beforeEach(() => {+ app = makeApp();+ vi.clearAllMocks();+ postService.updatePostConfig.mockResolvedValue({ reminder: { enabled: true, time: '09:00' } });+ });++ it('reschedules the reminder when the payload includes a reminder block', async () => {+ const r = await request(app)+ .put('/api/meatspace/post/config')+ .send({ reminder: { enabled: true, time: '09:00' } });+ expect(r.status).toBe(200);+ expect(registerPostReminderSchedule).toHaveBeenCalledTimes(1);+ });++ it('does not touch the reminder schedule when the payload has no reminder key', async () => {+ const r = await request(app)+ .put('/api/meatspace/post/config')+ .send({ adaptive: { enabled: true } });+ expect(r.status).toBe(200);+ expect(registerPostReminderSchedule).not.toHaveBeenCalled();+ });+});diff --git a/server/services/meatspacePost.js b/server/services/meatspacePost.jsindex c218144793..e0a6acc5d4 100644--- a/server/services/meatspacePost.js+++ b/server/services/meatspacePost.js@@ -54,7 +54,12 @@ const DEFAULT_CONFIG = {scoring: { weights: { 'mental-math': 1.0, 'llm-drills': 1.0, 'cognitive': 1.0 } },// Opt-in adaptive difficulty (default OFF). When enabled, math drills are// nudged harder/easier at generation time from recent scored performance.- adaptive: { enabled: false }+ adaptive: { enabled: false },+ // Opt-in daily reminder (default OFF, off-by-default per CLAUDE.md's+ // single-user/no-surprise-background-behavior convention). When enabled,+ // meatspacePostReminder.js fires a deterministic (no-LLM) in-app notification+ // at `time` (HH:MM, user's configured timezone) if today's POST is incomplete.+ reminder: { enabled: false, time: '09:00' }};// Math tasks are logged under this coarse module in scored sessions, so thediff --git a/server/services/meatspacePostReminder.js b/server/services/meatspacePostReminder.jsnew file mode 100644index 0000000000..457900ca31--- /dev/null+++ b/server/services/meatspacePostReminder.js@@ -0,0 +1,111 @@+/**+ * MeatSpace POST Daily Reminder Scheduler+ *+ * Optional, opt-in (default OFF) scheduled nudge: fires a single deterministic+ * (no LLM) in-app notification at a user-chosen time-of-day when today's POST+ * (Power On Self Test) session is still incomplete. Nothing here calls an AI+ * provider — the "scheduled automations are user-configured" exception in+ * CLAUDE.md's AI Provider Usage Policy covers this even though it's moot, since+ * this feature makes zero LLM calls of its own.+ *+ * Mirrors backupScheduler.js's daily-cron registration pattern via+ * eventScheduler.js, but — unlike backupScheduler's fixed-at-registration cron+ * expression — the time-of-day is user-editable at runtime:+ * registerPostReminderSchedule() is called both at server boot and again after+ * every `PUT /post/config`, so a changed time or enabled flag takes effect on+ * the next tick without a restart (same idea as cosJobScheduler.js's+ * `registerSingleJobSchedule`, simplified since a daily HH:MM nudge doesn't+ * need that module's weekday/interval-fallback machinery).+ */++import { schedule, cancel } from './eventScheduler.js';+import { getUserTimezone } from '../lib/timezone.js';+import { getPostConfig, getPostSessions, computePostStreaks } from './meatspacePost.js';+import { addNotification, NOTIFICATION_TYPES, PRIORITY_LEVELS } from './notifications.js';++export const POST_REMINDER_EVENT_ID = 'post-daily-reminder';++const HHMM_RE = /^([01]\d|2[0-3]):[0-5]\d$/;++/**+ * Convert an "HH:MM" time-of-day into a daily cron expression ("M H * * *").+ * Pure — exported for unit testing. Returns null for a malformed/missing time+ * so callers can skip scheduling rather than register a bad cron string.+ */+export function reminderTimeToCron(time) {+ if (typeof time !== 'string' || !HHMM_RE.test(time)) return null;+ const [hour, minute] = time.split(':').map(Number);+ return `${minute} ${hour} * * *`;+}++/**+ * Fire the reminder notification if — and only if — today's POST is still+ * incomplete. Re-reads config at fire time (mirrors backupScheduler's+ * re-check) so a disable that happened between registration and the+ * scheduled minute is respected instead of nagging once more.+ */+export async function firePostReminderIfIncomplete() {+ const config = await getPostConfig();+ if (config.reminder?.enabled !== true) {+ console.log(`🔔 POST reminder: disabled since registration — skipping`);+ return;+ }++ const sessions = await getPostSessions();+ const todayStr = new Date().toISOString().split('T')[0];+ const { completedToday } = computePostStreaks(sessions, todayStr);+ if (completedToday) {+ console.log(`🔔 POST reminder: today's session already complete — no nudge`);+ return;+ }++ await addNotification({+ type: NOTIFICATION_TYPES.DAILY_POST_REMINDER,+ title: "Today's POST is still open",+ description: "You haven't completed a Power On Self Test session today — a quick one keeps your streak alive.",+ priority: PRIORITY_LEVELS.LOW,+ link: '/post/launcher'+ });+ console.log(`🔔 POST reminder: nudge sent (today's session incomplete)`);+}++/**+ * Register (or cancel) the daily reminder cron job from the current POST+ * config. Safe to call repeatedly — `schedule()` replaces any existing+ * registration under the same id, so calling this again after a settings+ * change reschedules immediately.+ */+export async function registerPostReminderSchedule() {+ const config = await getPostConfig();+ const { enabled, time } = config.reminder || {};++ if (!enabled) {+ cancel(POST_REMINDER_EVENT_ID);+ return;+ }++ const cron = reminderTimeToCron(time);+ if (!cron) {+ console.error(`❌ POST reminder: invalid time "${time}" — not scheduling`);+ cancel(POST_REMINDER_EVENT_ID);+ return;+ }++ const timezone = await getUserTimezone();+ schedule({+ id: POST_REMINDER_EVENT_ID,+ type: 'cron',+ cron,+ timezone,+ handler: firePostReminderIfIncomplete,+ metadata: { source: 'meatspacePostReminder' }+ });+ console.log(`🔔 POST reminder: registered daily at ${time} (${timezone})`);+}++/**+ * Cancel the reminder schedule outright (explicit teardown / test cleanup).+ */+export function stopPostReminderSchedule() {+ cancel(POST_REMINDER_EVENT_ID);+}diff --git a/server/services/meatspacePostReminder.test.js b/server/services/meatspacePostReminder.test.jsnew file mode 100644index 0000000000..17f5cd5476--- /dev/null+++ b/server/services/meatspacePostReminder.test.js@@ -0,0 +1,152 @@+/**+ * Tests for meatspacePostReminder — the opt-in (default OFF) daily reminder+ * for POST sessions. Covers: the pure HH:MM -> cron conversion, that the+ * scheduler only registers when enabled, that it reschedules (not+ * double-registers) on repeated calls, and that the fired handler only sends+ * a notification when today's session is genuinely incomplete.+ */++import { describe, it, expect, vi, beforeEach } from 'vitest';++vi.mock('./eventScheduler.js', () => ({+ schedule: vi.fn(),+ cancel: vi.fn()+}));++vi.mock('../lib/timezone.js', () => ({+ getUserTimezone: vi.fn().mockResolvedValue('UTC')+}));++vi.mock('./meatspacePost.js', () => ({+ getPostConfig: vi.fn(),+ getPostSessions: vi.fn(),+ computePostStreaks: vi.fn()+}));++vi.mock('./notifications.js', () => ({+ addNotification: vi.fn().mockResolvedValue({ id: 'n1' }),+ NOTIFICATION_TYPES: { DAILY_POST_REMINDER: 'daily_post_reminder' },+ PRIORITY_LEVELS: { LOW: 'low' }+}));++import { schedule, cancel } from './eventScheduler.js';+import { getUserTimezone } from '../lib/timezone.js';+import { getPostConfig, getPostSessions, computePostStreaks } from './meatspacePost.js';+import { addNotification } from './notifications.js';+import {+ reminderTimeToCron,+ registerPostReminderSchedule,+ firePostReminderIfIncomplete,+ stopPostReminderSchedule,+ POST_REMINDER_EVENT_ID+} from './meatspacePostReminder.js';++describe('reminderTimeToCron', () => {+ it('converts HH:MM to a daily cron expression', () => {+ expect(reminderTimeToCron('09:30')).toBe('30 9 * * *');+ expect(reminderTimeToCron('00:00')).toBe('0 0 * * *');+ expect(reminderTimeToCron('23:59')).toBe('59 23 * * *');+ });++ it('returns null for malformed or missing input', () => {+ expect(reminderTimeToCron('9:30')).toBeNull();+ expect(reminderTimeToCron('25:00')).toBeNull();+ expect(reminderTimeToCron('not-a-time')).toBeNull();+ expect(reminderTimeToCron(undefined)).toBeNull();+ expect(reminderTimeToCron(null)).toBeNull();+ });+});++describe('registerPostReminderSchedule', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ it('cancels the schedule and does not register when disabled (default off)', async () => {+ getPostConfig.mockResolvedValue({ reminder: { enabled: false, time: '09:00' } });+ await registerPostReminderSchedule();+ expect(schedule).not.toHaveBeenCalled();+ expect(cancel).toHaveBeenCalledWith(POST_REMINDER_EVENT_ID);+ });++ it('cancels and skips scheduling when the reminder block is entirely absent', async () => {+ getPostConfig.mockResolvedValue({});+ await registerPostReminderSchedule();+ expect(schedule).not.toHaveBeenCalled();+ expect(cancel).toHaveBeenCalledWith(POST_REMINDER_EVENT_ID);+ });++ it('registers a daily cron at the configured time when enabled', async () => {+ getPostConfig.mockResolvedValue({ reminder: { enabled: true, time: '09:00' } });+ await registerPostReminderSchedule();+ expect(schedule).toHaveBeenCalledTimes(1);+ expect(schedule.mock.calls[0][0]).toMatchObject({+ id: POST_REMINDER_EVENT_ID,+ type: 'cron',+ cron: '0 9 * * *',+ timezone: 'UTC'+ });+ });++ it('cancels rather than registers when enabled but the time is invalid', async () => {+ getPostConfig.mockResolvedValue({ reminder: { enabled: true, time: 'garbage' } });+ await registerPostReminderSchedule();+ expect(schedule).not.toHaveBeenCalled();+ expect(cancel).toHaveBeenCalledWith(POST_REMINDER_EVENT_ID);+ });++ it('reschedules (re-registers under the same id) rather than accumulating on repeated calls', async () => {+ getPostConfig.mockResolvedValue({ reminder: { enabled: true, time: '09:00' } });+ await registerPostReminderSchedule();+ getPostConfig.mockResolvedValue({ reminder: { enabled: true, time: '18:30' } });+ await registerPostReminderSchedule();+ expect(schedule).toHaveBeenCalledTimes(2);+ expect(schedule.mock.calls[1][0]).toMatchObject({ id: POST_REMINDER_EVENT_ID, cron: '30 18 * * *' });+ });+});++describe('stopPostReminderSchedule', () => {+ it('cancels the reminder event', () => {+ vi.clearAllMocks();+ stopPostReminderSchedule();+ expect(cancel).toHaveBeenCalledWith(POST_REMINDER_EVENT_ID);+ });+});++describe('firePostReminderIfIncomplete', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ getPostSessions.mockResolvedValue([]);+ });++ it('sends a notification when the reminder is enabled and today is incomplete', async () => {+ getPostConfig.mockResolvedValue({ reminder: { enabled: true, time: '09:00' } });+ computePostStreaks.mockReturnValue({ completedToday: false });++ await firePostReminderIfIncomplete();++ expect(addNotification).toHaveBeenCalledTimes(1);+ expect(addNotification.mock.calls[0][0]).toMatchObject({+ type: 'daily_post_reminder',+ link: '/post/launcher'+ });+ });++ it('does not nag once the session is already done today', async () => {+ getPostConfig.mockResolvedValue({ reminder: { enabled: true, time: '09:00' } });+ computePostStreaks.mockReturnValue({ completedToday: true });++ await firePostReminderIfIncomplete();++ expect(addNotification).not.toHaveBeenCalled();+ });++ it('skips entirely if disabled since registration', async () => {+ getPostConfig.mockResolvedValue({ reminder: { enabled: false, time: '09:00' } });+ computePostStreaks.mockReturnValue({ completedToday: false });++ await firePostReminderIfIncomplete();++ expect(addNotification).not.toHaveBeenCalled();+ });+});diff --git a/server/services/notifications.js b/server/services/notifications.jsindex f4f4ad78cb..5a8b6c3807 100644--- a/server/services/notifications.js+++ b/server/services/notifications.js@@ -35,7 +35,8 @@ export const NOTIFICATION_TYPES = {AUTOBIOGRAPHY_PROMPT: 'autobiography_prompt',PLAN_QUESTION: 'plan_question',AGENT_WARNING: 'agent_warning',- AUTOPILOT_PAUSED: 'autopilot_paused'+ AUTOPILOT_PAUSED: 'autopilot_paused',+ DAILY_POST_REMINDER: 'daily_post_reminder'};// Priority levelsdiff --git a/server/services/telegramBridge.js b/server/services/telegramBridge.jsindex c89c19bb0b..e2a1029a39 100644--- a/server/services/telegramBridge.js+++ b/server/services/telegramBridge.js@@ -42,7 +42,8 @@ const NOTIFICATION_EMOJI = {[NOTIFICATION_TYPES.HEALTH_ISSUE]: '⚠️',[NOTIFICATION_TYPES.BRIEFING_READY]: '📋',[NOTIFICATION_TYPES.AUTOBIOGRAPHY_PROMPT]: '📝',- [NOTIFICATION_TYPES.PLAN_QUESTION]: '❓'+ [NOTIFICATION_TYPES.PLAN_QUESTION]: '❓',+ [NOTIFICATION_TYPES.DAILY_POST_REMINDER]: '🧪'};const PRIORITY_EMOJI = {