Skip to content

feat: subagent and profile analytics across panel, server, and CLI#244

Merged
upsetbit merged 9 commits into
masterfrom
feat/subagent-profile-analytics
Jun 14, 2026
Merged

feat: subagent and profile analytics across panel, server, and CLI#244
upsetbit merged 9 commits into
masterfrom
feat/subagent-profile-analytics

Conversation

@upsetbit

@upsetbit upsetbit commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Richer visibility into subagent delegation and per-agent profiles, built entirely on existing columns (sessions.parent_session_id, sessions.profile, session_usage) — no schema changes, no new dependencies.

Server — five new reports + profile filtering

  • GetReportRequest gains profile/profiles fields; buildWhere scopes every report by them.
  • New reports: usage_by_hour (hour-of-day model/token profile), subagent_usage_by_day (direct vs subagent usage split), subagent_parents (one row per spawning session), profile_usage (per device/agent/profile/model with token sums + last activity), profiles_by_day.

Panel

  • /insights: new full-width Across the day card (sessions per local hour stacked by model + tokens per hour), a Fan-out histogram (subagents per spawning session), a Delegation section (spawning sessions, subagent sessions, % tokens delegated, est. subagent spend, max fan-out + weekly delegated-share trend), and a Top delegating sessions list deep-linking into /sessions. The per-parent-agent table keeps its card.
  • /profiles: rebuilt from a bare table into a dashboard — KPI strip (active profiles, sessions outside default, tokens, est. spend), stacked weekly sessions-per-profile trend, tokens & cost per agent·profile with a cost donut, and the device × agent × profile table enriched with tokens, cost, and last seen.
  • Filter chrome: Home, Insights, and Profiles gain a Profile multi-select in the shared drawer, with active-filter chips.

CLI

  • prosa analytics subagents — SQLite mirror of the per-parent-agent fan-out report.
  • --profile now applies with --remote (was silently dropped).

Docs

docs/panel/screens.md (Insights cards, new Profiles section, 7-entry sidebar), docs/architecture/{panel,server,cli}.md, docs/usage.md, and the proto report enumeration are aligned with the new surface.

Known caveat (documented in screens.md)

The delegated-token share counts any session with a parent edge, while the parent-grouped KPIs require the parent row to exist — a child whose parent was never imported counts in the share but not under spawning sessions.

Test plan

  • go test -race ./... including Postgres-backed e2e (PROSA_TEST_PG_URL) covering all five new reports and both profile-filter paths
  • golangci-lint, go vet, gen-check, lint-md clean
  • Panel render tests for /insights and /profiles drive the real handlers against a fake upstream
  • CLI smoke against a real local store: prosa analytics subagents (table + --json)

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

upsetbit and others added 9 commits June 12, 2026 02:52
GetReportRequest gains profile (CLI --profile) and profiles (panel
multi-select) so analytics reports can be scoped per profile, and the
report-name comment now enumerates the full report set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
buildWhere honors the new profile/profiles request fields, and GetReport
gains five reports: usage_by_hour (hour-of-day model/token profile),
subagent_usage_by_day (direct vs subagent usage split), subagent_parents
(one row per spawning session), profile_usage (per device/agent/profile/
model with token sums and last activity), and profiles_by_day.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
prosa analytics subagents mirrors the server's per-parent-agent fan-out
report against the local SQLite store, and the remote path now maps
--profile onto the GetReport request instead of silently dropping it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Home and Insights filter drawers gain a profile multi-select wired
through dashboardReportRequest onto the analytics RPC's repeated
profiles field, with active-filter chips and dropdown options sourced
from the profiles report (shared with the sessions page via
profileLabelsFromRows).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/insights gains an Across the day card (sessions per local hour stacked
by model plus tokens per hour, from usage_by_hour) and a full Delegation
section: KPI strip with delegated token share and estimated subagent
spend, a weekly delegated-share trend, a fan-out histogram, and a
top-delegating-sessions list deep-linking into /sessions. The per-parent
agent table keeps its card.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/profiles grows from a bare table into a dashboard sharing the Home/
Insights filter chrome: KPI strip (active profiles, sessions outside
default, tokens, est. spend), a stacked sessions-per-profile weekly
trend, tokens & cost per agent·profile with a cost donut, and the
device × agent × profile table enriched with tokens, cost, and last
seen — cells still deep-link into /sessions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ts CLI report

screens.md gains the Delegation and Across-the-day cards on Insights,
the Profiles dashboard section, and the profile filter in the shared
drawer; panel.md and server.md reflect the new routes and reports;
cli.md and usage.md list prosa analytics subagents.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…dings

Lowercase the profiles empty-state message per the design contract,
document the sessions page's five filter controls (profile included),
and list all seven pages in the command palette mock.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@upsetbit upsetbit merged commit 8dbb8d1 into master Jun 14, 2026
5 checks passed
@upsetbit upsetbit deleted the feat/subagent-profile-analytics branch June 14, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant