Problem
DailyStatsActor._totalSkillsLoaded is a process-lifetime, non-persisted counter. The field comment at src/Netclaw.Daemon/Gateway/DailyStatsActor.cs:22 says it explicitly: "Process-lifetime totals (never reset, never persisted — lost on restart)". netclaw stats reads this value via DaemonStatsService.SkillsLoadedTotal → DailyStatsActor.QueryProcessStats → ProcessStatsResult.SkillsLoadedTotal.
Result: every daemon restart silently resets the displayed lifetime counter to 0, masking real activity from before the restart. The daily_stats SQLite table already has historical per-day totals that would survive a restart, but they're not surfaced through netclaw stats.
Evidence
daily_stats shows non-zero historical skills_loaded:
| date_key |
skills_loaded |
| 2026-04-08 |
1 |
| 2026-04-09 |
1 |
| 2026-04-10 |
0 |
| 2026-04-11 |
0 |
But netclaw stats always shows 0 because the daemon restarted at 2026-04-10 22:14 UTC, wiping the in-memory lifetime counter.
Options
- Sum from
daily_stats on query. In DailyStatsActor, change QueryProcessStats to read persisted rows + any unflushed in-memory _pending accumulators. Most accurate; no new state.
- Persist lifetime totals to a new table. Write a
lifetime_totals row that gets updated on each flush. Simpler to query but adds schema.
- Display both "today" and "lifetime" in
netclaw stats. Keep the volatile counter for the process-lifetime number but add a persisted total read from daily_stats.
Option 1 is simplest and doesn't require schema changes.
Affected
src/Netclaw.Daemon/Gateway/DailyStatsActor.cs — QueryProcessStats handler, _totalSkillsLoaded field
src/Netclaw.Daemon/Gateway/DaemonStatsService.cs:32-33,57 — query call site
src/Netclaw.Cli/Tui/StatsPage.cs:144 — display (no change needed if upstream value becomes correct)
src/Netclaw.Cli/Program.cs:1227 — netclaw stats plain-CLI path (no change if upstream fixed)
Related
Discovered while investigating netclaw stats Skills loaded: 0 under milestone 0.12.
Problem
DailyStatsActor._totalSkillsLoadedis a process-lifetime, non-persisted counter. The field comment atsrc/Netclaw.Daemon/Gateway/DailyStatsActor.cs:22says it explicitly: "Process-lifetime totals (never reset, never persisted — lost on restart)".netclaw statsreads this value viaDaemonStatsService.SkillsLoadedTotal→DailyStatsActor.QueryProcessStats→ProcessStatsResult.SkillsLoadedTotal.Result: every daemon restart silently resets the displayed lifetime counter to 0, masking real activity from before the restart. The
daily_statsSQLite table already has historical per-day totals that would survive a restart, but they're not surfaced throughnetclaw stats.Evidence
daily_statsshows non-zero historical skills_loaded:But
netclaw statsalways shows 0 because the daemon restarted at 2026-04-10 22:14 UTC, wiping the in-memory lifetime counter.Options
daily_statson query. InDailyStatsActor, changeQueryProcessStatsto read persisted rows + any unflushed in-memory_pendingaccumulators. Most accurate; no new state.lifetime_totalsrow that gets updated on each flush. Simpler to query but adds schema.netclaw stats. Keep the volatile counter for the process-lifetime number but add a persisted total read fromdaily_stats.Option 1 is simplest and doesn't require schema changes.
Affected
src/Netclaw.Daemon/Gateway/DailyStatsActor.cs—QueryProcessStatshandler,_totalSkillsLoadedfieldsrc/Netclaw.Daemon/Gateway/DaemonStatsService.cs:32-33,57— query call sitesrc/Netclaw.Cli/Tui/StatsPage.cs:144— display (no change needed if upstream value becomes correct)src/Netclaw.Cli/Program.cs:1227—netclaw statsplain-CLI path (no change if upstream fixed)Related
Discovered while investigating
netclaw stats Skills loaded: 0under milestone 0.12.