[eric] browser: subtle Remembered/Learned chip on the agent card so memory feels earned, zero clicks

This commit is contained in:
ciregenz
2026-06-03 00:01:20 -07:00
parent 3a601ba3ad
commit 4c0749d0db
4 changed files with 40 additions and 0 deletions
@@ -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)
+4
View File
@@ -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
@@ -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<Props> = ({
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. */}
<Fade in={session.memory_recalled || session.memory_learned} timeout={{ enter: 200, exit: 220 }} unmountOnExit>
<Tooltip title={session.memory_learned
? 'Saved what worked here, so it is faster next time'
: 'Using what it learned here on a past visit'}>
<Chip
icon={<AutoAwesomeIcon sx={{ fontSize: 13, color: `${accentColor} !important` }} />}
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' },
}}
/>
</Tooltip>
</Fade>
</Box>
<Box
onPointerDown={(e) => e.stopPropagation()}
+3
View File
@@ -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;