[Matrix] Chat History Persistence (localStorage per agent) #60

Open
opened 2026-03-21 00:44:42 +00:00 by replit · 0 comments
Owner

What & Why

Agent chat messages live only in memory and are lost on every page reload. For the Matrix to function as a real command center, operators need conversation continuity — especially for Timmy as primary orchestrator. All agents should retain their last 100 messages across sessions.

Done looks like

  • Chat messages survive page reload for all agents
  • When an agent panel is opened after a reload, previous conversation shown immediately
  • Storage capped at 100 messages per agent (oldest dropped first)
  • A "Clear History" button in the Chat tab header wipes that agent's stored history
  • Messages include timestamps; display correctly with existing time formatter

Out of scope

  • Syncing history across multiple devices/browsers (localStorage only)
  • Persisting memory or task data (chat only)
  • Changes to WebSocket or mock data layer

Tasks

  1. Storage helpers — Add loadChatHistory(agentId) and saveChatHistory(agentId, messages) in ui.js. Use localStorage key matrix:chat:<agentId>. Cap at 100 messages, dropping oldest when over limit.
  2. Persist on send/receive — Call saveChatHistory whenever a new message is added (both user sends and assistant responses). Add a timestamp field to each message object.
  3. Load on agent select — In selectAgent(), call loadChatHistory(agentId) and pre-populate chat render before mounting live WebSocket listener. Render with existing _addChatMessage styling.
  4. Clear History button — Small "Clear" button in Chat tab header in index.html. Wire in ui.js to remove matrix:chat:<agentId> from localStorage and clear rendered chat.

Relevant files

  • the-matrix/js/ui.js
  • the-matrix/index.html
  • the-matrix/style.css
## What & Why Agent chat messages live only in memory and are lost on every page reload. For the Matrix to function as a real command center, operators need conversation continuity — especially for Timmy as primary orchestrator. All agents should retain their last 100 messages across sessions. ## Done looks like - Chat messages survive page reload for all agents - When an agent panel is opened after a reload, previous conversation shown immediately - Storage capped at 100 messages per agent (oldest dropped first) - A "Clear History" button in the Chat tab header wipes that agent's stored history - Messages include timestamps; display correctly with existing time formatter ## Out of scope - Syncing history across multiple devices/browsers (localStorage only) - Persisting memory or task data (chat only) - Changes to WebSocket or mock data layer ## Tasks 1. **Storage helpers** — Add `loadChatHistory(agentId)` and `saveChatHistory(agentId, messages)` in `ui.js`. Use localStorage key `matrix:chat:<agentId>`. Cap at 100 messages, dropping oldest when over limit. 2. **Persist on send/receive** — Call `saveChatHistory` whenever a new message is added (both user sends and assistant responses). Add a timestamp field to each message object. 3. **Load on agent select** — In `selectAgent()`, call `loadChatHistory(agentId)` and pre-populate chat render before mounting live WebSocket listener. Render with existing `_addChatMessage` styling. 4. **Clear History button** — Small "Clear" button in Chat tab header in `index.html`. Wire in `ui.js` to remove `matrix:chat:<agentId>` from localStorage and clear rendered chat. ## Relevant files - `the-matrix/js/ui.js` - `the-matrix/index.html` - `the-matrix/style.css`
replit added the frontend label 2026-03-21 00:44:42 +00:00
gemini was assigned by Rockachopa 2026-03-22 23:37:11 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#60