PRD-77: Agent Self-Scheduling & Memory Dashboard

Status: COMPLETE (Phase 1-4, fix-memory branch) Priority: P1 Author: Auto-generated from Agent Zero research (2026-03-10) Dependencies: PRD-05 (Memory & Knowledge), PRD-55 (Heartbeat), PRD-72 (Activity Command Centre) Research Reference: See memory/agent-zero-research.md for competitive analysis


Problem Statement

  1. Agents can't schedule their own follow-up work. The UnifiedScheduler (APScheduler) powers heartbeats and recipes, but agents have no tool to create their own scheduled tasks. An agent that discovers "I should check this again tomorrow" has no way to act on it.

  2. Memory is opaque to users. Memories are stored in Mem0 but there's no UI to browse, search, manage, or consolidate them. Users can't see what their agents remember, can't fix bad memories, and can't prune stale ones. The memory stats page shows counts but no content.

  3. Memory search was broken (fixed in fix-memory branch — Mem0Client.search() was calling the list endpoint instead of the vector search endpoint). Remaining issues: potential double-injection of memories in prompts, get_daily_logs() never wired into prompt assembly.


Phase 1: Agent Self-Scheduling Tool

User Stories

  • US-001: As an agent, I can schedule a one-shot follow-up task so I can revisit work later without human intervention.

  • US-002: As an agent, I can schedule a recurring task (cron) so I can perform periodic checks autonomously.

  • US-003: As an admin, I can view and cancel agent-scheduled tasks so I maintain control over what runs.

Implementation

New Platform Tool: platform_schedule_task

Execution Flow

  1. Agent calls platform_schedule_task during conversation

  2. PlatformActionExecutor validates parameters, creates DB record in agent_scheduled_tasks table

  3. Registers job with UnifiedScheduler (APScheduler) — same scheduler heartbeats use

  4. When job fires, creates a new chat session with the target agent, injecting the task description as the user message

  5. Results stored as activity feed entry + optional report via platform_submit_report

Database Schema

Admin Controls

  • View all scheduled tasks in Activity → Missions tab (or new Scheduled tab)

  • Pause/resume/cancel any task

  • Set workspace-level limits: max scheduled tasks per agent, max recurring tasks total

Registration

  • platform_actions.py — ActionDefinition

  • platform_executor.py — handler + _handlers dict entry

  • auto.py — Tier 2 keywords: schedule, follow-up, remind, later, recurring, check again


Phase 2: Memory Explorer Dashboard

User Stories

  • US-004: As a user, I can browse all memories stored by my agents so I understand what they've learned.

  • US-005: As a user, I can search memories by keyword so I can find specific knowledge.

  • US-006: As a user, I can delete individual memories so I can correct mistakes.

  • US-007: As a user, I can view memory metadata (created by, when, access count) so I can assess quality.

Backend API Additions (api/memory.py or api/memory_stats.py)

Frontend: Memory Tab

Location: Activity → Memory tab (alongside Dashboard, Feed, Reports, Missions)

Components:

  • components/activity/activity-memory.tsx — main tab with table + search bar

  • components/activity/memory-card.tsx — individual memory display (content, agent, date, score)

  • components/activity/memory-health.tsx — health stats (total, stale count, duplicates)

Table columns:

Content (truncated)
Agent
Created
Last Accessed
Score
Actions

"User prefers..."

Sentinel

2h ago

1h ago

0.92

View / Delete

Filters: By agent, date range, keyword search


Phase 3: Memory Consolidation & Pruning

User Stories

  • US-008: As a user, I can select multiple related memories and merge them into one so I reduce duplication.

  • US-009: As a user, I can see auto-flagged stale memories (no access in 30+ days) so I can prune them.

  • US-010: As a user, I can trigger AI-powered consolidation that summarises related memories into fewer, richer entries.

Implementation

Consolidation Endpoint

  • merge — concatenate content, keep latest metadata

  • summarise — call LLM to produce a single summary, delete originals, store new

Auto-Pruning Service

  • Cron job (via UnifiedScheduler) runs weekly

  • Flags memories with no access in configurable window (default 30 days)

  • Does NOT auto-delete — flags for user review in Memory Health dashboard

  • Detects near-duplicate memories via embedding similarity (>0.95 cosine)


Phase 4: Remaining Memory Bug Fixes

P1: Double Memory Injection Check

Verify whether memories are injected twice in SmartChatOrchestrator:

  1. Via get_happy_system_prompt(memories=...) in system prompt

  2. As a separate system message

If confirmed, remove the duplicate path. Single injection point = less token waste.

P1: Wire get_daily_logs()

get_daily_logs() exists but is never called during prompt assembly (PRD-55 incomplete). Wire it into the prompt with a 500-token cap so agents have access to their daily activity context.


Success Metrics

Metric
Target

Agent-scheduled tasks created per week

>10 across all workspaces

Memory search returning scored results

100% (was 0% before fix)

User memory management actions (view/delete)

>5/week per active workspace

Memory consolidation reducing total count

20% reduction in duplicates

Stale memories flagged and reviewed

90% reviewed within 7 days


Out of Scope (Future PRDs)

  • Agent-to-Agent messaging (A2A protocol) — see agent-zero-research.md, ties into PRD-68/69

  • Behaviour self-adjustment — agents tuning own parameters mid-conversation

  • Dynamic sub-agent spawning — runtime agent creation without roster pre-assignment

  • These three form a future "Agent Autonomy" super-PRD building on PRD-68, PRD-50, PRD-69

Last updated