You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: document v0.18.0 analytics across external and internal guides
Add coverage for multi-dimensional analytics, intelligent backend
selection, and new MCP tools across all user-facing and contributor
doc surfaces:
External docs:
- reference/mcp-tools.md: new Analytics tools section + readonly tier
- reference/configuration.md: use_recommended_backend setting
- guides/web-dashboard.md: Analytics page section with 4-tab overview
- guides/mcp-setup.md: Analytics tools subsection for MCP clients
Internal docs:
- internal/features/server.md: 9 analytics REST routes documented
- internal/features/mcp.md: new Analytics Tools section + renumbered
Cross-links point to the existing analytics.md guide for deep dives.
Style and formatting match each file's existing conventions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Kagan exposes its analytics data over MCP so external clients (Claude Desktop, Cursor, Claude Code, etc.) can query agent performance and session activity programmatically. These tools are available to every role (`WORKER`, `REVIEWER`, `ORCHESTRATOR`) and operate on the currently active project — open a project in Kagan first, otherwise they return empty results.
|**By Role**| Per-role success rates (Worker / Orchestrator / Reviewer) and a role comparison chart |
58
+
|**By Task Type**| Per-task-type success rates and a Backend x Task Type matrix |
59
+
|**Combined**| 3D table of Backend x Role x Task Type combinations |
60
+
61
+
Top-of-page controls:
62
+
63
+
-**Time range dropdown**: 7 / 14 / 30 days.
64
+
-**Export**: downloads the current dataset as JSON.
65
+
-**Glossary**: help icon that explains each metric.
66
+
67
+
See [Analytics & Metrics](./analytics.md) for the full metric definitions, task-type classifier, and access across other surfaces (TUI, CLI, VS Code, MCP).
68
+
49
69
## Settings
50
70
51
71
The settings page uses a left sidebar for category navigation. See [Configuration reference -- Web dashboard settings](../reference/configuration.md#web-dashboard-settings) for the full category list.
Read-only wrappers around `Analytics` in `kagan.core._analytics`, scoped to the active project. All three tools are registered in the WORKER tier so any agent role can query them; they return empty payloads when no project is active.
117
+
118
+
-`analytics_backend_stats` — per-backend aggregates (count, success rate, avg duration, retry rate) for choosing an agent backend
119
+
-`analytics_session_timeline(days=30)` — daily session counts bucketed by status (completed/failed/cancelled/running/pending) for trend charts
120
+
-`analytics_export(days=30)` — combined `{exported_at, period_days, backend_stats, session_timeline}` snapshot for archival or offline analysis
121
+
122
+
The richer multi-dimensional analytics (by agent role, by task type, per-task backend recommendation) live only on the REST surface under `/api/analytics/*` (see `src/kagan/server/_analytics_routes.py`). They are intentionally not exposed as MCP tools yet — add them to `toolsets/analytics.py` and register in `_policy.py` if a use case emerges.
Registered in `src/kagan/server/_analytics_routes.py`. All endpoints require an active project context — if none is set, they return an empty list or object rather than erroring. Used by the web dashboard's analytics views and by agents deciding which backend to invoke.
|`GET /api/analytics/backend-stats`| Per-backend aggregates (sessions, success rate, duration) for the active project. |
210
+
|`GET /api/analytics/session-timeline?days=N`| Daily session counts over the last `N` days (default 30). |
211
+
|`GET /api/analytics/timeline-summary?days=N`| Rolled-up timeline aggregates over `N` days (default 30). |
212
+
|`GET /api/analytics/recommended-backend`| Simple recommendation: the backend with the highest success rate for this project. |
213
+
|`GET /api/analytics/export?days=N`| Combined export blob (backend stats + session timeline) over `N` days — used for download/share. |
214
+
|`GET /api/analytics/by-role`| Backend stats grouped by agent role (WORKER/REVIEWER/ORCHESTRATOR). |
215
+
|`GET /api/analytics/by-task-type`| Backend stats grouped by task type. |
216
+
|`GET /api/analytics/by-role-and-task-type?role=&task_type=`| 3D stats (backend × role × task type), optionally filtered by role and/or task type query params. |
217
+
|`GET /api/analytics/recommend-for-task?title=&description=&role=`| Intelligent backend selection via `BackendSelector` — combines history with task title/description. |
218
+
219
+
`title` is required on `/recommend-for-task`; omitting it returns a default `claude-code` recommendation with zero confidence.
|`use_recommended_backend`| boolean |`false`| Auto-pick the best-performing backend per task from historical analytics (requires ≥5 prior sessions per backend × role × task-type). See [intelligent backend selection](../guides/analytics.md#intelligent-backend-selection). |
49
50
|`additional_instructions`| string |`""`| Free-text rules appended to every agent prompt |
-**Use case**: Snapshot aggregate analytics in a single call for archival, sharing, or offline analysis.
143
+
144
+
Additional multi-dimensional analytics (by role, by task type, per-task backend recommendation) are exposed over REST at `/api/analytics/...` but are not currently wrapped as MCP tools.
0 commit comments