Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
TypeScript aiai-agentsai-memoryanthropicartificial-intelligencechromadbclaudeclaude-agent-sdkclaude-agentsclaude-codeclaude-code-pluginclaude-skillsembeddingslong-term-memorymem0memory-engineopenmemoryragsqlitesupermemory
import React, { useEffect, useId, useRef } from 'react';
import { useI18n } from '../../i18n';
import { settingsHash } from '../utils/memory-route';
import { ArrowRightIcon, BookOpenIcon, XIcon } from './icons';
interface WelcomeCardProps {
onDismiss: () => void;
/** Move focus to the panel when it appears: "Show welcome card" in the bar's menu brought it back. */
focusOnShow?: boolean;
/** The panel took focus: App sets `focusOnShow` back, so the next "Show welcome card" moves focus again. */
onFocused?: () => void;
}
const STORAGE_KEY = 'claude-mem-welcome-dismissed-v3';
const DOCS_URL = 'https://docs.claude-mem.ai';
export function getStoredWelcomeDismissed(): boolean {
try {
return localStorage.getItem(STORAGE_KEY) === 'true';
} catch (e: unknown) {
console.warn('Failed to read welcome-dismissed from localStorage:', e instanceof Error ? e.message : String(e));
return false;
}
}
export function setStoredWelcomeDismissed(dismissed: boolean): void {
try {
if (dismissed) {
localStorage.setItem(STORAGE_KEY, 'true');
} else {
localStorage.removeItem(STORAGE_KEY);
}
} catch (e: unknown) {
console.warn('Failed to save welcome-dismissed to localStorage:', e instanceof Error ? e.message : String(e));
}
}
/**
* The first visit's welcome (design pass Phase 11, Codex D17): a panel above the timeline's toolbar, never over the
* records. It says what the page holds, links Memory settings and the docs, and goes away with its X; the dismissal
* is saved, and "Show welcome card" in the bar's menu clears it again.
*/
export function WelcomeCard({ onDismiss, focusOnShow = false, onFocused }: WelcomeCardProps) {
const { t } = useI18n();
const titleId = useId();
const panelRef = useRef<HTMLElement>(null);
useEffect(() => {
if (!focusOnShow) return;
panelRef.current?.focus();
onFocused?.();
}, [focusOnShow, onFocused]);
const dismiss = () => {
setStoredWelcomeDismissed(true);
onDismiss();
};
return (
<section ref={panelRef} className="mem-panel mem-welcome" aria-labelledby={titleId} tabIndex={-1}>
<span className="mem-mark" data-tone="green" aria-hidden="true"><BookOpenIcon size={20} /></span>
<div className="mem-welcome-body">
<h2 className="mem-welcome-title" id={titleId}>{t('Welcome to your memory')}</h2>
<p className="mem-welcome-text">
{t('Find past prompts, observations and summaries from your agent sessions. Choose Settings to change what the next session receives.')}
</p>
<div className="mem-welcome-actions">
<a className="mem-textbtn" href={settingsHash()}>{t('Memory settings')}<ArrowRightIcon size={18} /></a>
<a className="mem-textbtn" href={DOCS_URL} target="_blank" rel="noopener noreferrer">{t('Read the docs')}<ArrowRightIcon size={18} /></a>
</div>
</div>
<button type="button" className="mem-iconbtn mem-welcome-dismiss" onClick={dismiss} aria-label={t('Dismiss welcome')} title={t('Dismiss welcome')}>
<XIcon size={20} />
</button>
</section>
);
}