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): surface learning insights during periodic evaluations

Adam Eivy6b19ddd55a69
diff --git a/.changelog/v0.10.x.md b/.changelog/v0.10.x.md
index d96632ce09..eb3c3d76a4 100644
--- a/.changelog/v0.10.x.md
+++ b/.changelog/v0.10.x.md
@@ -294,6 +294,12 @@ This release introduces a structured changelog documentation system for creating
- **Scrollable Tab Bar**: Tab bar uses horizontal scroll with `shrink-0` to prevent tab overflow issues
- **Badge Support on Collapsible Sections**: Notification badges now display correctly on collapsible nav sections (both collapsed and expanded states)
+### Chief of Staff - Learning Insights Integration
+- **Periodic Learning Recommendations**: CoS now surfaces actionable learning insights every 20 evaluations (~20 minutes) in the log stream
+- **Recommendation Types**: Logs optimization suggestions, warnings about low-success task types, and action items for recurring errors
+- **Event Emission**: New `learning:recommendations` event emitted with recommendations and insights data for UI consumption
+- **Best/Worst Performers**: Includes top-performing and struggling task types with success rates for informed decision-making
+
## 🐛 Bug Fixes
### Task Enhancer Directory Not Found Error
diff --git a/server/services/cos.js b/server/services/cos.js
index 1798c37111..25a454e2ef 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -16,7 +16,7 @@ import { getActiveProvider } from './providers.js';
import { parseTasksMarkdown, groupTasksByStatus, getNextTask, getAutoApprovedTasks, getAwaitingApprovalTasks, updateTaskStatus, generateTasksMarkdown } from '../lib/taskParser.js';
import { isAppOnCooldown, getNextAppForReview, markAppReviewStarted, markIdleReviewStarted } from './appActivity.js';
import { getAllApps, getActiveApps } from './apps.js';
-import { getAdaptiveCooldownMultiplier, getSkippedTaskTypes, getPerformanceSummary, checkAndRehabilitateSkippedTasks } from './taskLearning.js';
+import { getAdaptiveCooldownMultiplier, getSkippedTaskTypes, getPerformanceSummary, checkAndRehabilitateSkippedTasks, getLearningInsights } from './taskLearning.js';
import { schedule as scheduleEvent, cancel as cancelEvent, getStats as getSchedulerStats } from './eventScheduler.js';
import { generateProactiveTasks as generateMissionTasks, getStats as getMissionStats } from './missions.js';
import { formatDuration } from '../lib/fileUtils.js';
@@ -681,7 +681,7 @@ export async function evaluateTasks() {
availableSlots
});
- // Periodically log performance summary (every 10 evaluations)
+ // Periodically log performance summary with learning insights (every 10 evaluations)
const evalCount = state.stats.evaluationCount || 0;
if (evalCount % 10 === 0 && evalCount > 0) {
const perfSummary = await getPerformanceSummary().catch(() => null);
@@ -692,6 +692,28 @@ export async function evaluateTasks() {
topPerformers: perfSummary.topPerformers.length,
needsAttention: perfSummary.needsAttention.length
});
+
+ // Surface learning recommendations every 20 evaluations (less frequent to avoid noise)
+ if (evalCount % 20 === 0) {
+ const learningInsights = await getLearningInsights().catch(() => null);
+ if (learningInsights?.recommendations?.length > 0) {
+ const recommendations = learningInsights.recommendations.slice(0, 3);
+ for (const rec of recommendations) {
+ const level = rec.type === 'warning' ? 'warn' : rec.type === 'action' ? 'info' : 'debug';
+ emitLog(level, `🧠 Learning: ${rec.message}`, { recommendationType: rec.type });
+ }
+ // Emit event for UI consumption
+ cosEvents.emit('learning:recommendations', {
+ recommendations,
+ insights: {
+ bestPerforming: learningInsights.insights?.bestPerforming?.slice(0, 2) || [],
+ worstPerforming: learningInsights.insights?.worstPerforming?.slice(0, 2) || [],
+ commonErrors: learningInsights.insights?.commonErrors?.slice(0, 2) || []
+ },
+ totals: learningInsights.totals
+ });
+ }
+ }
}
}