Agent: programmer (
programmer)
Confidence: 61%
Cost: $1.3915
Duration: 4m 39s
Task ID:4522cc1b-8ed3-4851-aff7-52e36f9464e1
All tasks complete. Here’s the summary:
SPEC-08 Implementation Summary
Changes Made
File 1 (新建): src/agents/stats-snapshot.ts
snapshotDailyStats(date)— Reads all agent configs, captures per-agent stats (runs, failures, cost, confidence, duration) for the given date, writes tosoul/agent-stats/daily/{YYYY-MM-DD}.json. Idempotent (skips if file already exists). Auto-creates directory.getAgentTrends(agentName, days?)— Reads recent N daily files, computes trend points for cost/failures/confidence, calculates change percentages (first-half vs second-half average), generates recommendations.- Exported types:
DailyAgentStats,AgentDayStats,TrendPoint,TrendData
File 2: src/agents/worker-scheduler.ts (line ~1563)
- Added daily stats snapshot call inside
checkScheduledAgents(), alongside existing daily operations (budget optimization, knowledge compaction). Snapshots yesterday’s data usinggetTodayString(new Date(now - 86400_000)).
File 3: src/mcp/bot-tools-server.ts (before // ── Start)
- Added
get_agent_trendsMCP tool with params:agentName(string, required),days(number, 1-90, optional, default 7). Returns formatted markdown with cost/failure/confidence trends and summary.
Verification
tsc --noEmit— EXIT_CODE=0 (pass)snapshotDailyStatsandgetAgentTrendsboth exported
—HANDOFF—
TO: reviewer
INTENT: handoff
ARTIFACT_TYPE: code-change
SUMMARY: SPEC-08 Agent Performance Trend Observability — 新建 stats-snapshot.ts + worker-scheduler 每日快照 + get_agent_trends MCP tool