Skip to content

feat: add skill usage analytics backend#688

Open
charlieviettq wants to merge 1 commit into
kenn-io:mainfrom
charlieviettq:codex/upstream-skill-analytics-backend
Open

feat: add skill usage analytics backend#688
charlieviettq wants to merge 1 commit into
kenn-io:mainfrom
charlieviettq:codex/upstream-skill-analytics-backend

Conversation

@charlieviettq

Copy link
Copy Markdown
Contributor

Summary

  • add GET /api/v1/analytics/skills for skill usage analytics from tool_calls.skill_name
  • add db.Store.GetAnalyticsSkills with SQLite, PostgreSQL, and DuckDB implementations
  • include generated API client types for the new response shape

Compatibility

  • additive API only
  • no behavior changes to existing analytics endpoints
  • empty skill names are ignored and response payload remains valid for empty data

Privacy/Data

  • local analytics only; no data is uploaded
  • aggregates existing tool_calls.skill_name values

Tests

  • go test -tags "fts5,kit_posthog_disabled" ./internal/db ./internal/server ./internal/postgres ./internal/duckdb ./internal/backendcontract
  • cd frontend && npm run check
  • cd frontend && npm run generate:api
  • git diff --check

Follow-ups

  • parser improvements to populate skill_name for Codex/Cursor from SKILL.md reads
  • frontend Top Skills analytics panel

@roborev-ci

roborev-ci Bot commented Jun 14, 2026

Copy link
Copy Markdown

roborev: Combined Review (67450b7)

No Medium, High, or Critical findings were reported.

The only reported issue was Low severity and has been omitted per instructions.


Panel: ci_default_security | Synthesis: codex, 5s | Members: codex_default (codex/default, done, 7m17s), codex_security (codex/security, done, 59s) | Total: 8m21s

@charlieviettq charlieviettq force-pushed the codex/upstream-skill-analytics-backend branch from 67450b7 to fed42d1 Compare June 14, 2026 16:43
@roborev-ci

roborev-ci Bot commented Jun 14, 2026

Copy link
Copy Markdown

roborev: Combined Review (fed42d1)

Skill analytics changes have one Medium correctness issue; no security findings reported.

Medium

  • internal/db/analytics.go:2254: last_used_at is populated from the session start/created timestamp (info.ts) instead of the timestamp of the message/tool call that used the skill. Long-running sessions will report stale skill usage times, and the same session-based timestamp pattern is mirrored in the PostgreSQL and DuckDB implementations.
    • Fix: Join tool_calls to messages and aggregate the latest message timestamp per session/skill, using that value for LastUsedAt and trend bucketing with a session timestamp fallback only when message timestamps are missing.

Panel: ci_default_security | Synthesis: codex, 8s | Members: codex_default (codex/default, done, 5m25s), codex_security (codex/security, done, 16s) | Total: 5m49s

mariusvniekerk pushed a commit that referenced this pull request Jun 15, 2026
## Summary

- add a full-width `Top Skills` panel to the Analytics page
- fetch data from `GET /api/v1/analytics/skills`
- show all-agent skill totals with visible per-agent breakdowns
- keep project breakdown secondary and remove click/search behavior until a backend skill session filter exists

## Compatibility

- frontend-only follow-up to #688
- no backend changes beyond the endpoint introduced in #688
- UI copy is English

## Tests

- `cd frontend && npm run check`
- `cd frontend && npm test -- --run`
- `git diff --check`

## Review note

This branch is stacked on #688 (`feat: add skill usage analytics backend`) because it uses the generated API client for `GET /api/v1/analytics/skills`. After #688 merges, this PR can be rebased onto upstream `main` for a cleaner diff.

Co-authored-by: Trần Quốc Việt <charlieviettq@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant