Skip to content

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

feat(cos): add daily briefing page with notification integration

Adam Eivyb38ba77d1c2a
diff --git a/.changelog/v0.12.x.md b/.changelog/v0.12.x.md
index 2b16461484..e740f1f8a4 100644
--- a/.changelog/v0.12.x.md
+++ b/.changelog/v0.12.x.md
@@ -196,3 +196,24 @@ This release adds branch management and automated release workflow capabilities
- `client/src/components/cos/index.js` — Exported QuickSummary component
- `client/src/services/api.js` — Added `getCosQuickSummary()` API function
- `client/src/pages/ChiefOfStaff.jsx` — Renders QuickSummary widget on the Tasks tab
+
+### CoS — Daily Briefing Page
+- **Briefing tab**: New "Briefing" tab in the Chief of Staff page displaying daily briefings generated by the autonomous Daily Briefing job
+- **Date selector**: Browse historical briefings via a dropdown showing all available dates
+- **Structured display**: Briefing markdown is parsed into collapsible sections with contextual icons (tasks, agents, brain, system, focus areas)
+- **Inline formatting**: Renders bold text, code snippets, bullet lists, and numbered lists from briefing markdown
+- **Notification integration**: A notification is automatically created when a daily briefing completes, linking directly to `/cos/briefing`
+- **Sidebar navigation**: Briefing link added to the CoS sidebar section for quick access
+
+**Server changes**:
+- `server/services/cos.js` — Added `listBriefings()`, `getBriefing(date)`, `getLatestBriefing()` functions; briefing notification on agent completion
+- `server/services/notifications.js` — Added `BRIEFING_READY` notification type
+- `server/routes/cos.js` — Added `GET /briefings`, `GET /briefings/latest`, `GET /briefings/:date` endpoints
+
+**Client changes**:
+- `client/src/components/cos/tabs/BriefingTab.jsx` — New tab component with markdown parsing, collapsible sections, and date navigation
+- `client/src/components/cos/constants.js` — Added "Briefing" tab with Newspaper icon (first position)
+- `client/src/components/cos/index.js` — Exported BriefingTab component
+- `client/src/services/api.js` — Added `getCosBriefings()`, `getCosLatestBriefing()`, `getCosBriefing(date)` functions
+- `client/src/components/Layout.jsx` — Added Briefing link to CoS sidebar navigation
+- `client/src/pages/ChiefOfStaff.jsx` — Imported and rendered BriefingTab
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index fb523591b3..9e055c659b 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -31,7 +31,8 @@ import {
Users,
Upload,
SquareTerminal,
- Globe
+ Globe,
+ Newspaper
} from 'lucide-react';
import packageJson from '../../package.json';
import Logo from './Logo';
@@ -59,6 +60,7 @@ const navItems = [
icon: Crown,
showBadge: true,
children: [
+ { to: '/cos/briefing', label: 'Briefing', icon: Newspaper },
{ to: '/cos/tasks', label: 'Tasks', icon: FileText },
{ to: '/cos/agents', label: 'Agents', icon: Cpu },
{ to: '/cos/scripts', label: 'Scripts', icon: Terminal },
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.js
index bd67dfb7eb..de689d7bd0 100644
--- a/client/src/components/cos/constants.js
+++ b/client/src/components/cos/constants.js
@@ -9,10 +9,12 @@ import {
Clock,
GraduationCap,
Bot,
- Flame
+ Flame,
+ Newspaper
} from 'lucide-react';
export const TABS = [
+ { id: 'briefing', label: 'Briefing', icon: Newspaper },
{ id: 'tasks', label: 'Tasks', icon: FileText },
{ id: 'agents', label: 'Agents', icon: Cpu },
{ id: 'jobs', label: 'Jobs', icon: Bot },
diff --git a/client/src/components/cos/index.js b/client/src/components/cos/index.js
index 7a8cd9259b..e2e940dfe4 100644
--- a/client/src/components/cos/index.js
+++ b/client/src/components/cos/index.js
@@ -31,3 +31,4 @@ export { default as HealthTab } from './tabs/HealthTab';
export { default as ConfigTab } from './tabs/ConfigTab';
export { default as DigestTab } from './tabs/DigestTab';
export { default as ProductivityTab } from './tabs/ProductivityTab';
+export { default as BriefingTab } from './tabs/BriefingTab';
diff --git a/client/src/components/cos/tabs/BriefingTab.jsx b/client/src/components/cos/tabs/BriefingTab.jsx
new file mode 100644
index 0000000000..33f07d681b
--- /dev/null
+++ b/client/src/components/cos/tabs/BriefingTab.jsx
@@ -0,0 +1,277 @@
+import { useState, useEffect } from 'react';
+import {
+ Newspaper,
+ RefreshCw,
+ Calendar,
+ ChevronDown,
+ ChevronRight,
+ CheckCircle,
+ Cpu,
+ Brain,
+ Target,
+ Activity,
+ GitBranch
+} from 'lucide-react';
+import * as api from '../../../services/api';
+
+const SECTION_ICONS = {
+ 'Task Queue': CheckCircle,
+ 'Agent Activity': Cpu,
+ 'Brain': Brain,
+ 'System': Activity,
+ 'Dev Branch': GitBranch,
+ 'Suggested Focus': Target,
+ 'Focus Areas': Target
+};
+
+const getSectionIcon = (title) => {
+ for (const [key, Icon] of Object.entries(SECTION_ICONS)) {
+ if (title.includes(key)) return Icon;
+ }
+ return ChevronRight;
+};
+
+const parseBriefingMarkdown = (content) => {
+ if (!content) return { title: '', sections: [] };
+
+ const lines = content.split('\n');
+ let title = '';
+ const sections = [];
+ let currentSection = null;
+
+ for (const line of lines) {
+ if (line.startsWith('# ') && !title) {
+ title = line.replace('# ', '');
+ continue;
+ }
+
+ if (line.startsWith('## ')) {
+ if (currentSection) sections.push(currentSection);
+ currentSection = { title: line.replace('## ', ''), lines: [] };
+ continue;
+ }
+
+ if (line.startsWith('### ') && currentSection) {
+ currentSection.lines.push({ type: 'subheading', text: line.replace('### ', '') });
+ continue;
+ }
+
+ if (currentSection && line.trim()) {
+ currentSection.lines.push({ type: 'text', text: line });
+ }
+ }
+
+ if (currentSection) sections.push(currentSection);
+ return { title, sections };
+};
+
+const renderLine = (line, idx) => {
+ if (line.type === 'subheading') {
+ return (
+ <h4 key={idx} className="text-sm font-semibold text-port-accent mt-3 mb-1">
+ {line.text}
+ </h4>
+ );
+ }
+
+ const text = line.text;
+
+ // Numbered list item
+ if (/^\d+\.\s/.test(text)) {
+ return (
+ <div key={idx} className="flex gap-2 py-0.5 pl-2">
+ <span className="text-port-accent font-mono text-xs mt-0.5 shrink-0">{text.match(/^\d+/)[0]}.</span>
+ <span className="text-sm text-gray-300">{renderInlineFormatting(text.replace(/^\d+\.\s+/, ''))}</span>
+ </div>
+ );
+ }
+
+ // Bullet list item
+ if (text.startsWith('- ')) {
+ return (
+ <div key={idx} className="flex gap-2 py-0.5 pl-2">
+ <span className="text-gray-500 mt-1 shrink-0">&#8226;</span>
+ <span className="text-sm text-gray-300">{renderInlineFormatting(text.slice(2))}</span>
+ </div>
+ );
+ }
+
+ // Indented bullet
+ if (text.startsWith(' - ')) {
+ return (
+ <div key={idx} className="flex gap-2 py-0.5 pl-6">
+ <span className="text-gray-600 mt-1 shrink-0">&#8226;</span>
+ <span className="text-sm text-gray-400">{renderInlineFormatting(text.slice(4))}</span>
+ </div>
+ );
+ }
+
+ // Regular paragraph
+ return (
+ <p key={idx} className="text-sm text-gray-300 py-0.5">
+ {renderInlineFormatting(text)}
+ </p>
+ );
+};
+
+const renderInlineFormatting = (text) => {
+ // Split on **bold** markers and render
+ const parts = text.split(/(\*\*[^*]+\*\*)/g);
+ return parts.map((part, i) => {
+ if (part.startsWith('**') && part.endsWith('**')) {
+ return <strong key={i} className="text-white font-medium">{part.slice(2, -2)}</strong>;
+ }
+ // Handle `code` backticks
+ const codeParts = part.split(/(`[^`]+`)/g);
+ return codeParts.map((cp, j) => {
+ if (cp.startsWith('`') && cp.endsWith('`')) {
+ return <code key={`${i}-${j}`} className="text-xs bg-port-bg px-1 py-0.5 rounded text-cyan-400 font-mono">{cp.slice(1, -1)}</code>;
+ }
+ return cp;
+ });
+ });
+};
+
+export default function BriefingTab() {
+ const [briefings, setBriefings] = useState([]);
+ const [currentBriefing, setCurrentBriefing] = useState(null);
+ const [selectedDate, setSelectedDate] = useState(null);
+ const [loading, setLoading] = useState(true);
+ const [expandedSections, setExpandedSections] = useState({});
+
+ useEffect(() => {
+ loadData();
+ }, []);
+
+ const loadData = async () => {
+ setLoading(true);
+ const [listResult, latest] = await Promise.all([
+ api.getCosBriefings().catch(() => ({ briefings: [] })),
+ api.getCosLatestBriefing().catch(() => null)
+ ]);
+ setBriefings(listResult.briefings || []);
+ if (latest) {
+ setCurrentBriefing(latest);
+ setSelectedDate(latest.date);
+ // Expand all sections by default
+ const parsed = parseBriefingMarkdown(latest.content);
+ const expanded = {};
+ parsed.sections.forEach((s, i) => { expanded[i] = true; });
+ setExpandedSections(expanded);
+ }
+ setLoading(false);
+ };
+
+ const loadBriefing = async (date) => {
+ setLoading(true);
+ setSelectedDate(date);
+ const briefing = await api.getCosBriefing(date).catch(() => null);
+ if (briefing) {
+ setCurrentBriefing(briefing);
+ const parsed = parseBriefingMarkdown(briefing.content);
+ const expanded = {};
+ parsed.sections.forEach((s, i) => { expanded[i] = true; });
+ setExpandedSections(expanded);
+ }
+ setLoading(false);
+ };
+
+ const toggleSection = (idx) => {
+ setExpandedSections(prev => ({ ...prev, [idx]: !prev[idx] }));
+ };
+
+ if (loading && !currentBriefing) {
+ return (
+ <div className="flex items-center justify-center py-12">
+ <RefreshCw className="w-6 h-6 animate-spin text-port-accent" />
+ </div>
+ );
+ }
+
+ const parsed = currentBriefing ? parseBriefingMarkdown(currentBriefing.content) : null;
+
+ return (
+ <div className="space-y-6">
+ {/* Header with date selector */}
+ <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
+ <div className="flex items-center gap-3">
+ <Newspaper className="w-5 h-5 text-port-accent" />
+ <h3 className="text-lg font-semibold text-white">Daily Briefing</h3>
+ {briefings.length > 0 && (
+ <select
+ value={selectedDate || ''}
+ onChange={(e) => loadBriefing(e.target.value)}
+ className="bg-port-card border border-port-border rounded px-2 py-1 text-sm text-gray-300"
+ >
+ {briefings.map(b => (
+ <option key={b.date} value={b.date}>
+ {new Date(b.date + 'T12:00:00').toLocaleDateString('en-US', {
+ weekday: 'short',
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric'
+ })}
+ </option>
+ ))}
+ </select>
+ )}
+ </div>
+ <button
+ onClick={loadData}
+ className="flex items-center gap-2 px-3 py-1.5 text-sm bg-port-card border border-port-border hover:border-port-accent/50 text-gray-300 rounded-lg transition-colors"
+ >
+ <RefreshCw size={14} />
+ Refresh
+ </button>
+ </div>
+
+ {!parsed ? (
+ <div className="bg-port-card border border-port-border rounded-lg p-8 text-center">
+ <Newspaper className="w-12 h-12 text-gray-600 mx-auto mb-3" />
+ <p className="text-gray-400">No briefings available yet.</p>
+ <p className="text-gray-500 text-sm mt-1">Briefings are generated automatically by the Daily Briefing job.</p>
+ </div>
+ ) : (
+ <>
+ {/* Briefing Title */}
+ {parsed.title && (
+ <div className="bg-gradient-to-r from-port-accent/10 to-transparent border border-port-accent/20 rounded-lg p-4">
+ <div className="flex items-center gap-2">
+ <Calendar className="w-4 h-4 text-port-accent" />
+ <h2 className="text-base font-semibold text-white">{parsed.title}</h2>
+ </div>
+ </div>
+ )}
+
+ {/* Sections */}
+ {parsed.sections.map((section, idx) => {
+ const SectionIcon = getSectionIcon(section.title);
+ const isExpanded = expandedSections[idx] !== false;
+ return (
+ <div key={idx} className="bg-port-card border border-port-border rounded-lg overflow-hidden">
+ <button
+ onClick={() => toggleSection(idx)}
+ className="flex items-center gap-2 w-full text-left p-3 hover:bg-port-bg/50 transition-colors"
+ >
+ {isExpanded ? <ChevronDown size={16} className="text-gray-500" /> : <ChevronRight size={16} className="text-gray-500" />}
+ <SectionIcon size={16} className="text-port-accent" />
+ <span className="font-medium text-white text-sm">{section.title}</span>
+ </button>
+ {isExpanded && (
+ <div className="px-4 pb-3 pt-0">
+ {section.lines.map((line, lineIdx) => renderLine(line, lineIdx))}
+ </div>
+ )}
+ </div>
+ );
+ })}
+
+ {/* Footer */}
+ <div className="text-xs text-gray-600 text-center pt-2">
+ Briefing generated for {currentBriefing.date}
+ </div>
+ </>
+ )}
+ </div>
+ );
+}
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index 36a6901e31..6e1e1e9d84 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -31,7 +31,8 @@ import {
LearningTab,
MemoryTab,
HealthTab,
- ConfigTab
+ ConfigTab,
+ BriefingTab
} from '../components/cos';
import { resolveDynamicAvatar } from '../components/cos/constants';
@@ -598,6 +599,11 @@ export default function ChiefOfStaff() {
</div>
{/* Tab Content */}
+ {activeTab === 'briefing' && (
+ <div role="tabpanel" id="tabpanel-briefing" aria-labelledby="tab-briefing">
+ <BriefingTab />
+ </div>
+ )}
{activeTab === 'tasks' && (
<div role="tabpanel" id="tabpanel-tasks" aria-labelledby="tab-tasks">
<TasksTab tasks={tasks} onRefresh={fetchData} providers={providers} apps={apps} />
diff --git a/client/src/services/api.js b/client/src/services/api.js
index eaac6344c4..e0d41f1a9e 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -457,6 +457,11 @@ export const getCosReports = () => request('/cos/reports');
export const getCosTodayReport = () => request('/cos/reports/today');
export const getCosReport = (date) => request(`/cos/reports/${date}`);
+// CoS Briefings
+export const getCosBriefings = () => request('/cos/briefings');
+export const getCosLatestBriefing = () => request('/cos/briefings/latest');
+export const getCosBriefing = (date) => request(`/cos/briefings/${date}`);
+
// CoS Activity
export const getCosTodayActivity = () => request('/cos/activity/today');
diff --git a/server/routes/cos.js b/server/routes/cos.js
index df6e7e219a..c6297d28ac 100644
--- a/server/routes/cos.js
+++ b/server/routes/cos.js
@@ -275,6 +275,27 @@ router.post('/reports/generate', asyncHandler(async (req, res) => {
res.json(report);
}));
+// GET /api/cos/briefings - List all briefings
+router.get('/briefings', asyncHandler(async (req, res) => {
+ const briefings = await cos.listBriefings();
+ res.json({ briefings });
+}));
+
+// GET /api/cos/briefings/latest - Get latest briefing
+router.get('/briefings/latest', asyncHandler(async (req, res) => {
+ const briefing = await cos.getLatestBriefing();
+ res.json(briefing);
+}));
+
+// GET /api/cos/briefings/:date - Get briefing by date
+router.get('/briefings/:date', asyncHandler(async (req, res) => {
+ const briefing = await cos.getBriefing(req.params.date);
+ if (!briefing) {
+ throw new ServerError('Briefing not found', { status: 404, code: 'NOT_FOUND' });
+ }
+ res.json(briefing);
+}));
+
// GET /api/cos/scripts - List generated scripts
router.get('/scripts', asyncHandler(async (req, res) => {
const scripts = await cos.listScripts();
diff --git a/server/services/cos.js b/server/services/cos.js
index 8a95541d89..41331334e7 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -21,6 +21,7 @@ import { schedule as scheduleEvent, cancel as cancelEvent, getStats as getSchedu
import { generateProactiveTasks as generateMissionTasks, getStats as getMissionStats } from './missions.js';
import { getDueJobs, generateTaskFromJob, recordJobExecution } from './autonomousJobs.js';
import { formatDuration } from '../lib/fileUtils.js';
+import { addNotification, NOTIFICATION_TYPES } from './notifications.js';
// Import and re-export cosEvents from separate module to avoid circular dependencies
import { cosEvents as _cosEvents } from './cosEvents.js';
export const cosEvents = _cosEvents;
@@ -2422,6 +2423,45 @@ export async function listReports() {
.reverse();
}
+/**
+ * List all briefings (markdown files in reports dir)
+ */
+export async function listBriefings() {
+ await ensureDirectories();
+
+ const files = await readdir(REPORTS_DIR);
+ return files
+ .filter(f => f.endsWith('-briefing.md'))
+ .map(f => {
+ const date = f.replace('-briefing.md', '');
+ return { date, filename: f };
+ })
+ .sort((a, b) => b.date.localeCompare(a.date));
+}
+
+/**
+ * Get a briefing by date
+ */
+export async function getBriefing(date) {
+ const briefingFile = join(REPORTS_DIR, `${date}-briefing.md`);
+
+ if (!existsSync(briefingFile)) {
+ return null;
+ }
+
+ const content = await readFile(briefingFile, 'utf-8');
+ return { date, content };
+}
+
+/**
+ * Get the latest briefing
+ */
+export async function getLatestBriefing() {
+ const briefings = await listBriefings();
+ if (briefings.length === 0) return null;
+ return getBriefing(briefings[0].date);
+}
+
/**
* Get today's activity summary
* Returns completed tasks, success rate, time worked, and top accomplishments
@@ -2840,8 +2880,21 @@ async function init() {
await ensureDirectories();
// When an agent completes, immediately try to dequeue the next pending task
- cosEvents.on('agent:completed', () => {
+ cosEvents.on('agent:completed', (agent) => {
setImmediate(() => dequeueNextTask());
+
+ // Create notification when a daily briefing completes
+ if (agent?.metadata?.jobId === 'job-daily-briefing' && agent?.result?.success) {
+ const today = new Date().toISOString().split('T')[0];
+ addNotification({
+ type: NOTIFICATION_TYPES.BRIEFING_READY,
+ title: 'Daily Briefing Ready',
+ description: `Your daily briefing for ${today} is ready for review.`,
+ priority: 'low',
+ link: '/cos/briefing',
+ metadata: { date: today, agentId: agent.id }
+ }).catch(err => console.error(`❌ Failed to create briefing notification: ${err.message}`));
+ }
});
// Record autonomous job execution only after the agent actually spawns
diff --git a/server/services/notifications.js b/server/services/notifications.js
index 445fe8ce86..6f14cabbb5 100644
--- a/server/services/notifications.js
+++ b/server/services/notifications.js
@@ -28,7 +28,8 @@ export const NOTIFICATION_TYPES = {
MEMORY_APPROVAL: 'memory_approval',
TASK_APPROVAL: 'task_approval',
CODE_REVIEW: 'code_review',
- HEALTH_ISSUE: 'health_issue'
+ HEALTH_ISSUE: 'health_issue',
+ BRIEFING_READY: 'briefing_ready'
};
// Priority levels