Summary
Give agents a structured way to report telemetry and arbitrary domain reports back to Trinity via an MCP tool. Persist them in SQLite and surface them on a dashboard so users can see what each agent is producing without reading chat transcripts.
Context
Today agents only emit unstructured text (chat, logs) and a fixed set of metrics (cost, context, tool counts). Anything domain-specific — leads found, emails sent, deals progressed, KPI snapshots, weekly summaries — is buried in chat history. We need a generic "agent report" primitive that's typed enough to display but flexible enough to fit any agent.
Proposed Shape
MCP tool (new):
report(report_type: str, title: str, payload: dict, schema_version?: int, period_start?: str, period_end?: str)
report_type namespaced (e.g. recon.weekly_summary, prospector.leads_found, ops.daily_health, custom.*)
payload arbitrary JSON
- Resolves agent + user from MCP auth context (no spoofing)
Storage: new agent_reports table (id, agent_name, user_id, report_type, title, payload JSON, schema_version, period_start/end, created_at). Index on (agent_name, created_at DESC) and (report_type, created_at DESC).
Backend: routers/reports.py — list/get/delete with the standard owner/sharing/admin gate. WebSocket agent_report broadcast for live updates.
Frontend: a "Reports" tab on AgentDetail + a fleet-wide Reports view on the dashboard. Generic renderer that knows a handful of payload shapes (table, KPI tiles, markdown, timeline) chosen by report_type prefix or a display_hint field.
Example report types
prospector.weekly_leads → table of leads with score
recon.competitor_changes → timeline of detected changes
ops.fleet_health → KPI tiles (uptime, errors, cost)
kb-agent.coherence → markdown summary + counters
chief-of-staff.daily_brief → markdown
custom.* → free-form, rendered as JSON viewer
Acceptance Criteria
Technical Notes
- Follows the three-surface rule: backend router, MCP tool, frontend store/view
- No agent-server endpoint needed — reports flow agent → MCP → backend
- Per-user scoping: same access model as
agent_activities / chat_messages
- Consider audit-log entry on report write (low priority; reports themselves are the audit)
Summary
Give agents a structured way to report telemetry and arbitrary domain reports back to Trinity via an MCP tool. Persist them in SQLite and surface them on a dashboard so users can see what each agent is producing without reading chat transcripts.
Context
Today agents only emit unstructured text (chat, logs) and a fixed set of metrics (cost, context, tool counts). Anything domain-specific — leads found, emails sent, deals progressed, KPI snapshots, weekly summaries — is buried in chat history. We need a generic "agent report" primitive that's typed enough to display but flexible enough to fit any agent.
Proposed Shape
MCP tool (new):
report_typenamespaced (e.g.recon.weekly_summary,prospector.leads_found,ops.daily_health,custom.*)payloadarbitrary JSONStorage: new
agent_reportstable (id, agent_name, user_id, report_type, title, payload JSON, schema_version, period_start/end, created_at). Index on(agent_name, created_at DESC)and(report_type, created_at DESC).Backend:
routers/reports.py— list/get/delete with the standard owner/sharing/admin gate. WebSocketagent_reportbroadcast for live updates.Frontend: a "Reports" tab on AgentDetail + a fleet-wide Reports view on the dashboard. Generic renderer that knows a handful of payload shapes (table, KPI tiles, markdown, timeline) chosen by
report_typeprefix or adisplay_hintfield.Example report types
prospector.weekly_leads→ table of leads with scorerecon.competitor_changes→ timeline of detected changesops.fleet_health→ KPI tiles (uptime, errors, cost)kb-agent.coherence→ markdown summary + counterschief-of-staff.daily_brief→ markdowncustom.*→ free-form, rendered as JSON viewerAcceptance Criteria
agent_reportstable + schema migrationreport(and matching backend endpoint) with auth-context resolutionGET /api/agents/{name}/reportsandGET /api/reports(fleet-wide, access-controlled)agent_reportbroadcastcleanup_service(default 90d, configurable)Technical Notes
agent_activities/chat_messages