Skip to content
Star

Team memory

What the agent remembers about your team, editable and removable. Free and MIT licensed, as HTML, a typed React component or an Astro component, in three styles with light and dark mode.

$npx designme add team-memory
$npx shadcn@latest add https://designme.dev/r/shadcn/team-memory.json

Need this designed into your product? Book a call

Team memory
Used in 14 answers this week
01

Install

Add it to your project with the CLI.

HTML, CSS and JS

$npx designme add team-memory

React

$npx designme add team-memory --react

Astro

$npx designme add team-memory --astro

shadcn, React

$npx shadcn@latest add https://designme.dev/r/shadcn/team-memory.json

shadcn, Astro

$npx shadcn@latest add https://designme.dev/r/shadcn/astro/team-memory.json

The CLI copies the source into your project, so you own it and can change anything. Where each version lands, what it needs and the shadcn theme bridge: Installation.

02

About

What it is for and what it does.

A list of the things an agent remembers about a team, such as brand rules and working habits. Each memory shows where it came from, with that app's own mark (Slack, Figma, GitHub, Notion, Linear, Drive) or an icon for something said in chat, and what kind of memory it is, in the kind's colour. People can filter memories by kind, fix one in place, or tell the agent to forget it. A memory the agent learns arrives shimmering, then gets a New tag, and the memories an answer uses pulse once and keep a Used tag, so the agent's long-term memory is visible, alive and correctable.

  • When your agent keeps memories across sessions and people should be able to see them, and where each one came from.
  • When someone needs to correct a rule the agent learned wrong.
  • When you want to show the agent learning something new while the panel is open.
  • When people should see which memories shaped an answer.
  • As a settings page or a flat block inside a chat thread.
03

Usage

Import it in React and drive it from your own state, or place it in an Astro page.

React

import { TeamMemory } from '@/components/designme/team-memory/TeamMemory';

React example

The demo above as a React component, 54 lines you can copy.

'use client';
// The animated preview from designme.dev, rebuilt from the React component: an example of driving it from your own state.
import { useRef, useState } from 'react';
import { TeamMemory, type MemoryActivity, type MemoryItem, type MemoryKind } from './TeamMemory';
import type { BrandName } from '../lib/brands';
import type { IconName } from '../lib/icons';
import { useStory } from '../lib/useScript';

const KINDS: MemoryKind[] = [
  { value: 'brand', label: 'Brand', color: 'var(--dm-pl)' },
  { value: 'process', label: 'Process', color: 'var(--dm-pt)' }
];
// where each memory came from: an app's mark, or an icon for something said in chat
const START: MemoryItem[] = ([
  ['brand', 'Primary buttons use the accent blue, never black', 'figma', 'Pricing review in Figma, Sep 12'],
  ['brand', 'Headlines stay under eight words', '', 'You told the agent, Aug 30'],
  ['process', 'Ask Maya before publishing to the shared library', 'slack', 'A thread in #design-system, Sep 4'],
  ['brand', 'Card radius is 16px on web, 12px in the app', 'github', 'tokens.css on GitHub, Sep 18'],
  ['process', 'Run the launch checklist before every PR', 'notion', 'Launch checklist in Notion, Sep 20'],
  ['process', 'File design bugs in the Design QA project', 'linear', 'DES-214 in Linear, Sep 26'],
  ['brand', 'No em dashes in product copy', 'drive', 'Voice and tone guide in Drive, Oct 2']
] as const).map(([kind, text, brand, source], id) => ({ id, kind, text, source, ...(brand ? { brand: brand as BrandName } : { icon: 'comment' as IconName }) }));
const IDLE: MemoryActivity = { text: 'Used in 14 answers this week' };

/* ---------- Team memory: the agent learns a rule from your edit in Figma, then drafts an email in Gmail with three memories, which pulse as it uses them ---------- */
export default function TeamMemoryDemo() {
  const ref = useRef<HTMLDivElement>(null);
  const [list, setList] = useState(START);
  const [activity, setActivity] = useState(IDLE);
  const set = (id: number, patch: Partial<MemoryItem>) => setList(l => l.map(m => (m.id === id ? { ...m, ...patch } : m)));
  // the story stops for good at your first click, key or focus inside the panel; whatever it was halfway through settles
  useStory(ref, async ({ wait, taken }) => {
    await wait(2200);
    setList(l => [{ id: 100, kind: 'brand', text: 'Learning from your edit in Pricing v4', source: 'Just now', brand: 'figma', learning: true }, ...l]);
    const learnt = { learning: false, text: 'Use “Start free” instead of “Sign up” on CTAs', source: 'Your edit in Pricing v4, just now' };
    taken(() => { setList(l => l.map(m => (m.id === 100 && m.learning ? { ...m, ...learnt } : m))); setActivity(IDLE); });
    await wait(1500);
    set(100, { ...learnt, isNew: true });
    await wait(2600);
    set(100, { isNew: false, source: 'Your edit in Figma, today' });
    await wait(1000);
    setActivity({ text: 'Drafting the launch email in Gmail', live: true, brand: 'gmail' });
    await wait(1100);
    for (const id of [100, 1, 6]) { set(id, { used: true }); await wait(700); }
    setActivity({ text: 'Used 3 memories in the launch email draft', brand: 'gmail' });
    // an agent at work, so it carries on under the pointer
  }, { hold: false });
  return (
    <div ref={ref} style={{ width: '100%' }}>
      <TeamMemory kinds={KINDS} memories={list} onMemoriesChange={setList} activity={activity} />
    </div>
  );
}

Astro

In a page in src/pages. It plays the demo above; change its team-memory.js to show your own data. Attributes like class go on its root element.

---
import TeamMemory from '../components/designme/team-memory/TeamMemory.astro';
---
<TeamMemory />
<TeamMemory data-style="soft" class="my-class" />
04

Props

Everything TeamMemory takes.

PropTypeWhat it does
titleReactNodeLike "Team memory"
iconIconName
kindsrequiredMemoryKind[]
memoriesMemoryItem[]Every memory, newest first. Leave it out to let Edit and Forget keep their own list
defaultMemoriesMemoryItem[]
onMemoriesChange(memories: MemoryItem[]) => void
filterstringThe tab that is showing: 'all' or a kind's value
defaultFilterstring
onFilterChange(filter: string) => void
allLabelstringThe first tab
activityMemoryActivityThe line at the foot, like what the agent is answering with its memory now
editedSourcestringThe source an edited memory gets
newLabelstringThe tag on a memory marked `isNew`
usedLabelstringThe tag on a memory marked `used`
onEdit(memory: MemoryItem) => voidCalled with the memory after an edit
onForget(memory: MemoryItem) => voidCalled when a memory is forgotten. It can still come back with Undo for `undoFor` ms
onRestore(memory: MemoryItem) => voidCalled when Undo brings a forgotten memory back
undoFornumberHow long Undo stays, in ms
barebooleanDraws its own container (the default, as on designme.dev). Set true to sit it flat in a chat thread
classNamestring
05

Code

The full source, as the CLI installs it.

TeamMemory.tsxReact · 243 lines
'use client';
import { useEffect, useId, useRef, useState, type CSSProperties, type ReactNode } from 'react';
import { cx } from '../lib/cx';
import { useControllable, useIsoLayoutEffect, useReducedMotion } from '../lib/hooks';
import { Icon, type IconName } from '../lib/icons';
import { Brand, type BrandName } from '../lib/brands';
import { Swap, SwapIcon, Tip, UTabs, useGrow, useReflow } from '../lib/motion';
import { useHoverGlide } from '../lib/glide';
import '../designme.css';
import './team-memory.css';

/** A group of memories, with its own filter tab and colour */
export interface MemoryKind {
  value: string;
  /** Its tab, and the word under each of its memories, like "Brand" */
  label: string;
  /** Its colour, for that word, like 'var(--dm-pl)'. Pick one that reads as text, 4.5:1 on your surface */
  color: string;
}

/** Something the agent remembers */
export interface MemoryItem {
  id: string | number;
  /** Which kind it is, by value */
  kind: string;
  /** What it remembers, like "Headlines stay under eight words" */
  text: string;
  /** Where it came from, like "A thread in #design-system, Sep 4" */
  source?: string;
  /** The app it came from, shown as its own mark, like 'slack' or 'figma' */
  brand?: BrandName;
  /** An icon for where it came from when that isn't an app, like 'comment' for something said in chat. Used without a `brand` */
  icon?: IconName;
  /** Marks it as just learned, with a New tag */
  isNew?: boolean;
  /** Still being learned: the text shimmers, a spinner stands in for its source, and it can't be edited yet */
  learning?: boolean;
  /** Used in the answer the agent is writing: it pulses once when this turns on, and keeps a Used tag */
  used?: boolean;
}

/** The line at the foot of the panel */
export interface MemoryActivity {
  /** Like "Drafting the launch email in Gmail" or "Used in 14 answers this week" */
  text: string;
  /** Shimmers the text, while the agent is at work */
  live?: boolean;
  brand?: BrandName;
  icon?: IconName;
}

export interface TeamMemoryProps {
  /** Like "Team memory" */
  title?: ReactNode;
  icon?: IconName;
  kinds: MemoryKind[];
  /** Every memory, newest first. Leave it out to let Edit and Forget keep their own list */
  memories?: MemoryItem[];
  defaultMemories?: MemoryItem[];
  onMemoriesChange?: (memories: MemoryItem[]) => void;
  /** The tab that is showing: 'all' or a kind's value */
  filter?: string;
  defaultFilter?: string;
  onFilterChange?: (filter: string) => void;
  /** The first tab */
  allLabel?: string;
  /** The line at the foot, like what the agent is answering with its memory now */
  activity?: MemoryActivity;
  /** The source an edited memory gets */
  editedSource?: string;
  /** The tag on a memory marked `isNew` */
  newLabel?: string;
  /** The tag on a memory marked `used` */
  usedLabel?: string;
  /** Called with the memory after an edit */
  onEdit?: (memory: MemoryItem) => void;
  /** Called when a memory is forgotten. It can still come back with Undo for `undoFor` ms */
  onForget?: (memory: MemoryItem) => void;
  /** Called when Undo brings a forgotten memory back */
  onRestore?: (memory: MemoryItem) => void;
  /** How long Undo stays, in ms */
  undoFor?: number;
  /** Draws its own container (the default, as on designme.dev). Set true to sit it flat in a chat thread */
  bare?: boolean;
  className?: string;
}

interface Gone { m: MemoryItem; at: number; leaving: boolean }

const Mark = ({ brand, icon }: { brand?: BrandName; icon?: IconName }) => brand ? <Brand name={brand} /> : icon ? <Icon name={icon} size="xs" /> : null;

/** What the agent remembers about the team, filtered by kind, each memory with the app or place it came from, editable in
    place or forgotten with an undo. New memories arrive with a New tag, and the ones an answer uses pulse. The panel grows and
    shrinks with its list, eased. */
export function TeamMemory({
  title = 'Team memory', icon = 'book', kinds, memories, defaultMemories = [], onMemoriesChange, filter, defaultFilter = 'all', onFilterChange,
  allLabel = 'All', activity, editedSource = 'Edited by you, just now', newLabel = 'New', usedLabel = 'Used',
  onEdit, onForget, onRestore, undoFor = 4000, bare = false, className
}: TeamMemoryProps) {
  // Studio's one hover glides from memory to memory
  const listRef = useRef<HTMLDivElement>(null);
  useHoverGlide(listRef, '.dm-mmx-m');
  const [list, setList] = useControllable(memories, defaultMemories, onMemoriesChange);
  const [f, setF] = useControllable(filter, defaultFilter, onFilterChange);
  const tid = useId();
  const [gone, setGone] = useState<Gone[]>([]);
  const [editing, setEditing] = useState<MemoryItem['id'] | null>(null);
  const timers = useRef(new Map<MemoryItem['id'], ReturnType<typeof setTimeout>>());
  const edit = useRef<HTMLSpanElement>(null);
  const kindOf = (kind: string) => kinds.find(k => k.value === kind);

  // a new tab changes the list: the rows that stay glide to their new places, the ones that go fade where they were, the new
  // ones come in after one another (motion pieces), and any Undo goes away
  const [, setPaint] = useState(0);
  const order = useRef(new Map<MemoryItem['id'], number>());
  const first = useRef(true);
  useIsoLayoutEffect(() => {
    if (first.current) { first.current = false; return; }
    timers.current.forEach(clearTimeout); timers.current.clear();
    order.current.clear(); setGone([]); setPaint(p => p + 1);
  }, [f]);
  useEffect(() => { const t = timers.current; return () => t.forEach(clearTimeout); }, []);

  // editing starts with the caret at the end of the text
  useIsoLayoutEffect(() => {
    const t = edit.current; if (editing === null || !t) return;
    t.focus();
    const s = document.getSelection(); s?.selectAllChildren(t); s?.collapseToEnd();
  }, [editing]);

  // a memory that has just been learned crossfades from its shimmering line to what it remembers, and its source comes in
  const learnt = useRef(new Set<MemoryItem['id']>());
  list.forEach(m => { if (m.learning) learnt.current.add(m.id); });

  const commit = (m: MemoryItem, text: string) => {
    const next: MemoryItem = { ...m, text: text.trim() || m.text, source: editedSource, brand: undefined, icon: 'edit' };
    setEditing(null);
    setList(list.map(x => (x.id === m.id ? next : x)));
    onEdit?.(next);
  };
  const forget = (m: MemoryItem) => {
    const at = list.indexOf(m);
    setList(list.filter(x => x !== m)); onForget?.(m);
    order.current.delete(m.id);
    setGone(g => [...g, { m, at, leaving: false }]);
    timers.current.set(m.id, setTimeout(() => {
      setGone(g => g.map(x => (x.m === m ? { ...x, leaving: true } : x)));
      timers.current.set(m.id, setTimeout(() => { setGone(g => g.filter(x => x.m !== m)); timers.current.delete(m.id); }, 320));
    }, undoFor));
  };
  const restore = (g: Gone) => {
    clearTimeout(timers.current.get(g.m.id)); timers.current.delete(g.m.id);
    setGone(x => x.filter(y => y !== g));
    const next = [...list]; next.splice(Math.min(g.at, next.length), 0, g.m);
    setList(next); onRestore?.(g.m);
  };

  // forgotten memories hold their place with an Undo until it times out
  const rows: ({ m: MemoryItem; g?: undefined } | { g: Gone; m?: undefined })[] = list.map(m => ({ m }));
  for (const g of gone) rows.splice(Math.min(g.at, rows.length), 0, { g });
  const shown = rows.filter(r => f === 'all' || (r.m ?? r.g.m).kind === f);
  // rows that were there when the tab painted stagger in; anything that arrives later comes in on its own
  if (!order.current.size) shown.forEach((r, i) => { if (r.m) order.current.set(r.m.id, i); });
  const delay = (id: MemoryItem['id']) => (order.current.get(id) ?? 0) * 40 + 'ms';
  // a memory the agent learns while the panel is open opens its own height, so the panel grows instead of jumping
  const reduce = useReducedMotion(), grown = useRef(new WeakSet<HTMLElement>());
  const growRow = (el: HTMLDivElement | null) => {
    if (!el || grown.current.has(el)) return; grown.current.add(el);
    if (reduce || !el.animate) return;
    // (Studio fades without a blur)
    const cs = getComputedStyle(el), ease = cs.getPropertyValue('--dm-ease').trim() || 'ease', blur = cs.getPropertyValue('--dm-motion').trim() === 'studio' ? 0 : 4;
    el.animate([{ height: '0px', paddingTop: '0px', paddingBottom: '0px', opacity: 0, filter: `blur(${blur}px)`, overflow: 'hidden' },
      { height: cs.height, paddingTop: cs.paddingTop, paddingBottom: cs.paddingBottom, opacity: 1, filter: 'blur(0px)', overflow: 'hidden' }], { duration: 560, easing: ease });
  };
  // no room is kept for a memory still to come (owner, 17 Nov): the panel grows and shrinks with its list, eased (as grow() on
  // the site)
  const [box, inner] = useGrow();
  useReflow(box, '.dm-mmx-m', { blur: true, enter: false, host: listRef });

  return (
    <div data-dm="" ref={box} className={cx('dm-mmx dm-growing dm-mx-grow dm-mx-ic', !bare && 'dm-panel', className)} style={bare ? { paddingInline: 0 } : undefined}>
      <div ref={inner} className="dm-grow">
      {/* the head names the panel; a count and a row of the sources' marks would repeat what the list shows */}
      <div className="dm-mmx-h">
        <span className="dm-mmx-ic"><Icon name={icon} /></span>
        <b className="dm-mmx-ht">{title}</b>
      </div>
      {/* the filter: underline tabs under the head */}
      <UTabs className="dm-mmx-ut" label="Filter" value={f} onChange={setF} idBase={tid} options={[{ value: 'all', label: allLabel }, ...kinds.map(k => ({ value: k.value, label: k.label }))]} />
      <div ref={listRef} className="dm-mmx-list dm-mx-glide" role="tabpanel" aria-labelledby={`${tid}-${f}`}>
        {shown.map(r => {
          if (r.g) {
            const { m, leaving } = r.g;
            return (
              <div key={`gone-${m.id}`} className={cx('dm-mmx-gone', leaving ? 'dm-leave' : 'dm-enter')}>
                <span>Forgot “{m.text.slice(0, 32)}{m.text.length > 32 ? '…' : ''}”</span>
                <button type="button" onClick={() => restore(r.g)}>Undo</button>
              </div>
            );
          }
          const m = r.m, arriving = !!(m.isNew || m.learning) && !order.current.has(m.id), k = kindOf(m.kind);
          const fresh = learnt.current.has(m.id) && !m.learning;
          return (
            // a memory that turns `used` pulses once, as the class arrives
            <div key={m.id} data-key={String(m.id)} ref={arriving ? growRow : undefined}
              className={cx('dm-mmx-m', !arriving && 'dm-enter', m.learning && 'dm-learn', m.used && 'dm-use')}
              style={{ '--dm-k': k?.color ?? 'var(--dm-muted)', ...(arriving ? null : { animationDelay: delay(m.id) }) } as CSSProperties}>
              <span key={m.learning ? 'learn' : 'from'} className={cx('dm-mmx-src', fresh && 'dm-enter')} aria-hidden="true">
                {m.learning ? <span className="dm-spin" /> : <Mark brand={m.brand} icon={m.icon} />}
              </span>
              <span className="dm-mmx-b">
                {editing === m.id
                  ? <span key="edit" ref={edit} className="dm-t" spellCheck={false} contentEditable suppressContentEditableWarning
                      onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); e.currentTarget.blur(); } }}
                      onBlur={e => commit(m, e.currentTarget.textContent ?? '')}>{m.text}</span>
                  : <Swap key="view" className={cx('dm-t', m.learning && 'dm-shim')}>{m.text}</Swap>}
                <span className="dm-mmx-meta">
                  {k && <span className="dm-k">{k.label}</span>}
                  {k && m.source && <span aria-hidden="true">·</span>}
                  {m.source && <span className="dm-s">{m.source}</span>}
                  {m.isNew && <span className="dm-tag dm-nw">{newLabel}</span>}
                  {m.used && <span className="dm-tag dm-nw">{usedLabel}</span>}
                </span>
              </span>
              <span className="dm-acts">
                <Tip label="Edit"><button type="button" className="dm-ib dm-mx-press" aria-label="Edit" disabled={m.learning} onClick={() => setEditing(m.id)}><Icon name="edit" size="xs" /></button></Tip>
                <Tip label="Forget"><button type="button" className="dm-ib dm-mx-press" aria-label="Forget" disabled={m.learning} onClick={() => forget(m)}><Icon name="trash" size="xs" /></button></Tip>
              </span>
            </div>
          );
        })}
      </div>
      {activity && (
        <div className="dm-mmx-f" aria-live="polite">
          <span className="dm-mmx-fi" aria-hidden="true"><SwapIcon id={activity.brand ?? activity.icon ?? 'spark'}><Mark brand={activity.brand} icon={activity.icon ?? (activity.brand ? undefined : 'spark')} /></SwapIcon></span>
          <Swap className={cx('dm-mmx-ft', activity.live && 'dm-shim')}>{activity.text}</Swap>
        </div>
      )}
      </div>
    </div>
  );
}
team-memory.cssReact · 85 lines
/* Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync. */
/* ---------- Team memory ---------- */
/* each memory shows where it came from, as that source's own mark (Slack, Figma, GitHub, Notion, Linear, Drive) or an icon
   (something said in chat, an edit), and its kind in the kind's colour (--dm-k). A memory the agent learns arrives with a spinner
   on its mark and its words shimmering while it works the rule out, then a New tag (no tinted band, owner 18 Nov); the
   memories an answer uses pulse once with a quiet grey (never a hue) and say so. The card sits on two columns (owner, 18 Nov),
   its content 16px from every edge: the head's mark in a 28px column with each memory's mark centred under it, and the title,
   each memory and the footer's words 12px after it; a row's hover fill reaches 8px out round its content, and its Edit and
   Forget end on the content's right edge. The filter is the core's underline tabs under the head (owner, 28 Nov). The panel keeps no room for the memory still to come: it grows as
   the new one opens its row (grow()) and stays centred in its stage */
.dm-mmx{padding:var(--dm-s-4);display:flex;flex-direction:column;gap:var(--dm-s-2);container:mmx/inline-size}
.dm-mmx-h{display:flex;align-items:center;gap:8px 12px;padding-bottom:var(--dm-s-2)}
.dm-mmx-ic{width:28px;height:28px;border-radius:calc(8px * var(--dm-rk-m,var(--dm-rk)));background:var(--dm-pp-bg);color:var(--dm-pp);display:grid;place-items:center;flex:none}
.dm-mmx-ht{flex:1 0 auto;min-width:0;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* the filter: underline tabs 16px under the head, their hairline from edge to edge and the first tab's words on the content's
   16px column, the memories under them */
.dm-mmx-ut{margin:0 calc(-1 * var(--dm-s-4))}
/* a memory's mark sits on the head's tile column and its actions end on the content's 16px edge; its hover fill reaches 8px
   out round it, into the padding, in every style (owner, 26 Nov) */
.dm-mmx-list{display:flex;flex-direction:column;margin:0 calc(-1 * var(--dm-s-2))}
.dm-mmx-m{display:flex;align-items:flex-start;gap:12px;padding:var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:13px;line-height:1.5;transition:background .3s}
@media (hover:hover) and (pointer:fine){.dm-mmx-m:hover{background:var(--dm-row)}}
/* its motion (the core's motion pieces, owner, 26 Nov): one highlight glides from memory to memory in every style (.mx-glide);
   a filter moves the rows (reflow()); a press on Edit or Forget shows at once (.mx-press); a source's spinner and mark, and the
   footer's mark, crossfade (.mx-ic); the panel grows on the spring (.mx-grow) */
.dm-mmx-src{width:28px;height:28px;margin-top:1px;border-radius:calc(8px * var(--dm-rk-m,var(--dm-rk)));display:grid;place-items:center;flex:none;background:var(--dm-surface);color:var(--dm-fg2);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dm-rail) 50%,transparent)}
.dm-mmx-src .dm-brand{width:15px;height:15px;color:var(--dm-fg)}
.dm-mmx-src .dm-spin{width:12px;height:12px}
.dm-mmx-b{flex:1;min-width:0;display:flex;flex-direction:column}
/* a memory that wraps never leaves one word alone on its last line (owner, 24 Nov) */
.dm-mmx-b .dm-t{text-wrap:pretty}
.dm-mmx-m .dm-t{outline:0;border-radius:var(--dm-r-tiny,5px);padding:0 3px;margin:0 -3px}
.dm-mmx-m .dm-t[contenteditable="true"]{background:var(--dm-surface);box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-field-line) 50%,transparent)}
.dm-mmx-m .dm-t[contenteditable="true"]:focus{box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-field-line-strong) 50%,transparent)}
/* under it: its kind in the kind's colour, then where it came from */
.dm-mmx-meta{display:flex;align-items:center;gap:6px;min-width:0;font-size:11.5px;color:var(--dm-muted);white-space:nowrap}
.dm-mmx-meta>*{flex:none}
.dm-mmx-meta .dm-k{color:var(--dm-k);font-weight:500}
.dm-mmx-meta .dm-s{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
.dm-mmx-meta .dm-tag.dm-nw{background:var(--dm-accent-bg);color:var(--dm-accent-fg,var(--dm-fg))}
.dm-mmx-m .dm-acts{display:flex;opacity:0;transition:opacity .2s}
.dm-mmx-m:focus-within .dm-acts{opacity:1}
@media (hover:hover) and (pointer:fine){.dm-mmx-m:hover .dm-acts{opacity:1}}
/* Forget's glyph ends on the content's edge, under the filter, its hover circle reaching out round it */
.dm-mmx-m .dm-ib{width:24px;height:24px}
.dm-mmx-m .dm-acts{margin-right:-6px}
.dm-mmx-m.dm-learn .dm-acts{visibility:hidden}
/* a memory an answer uses pulses once with a quiet grey fill, and its source lifts */
.dm-mmx-m.dm-use{animation:dm-mmxuse 1.4s var(--dm-ease)}
.dm-mmx-m.dm-use .dm-mmx-src{animation:dm-mmxlift .6s var(--dm-ease)}
/* (the pulse is an inset shade, not the row's fill, so the gliding hover, which clears the rows' own fills, never hides it) */
@keyframes dm-mmxuse{0%{box-shadow:inset 0 0 0 99px var(--dm-hover)}100%{box-shadow:inset 0 0 0 99px transparent}}
@keyframes dm-mmxlift{40%{transform:translateY(-2px) scale(1.08)}}
/* a forgotten memory leaves a line with its Undo in its place: the words on the memories' mark column, Undo ending where their
   actions end */
.dm-mmx-gone{display:flex;align-items:center;justify-content:space-between;gap:var(--dm-s-2);min-height:32px;padding:4px var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:12.5px;color:var(--dm-muted);background:var(--dm-chip)}
.dm-mmx-gone span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dm-mmx-gone button{flex:none;color:var(--dm-accent-fg,var(--dm-accent));font-weight:500;font-size:12.5px}
/* the line at the foot: how often the memory is used, or the answer it is helping with now; its mark centred in the memories'
   mark column and its words on their words column */
.dm-mmx-f{display:flex;align-items:center;gap:12px;margin-top:var(--dm-s-1);padding:var(--dm-s-4) 0 0;border-top:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent);font-size:12px;line-height:18px;color:var(--dm-muted)}
.dm-mmx-fi{display:grid;place-items:center;flex:none;width:28px;color:var(--dm-fg2)}
.dm-mmx-fi .dm-brand{width:14px;height:14px}
.dm-mmx-ft{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dm-mmx-ft.dm-sw{display:block}
:root:not([data-style="soft"],[data-style="studio"]) .dm-mmx-m.dm-use:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){animation:dm-mmxusebp .9s steps(3,end)}
@keyframes dm-mmxusebp{0%{box-shadow:inset 0 0 0 99px var(--dm-hover)}100%{box-shadow:inset 0 0 0 99px transparent}}
:root:not([data-style="soft"],[data-style="studio"]) .dm-mmx-m.dm-use .dm-mmx-src:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){animation:dm-mmxbp .9s steps(1,end)}
@keyframes dm-mmxbp{0%,50%{box-shadow:inset 0 0 0 1px var(--dm-line-strong)}51%,100%{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dm-rail) 50%,transparent)}}
/* nothing in it grows or shrinks when it is pressed (owner, 18 Nov) */
.dm-mmx :is(.dm-ib,.dm-pill):active,:root[data-style="studio"] .dm-mmx .dm-ib:active,:root [data-style="studio"] .dm-mmx .dm-ib:active,:root [data-style="studio"].dm-mmx .dm-ib:active{transform:none}
/* Studio (owner, 18 Nov): the head's mark is the neutral tile with a hairline that the sources' marks have; the rows' fills are
   concentric with the card (14px, 8px in); an edited memory is a field with Studio's 10px corners; the footer is an off-white foot
   strip, edge to edge, its mark and words on the card's columns */
:root[data-style="studio"] .dm-mmx-ic,:root [data-style="studio"] .dm-mmx-ic,:root [data-style="studio"].dm-mmx-ic{color:var(--dm-fg2);background:var(--dm-chip);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .dm-mmx-src,:root [data-style="studio"] .dm-mmx-src,:root [data-style="studio"].dm-mmx-src{box-shadow:inset 0 0 0 1px var(--dm-hair)}
/* the head is an off-white head strip, its mark and title 16px from the strip's top and from the tabs (--dm-strip-y), and the
   tabs end it, on its off-white, as Notifications' do (owner, 28 Nov) */
:root[data-style="studio"] .dm-mmx-h,:root [data-style="studio"] .dm-mmx-h,:root [data-style="studio"].dm-mmx-h{margin:calc(-1 * var(--dm-s-4)) calc(-1 * var(--dm-s-4)) calc(-1 * var(--dm-s-2));padding:var(--dm-strip-y) var(--dm-s-4);background:var(--dm-strip);border-radius:var(--dm-r-card) var(--dm-r-card) 0 0}
:root[data-style="studio"] :is(.dm-mmx-m,.dm-mmx-gone),:root [data-style="studio"] :is(.dm-mmx-m,.dm-mmx-gone),:root [data-style="studio"]:is(.dm-mmx-m,.dm-mmx-gone){border-radius:calc(var(--dm-r-card) - 8px);transition:background-color var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .dm-mmx-m .dm-t[contenteditable="true"],:root [data-style="studio"] .dm-mmx-m .dm-t[contenteditable="true"],:root [data-style="studio"].dm-mmx-m .dm-t[contenteditable="true"]{padding:1px 6px;margin:-1px -6px;border-radius:var(--dm-r-field)}
:root[data-style="studio"] .dm-mmx-m .dm-acts,:root [data-style="studio"] .dm-mmx-m .dm-acts,:root [data-style="studio"].dm-mmx-m .dm-acts{transition:opacity var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .dm-mmx-f,:root [data-style="studio"] .dm-mmx-f,:root [data-style="studio"].dm-mmx-f{min-height:calc(28px + 2 * var(--dm-strip-y) + 1px);margin:var(--dm-s-1) calc(-1 * var(--dm-s-4)) calc(-1 * var(--dm-s-4));padding:0 var(--dm-s-4);background:var(--dm-strip);border-top-color:var(--dm-line);border-radius:0 0 var(--dm-r-card) var(--dm-r-card)}
:root[data-style="studio"] .dm-mmx-m.dm-use,:root [data-style="studio"] .dm-mmx-m.dm-use,:root [data-style="studio"].dm-mmx-m.dm-use{animation:dm-mmxuse 1.4s var(--dm-ease)}
TeamMemory.astroAstro · 29 lines
---
// Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync.
// Team memory: What the agent remembers about your team, editable and removable.
// The markup, CSS and script are designme.dev's own, run by the shared core in ../core, which mounts the component when it scrolls
// into view and plays its demo. To show your own data, change team-memory.js. The markup is kept exactly as it is (is:raw).
import type { HTMLAttributes } from 'astro/types';
import '../core/designme.css';
import './team-memory.css';

export interface Props extends HTMLAttributes<'div'> {
  /** "soft" or "studio" draws it in that style. Leave it out for Blueprint, or for the style set on <html> (data-style="soft" or "studio") */
  'data-style'?: 'soft' | 'studio';
}
const { class: className, ...rest } = Astro.props;
---
<div class:list={['card', className]} data-c="team-memory" {...rest}>
  <div class="stage-in"><Fragment is:raw>
<div class="mmx panel mx-grow mx-ic" data-reveal="flat">
  <div class="mmx-h"><span class="mmx-ic"><svg class="i s"><use href="#i-book"/></svg></span><b class="mmx-ht">Team memory</b></div>
  <div class="utabs mmx-ut" role="tablist" aria-label="Filter"><span class="utabs-i" aria-hidden="true"></span><button role="tab" aria-selected="true" data-v="all">All</button><button role="tab" aria-selected="false" tabindex="-1" data-v="brand">Brand</button><button role="tab" aria-selected="false" tabindex="-1" data-v="process">Process</button></div>
  <div class="mmx-list mx-glide" role="tabpanel"></div>
  <div class="mmx-f" aria-live="polite"><span class="mmx-fi" aria-hidden="true"><svg class="i xs"><use href="#i-spark"/></svg></span><span class="mmx-ft">Used in 14 answers this week</span></div>
</div>
  </Fragment></div>
</div>
<script>
  import './team-memory.js';
</script>
team-memory.htmlHTML · 11 lines
<div class="card" data-c="team-memory">
  <div class="stage-in">
    <div class="mmx panel mx-grow mx-ic" data-reveal="flat">
      <div class="mmx-h"><span class="mmx-ic"><svg class="i s"><use href="#i-book"/></svg></span><b class="mmx-ht">Team memory</b></div>
      <div class="utabs mmx-ut" role="tablist" aria-label="Filter"><span class="utabs-i" aria-hidden="true"></span><button role="tab" aria-selected="true" data-v="all">All</button><button role="tab" aria-selected="false" tabindex="-1" data-v="brand">Brand</button><button role="tab" aria-selected="false" tabindex="-1" data-v="process">Process</button></div>
      <div class="mmx-list mx-glide" role="tabpanel"></div>
      <div class="mmx-f" aria-live="polite"><span class="mmx-fi" aria-hidden="true"><svg class="i xs"><use href="#i-spark"/></svg></span><span class="mmx-ft">Used in 14 answers this week</span></div>
    </div>
  </div>
</div>
team-memory.cssHTML · 84 lines
/* ---------- Team memory ---------- */
/* each memory shows where it came from, as that source's own mark (Slack, Figma, GitHub, Notion, Linear, Drive) or an icon
   (something said in chat, an edit), and its kind in the kind's colour (--dm-k). A memory the agent learns arrives with a spinner
   on its mark and its words shimmering while it works the rule out, then a New tag (no tinted band, owner 18 Nov); the
   memories an answer uses pulse once with a quiet grey (never a hue) and say so. The card sits on two columns (owner, 18 Nov),
   its content 16px from every edge: the head's mark in a 28px column with each memory's mark centred under it, and the title,
   each memory and the footer's words 12px after it; a row's hover fill reaches 8px out round its content, and its Edit and
   Forget end on the content's right edge. The filter is the core's underline tabs under the head (owner, 28 Nov). The panel keeps no room for the memory still to come: it grows as
   the new one opens its row (grow()) and stays centred in its stage */
.mmx{padding:var(--dm-s-4);display:flex;flex-direction:column;gap:var(--dm-s-2);container:mmx/inline-size}
.mmx-h{display:flex;align-items:center;gap:8px 12px;padding-bottom:var(--dm-s-2)}
.mmx-ic{width:28px;height:28px;border-radius:calc(8px * var(--dm-rk-m,var(--dm-rk)));background:var(--dm-pp-bg);color:var(--dm-pp);display:grid;place-items:center;flex:none}
.mmx-ht{flex:1 0 auto;min-width:0;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* the filter: underline tabs 16px under the head, their hairline from edge to edge and the first tab's words on the content's
   16px column, the memories under them */
.mmx-ut{margin:0 calc(-1 * var(--dm-s-4))}
/* a memory's mark sits on the head's tile column and its actions end on the content's 16px edge; its hover fill reaches 8px
   out round it, into the padding, in every style (owner, 26 Nov) */
.mmx-list{display:flex;flex-direction:column;margin:0 calc(-1 * var(--dm-s-2))}
.mmx-m{display:flex;align-items:flex-start;gap:12px;padding:var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:13px;line-height:1.5;transition:background .3s}
@media (hover:hover) and (pointer:fine){.mmx-m:hover{background:var(--dm-row)}}
/* its motion (the core's motion pieces, owner, 26 Nov): one highlight glides from memory to memory in every style (.mx-glide);
   a filter moves the rows (reflow()); a press on Edit or Forget shows at once (.mx-press); a source's spinner and mark, and the
   footer's mark, crossfade (.mx-ic); the panel grows on the spring (.mx-grow) */
.mmx-src{width:28px;height:28px;margin-top:1px;border-radius:calc(8px * var(--dm-rk-m,var(--dm-rk)));display:grid;place-items:center;flex:none;background:var(--dm-surface);color:var(--dm-fg2);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dm-rail) 50%,transparent)}
.mmx-src .brand{width:15px;height:15px;color:var(--dm-fg)}
.mmx-src .spin{width:12px;height:12px}
.mmx-b{flex:1;min-width:0;display:flex;flex-direction:column}
/* a memory that wraps never leaves one word alone on its last line (owner, 24 Nov) */
.mmx-b .t{text-wrap:pretty}
.mmx-m .t{outline:0;border-radius:var(--dm-r-tiny,5px);padding:0 3px;margin:0 -3px}
.mmx-m .t[contenteditable="true"]{background:var(--dm-surface);box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-field-line) 50%,transparent)}
.mmx-m .t[contenteditable="true"]:focus{box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-field-line-strong) 50%,transparent)}
/* under it: its kind in the kind's colour, then where it came from */
.mmx-meta{display:flex;align-items:center;gap:6px;min-width:0;font-size:11.5px;color:var(--dm-muted);white-space:nowrap}
.mmx-meta>*{flex:none}
.mmx-meta .k{color:var(--dm-k);font-weight:500}
.mmx-meta .s{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
.mmx-meta .tag.nw{background:var(--dm-accent-bg);color:var(--dm-accent-fg,var(--dm-fg))}
.mmx-m .acts{display:flex;opacity:0;transition:opacity .2s}
.mmx-m:focus-within .acts{opacity:1}
@media (hover:hover) and (pointer:fine){.mmx-m:hover .acts{opacity:1}}
/* Forget's glyph ends on the content's edge, under the filter, its hover circle reaching out round it */
.mmx-m .ib{width:24px;height:24px}
.mmx-m .acts{margin-right:-6px}
.mmx-m.learn .acts{visibility:hidden}
/* a memory an answer uses pulses once with a quiet grey fill, and its source lifts */
.mmx-m.use{animation:mmxuse 1.4s var(--dm-ease)}
.mmx-m.use .mmx-src{animation:mmxlift .6s var(--dm-ease)}
/* (the pulse is an inset shade, not the row's fill, so the gliding hover, which clears the rows' own fills, never hides it) */
@keyframes mmxuse{0%{box-shadow:inset 0 0 0 99px var(--dm-hover)}100%{box-shadow:inset 0 0 0 99px transparent}}
@keyframes mmxlift{40%{transform:translateY(-2px) scale(1.08)}}
/* a forgotten memory leaves a line with its Undo in its place: the words on the memories' mark column, Undo ending where their
   actions end */
.mmx-gone{display:flex;align-items:center;justify-content:space-between;gap:var(--dm-s-2);min-height:32px;padding:4px var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:12.5px;color:var(--dm-muted);background:var(--dm-chip)}
.mmx-gone span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mmx-gone button{flex:none;color:var(--dm-accent-fg,var(--dm-accent));font-weight:500;font-size:12.5px}
/* the line at the foot: how often the memory is used, or the answer it is helping with now; its mark centred in the memories'
   mark column and its words on their words column */
.mmx-f{display:flex;align-items:center;gap:12px;margin-top:var(--dm-s-1);padding:var(--dm-s-4) 0 0;border-top:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent);font-size:12px;line-height:18px;color:var(--dm-muted)}
.mmx-fi{display:grid;place-items:center;flex:none;width:28px;color:var(--dm-fg2)}
.mmx-fi .brand{width:14px;height:14px}
.mmx-ft{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mmx-ft.sw{display:block}
:root:not([data-style="soft"],[data-style="studio"]) .mmx-m.use:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){animation:mmxusebp .9s steps(3,end)}
@keyframes mmxusebp{0%{box-shadow:inset 0 0 0 99px var(--dm-hover)}100%{box-shadow:inset 0 0 0 99px transparent}}
:root:not([data-style="soft"],[data-style="studio"]) .mmx-m.use .mmx-src:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){animation:mmxbp .9s steps(1,end)}
@keyframes mmxbp{0%,50%{box-shadow:inset 0 0 0 1px var(--dm-line-strong)}51%,100%{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dm-rail) 50%,transparent)}}
/* nothing in it grows or shrinks when it is pressed (owner, 18 Nov) */
.mmx :is(.ib,.pill):active,:root[data-style="studio"] .mmx .ib:active,:root [data-style="studio"] .mmx .ib:active,:root [data-style="studio"].mmx .ib:active{transform:none}
/* Studio (owner, 18 Nov): the head's mark is the neutral tile with a hairline that the sources' marks have; the rows' fills are
   concentric with the card (14px, 8px in); an edited memory is a field with Studio's 10px corners; the footer is an off-white foot
   strip, edge to edge, its mark and words on the card's columns */
:root[data-style="studio"] .mmx-ic,:root [data-style="studio"] .mmx-ic,:root [data-style="studio"].mmx-ic{color:var(--dm-fg2);background:var(--dm-chip);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .mmx-src,:root [data-style="studio"] .mmx-src,:root [data-style="studio"].mmx-src{box-shadow:inset 0 0 0 1px var(--dm-hair)}
/* the head is an off-white head strip, its mark and title 16px from the strip's top and from the tabs (--dm-strip-y), and the
   tabs end it, on its off-white, as Notifications' do (owner, 28 Nov) */
:root[data-style="studio"] .mmx-h,:root [data-style="studio"] .mmx-h,:root [data-style="studio"].mmx-h{margin:calc(-1 * var(--dm-s-4)) calc(-1 * var(--dm-s-4)) calc(-1 * var(--dm-s-2));padding:var(--dm-strip-y) var(--dm-s-4);background:var(--dm-strip);border-radius:var(--dm-r-card) var(--dm-r-card) 0 0}
:root[data-style="studio"] :is(.mmx-m,.mmx-gone),:root [data-style="studio"] :is(.mmx-m,.mmx-gone),:root [data-style="studio"]:is(.mmx-m,.mmx-gone){border-radius:calc(var(--dm-r-card) - 8px);transition:background-color var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .mmx-m .t[contenteditable="true"],:root [data-style="studio"] .mmx-m .t[contenteditable="true"],:root [data-style="studio"].mmx-m .t[contenteditable="true"]{padding:1px 6px;margin:-1px -6px;border-radius:var(--dm-r-field)}
:root[data-style="studio"] .mmx-m .acts,:root [data-style="studio"] .mmx-m .acts,:root [data-style="studio"].mmx-m .acts{transition:opacity var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .mmx-f,:root [data-style="studio"] .mmx-f,:root [data-style="studio"].mmx-f{min-height:calc(28px + 2 * var(--dm-strip-y) + 1px);margin:var(--dm-s-1) calc(-1 * var(--dm-s-4)) calc(-1 * var(--dm-s-4));padding:0 var(--dm-s-4);background:var(--dm-strip);border-top-color:var(--dm-line);border-radius:0 0 var(--dm-r-card) var(--dm-r-card)}
:root[data-style="studio"] .mmx-m.use,:root [data-style="studio"] .mmx-m.use,:root [data-style="studio"].mmx-m.use{animation:mmxuse 1.4s var(--dm-ease)}
team-memory.jsHTML · 78 lines
DM.def('team-memory', (r, c) => {
  r.innerHTML = r.innerHTML.replace('{book}', I('book')).replace('{spark}', I('spark','xs'));
  // where a memory came from: an app's own mark, or an icon for something said in chat or an edit
  const ICON = { chat:'comment', edit:'edit' };
  const mark = s => BRAND[s] || I(ICON[s] || s, 'xs');
  const KIND = { brand:['Brand', 'var(--dm-pl)'], process:['Process', 'var(--dm-pt)'] };
  let M = [
    ['brand','Primary buttons use the accent blue, never black','figma','Pricing review in Figma, Sep 12'],
    ['brand','Headlines stay under eight words','chat','You told the agent, Aug 30'],
    ['process','Ask Maya before publishing to the shared library','slack','A thread in #design-system, Sep 4'],
    ['brand','Card radius is 16px on web, 12px in the app','github','tokens.css on GitHub, Sep 18'],
    ['process','Run the launch checklist before every PR','notion','Launch checklist in Notion, Sep 20'],
    ['process','File design bugs in the Design QA project','linear','DES-214 in Linear, Sep 26'],
    ['brand','No em dashes in product copy','drive','Voice and tone guide in Drive, Oct 2']
  ].map((m, i) => ({ id:i, k:m[0], t:m[1], from:m[2], s:m[3] }));
  const list = $('.mmx-list', r), fi = $('.mmx-fi', r), ft = $('.mmx-ft', r);
  if (!r.closest('.ahx')) c.offs.push(hoverGlide(list, '.mmx-m'));
  let f = 'all', nid = 100;
  // the head names the panel only: a count of the memories and a row of their sources' marks repeated what the list shows
  const count = () => {};
  const meta = m => `<span class="k">${KIND[m.k][0]}</span><span aria-hidden="true">·</span><span class="s">${m.s}</span>${m.isNew ? '<span class="tag nw">New</span>' : ''}${m.used ? '<span class="tag nw">Used</span>' : ''}`;
  const rowOf = m => $(`.mmx-m[data-id="${m.id}"]`, list);
  function item(m){
    const el = html(`<div class="mmx-m${m.learn ? ' learn' : ''}" data-id="${m.id}" style="--dm-k:${KIND[m.k][1]}"><span class="mmx-src" aria-hidden="true">${m.learn ? '<span class="spin"></span>' : mark(m.from)}</span><span class="mmx-b"><span class="t${m.learn ? ' shim' : ''}" spellcheck="false">${m.t}</span><span class="mmx-meta">${meta(m)}</span></span><span class="acts"><button class="ib ed mx-press" aria-label="Edit" data-tip="Edit">${I('edit','xs')}</button><button class="ib rm mx-press" aria-label="Forget" data-tip="Forget">${I('trash','xs')}</button></span></div>`);
    const t = $('.t', el);
    $('.ed', el).onclick = () => { t.contentEditable = 'true'; t.focus({ preventScroll:true }); const s = document.getSelection(); s.selectAllChildren(t); s.collapseToEnd();
      const done = () => { t.contentEditable = 'false'; m.t = t.textContent.trim() || m.t; m.s = 'Edited by you, just now'; m.from = 'edit'; t.textContent = m.t; update(m); count(); };
      t.onkeydown = e => { if (e.key === 'Enter'){ e.preventDefault(); t.blur(); } }; t.onblur = done; };
    $('.rm', el).onclick = () => { const i = M.indexOf(m); M.splice(i, 1); count();
      const g = html(`<div class="mmx-gone"><span>Forgot “${m.t.slice(0, 32)}${m.t.length > 32 ? '…' : ''}”</span><button>Undo</button></div>`); el.replaceWith(g); enter(g);
      const tm = setTimeout(() => { g.classList.add('leave'); setTimeout(() => g.remove(), 320); }, 4000);
      $('button', g).onclick = () => { clearTimeout(tm); M.splice(i, 0, m); count(); const n = item(m); g.replaceWith(n); enter(n); }; };
    return el;
  }
  // a memory's row catches up with its data: its source, its text once it has been learned, its tags and its highlight
  function update(m, pulse){
    const el = rowOf(m); if (!el) return;
    const src = $('.mmx-src', el), t = $('.t', el);
    if (!m.learn && el.classList.contains('learn')){ el.classList.remove('learn'); t.classList.remove('shim'); swap(t, m.t); iconSwap(src, () => { src.innerHTML = mark(m.from); }, { inner:true }); }
    else if (t.contentEditable !== 'true') src.innerHTML = mark(m.from);
    $('.mmx-meta', el).innerHTML = meta(m);
    if (pulse){ el.classList.remove('use'); void el.offsetWidth; el.classList.add('use'); }
  }
  const draw = () => { list.innerHTML = ''; M.filter(m => f === 'all' || m.k === f).forEach(m => list.appendChild(item(m))); };
  function paint(){ draw(); stagger([...list.children], 40); }
  // a row that arrives opens its own height, so the panel grows smoothly instead of jumping
  const growRow = el => { if (REDUCE) return; const cs = getComputedStyle(el), gap = parseFloat(getComputedStyle(list).rowGap) || 0, ease = getComputedStyle(r).getPropertyValue('--dm-ease').trim() || 'ease', blur = getComputedStyle(r).getPropertyValue('--dm-motion').trim() === 'studio' ? 0 : 4;
    el.animate([{ height:'0px', paddingTop:'0px', paddingBottom:'0px', marginBottom:-gap + 'px', opacity:0, filter:`blur(${blur}px)`, overflow:'hidden' }, { height:cs.height, paddingTop:cs.paddingTop, paddingBottom:cs.paddingBottom, marginBottom:'0px', opacity:1, filter:'blur(0px)', overflow:'hidden' }], { duration:560, easing:ease }); };
  // a filter moves the rows: the memories that stay glide to their new places, new ones rise in out of a short blur and the
  // ones that go fade where they were (reflow(), motion pieces), as the panel eases to its new height
  utabs(c, $('.mmx-ut', r), v => { f = v; reflow(() => $$('.mmx-m', list), draw, { by:'data-id', root:list.closest('.mmx') || r, host:list, blur:true }); }, list);
  count(); paint();
  // no room is kept for the memory still to come (owner, 17 Nov): the panel grows as the new one opens its row, and as a filter
  // or a forgotten memory changes the list (grow(), centred in its stage), once its entrance (which scales it) has ended
  const mroot = r.classList.contains('mmx') ? r : $('.mmx', r);
  if (mroot && r === c.st) Promise.resolve().then(() => Promise.all(mroot.getAnimations().map(a => a.finished.catch(() => {})))).then(() => { if (!c.dead && mroot.isConnected) c.offs.push(grow(mroot)); });
  // the preview: the agent learns a rule from your edit in Figma, then drafts an email in Gmail with three memories, which
  // pulse as it reads them. Every state lives in the memories' data, so switching tabs keeps it; taking over settles it
  c.run(async () => {
    await c.step(2200);
    const m = { id:nid++, k:'brand', t:'Learning from your edit in Pricing v4', from:'figma', s:'Just now', learn:true };
    const learnt = () => Object.assign(m, { learn:false, t:'Use “Start free” instead of “Sign up” on CTAs', s:'Your edit in Pricing v4, just now' });
    c.taken(() => { if (m.learn){ learnt(); update(m); } if (ft.classList.contains('shim')){ ft.classList.remove('shim'); iconSwap(fi, () => { fi.innerHTML = I('spark','xs'); }, { inner:true }); swap(ft, 'Used in 14 answers this week'); } });
    M.unshift(m); count(); if (f === 'brand' || f === 'all'){ const el = item(m); list.prepend(el); growRow(el); }
    await c.step(1500);
    learnt(); m.isNew = true; update(m);
    await c.step(2600);
    m.isNew = false; m.s = 'Your edit in Figma, today'; update(m);
    await c.step(1000);
    iconSwap(fi, () => { fi.innerHTML = BRAND.gmail; }, { inner:true });
    ft.classList.add('shim'); swap(ft, 'Drafting the launch email in Gmail');
    await c.step(1100);
    let n = 0;
    for (const id of [m.id, 1, 6]){ const x = M.find(y => y.id === id); if (!x) continue; x.used = true; n++; update(x, true); await c.step(700); }
    ft.classList.remove('shim'); swap(ft, `Used ${n} ${n === 1 ? 'memory' : 'memories'} in the launch email draft`);
  });
});
06

Questions

What people ask about it.

How do I save an edited memory to my backend?
Use onEdit. It is called with the updated memory after an edit, with its new text, the editedSource line and the edit icon. If the text is left empty, the old text is kept.
When should I delete a forgotten memory for good?
onForget fires as soon as someone clicks Forget, and onRestore fires if they click Undo within undoFor ms. Wait out that window, or handle both callbacks, before deleting it on the server.
How do I show a memory the agent just learned?
Add it to the front of memories with learning: true while the agent works it out, then replace its text and set learning to false and isNew to true. It grows into the list with its New tag; set isNew back to false later to clear the tag.
How do I show which memories an answer used?
Set used: true on each one as the agent reads it, and set activity to say what it is writing, with live: true while it works. Each memory pulses as it turns on and keeps its Used tag until you set used back to false.
Can I use my own categories?
Yes. Pass kinds with a value, a tab label and a colour for each; every memory points to one by its kind. Pick a colour that reads as text, since the kind's label is written in it.
07

More in Workspace

Navigation, search, settings, models and automations around the agent.

Tool railA board's tools in one vertical rail: pick one, and its name and key show on hover.
Zoom barUndo, redo, zoom and fit in one floating bar for a canvas.
Run drawerA workflow's run under its canvas: the steps, the log and the data.
Command paletteJump anywhere or hand a task to the agent from one box.
Tools and connectionsThe tools the agent can reach, and how much it may do with each.
Knowledge sourcesThe files, sites and folders the agent knows, and how far each is indexed.
Recurring jobsTasks the agent runs on a schedule, with their last result and a switch.
File explorerProject files, with the ones the agent touched marked.