Sloth-ninja gives firm admins a clearer view of usage

This fork adds an administrative dashboard for tracking how a firm is using the platform.

analyticsmulti-tenant

The new dashboard is aimed at the person responsible for seeing whether a legal AI rollout is actually being used, rather than merely being available. It creates a single place for firm-level usage reporting, giving administrators a more practical basis for adoption conversations and operational follow-up.

Just as importantly, the follow-up work fixes two quiet ways dashboards can mislead: activity is grouped consistently by UTC date, and reports no longer count events dated in the future. Those details matter when a partner or legal-ops lead is using the figures to judge uptake across offices or compare periods.

So what Firm leaders and legal-ops teams should care because trustworthy usage reporting is the difference between measuring adoption and guessing at it.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from Sloth-ninja/JessicaOSS, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
863f8447 WS8 PR D: admin usage dashboard sloth-ninja 2026-07-22 ↗ GitHub
commit body
Read-only firm usage overview for organisation admins. Aggregates existing
activity (chats, tabular reviews as workflow runs, documents) into period
totals, per-member activity, per-workflow-template runs and a per-day chat
trend. No migration, no new event capture, no new env vars.

Backend: lib/usageStats.ts (org-scoped aggregation, uuid->text member
resolution, 30d fetch floor, injectable now) + GET /admin/usage (requireAdmin,
asyncHandler, ?days=7|30). Frontend: (pages)/admin/dashboard with 4 stat tiles,
a restrained single-accent SVG daily bar chart (DD/MM labels, tabular figures),
member + workflow-template tables, 7d/30d switch, loading skeletons and
error+retry. mikeApi.getFirmUsage; sidebar Dashboard item (isAdmin-gated).

Tests: 10 usageStats cases incl. the watertight another-org-excluded case,
uuid->text matching, window edges/bucketing, empty/single org. Backend vitest
234 passed; backend+frontend tsc clean; evals:smoke 4/4.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
22699fe5 WS8 PR D: review round 1 - UTC dates, future-event bound, comments sloth-ninja 2026-07-23 ↗ GitHub
commit body
Independent review (approve-with-fixes, all Minor):
1. Dashboard formatUkDate now renders lastActive/lastRun in UTC (timeZone:
   "UTC") so dates can't drift a day from the UTC-bucketed trend for late-night
   UK viewers.
2. usageStats: added an upper bound - a future-dated created_at (clock skew /
   bad data) is treated as no timestamp everywhere (local eventTime helper), so
   it can't count in tiles while falling outside the daily series. New test.
3. usageStats: commented the "Untitled workflow" fallback as defensive-only
   (titleById is always populated by the has() guard; workflows.title is NOT
   NULL) - kept for safety.
4. BUILD_LOG: recorded the definition-of-done deviation that the chart/tables
   were not screenshotted in a running app (geometry validated by reasoning +
   mock-up parity).

Backend tsc clean; vitest 235 passed (20 files). Frontend tsc clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
188ee8b0 Merge pull request #39 from Sloth-ninja/ws8-usage-dashboard Ezana.H 2026-07-23 ↗ GitHub
WS8 PR D: admin usage dashboard

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-871.md from inside the repo you want the changes in.

⬇ Download capture-thread-871.md