Summary
Build the FastAPI router for the Memory Dashboard. Exposes MemoryStore data via REST API for the frontend dashboard.
Spec: docs/spec/agent-memory-architecture.md → "Observability & Dashboard" → "UI Backend: Memory Router"
Depends on: #542 (MemoryStore)
File: src/gaia/ui/routers/memory.py
Endpoints
Dashboard
GET /api/memory/stats — aggregate stats (knowledge counts by category/context, conversation/tool totals, upcoming/overdue)
GET /api/memory/activity?days=30 — daily activity timeline
Knowledge Browser
GET /api/memory/knowledge — paginated, filterable (category, context, entity, sensitive, search), sortable
POST /api/memory/knowledge — create entry (source='user', confidence=0.8)
PUT /api/memory/knowledge/{id} — edit entry (all fields)
DELETE /api/memory/knowledge/{id} — delete entry
Entities & Contexts
GET /api/memory/entities — list unique entities with counts
GET /api/memory/entities/{entity} — all knowledge for an entity
GET /api/memory/contexts — list contexts with counts
Tool Performance
GET /api/memory/tools — per-tool stats (calls, success rate, avg duration, last error)
GET /api/memory/tools/{name}/history — call history for a tool
Errors & Conversations
GET /api/memory/errors — recent tool errors
GET /api/memory/conversations — session list with turn counts
GET /api/memory/conversations/{session_id} — full conversation
GET /api/memory/conversations/search — FTS5 search
GET /api/memory/upcoming?days=7 — time-sensitive items
DB Access
- Read operations use read-only connection (?mode=ro)
- Write operations (POST/PUT/DELETE) use short-lived read-write connections
- WAL mode ensures concurrent reader safety
Acceptance Criteria
Summary
Build the FastAPI router for the Memory Dashboard. Exposes MemoryStore data via REST API for the frontend dashboard.
Spec:
docs/spec/agent-memory-architecture.md→ "Observability & Dashboard" → "UI Backend: Memory Router"Depends on: #542 (MemoryStore)
File:
src/gaia/ui/routers/memory.pyEndpoints
Dashboard
GET /api/memory/stats— aggregate stats (knowledge counts by category/context, conversation/tool totals, upcoming/overdue)GET /api/memory/activity?days=30— daily activity timelineKnowledge Browser
GET /api/memory/knowledge— paginated, filterable (category, context, entity, sensitive, search), sortablePOST /api/memory/knowledge— create entry (source='user', confidence=0.8)PUT /api/memory/knowledge/{id}— edit entry (all fields)DELETE /api/memory/knowledge/{id}— delete entryEntities & Contexts
GET /api/memory/entities— list unique entities with countsGET /api/memory/entities/{entity}— all knowledge for an entityGET /api/memory/contexts— list contexts with countsTool Performance
GET /api/memory/tools— per-tool stats (calls, success rate, avg duration, last error)GET /api/memory/tools/{name}/history— call history for a toolErrors & Conversations
GET /api/memory/errors— recent tool errorsGET /api/memory/conversations— session list with turn countsGET /api/memory/conversations/{session_id}— full conversationGET /api/memory/conversations/search— FTS5 searchGET /api/memory/upcoming?days=7— time-sensitive itemsDB Access
Acceptance Criteria