Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

Commit 98ef616

Browse files
committed
feat(briefings): unified report overhaul — workday digest, council brief, weekly upgrade
- add WorkdayDigest: always sends 4pm Work Day Wrap with market pulse + family-time transition even when queue is empty - add Council Brief section to evening summary with vote tally, veto callout, compliance bar, and verdict — hidden when no governance activity - upgrade weekly review with divider sections, Council Chamber, week number + date range header, and performance progress bar - fix complianceRate double-scaling bug (was *100 on already-0-100 value) - remove Telegram from ai_council_nightly (audit log only — covered by 9pm) - move weekly-review to 7:00 PM, weekly-wisdom to 7:10 PM Sunday - add visual aids: unicode progress bars (████░░), trend arrows (↑↓), pre-formatted market tables for workday/portfolio sections - natural closing phrases throughout (remove ai-sounding "I'm here") - add 5 new tests for workday digest, evening council brief, weekly council
1 parent 59f37f3 commit 98ef616

4 files changed

Lines changed: 394 additions & 60 deletions

File tree

src/autonomous/agent.ts

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,15 +1322,19 @@ export class AutonomousAgent {
13221322
? this.lastCareerMatches.map(m => ({ title: m.title, company: m.company, matchScore: m.matchScore }))
13231323
: null,
13241324
portfolio: this.lastPortfolio,
1325+
governance: governanceReporter.generateSnapshot(),
13251326
});
13261327
}
13271328
log.info('Evening summary completed');
13281329
});
13291330

1330-
// Weekly review on Sunday 6pm
1331+
// Weekly review on Sunday 7 PM
13311332
this.scheduler.registerHandler('weekly_review', async () => {
13321333
if (this.briefingGenerator) {
1333-
await this.briefingGenerator.weeklyReview();
1334+
const weeklyGovernance = governanceReporter.generateSnapshot(7 * 24 * 60 * 60 * 1000);
1335+
await this.briefingGenerator.weeklyReview({
1336+
governance: weeklyGovernance,
1337+
});
13341338
}
13351339
log.info('Weekly review completed');
13361340
});
@@ -1993,44 +1997,19 @@ export class AutonomousAgent {
19931997
}
19941998
});
19951999

1996-
// AI Council nightly review at 10 PM — governance summary to Telegram
1997-
this.scheduler.registerHandler('ai_council_nightly', async () => {
2000+
// AI Council nightly review at 10 PM — audit log only (governance in evening summary)
2001+
this.scheduler.registerHandler('ai_council_nightly', () => {
19982002
try {
19992003
log.info('AI Council nightly review started');
20002004

2001-
// Generate governance snapshot for the last 24 hours
2005+
// Generate governance snapshot for audit — Telegram delivery is via 9 PM evening summary
20022006
const snapshot = governanceReporter.generateSnapshot();
2003-
const formatted = governanceReporter.formatForBriefing(snapshot);
2004-
2005-
// Build council summary with system metrics
2006-
const lines: string[] = ['<b>🏛️ Council Nightly Review</b>', ''];
2007-
2008-
// Governance activity
2009-
lines.push(formatted);
2010-
lines.push('');
2011-
2012-
// System health summary
2013-
lines.push('<b>📊 System Status</b>');
2014-
lines.push(`▸ Tasks processed: ${this.state.tasksProcessed}`);
2015-
lines.push(`▸ Errors today: ${this.state.errors}`);
2016-
if (this.costTracker) {
2017-
const status = this.costTracker.getThrottleStatus();
2018-
lines.push(`▸ Budget: ${status.usagePercent.toFixed(0)}% used (${status.level})`);
2019-
}
2020-
lines.push('');
2021-
2022-
lines.push('Council session complete. ⚖️');
20232007

2024-
// Send to Telegram
2025-
if (notificationManager.isReady()) {
2026-
await notificationManager.notify({
2027-
category: 'governance',
2028-
title: 'Council Nightly Review',
2029-
body: lines.join('\n'),
2030-
priority: 'normal',
2031-
telegramHtml: lines.join('\n'),
2032-
});
2033-
}
2008+
// Governance already delivered via 9 PM evening summary — log only (no Telegram duplicate)
2009+
log.info(
2010+
{ events: snapshot.pipeline.totalEvents, complianceRate: snapshot.arbiter.complianceRate },
2011+
'AI Council nightly review logged (no Telegram — see evening summary)',
2012+
);
20342013

20352014
this.eventBus.emit('audit:log', {
20362015
action: 'ai_council:nightly_review',
@@ -2047,6 +2026,7 @@ export class AutonomousAgent {
20472026
} catch (error) {
20482027
log.error({ error }, 'AI Council nightly review failed');
20492028
}
2029+
return Promise.resolve();
20502030
});
20512031

20522032
// E2E daily test run (placeholder)
@@ -2166,13 +2146,16 @@ export class AutonomousAgent {
21662146
}
21672147
});
21682148

2169-
// 4 PM weekday work-day digest — flushes all notifications batched during school IT hours
2149+
// 4 PM weekday work-day digest — flushes notifications + market pulse + family-time signal
21702150
this.scheduler.registerHandler('workday_digest', async () => {
21712151
try {
2172-
const result = await notificationManager.processQueue();
2173-
if (result.processed > 0) {
2174-
log.info({ processed: result.processed, sent: result.sent }, 'Work-day digest delivered');
2152+
if (this.briefingGenerator) {
2153+
await this.briefingGenerator.workdayDigest({
2154+
marketAlerts: this.lastMarketAlerts.length > 0 ? this.lastMarketAlerts : null,
2155+
portfolio: this.lastPortfolio,
2156+
});
21752157
}
2158+
log.info('Work-day digest delivered');
21762159
} catch (error) {
21772160
log.error({ error }, 'Work-day digest failed');
21782161
}

0 commit comments

Comments
 (0)