refactor: remove self-learning and the optimizer package (P1.4)

Self-learning is excluded from the community edition (ADR-0004); the
project owner reworks it separately. Cost tracking stays.

- agent: delete behaviour evolution (evolve-schema, iterative GEPA,
  compose-evolution, evolution gates, orchestrator and deploy),
  improvement and correction detection, AgentLearning, the eval-dataset
  builder, optimization-capture and the agent_insights tool. Secret
  detection moves from eval-dataset to secret-patterns. The LLM wiring
  keeps only the Haiku adapter and judge call used by skill audit and
  hygiene, so @ax-llm/ax is now declared by agent instead of server.
- server: delete /api/evolution/*, the evolution and optimizer services,
  GEPA expansion of the first chat message, the prompt_optimization and
  monthly_assessment jobs, the idle-session reviewer and its
  session-reviewer persona, prompt injection of past corrections and
  thumbs-down recorded as correction signals. Existing job rows of the
  removed types are ignored, not deleted.
- core: delete OptimizationLogStore; stop re-exporting the improvement
  signal and evolution run stores.
- web: delete the Evolution screen and the two job types in the
  automation editor.
- delete packages/optimizer.

Also logs UF-027 (self-learning loops read data nothing collects) and
UF-028 (the Settings prompt-shape choice is ignored by chat).
This commit is contained in:
shumeiko.it
2026-10-20 00:54:58 +02:00
parent b734c1d3d2
commit 2e1999a3f6
112 changed files with 336 additions and 16165 deletions

View File

@@ -10,7 +10,7 @@ import Fastify, { type FastifyInstance, type FastifyRequest } from 'fastify';
import cors from '@fastify/cors';
import fastifyStatic from '@fastify/static';
import websocket from '@fastify/websocket';
import { MindDB, MultiMind, MultiMindCache, WorkspaceManager, WaggleConfig, createEmbeddingProvider, type EmbeddingProviderConfig, type EmbeddingProviderInstance, FrameStore, SessionStore, SuppressionStore, InstallAuditStore, CronStore, AwarenessLayer, VaultStore, SkillHashStore, OptimizationLogStore, ImprovementSignalStore, HarvestSourceStore, ClaudeCodeAdapter, reconcileIndexes, TeamSync, TelemetryStore, TELEMETRY_EVENTS, ExecutionTraceStore, EvolutionRunStore, harvestSetHash, type WorkspaceConfig } from '@waggle/core';
import { MindDB, MultiMind, MultiMindCache, WorkspaceManager, WaggleConfig, createEmbeddingProvider, type EmbeddingProviderConfig, type EmbeddingProviderInstance, FrameStore, SessionStore, SuppressionStore, InstallAuditStore, CronStore, AwarenessLayer, VaultStore, SkillHashStore, HarvestSourceStore, ClaudeCodeAdapter, reconcileIndexes, TeamSync, TelemetryStore, TELEMETRY_EVENTS, ExecutionTraceStore, harvestSetHash, type WorkspaceConfig } from '@waggle/core';
import { corsOriginAllowed } from './cors-config.js';
import { getBoundTeamServer } from './team-server-binding.js';
import { fetchTeamServer } from './team-server-egress.js';
@@ -46,18 +46,14 @@ import {
createBrowserTools,
createLspTools,
createCliTools,
createInsightsTools,
createConnectorSearchTools,
createCrossWorkspaceTools,
McpRuntime,
McpToolRetriever,
isWithinBudget,
getRecentLogs,
setPersonaDataDir,
deliverCronResult,
createDefaultDeliveryPreferences,
buildActiveBehavioralSpec,
loadBehavioralSpecOverrides,
TraceRecorder,
HarnessTraceBridge,
safeFetch,
@@ -108,7 +104,6 @@ import { homeRoutes } from './routes/home.js';
import { onboardingRoutes } from './routes/onboarding.js';
import { cronRoutes } from './routes/cron.js';
import { notificationRoutes, emitNotification, emitSubagentStatus } from './routes/notifications.js';
import { materialFingerprint } from './notification-gate.js';
import { marketplaceDevRoutes } from './routes/marketplace-dev.js';
import { marketplaceRoutes } from './routes/marketplace.js';
import {
@@ -129,7 +124,6 @@ import { personaRoutes } from './routes/personas.js';
import { feedbackRoutes } from './routes/feedback.js';
import { workflowRoutes } from './routes/workflows.js';
import { workspaceTemplateRoutes } from './routes/workspace-templates.js';
import { evolutionRoutes } from './routes/evolution.js';
import { exportRoutes } from './routes/export.js';
import { dataEraseRoutes } from './routes/data-erase.js';
import { costRoutes } from './routes/cost.js';
@@ -154,7 +148,6 @@ import { runChannelChatTurn } from './channels/chat-client.js';
import { channelRoutes } from './channels/routes.js';
import { isChannelPlatform } from './channels/types.js';
import { WorkspaceTurnCoordinator } from './workspace-turn-coordinator.js';
import { IdleSessionWatcher, readRecentTranscript, buildReviewInstruction, NOTHING_TO_DO } from './idle-watcher.js';
import { DreamJournal } from './dream-journal.js';
import { dreamRoutes } from './routes/dreams.js';
import { oauthRoutes } from './routes/oauth.js';
@@ -183,7 +176,6 @@ import {
securityMiddleware,
} from './security-middleware.js';
import { LocalScheduler, makeRecordExecutionCallback } from './cron.js';
import { EvolutionService, isEvolutionAutoEnabled } from './services/evolution-service.js';
import {
generateMorningBriefing,
checkStaleWorkspaces,
@@ -192,7 +184,6 @@ import {
type ProactiveContext,
type ProactiveMessage,
} from './proactive-handlers.js';
import { generateMonthlyAssessment, saveAssessmentToMind } from './monthly-assessment.js';
import { MAX_WORKSPACE_SESSIONS, WorkspaceSessionManager } from './workspace-sessions.js';
import { EventEmitter } from 'node:events';
import { LocalJobStore } from './job-store.js';
@@ -392,21 +383,12 @@ declare module 'fastify' {
auditStore: import('@waggle/core').InstallAuditStore;
cronStore: import('@waggle/core').CronStore;
traceStore: import('@waggle/core').ExecutionTraceStore;
evolutionStore: import('@waggle/core').EvolutionRunStore;
/**
* Active behavioral spec — baseline `BEHAVIORAL_SPEC` with any
* accepted-and-deployed evolution overrides applied. Re-derived on
* the 'behavioral-spec:reloaded' event.
*/
/** Active behavioral spec — the compiled `BEHAVIORAL_SPEC` baseline. */
activeBehavioralSpec: ReturnType<typeof import('@waggle/agent').buildActiveBehavioralSpec>;
vault: import('@waggle/core').VaultStore;
embeddingProvider: import('@waggle/core').EmbeddingProviderInstance;
skillHashStore: import('@waggle/core').SkillHashStore;
scheduler: import('./cron.js').LocalScheduler;
/** Idle-session self-evolution watcher. Inert unless self-evolution.json enabled. */
idleWatcher: import('./idle-watcher.js').IdleSessionWatcher;
/** H-10 G1: autonomous evolution daemon. Inert unless WAGGLE_EVOLUTION_AUTO_ENABLED=1. */
evolutionService: import('./services/evolution-service.js').EvolutionService;
marketplace: import('@waggle/marketplace').MarketplaceDB | null;
/** Shared per-workspace mind cache. Routes use this to reach an arbitrary
* workspace's mind (e.g. FileIndexer for L-20 auto-indexing). */
@@ -418,7 +400,7 @@ declare module 'fastify' {
sessionManager: import('./workspace-sessions.js').WorkspaceSessionManager;
/**
* Bridges workflow-harness phase events into the execution trace store
* so harnessed runs become training signal for the self-evolution loop.
* so harnessed runs show up in cost tracking and run history.
* Started at boot, stopped on close.
*/
harnessTraceBridge: HarnessTraceBridge;
@@ -533,14 +515,14 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
seedDefaultCrons(cronStore);
// Execution trace store — persistent log of agent runs (self-evolution substrate)
// Execution trace store — persistent log of agent runs (cost tracking, run history)
const traceStore = new ExecutionTraceStore(multiMind.personal);
server.decorate('traceStore', traceStore);
// Workflow-harness → trace bridge. Any harness phase that completes or
// aborts anywhere in the app emits on the shared `harnessEvents` emitter;
// this bridge translates those into rows in `execution_traces` so harness
// runs become training data for the self-evolution loop.
// runs show up in cost tracking.
const harnessTraceBridge = new HarnessTraceBridge({
recorder: new TraceRecorder(traceStore),
});
@@ -550,22 +532,7 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
harnessTraceBridge.stop();
});
// Evolution run store — audit trail of proposed/accepted/rejected self-evolution runs
const evolutionStore = new EvolutionRunStore(multiMind.personal);
server.decorate('evolutionStore', evolutionStore);
// Behavioral spec with deployed overrides applied (self-evolution deploy target).
// Re-derived on the 'behavioral-spec:reloaded' event emitted by evolution routes.
const initialOverrides = loadBehavioralSpecOverrides(fullConfig.dataDir);
let activeBehavioralSpec = buildActiveBehavioralSpec(initialOverrides);
server.decorate('activeBehavioralSpec', activeBehavioralSpec);
eventBus.on('behavioral-spec:reloaded', () => {
const latest = loadBehavioralSpecOverrides(fullConfig.dataDir);
activeBehavioralSpec = buildActiveBehavioralSpec(latest);
// Re-decorate so server.activeBehavioralSpec returns the fresh value.
// Fastify's decorate() is idempotent for reassignment via the instance.
(server as unknown as { activeBehavioralSpec: typeof activeBehavioralSpec }).activeBehavioralSpec = activeBehavioralSpec;
});
server.decorate('activeBehavioralSpec', buildActiveBehavioralSpec());
// Vault — encrypted secret storage
const vault = new VaultStore(fullConfig.dataDir);
@@ -819,86 +786,13 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
// Dynamic connector tools (initial — regenerated per workspace in buildToolsForWorkspace)
const defaultConnectorTools = connectorRegistry.generateTools();
// Insights tools — self-analytics so the agent can reflect on its own performance.
// Aggregates optimization logs + improvement signals across the personal mind and
// every workspace so the agent sees a complete picture regardless of where it runs.
const insightsTools = createInsightsTools({
getOptimizationLogs: (limit: number) => {
const rows: Array<{
tools_used: string;
was_correction: number;
input_tokens: number;
output_tokens: number;
timestamp: string;
}> = [];
try {
rows.push(...new OptimizationLogStore(multiMind.personal).getRecent(limit));
} catch { /* personal store unavailable — keep going */ }
for (const ws of wsManager.list()) {
const wsDb = getWorkspaceMindDb(ws.id);
if (!wsDb) continue;
try {
rows.push(...new OptimizationLogStore(wsDb).getRecent(limit));
} catch { /* workspace store unavailable — skip */ }
}
rows.sort((a, b) => (b.timestamp ?? '').localeCompare(a.timestamp ?? ''));
return rows.slice(0, limit).map(row => {
let toolNames = '';
try {
const parsed = JSON.parse(row.tools_used ?? '[]');
if (Array.isArray(parsed)) toolNames = parsed.join(',');
} catch { /* malformed — leave empty */ }
return {
model: undefined,
tool_names: toolNames,
total_tokens: (row.input_tokens ?? 0) + (row.output_tokens ?? 0),
estimated_cost: 0,
was_correction: row.was_correction,
created_at: row.timestamp,
};
});
},
getImprovementSignals: () => {
const collectFrom = (db: MindDB) => {
const store = new ImprovementSignalStore(db);
return [
...store.getByCategory('capability_gap'),
...store.getByCategory('correction'),
...store.getByCategory('workflow_pattern'),
];
};
const all: Array<{
category: string;
pattern_key: string;
detail: string;
count: number;
first_seen: string;
last_seen: string;
}> = [];
try { all.push(...collectFrom(multiMind.personal)); } catch { /* skip */ }
for (const ws of wsManager.list()) {
const wsDb = getWorkspaceMindDb(ws.id);
if (!wsDb) continue;
try { all.push(...collectFrom(wsDb)); } catch { /* skip */ }
}
return all.map(s => ({
category: s.category,
pattern_key: s.pattern_key,
detail: s.detail,
count: s.count,
first_seen: s.first_seen,
last_seen: s.last_seen,
}));
},
});
// Connector search tools — give the agent natural-language discovery over
// the 148-entry MCP catalog (find_connector, list_connector_categories).
// Static data, zero I/O, no deps — cheap to always-include.
const connectorSearchTools = createConnectorSearchTools();
// Collect all non-subagent tools first (sub-agent tools need the full list)
const baseTools = [...mindTools, ...systemTools, ...planTools, ...gitTools, ...documentTools, ...skillTools, ...cronTools, ...searchTools, ...browserTools, ...lspTools, ...cliTools, ...insightsTools, ...connectorSearchTools, ...defaultConnectorTools];
const baseTools = [...mindTools, ...systemTools, ...planTools, ...gitTools, ...documentTools, ...skillTools, ...cronTools, ...searchTools, ...browserTools, ...lspTools, ...cliTools, ...connectorSearchTools, ...defaultConnectorTools];
// PR4: expose the full native-tool name union to the agent-search route so
// its "you already have a tool for this" lane isn't blind to search/browser/
@@ -945,7 +839,7 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
const targetDb = wsDb ?? multiMind.personal;
const mindLabel = wsDb ? `workspace:${wsId}` : 'personal';
// Structured content: tag provenance so search/evolution can filter
// Structured content: tag provenance so search can filter
// for sub-agent-derived frames and so humans can see where it came from.
const content = `[Sub-agent: ${result.role}] ${result.agentName}\n\n${result.response}\n\n— tools: ${result.toolsUsed.join(', ') || 'none'} · ${(result.duration / 1000).toFixed(1)}s · ${result.usage.inputTokens + result.usage.outputTokens} tokens`;
@@ -1874,7 +1768,7 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
// W4.3d: extraction of the benchmark-proven recall lanes
// (facts/events/profiles) over frames written since the last run.
// Routes through the built-in proxy ('fast' tier = haiku) — the
// same internal-LLM pattern as prompt_optimization above.
// same internal-LLM pattern as the other cron LLM calls.
try {
const llmCall = async (prompt: string, _model: 'fast' | 'accurate'): Promise<string> => {
const proxyUrl = `http://127.0.0.1:${fullConfig.port ?? 3333}/v1/chat/completions`;
@@ -2041,143 +1935,6 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
}
break;
}
case 'prompt_optimization': {
// Background GEPA/Ax prompt optimization — runs daily at 2 AM.
// Iterates workspaces with optimizationEnabled, checks budget, reads logs,
// and invokes PromptOptimizer for variant generation.
try {
const workspaces = wsManager.list().filter(ws => ws.optimizationEnabled);
for (const ws of workspaces) {
const wsDb = getWorkspaceMindDb(ws.id);
if (!wsDb) continue;
const optStore = new OptimizationLogStore(wsDb);
const budget = ws.optimizationBudget ?? 100; // cents, default $1/day
// Check budget before spending any tokens
if (!isWithinBudget(optStore, budget)) {
log.info(`[cron] Prompt optimization: workspace "${ws.name}" over budget, skipping`);
continue;
}
// Read recent logs for analysis
const recentLogs = getRecentLogs(optStore, 100);
if (recentLogs.length < 5) {
// Not enough data to optimize yet
continue;
}
// Analyze patterns: high correction rate, common tools, avg turn count
const stats = optStore.getStats();
const correctionRate = stats.correctionRate;
const avgTurns = stats.avgTurnCount;
// Only trigger optimization if correction rate is above threshold
// or turn count is significantly above average (indicating inefficiency)
if (correctionRate > 0.2 || avgTurns > 15) {
const rate = (correctionRate * 100).toFixed(1);
log.info(`[cron] Prompt optimization: workspace "${ws.name}" — correction rate ${rate}%, avg turns ${avgTurns.toFixed(1)}`);
// Re-check budget before the LLM call (another workspace may have consumed tokens)
if (!isWithinBudget(optStore, budget)) {
log.info(` GEPA optimization skipped — daily budget exceeded`);
continue;
}
// Get the most recent system prompt from the workspace's logs
const currentSystemPrompt = recentLogs[0]?.system_prompt ?? '';
if (!currentSystemPrompt) {
log.info(`[cron] Prompt optimization: no system prompt in logs, skipping`);
continue;
}
// Generate variant via the built-in Anthropic proxy (localhost)
try {
const proxyUrl = `http://127.0.0.1:${fullConfig.port ?? 3333}/v1/chat/completions`;
const variantResponse = await fetch(proxyUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'claude-sonnet-4-6',
max_tokens: 4096,
messages: [
{
role: 'system',
content: `You are a prompt optimization specialist. Your task is to improve an AI agent's system prompt based on performance signals.
The agent's correction rate is ${rate}% (target: under 20%) and average turn count is ${avgTurns.toFixed(1)} (target: under 15).
A high correction rate means the agent frequently misunderstands instructions or produces wrong outputs.
A high turn count means the agent takes too many steps to complete tasks.
Analyze the current system prompt and generate an improved variant that:
1. Adds clearer instructions for areas where corrections are common
2. Reduces unnecessary verbosity that inflates turn count
3. Preserves the core identity and capabilities
4. Is production-ready (not a draft or explanation)
Return ONLY the improved system prompt text. No commentary, no markdown fences, no explanation.`,
},
{
role: 'user',
content: `Here is the current system prompt to improve:\n\n${currentSystemPrompt.slice(0, 12000)}`,
},
],
}),
signal: AbortSignal.timeout(60_000),
});
if (!variantResponse.ok) {
log.warn(`[cron] GEPA variant generation failed: HTTP ${variantResponse.status}`);
} else {
const variantBody = await variantResponse.json() as unknown;
const variantText = parseOpenAiTextCompletion(variantBody).content;
if (variantText.length > 100) {
// Store the variant in the optimization_log with a marker
optStore.insert({
sessionId: `gepa-variant-${Date.now()}`,
workspaceId: ws.id,
systemPrompt: variantText,
toolsUsed: ['gepa_variant'],
turnCount: 0,
wasCorrection: false,
inputTokens: currentSystemPrompt.length,
outputTokens: variantText.length,
});
log.info(` GEPA generated prompt variant (correction_rate=${rate}%)`);
} else {
log.warn(`[cron] GEPA variant too short (${variantText.length} chars), discarding`);
}
}
} catch (variantErr) {
log.warn(`[cron] GEPA variant generation error: ${(variantErr as Error).message}`);
}
// Anti-nag: one signal per (workspace, month, correction-rate bucket).
// Re-runs on the same month with an unchanged rate bucket are suppressed.
emitNotification(server, {
title: 'Prompt optimization signal',
body: `Workspace "${ws.name}" has ${(correctionRate * 100).toFixed(0)}% correction rate — optimization candidate`,
category: 'agent',
}, {
dedupeKey: `prompt_optimization:${ws.id}`,
materialHash: materialFingerprint({
wsId: ws.id,
period: new Date().toISOString().slice(0, 7),
rateBucket: Math.round(correctionRate * 10),
}),
});
}
// Prune old logs (>30 days) to keep the .mind file lean
optStore.pruneOlderThan(30);
}
} catch (err) {
log.warn(`[cron] Prompt optimization failed: ${(err as Error).message}`);
}
break;
}
case 'agent_task': {
// F9: Execute an agent task prompt in a workspace context
const taskConfig = JSON.parse(schedule.job_config || '{}');
@@ -2363,31 +2120,6 @@ Return ONLY the improved system prompt text. No commentary, no markdown fences,
}
break;
}
case 'monthly_assessment': {
try {
const assessment = generateMonthlyAssessment(fullConfig, multiMind.personal);
saveAssessmentToMind(multiMind.personal, assessment);
log.info(`[cron] Monthly assessment for ${assessment.period}: ${assessment.totalInteractions} interactions, ${(assessment.correctionRate * 100).toFixed(1)}% correction rate`);
emitNotification(server, {
title: 'Monthly agent assessment ready',
body: `${assessment.period} report: ${assessment.totalInteractions} interactions, ${(assessment.correctionRate * 100).toFixed(1)}% correction rate — check your workspace home`,
category: 'agent',
actionUrl: '/',
}, {
// Anti-nag: one per period + counters. Same month with unchanged
// counters is suppressed; a new month or changed numbers re-fires.
dedupeKey: 'monthly_assessment',
materialHash: materialFingerprint({
period: assessment.period,
totalInteractions: assessment.totalInteractions,
correctionRateBucket: Math.round(assessment.correctionRate * 100),
}),
});
} catch (err) {
log.warn(`[cron] Monthly assessment failed: ${(err as Error).message}`);
}
break;
}
case 'loop': {
// Loop v0 (L1, report-only): a stateful, memory-powered scheduled
// automation. Resolve the target mind (a specific workspace, else the
@@ -2509,66 +2241,6 @@ Return ONLY the improved system prompt text. No commentary, no markdown fences,
scheduler.start();
server.decorate('scheduler', scheduler);
// Self-evolution: idle-session watcher (CowAgent steal #3, v1). Default OFF via
// <dataDir>/self-evolution.json; when enabled, it reviews idle sessions through
// a restricted `session-reviewer` loopback turn whose only write (create_skill)
// is HELD for human approval. Skipped under test to keep unit runs hermetic
// (mirrors the ChannelManager VITEST guard below).
const idleWatcher = new IdleSessionWatcher({
dataDir: fullConfig.dataDir,
emitNotification: (event, options) => emitNotification(server, event, options),
log: { info: (msg: string) => log.info(msg), warn: (msg: string) => log.warn(msg) },
runReviewTurn: async ({ sessionId, workspaceId }) => {
const transcript = readRecentTranscript(fullConfig.dataDir, workspaceId, sessionId);
if (!transcript) return { content: NOTHING_TO_DO };
const res = await runChannelChatTurn({
port: server.localConfig.port,
sessionToken: server.agentState.wsSessionToken,
message: buildReviewInstruction(sessionId, transcript),
workspace: workspaceId,
session: `evolve-${sessionId}`,
persona: 'session-reviewer',
proposeHeld: true,
origin: 'automation',
});
return { content: res.content, ...(res.error ? { error: res.error } : {}) };
},
});
server.decorate('idleWatcher', idleWatcher);
if (!process.env.VITEST && process.env.NODE_ENV !== 'test') {
idleWatcher.start();
}
server.addHook('onClose', async () => {
idleWatcher.stop();
});
// H-10 G1: Evolution service — autonomous self-evolution daemon.
// Disabled by default; opt-in via WAGGLE_EVOLUTION_AUTO_ENABLED=1 so
// existing deployments don't start burning Anthropic credits silently.
// Even when enabled, the service only produces `proposed` runs — accept
// still happens manually via the Memory → Evolution UI.
const evolutionService = new EvolutionService(
{
traceStore,
runStore: evolutionStore,
getApiKey: () => server.vault?.get('anthropic')?.value ?? null,
getActiveBehavioralSpec: () => (server as unknown as { activeBehavioralSpec: Record<string, unknown> }).activeBehavioralSpec,
log: (level, msg) => {
if (level === 'warn') log.warn(`[evolution-service] ${msg}`);
else log.info(`[evolution-service] ${msg}`);
},
},
{
tickIntervalMs: parseInt(process.env.WAGGLE_EVOLUTION_TICK_INTERVAL_MS ?? '', 10) || undefined,
minTracesPerTarget: parseInt(process.env.WAGGLE_EVOLUTION_MIN_TRACES ?? '', 10) || undefined,
},
);
server.decorate('evolutionService', evolutionService);
if (isEvolutionAutoEnabled()) {
evolutionService.start();
log.info('[evolution-service] autonomous evolution enabled (WAGGLE_EVOLUTION_AUTO_ENABLED=1)');
}
// F2: Daily audit event cleanup (retain 90 days by default)
const auditRetentionDays = parseInt(process.env.WAGGLE_AUDIT_RETENTION_DAYS ?? '90', 10);
const auditCleanupTimer = setInterval(() => {
@@ -2807,7 +2479,6 @@ Return ONLY the improved system prompt text. No commentary, no markdown fences,
await server.register(personaRoutes);
await server.register(feedbackRoutes);
await server.register(workspaceTemplateRoutes);
await server.register(evolutionRoutes);
await server.register(exportRoutes);
await server.register(dataEraseRoutes);
await server.register(costRoutes);
@@ -3288,7 +2959,6 @@ Return ONLY the improved system prompt text. No commentary, no markdown fences,
agentRunRegistry.close();
stopMarketplaceBackgroundSync();
scheduler.stop();
evolutionService.stop();
await offlineManager.stop();
clearInterval(auditCleanupTimer);