From 4c0749d0dbe0d5edb43cb5d374e0d7a67aa30b9f Mon Sep 17 00:00:00 2001 From: ciregenz Date: Wed, 3 Jun 2026 00:01:20 -0700 Subject: [PATCH] [eric] browser: subtle Remembered/Learned chip on the agent card so memory feels earned, zero clicks --- backend/apps/agents/browser/browser_agent.py | 8 ++++++ backend/apps/agents/core/models.py | 4 +++ .../app/pages/Dashboard/cards/AgentCard.tsx | 25 +++++++++++++++++++ frontend/src/shared/state/agentsSlice.ts | 3 +++ 4 files changed, 40 insertions(+) diff --git a/backend/apps/agents/browser/browser_agent.py b/backend/apps/agents/browser/browser_agent.py index 2b791a97..de3ce044 100644 --- a/backend/apps/agents/browser/browser_agent.py +++ b/backend/apps/agents/browser/browser_agent.py @@ -405,12 +405,19 @@ async def run_browser_agent( # picking up where it left off, not figuring the site out cold again. Only # when strategy was actually seeded, so it's honest, never noise. if pb_seeded and _pb_host: + session.memory_recalled = True # drives the subtle "Remembered" card chip _recall_msg = Message(role="assistant", content=f"Picking up what I learned about {_pb_host} from a previous visit.") session.messages.append(_recall_msg) await ws_manager.send_to_session(session_id, "agent:message", { "session_id": session_id, "message": _recall_msg.model_dump(mode="json"), }) + # Push the session so the "Remembered" chip shows WHILE it works (the + # high-value moment), not just on the finished card. + await ws_manager.send_to_session(session_id, "agent:status", { + "session_id": session_id, "status": session.status, + "session": session.model_dump(mode="json"), + }) async def _cancellable(coro): """Race any awaitable against the cancel event. Returns None if cancelled.""" @@ -1150,6 +1157,7 @@ async def run_browser_agent( # sees the agent got a little smarter for next time. Only when # it genuinely learned something, so it stays honest + rare. if changed: + session.memory_learned = True # drives the subtle "Learned" card chip _learn_msg = Message(role="assistant", content=f"Noted what worked on {pb_host} so I'm faster here next time.") session.messages.append(_learn_msg) diff --git a/backend/apps/agents/core/models.py b/backend/apps/agents/core/models.py index 13e21676..f2b9f59d 100644 --- a/backend/apps/agents/core/models.py +++ b/backend/apps/agents/core/models.py @@ -116,6 +116,10 @@ class AgentSession(BaseModel): dashboard_id: Optional[str] = None browser_id: Optional[str] = None parent_session_id: Optional[str] = None + # Browser memory signals, drive the subtle "remembered/learned" card chip so + # the user feels the agent getting smarter without lifting a finger. + memory_recalled: bool = False + memory_learned: bool = False needs_fork: bool = False # Stronger than needs_fork: drop resume= and replay history into a fresh sdk_session_id; fork_session alone won't re-read mcp_servers. needs_fresh_session: bool = False diff --git a/frontend/src/app/pages/Dashboard/cards/AgentCard.tsx b/frontend/src/app/pages/Dashboard/cards/AgentCard.tsx index f0b58d60..8b8c19ca 100644 --- a/frontend/src/app/pages/Dashboard/cards/AgentCard.tsx +++ b/frontend/src/app/pages/Dashboard/cards/AgentCard.tsx @@ -5,6 +5,8 @@ import Chip from '@mui/material/Chip'; import IconButton from '@mui/material/IconButton'; import Button from '@mui/material/Button'; import Tooltip from '@mui/material/Tooltip'; +import Fade from '@mui/material/Fade'; +import AutoAwesomeIcon from '@mui/icons-material/AutoAwesome'; import CheckIcon from '@mui/icons-material/Check'; import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import CancelIcon from '@mui/icons-material/Cancel'; @@ -766,6 +768,29 @@ const AgentCard: React.FC = ({ flexShrink: 0, }} /> + {/* Calm, zero-click signal: the agent recalled or built up memory of + this site, so the user feels it getting smarter on its own. */} + + + } + label={session.memory_learned ? 'Learned' : 'Remembered'} + size="small" + sx={{ + bgcolor: c.bg.secondary, + color: accentColor, + border: `1px solid ${accentColor}33`, + fontWeight: 600, + fontSize: '0.68rem', + height: 22, + flexShrink: 0, + '& .MuiChip-icon': { ml: '4px' }, + }} + /> + + e.stopPropagation()} diff --git a/frontend/src/shared/state/agentsSlice.ts b/frontend/src/shared/state/agentsSlice.ts index 5be9f50a..5c265acc 100644 --- a/frontend/src/shared/state/agentsSlice.ts +++ b/frontend/src/shared/state/agentsSlice.ts @@ -82,6 +82,9 @@ export interface AgentSession { dashboard_id?: string; browser_id?: string | null; parent_session_id?: string | null; + /** Browser memory signals that drive the subtle "Remembered"/"Learned" card chip. */ + memory_recalled?: boolean; + memory_learned?: boolean; thinking_level?: 'off' | 'low' | 'medium' | 'high' | 'auto'; active_mcps?: string[]; ctx_used_pct?: number;