Admin Dashboard
Overview of all admin views for monitoring AI usage, research plans, skill executions, and hybrid search.
The admin dashboard is a set of internal views under /admin/* that provide visibility into the research engine's runtime behavior. Every admin page requires authentication (per-page getSession() check) and wraps its content in the standard DashboardPage shell with sidebar navigation.
Admin Views
The dashboard is organized around four views, each targeting a different operational concern:
| View | Route | Purpose |
|---|---|---|
| AI Logs | /admin/ai-logs | Monitor Claude API usage, costs, latency, and test prompts in the playground |
| Research Plans | /admin/research-plans | Inspect plan execution, step progress, artifacts, extractions, and audit trails |
| Skill Executions | /admin/skill-executions | Track skill invocations, routing decisions, durations, and failure rates |
| Hybrid Search | /admin/search | Debug search queries across keyword and semantic indexes, monitor chunk health |
Architecture Pattern
All admin views follow the same structural pattern:
app/admin/<view>/page.tsx Server component: auth check + DashboardPage wrapper
|
v
components/admin/<view>-content.tsx Client component: orchestrates queries and child components
|
+-- KPI / summary cards Aggregated metrics from summary tRPC procedures
+-- Charts (recharts) Time-series and distribution visualizations
+-- Paginated data table Filterable list with drill-down to detail views
+-- Detail panel / page Full record inspection with collapsible sections
Each view queries its own tRPC router. The routers live in packages/api/src/routers/ and enforce authorization via authorizedProcedure (auth + RLS + CASL). See Authorization -- Router Enforcement for how this works.
Data Flow
Admin components use tRPC via TanStack Query (trpc.*.useQuery()) for data fetching. There is no custom caching layer -- TanStack Query's built-in stale-while-revalidate handles cache invalidation.
Client component
|-- trpc.<router>.<procedure>.useQuery(input)
|
v
tRPC client (HTTP batching via httpBatchStreamLink)
|
v
/api/trpc/* route handler
|
v
authorizedProcedure (session + RLS + CASL check)
|
v
Drizzle ORM query against PostgreSQL
Shared Components
All admin views share a small set of utility components:
QueryError-- inline destructive alert for failed tRPC queries, showing the error message in monospaceDashboardPage-- server component wrapper providing the sidebar shell and session context
tRPC Routers Backing Admin Views
| Router | File | Procedures |
|---|---|---|
aiLogs | packages/api/src/routers/ai-logs.ts | summary, usageOverTime, modelDistribution, list, detail, sendPrompt |
researchPlan | packages/api/src/routers/research-plan.ts | list, detail, healthSummary, stepResults, artifacts, extractionResults, branchingConditions, toolCallLog, outputs, feedback, skillExecution, auditLog |
skillExecution | packages/api/src/routers/skill-execution.ts | list, detail, summary |
hybridSearch | packages/api/src/routers/hybrid-search.ts | debugSearch, stats |
All procedures require the read ability on either Organization or ResearchPlan CASL subjects. The sendPrompt mutation (playground) requires update on Organization.
Related Pages
- AI Logs View -- AI usage dashboard and playground
- Research Plans View -- plan monitoring and step inspection
- Skill Executions View -- execution tracking and debugging
- Hybrid Search View -- search debugger and index health
- Authorization -- CASL ability checks used by admin routers
- Drizzle Patterns -- query patterns used in admin tRPC procedures