mémoire design system

The foundational layer that powers every Mémoire-generated interface. Tokens, primitives, components, and patterns — all built for autonomous reskinning while preserving developmental integrity.

Atomic-first
Every component is classified atom through template. No exceptions.
Token-driven
All visual decisions are tokens. Swap them, swap the skin.
Agent-native
Claude reads, generates, and validates every component autonomously.
Presentable
Every output is portfolio-grade. Preview gallery by default.

The semantic layer

Tokens are the single source of truth for all visual decisions. Mémoire extracts them from Figma variables and exports as CSS custom properties, Tailwind config, or raw JSON. Every generated component references tokens — never raw values.

Token categories

color.*Semantic colors — bg, fg, muted, accent, destructive, border
spacing.*4px base unit scale — 0, 1, 2, 3, 4, 6, 8, 12, 16, 24
radius.*Border radius — none, sm, md, lg, full
typography.*Font family, size, weight, line-height, letter-spacing
shadow.*Elevation levels — sm, md, lg
motion.*Duration and easing — fast, normal, slow, spring

AgenticUI base tokens

The default Mémoire aesthetic — dark-first, monospace-native. These are the exact tokens from the dashboard and preview system.

--bg
#111113
--bg-card
#19191c
--bg-hover
#222226
--fg
#ffffff
--fg-muted
#636369
--border
#2a2a2e
--accent
#a0a0a6
--green
#4ade80
--blue
#60a5fa

Atomic level badges

Each atomic level has a fixed color used across the dashboard, preview, and generated documentation.

atomBlue #60a5fa — rgba(96, 165, 250, 0.15) bg
moleculeGreen #4ade80 — rgba(74, 222, 128, 0.15) bg
organismYellow #facc15 — rgba(250, 204, 21, 0.15) bg
templateRed #f87171 — rgba(248, 113, 113, 0.15) bg

shadcn token mapping

Figma tokens are auto-mapped to shadcn CSS variables via regex in tailwind-tokens.ts. Values are converted to HSL for shadcn compatibility.

--primaryprimary, brand
--secondarysecondary
--accentaccent
--backgroundbackground, bg
--foregroundforeground, text
--mutedmuted
--destructivedestructive, error, danger
--borderborder
--ringring, focus
--cardcard
--popoverpopover
--inputinput

Export formats

TERMINAL
# Export as CSS custom properties
memi tokens --format css

# Export as Tailwind config
memi tokens --format tailwind

# Export as raw JSON
memi tokens --format json

Two faces, one system

Mémoire uses a deliberate dual-font pairing. The monospace stack — SF Mono, Fira Code, JetBrains Mono — for all interface text: data, labels, code, navigation. Cormorant Garamond for display moments only: titles, brand, editorial.

MONO
SF Mono / Fira Code / JetBrains Mono
Interface, labels, data, code, nav
SERIF
Cormorant Garamond 300 / 400
Brand, titles, display headings only

CSS variables

--mono'SF Mono', 'Fira Code', 'JetBrains Mono', monospace
--serif'Cormorant Garamond', 'Georgia', serif
--sans-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif

Scale

9px / 2px trackingSection labels, meta text, uppercase only
11px / 0.5px trackingNav values, file descriptions, secondary text
13px / baseBody text, list items, paragraphs
20px / 0.3px trackingSection headings (h2)
36px / serif italicPage titles (h1), display headings

Restrained by design

AgenticUI is dark-first and near-monochrome. Color enters only through semantic tokens (badge levels, status indicators) and data visualization. No gradients unless data-driven. No color without semantic meaning.

Background
#111113 — primary surface, body background
Card
#19191c — elevated surface, cards, panels
Hover
#222226 — interactive hover state, active tab
Foreground
#ffffff — primary text, headings, values
Muted
#636369 — secondary text, descriptions, nav labels
Border
#2a2a2e — dividers, card borders, separators
Accent
#a0a0a6 — links, accent-bright maps to #ffffff
SOUL.MD RULE

No gradients unless data-driven. No rounded-full on containers. No color without semantic meaning. No animation longer than 400ms for UI (cinematic excepted). From .memoire/SOUL.md.

4px base unit

All spacing derives from a 4px base. Components use semantic spacing tokens rather than raw pixel values. Grid layouts use CSS Grid with named areas for template-level composition.

1 — 4px
2 — 8px
3 — 12px
4 — 16px
6 — 24px
8 — 32px
12 — 48px
16 — 64px

Grid system

Sidebar + Content240px fixed sidebar, 1fr main — docs, design system
Dashboard Grid12-column grid with named areas for card placement
Full BleedEdge-to-edge hero sections with centered content

Primitives — components/ui/

The smallest building blocks. Atoms map directly to shadcn/ui primitives. The auto-spec engine infers atomic level from component names via regex pattern matching in auto-spec.ts. All 21 shadcn components are mapped in shadcn-mapper.ts.

shadcn/ui component map (21)

Button
ui/button.tsx
Badge
Badge
ui/badge.tsx
Input
ui/input.tsx
Label
Label
ui/label.tsx
Card
ui/card.tsx
Separator
ui/separator.tsx

Full shadcn map from SHADCN_IMPORTS in the codegen engine:

CardCard, CardContent, CardDescription, CardFooter, CardHeader, CardTitle
ButtonButton
BadgeBadge
InputInput
LabelLabel
TableTable, TableBody, TableCell, TableHead, TableHeader, TableRow
TabsTabs, TabsContent, TabsList, TabsTrigger
DialogDialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger
SelectSelect, SelectContent, SelectItem, SelectTrigger, SelectValue
AvatarAvatar, AvatarFallback, AvatarImage
SeparatorSeparator
SkeletonSkeleton
TooltipTooltip, TooltipContent, TooltipProvider, TooltipTrigger
DropdownMenuDropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger
SheetSheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger
ScrollAreaScrollArea
SwitchSwitch
CheckboxCheckbox
TextareaTextarea
ProgressProgress
SidebarSidebarProvider, Sidebar, SidebarContent, SidebarHeader, SidebarFooter

Auto-inference patterns

The auto-spec engine infers atomic level from Figma component names. These regex patterns are in auto-spec.ts:

ATOM_PATTERNSbutton, icon, badge, label, input, checkbox, radio, switch, avatar, separator, tag, chip, indicator, dot, spinner, skeleton
MOLECULE_PATTERNSform-field, search-bar, card, stat, metric, tooltip, popover, dropdown, select, date-picker, color-picker, file-upload, toggle-group
ORGANISM_PATTERNSheader, footer, sidebar, navbar, toolbar, form, table, data-table, list, modal, dialog, sheet, drawer, panel, section, hero, pricing, testimonial
TEMPLATE_PATTERNSlayout, template, page-layout, dashboard-layout, auth-layout, app-shell
CONSTRAINT

Atoms never compose other specs. composesSpecs must be empty in the JSON spec. If no pattern matches, the engine uses a heuristic: 6+ props or 5+ variants = organism, 3+ props or 2+ variants = molecule, else atom.

Composed primitives — components/molecules/

Molecules combine 2–5 atoms into a functional unit. They map to auto-spec patterns like form-field, stat, metric, card. Output goes to components/molecules/.

MetricCardCard + Badge — KPI display with title, value, trend. 3 variants: default, compact, highlighted
FormFieldLabel + Input — validation message, error state
SearchBarInput + Button — search interaction pattern
StatCardCard + Label — single metric display for dashboards
TokenSwatchColor preview + name + value — token documentation
DatePickerInput + Popover — date selection with calendar
REAL SPEC — specs/components/MetricCard.json
{
  "name": "MetricCard",
  "type": "component",
  "level": "molecule",
  "purpose": "Display a single KPI metric with title, value, and optional trend indicator",
  "variants": ["default", "compact", "highlighted"],
  "props": {
    "title": "string",
    "value": "string",
    "change": "string?",
    "trend": "up | down | flat"
  },
  "shadcnBase": ["Card", "Badge"],
  "accessibility": {
    "role": "article",
    "ariaLabel": "required",
    "keyboardNav": false
  },
  "tags": ["dashboard", "kpi"]
}

Stateful composites — components/organisms/

Organisms are complex components with real state and behavior. They compose molecules and atoms, handle data fetching, and manage interaction flows. This is where business logic lives in the component tree.

SidebarNavItems + brand + section groups — app navigation
SpecViewerCode block + metadata + validation status — spec inspector
TokenTableToken swatches + filter + export controls — token browser
AgentPanelAgent status + task list + port info — agent monitor
ResearchCardInsights + sources + charts — research display
LoginFormFormFields + submit + validation — authentication

Layout skeletons — components/templates/

Templates define page structure without content. They specify grid areas, responsive breakpoints, and slot positions. Content is injected by page specs — templates are purely structural.

DashboardTemplateSidebar + header + content grid + footer
DocsTemplateFixed sidebar + scrollable main + sticky nav
FullBleedTemplateEdge-to-edge hero + centered content sections
SplitTemplate50/50 panes for comparison, editor, or preview views
sidebar
header
card
card
card
card — wide
card
card
DashboardTemplate — grid-template-areas

Five specs, one system

Every artifact in Mémoire starts as a typed JSON spec validated by Zod. The spec is the single source of truth — code generation, validation, and preview all derive from it. Defined in src/specs/types.ts.

ComponentSpecname, type:"component", level, purpose, variants, props, shadcnBase, composesSpecs, codeConnect, accessibility, dataviz, tags
PageSpecname, type:"page", purpose, layout (6 types), sections (SectionSchema[]), shadcnLayout, responsive, meta
DataVizSpecname, type:"dataviz", purpose, chartType (15 types), library (recharts/d3/visx/custom), dataShape, interactions, accessibility, sampleData
DesignSpecname, type:"design", sourceNodeId, dimensions, spacing, interactions, typography, colors, borderRadius, shadows, breakpoints
IASpecname, type:"ia", root (IANode tree), flows (from/to/trigger/condition), entryPoints, globals

ComponentSpec fields

levelAtomicLevel: "atom" | "molecule" | "organism" | "template"
shadcnBasestring[] — which shadcn components to build on
composesSpecsstring[] — names of specs this composes (empty for atoms)
propsRecord<string, string> — prop name to TypeScript type
variantsstring[] — defaults to ["default"]
designTokenssource: "figma" | "manual" | "none", mapped: boolean
accessibilityrole, ariaLabel: "required" | "optional" | "none", keyboardNav
codeConnectfigmaNodeId, codebasePath, props mapping, mapped flag

Output folders

atomcomponents/ui/ — shadcn primitives
moleculecomponents/molecules/ — 2-5 atom compositions
organismcomponents/organisms/ — stateful composites
templatecomponents/templates/ — layout skeletons

Figma to code mapping

Every ComponentSpec has a codeConnect field that maps Figma components to codebase files. When Figma MCP returns Code Connect snippets, the codegen engine uses the mapped component directly instead of generating from scratch.

CODE CONNECT SCHEMA
{
  "codeConnect": {
    "figmaNodeId": "123:456",
    "codebasePath": "src/components/ui/button.tsx",
    "props": {
      "variant": "variant",
      "size": "size"
    },
    "mapped": true
  }
}
get_code_connect_mapRead existing component-to-code mappings from Figma
add_code_connect_mapRegister a new codebase component to a Figma component
get_code_connect_suggestionsAI-suggested mappings based on name matching

Repeatable structures

PageSpec defines six layout types. These map to CSS Grid structures that templates implement. Section-level layouts control card placement within each page section.

Page layouts (PageSpec.layout)

sidebar-main240px sidebar + 1fr content — docs, design system, settings
full-widthEdge-to-edge sections — landing pages, hero content
centeredMax-width container centered — blog, single-column
split50/50 panes — comparison, editor + preview
dashboard12-column grid with named areas — metrics, charts, tables
marketingFull-bleed hero + stacked sections — product pages

Section layouts (SectionSchema.layout)

full-widthSpans entire content area
half / third / quarterFractional widths within a row
grid-2 / grid-3 / grid-4Equal-column grids
stack / inlineVertical stack or horizontal inline flow

Responsive defaults (PageSpec.responsive)

mobilestack — single column, collapsible sidebar
tabletgrid-2 — two-column where possible
desktopgrid-4 — full multi-column layout

Motion and state

Interactions are minimal and purposeful. Transitions use 150–200ms durations. No spring physics, no bounces — direct, fast, and honest feedback.

Hover → fillButtons invert: bg becomes fg, text becomes bg. 200ms ease.
Active sectionIntersectionObserver tracks scroll, highlights sidebar link with left border.
Smooth scrollAnchor clicks use scrollIntoView with smooth behavior.
Code revealCode blocks appear with subtle opacity transition on scroll.

Visualizing system state

Mémoire generates dataviz from DataVizSpec using Recharts by default (also supports d3, visx, custom). Each chart is wrapped in a shadcn Card. Interactions and accessibility are defined in the spec.

Chart types (DataVizSpec.chartType)

lineTime-series, trends — single stroke, no fill by default
barCategorical comparison — rounded corners, tight spacing
areaFilled line chart — gradient fill with token colors
pie / donutProportional data — donut preferred for readability
scatterCorrelation plots — x/y data with optional groupBy
radarMulti-axis comparison — skill maps, feature comparison
treemapHierarchical proportional data — nested rectangles
funnelConversion funnels — sequential stage dropoff
heatmapDensity visualization — grid-based color intensity
sankeyFlow diagrams — source to destination with volume
gaugeProgress/threshold indicator — single value against range
sparklineInline trend indicator — compact, no axes
composed / customMulti-chart overlay or fully custom rendering

Chart interactions

hover-tooltipDefault — shows data point values on hover
click / drill-downNavigate into data segments
zoom / brush / panRange selection and navigation
legend-toggleShow/hide series via legend
crosshair / exportData inspection and download

The autonomous design engine

AgenticUI is defined by .memoire/SOUL.md — the design soul file. It is not a brand, it is a structural foundation any brand can sit on. Dark-first (#111113), monospace-native, 4px radius, tight spacing.

Voice (from SOUL.md)

  • Minimal, precise, monospace-native — no marketing speak, no filler
  • Technical but warm — like good documentation

Visual language

  • Dark-first — bg: #111113, fg: #ffffff
  • Monospace typography as primary — SF Mono, Fira Code, JetBrains Mono
  • Muted accents, high contrast text — #a0a0a6 accent, #636369 muted
  • 4px radius, tight spacing — no decorative elements, every pixel earns its place

Interaction principles

  • Immediate feedback — on all actions, no loading spinners without progress
  • Keyboard-first, mouse-friendly — every action has a keyboard path
  • Progressive disclosure — show less, reveal on demand
  • Respect prefers-reduced-motion — honor system accessibility settings

Anti-patterns (enforced)

  • No gradients — unless data-driven (heatmaps, charts)
  • No rounded-full — on containers. 4px max radius
  • No color without semantic meaning — decoration is noise
  • No animation > 400ms — for UI transitions (cinematic excepted)

How Claude uses it

Claude reads SOUL.md + the token system, applies defaults, and outputs shadcn/ui + Tailwind. The self-healing loop (CREATE → SCREENSHOT → ANALYZE → FIX → VERIFY, max 3 rounds) validates the result against the aesthetic.

CODEGEN OUTPUT — from shadcn-mapper.ts
"use client"

import * as React from "react"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import { cn } from "@/lib/utils"

export type MetricCardVariant = "default" | "compact" | "highlighted"

export interface MetricCardProps extends React.HTMLAttributes<HTMLDivElement> {
  title: string
  value: string
  change?: string
  trend: "up" | "down" | "flat"
  variant?: MetricCardVariant
}

export function MetricCard({ title, value, change, trend, variant = "default", className, ...props }: MetricCardProps) {
  return (
    <Card className={cn("transition-all", className)} {...props}>
      <CardHeader>
        <CardTitle>{title}</CardTitle>
      </CardHeader>
      <CardContent>
        <div className="text-2xl font-bold">{value}</div>
        {change && <span className="text-sm text-muted-foreground">{change}</span>}
        {trend && <Badge>{trend}</Badge>}
      </CardContent>
    </Card>
  )
}

One structure, any brand

Reskinning is how Mémoire transforms a neutral AgenticUI project into a branded case study. The structure stays, the skin changes. This is done entirely through token overrides — no component code changes.

What changes (token categories from DesignToken)

color tokensOverride --bg, --fg, --accent, --muted, --border, --card — auto-mapped to shadcn vars
typography tokensSwap --mono and --serif font stacks — brand typeface
spacing / radius4px base unit scale + border radius — --radius from 0 to 12px+
shadow tokensFlat to elevated — sm, md, lg elevation levels
.memoire/SOUL.mdDesign soul file — voice, visual language, anti-patterns, interaction principles

What stays

Component specsSame atomic hierarchy, same composition rules
Layout templatesSame grid structures, same slot positions
Interaction patternsSame hover/active/focus behaviors
Zod schemasSame validation, same type safety
Self-healing loopStill validates every canvas operation
RESKIN EXAMPLE
// Override tokens for a fintech case study
{
  "color.bg": "#0d1117",
  "color.fg": "#e6edf3",
  "color.accent": "#58a6ff",
  "color.muted": "#8b949e",
  "typography.family.mono": "'IBM Plex Mono', monospace",
  "radius.md": "8px",
  "shadow.md": "0 4px 24px rgba(0,0,0,0.3)"
}

Presentable by default

Every Mémoire project generates a preview gallery automatically via memi preview. It runs on port 3030 and serves 6 pages in the AgenticUI aesthetic or the project's reskinned version.

Preview gallery pages

  • Index — project overview with component counts, token summary, Figma status
  • Specs — all component, page, and dataviz specs with validation status
  • Design System — live token table with swatches and export controls
  • Research — ingested data visualized as charts and insight cards
  • Portal — Figma bridge status, connected agents, auto-discovery
  • Changelog — version history with architectural decisions documented

Workflow

figma pull token override spec create generate preview = case study

Guardrails that hold

Reskinning is surface-level by design. The development architecture underneath never bends. These constraints are enforced in code — not by convention, not by documentation, but by Zod schemas and validation at every step.

Enforced constraints

Atoms cannot compose
Zod rejects any atom spec with non-empty composesSpecs
Molecules must compose atoms
Spec validation checks that composed specs exist and are atoms
Templates have no content
Template specs define slots only — content comes from page specs
Tokens are semantic
Raw hex values in generated code trigger a self-healing correction
TypeScript strict
All generated code passes tsc --strict — no any, no implicit
Self-healing validates
Screenshot loop checks visual output against the spec intent, max 3 rounds
PHILOSOPHY

The skin is the variable. The skeleton is the constant. You can make it look like anything — but you cannot break the atomic hierarchy, skip validation, or bypass the self-healing loop. That is what developmental integrity means.