plugins/hermes-achievements/docs/achievements-performance-spec.md
Status: Draft (no code changes yet)
Owner: hermes-achievements plugin
Scope: dashboard/plugin_api.py + dashboard/dist/index.js request behavior
Decision: Drop /overview and top-banner slots; keep only Achievements tab data path.
Current plugin endpoints /achievements and /overview both execute a full history recomputation (evaluate_all()), which performs a full SessionDB scan each request.
Observed on this machine/repo:
evaluate_all() ~13–16s per call/achievements ~13–15s per call/overview ~12–15s per callGiven current product direction, /overview and cross-tab top-banner slots are not needed.
/overview) and slot wiring.Non-goals (phase 1):
GET /api/plugins/hermes-achievements/achievementsSingle source endpoint for Achievements UI. Returns full payload used by the tab:
achievementsunlocked_countdiscovered_countsecret_counttotal_counterrorPOST /api/plugins/hermes-achievements/rescan (optional)Manual refresh trigger. Prefer async trigger + immediate status response.
GET /api/plugins/hermes-achievements/scan-status (optional new)Reports scan state for UX/ops.
GET /api/plugins/hermes-achievements/overviewKeep:
/achievements in plugin tab manifest)Remove:
sessions:top and analytics:top/overview/achievements)FRESH: cached snapshot age <= TTLSTALE: snapshot exists but expiredSCANNING: background recompute runningFAILED: last recompute failed, last good snapshot still servedRules:
~/.hermes/plugins/hermes-achievements/scan_snapshot.json~/.hermes/plugins/hermes-achievements/scan_checkpoint.jsonsession_idupdated_at, message_count, or hash)/achievements once on mount.is_stale=true, UI may display “Updating in background”./achievements p95 < 1s (cached)Track:
Expose minimal diagnostics in /scan-status.
/achievements response shape backward-compatible./overview is acceptable because slot UI is intentionally removed./overview can return static deprecation response for one release.generated_at and explicit refresh status.Plugin state directory:
~/.hermes/plugins/hermes-achievements/Files:
state.json (existing): unlock trackingscan_snapshot.json (new): latest materialized achievements payloadscan_checkpoint.json (new): per-session fingerprints + contributions for incremental refresh