PRD-76: Agent Reporting & Workspace

Version: 1.0 Status: Draft Priority: P1 Author: Gar Kavanagh + Claude Created: 2026-03-09 Updated: 2026-03-09 Dependencies: PRD-55 (Agent Heartbeats — COMPLETE), PRD-72 (Activity Command Centre — IN PROGRESS), PRD-66 (Code Canvas — COMPLETE), PRD-71 (Unified Skills — COMPLETE)


Executive Summary

Agents run heartbeats, execute recipes, and complete tasks — but their output disappears. Sentinel writes a status report to scratchpad_write which goes to Redis and evaporates after execution. The heartbeat_results table captures metadata (status, findings count, tokens) but not the actual report content. Users can see "Sentinel ran at 7:30am" but can't read what it found.

This PRD introduces Agent Reports — a hybrid storage system where structured metadata lives in PostgreSQL and report content lives in the workspace filesystem. Reports become first-class objects: viewable, downloadable, gradeable, and shareable between agents.

What We're Building

  1. agent_reports table — lightweight metadata for discovery, filtering, stats, and grading

  2. Workspace report storage/reports/{agent_name}/{date}_{title}.{ext} convention for full content (markdown, images, CSVs, PDFs, any file type)

  3. platform_submit_report tool — single tool agents call to write file + insert DB row

  4. Reports tab on Activity page — grid of report cards, filterable, with inline viewer

  5. Reports tab on Agent profile — per-agent standup view with run history and report quality

  6. Report viewer — slide-over panel with rendered content, download, and user grading

  7. Cross-agent file access — agents can read reports from other agents via workspace_read_file

What We're NOT Building

  • Auto-reviewing agent (too much complexity for unclear value — user grading via simple slider for now)

  • New file explorer widget (Code Canvas stays for code; reports get their own dedicated viewer)

  • Report template engine (agents write freeform markdown; structure comes from their skill prompts)

Page Restructuring (from PRD-72 amendments)

Change
From
To

Activity page tabs

Dashboard | Feed | Recipes | Missions

Dashboard | Feed | Routines | Reports | Missions

Agents page tabs

Roster | Configuration | Coordination | Performance

Roster | Configuration | Coordination | Recipes

Recipes tab

Lives on Activity page

Moves to Agents page (all config in one place)

Performance tab

Dead code on Agents page

Replaced by Recipes tab


1. Database Schema

1.1 agent_reports Table

1.2 Workspace File Convention

Naming rules (critical for cross-agent access):

  • Agent name: lowercase, hyphens for spaces, no special chars → slugify(agent.name)

  • Date prefix: YYYY-MM-DD_HHMM in agent's configured timezone (or UTC)

  • Slug: kebab-case summary → weekly-marketing-update, platform-health-check

  • Extension matches content type

Example cross-agent workflow:


2. Platform Tool: platform_submit_report

2.1 Tool Definition

2.2 Execution Flow

2.3 Integration with Heartbeat Service

After _agent_tick() and _orchestrator_tick() complete, the heartbeat service should:

  1. Check if the agent produced a report (via platform_submit_report tool call in the execution)

  2. If no report was produced, auto-create a minimal standup entry from the heartbeat_results data:

This ensures every heartbeat run has a corresponding report row — even if the agent forgot to call platform_submit_report.


3. API Endpoints

3.1 Report CRUD

Method
Path
Description

GET

/api/reports

List reports for workspace. Query: agent_id, report_type, status, graded (bool), period (1d/7d/30d), limit, offset

GET

/api/reports/{id}

Single report metadata + content (fetches file from workspace)

GET

/api/reports/{id}/download

Download report file (Content-Disposition: attachment)

PATCH

/api/reports/{id}/grade

Submit grade (1-5) and optional notes

GET

/api/reports/stats

Aggregate stats: total, by_type, by_status, avg_grade, ungraded_count. Query: period

GET

/api/agents/{id}/reports

Reports for a specific agent. Query: report_type, period, limit

3.2 Response Schemas


4. Activity Page — Reports Tab

4.1 Updated Tab Structure

4.2 Reports Tab Layout

Left border colours by status:

  • OK: border-l-[hsl(var(--success))] (green)

  • Warning: border-l-[hsl(var(--warning))] (amber)

  • Critical: border-l-[hsl(var(--destructive))] (red)

  • Info: border-l-[hsl(var(--info))] (blue)

Report type badges (muted, after agent name):

Type
Badge
Icon

Standup

Standup

ClipboardCheck

Research

Research

Search

Incident

Incident

AlertTriangle

Summary

Summary

FileText

Delivery

Delivery

Package

Audit

Audit

Shield

4.3 Report Viewer (Slide-Over Panel)

Clicking "View" on a report card opens a slide-over panel from the right (60% width on desktop, full-screen on mobile):

Content rendering:

  • Markdown → rendered HTML (using existing react-markdown or @uiw/react-md-editor preview)

  • Images → inline preview

  • CSV → simple table preview

  • PDF → embedded viewer or download prompt

  • Other → download only

4.4 Feed Integration

Reports also appear in the Feed tab as activity items:

Type: report added to ActivityFeedItem.type union.


5. Agents Page — Reports Tab + Recipes Tab

5.1 Updated Tab Structure

5.2 Agent Profile — Reports Section

On the individual agent config/detail view, add a "Reports" section or tab:


6. Workspace Storage & Cross-Agent Access

6.1 File Lifecycle

6.2 Cross-Agent Pattern

Agents reference each other's reports by convention:

Or via the DB:

6.3 Download Endpoint

For attachments:


7. Heartbeat Service Integration

7.1 Changes to heartbeat_service.py

After _agent_tick() completes:

7.2 Auto-Report Content Template


8. File Structure


9. Implementation Phases

Phase 1: DB + Tool + Auto-Report (Backend Foundation)

  1. Create agent_reports table migration

  2. Add AgentReport SQLAlchemy model

  3. Build report_service.py (create, list, get, grade, stats)

  4. Build platform_submit_report tool (ActionDefinition + executor handler)

  5. Build platform_get_latest_report tool

  6. Wire heartbeat service auto-report fallback

  7. Create /api/reports endpoints

Phase 2: Activity Page Reports Tab (Frontend)

  1. Add "Reports" tab to Activity page (replace Recipes position)

  2. Build activity-reports.tsx with report card grid

  3. Build report-card.tsx component

  4. Build filter bar (type, agent, status, period, ungraded toggle)

  5. Build use-reports.ts hooks with polling

Phase 3: Report Viewer + Grading

  1. Build report-viewer.tsx slide-over panel

  2. Implement markdown rendering for report content

  3. Build report-grade-form.tsx (star rating + notes)

  4. Wire grade submission to PATCH /api/reports/{id}/grade

  5. Add download button (single file + attachments)

Phase 4: Agent Profile Integration

  1. Add Reports section to agent detail/config view

  2. Build agent-reports.tsx (summary stats + recent list)

  3. Link "View All →" to Activity Reports tab filtered by agent

Phase 5: Recipes Tab Migration + Feed Integration

  1. Move Recipes tab component from Activity to Agents page

  2. Replace dead Performance tab with Recipes

  3. Add report items to Activity Feed

  4. Update Activity stats to include report counts

Phase 6: Polish

  1. Report content rendering for non-markdown (images, CSV tables, PDF)

  2. Mobile responsive pass

  3. Loading skeletons for report cards

  4. Empty states ("No reports yet — configure a heartbeat to get started")

  5. Attachment preview (inline images, downloadable files)

  6. prefers-reduced-motion compliance


10. Sentinel Skill Update

Update /automatos-skills/sentinel/SKILL.md to use platform_submit_report instead of scratchpad_write:

Step 6 in workflow changes from:

Call scratchpad_write to persist the current baseline and report.

To:

Call platform_submit_report with the full status report. Use report_type: "standup", set status based on findings severity (ok/warning/critical). Include metrics: { services_checked, errors_found, avg_response_ms, daily_llm_cost }.

All agent skills that produce reports should be updated to call platform_submit_report.


11. Success Metrics

Metric
Target
How to Measure

Report visibility

100% of heartbeat runs produce a report row

Compare heartbeat_results count vs agent_reports count

Time to read a report

< 2 clicks from Activity page

Click "Reports" tab → click report card

Cross-agent file access

Agents can read other agents' reports

Integration test: Agent B reads Agent A's report file

Grading adoption

>50% of reports graded within 24h

ungraded_count / total from stats endpoint

Report quality trend

Avg grade improves over 30 days

Weekly avg_grade trend


12. Open Questions (Resolved)

  1. Report retention policy?DECIDED: 30 days in workspace, then delete. DB metadata kept indefinitely. Business tier gets longer retention (future).

  2. Report size limits?DECIDED: No limits. Users have 5GB workspace quota. If exceeded, reports fail to save (natural backpressure).

  3. Notification on critical reports?DEFERRED: Separate PRD for notification bell service (central alert routing to user-selected channels). TODO after PRD-76.

  4. Report threading?DECIDED: Keep simple, no threading for now.

  5. Bulk grading?DECIDED: Good idea, keep for Phase 6 enhancement.

Last updated