Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(ui): tidy the Memory card layout

leepokaic22c2ef9d134
diff --git a/apps/desktop/src/renderer/views/bots/MemoryView.tsx b/apps/desktop/src/renderer/views/bots/MemoryView.tsx
index 64b96daa..ffb6c997 100644
--- a/apps/desktop/src/renderer/views/bots/MemoryView.tsx
+++ b/apps/desktop/src/renderer/views/bots/MemoryView.tsx
@@ -1,11 +1,17 @@
import { useEffect, useMemo, useState } from 'react'
-import { Button, CardSection } from '../../components/Controls'
+import { Button, CardSection, ChoicePicker, DropdownMenu, IconButton, SearchField } from '../../components/Controls'
+import { Icon } from '../../components/Icon'
import { Dialog, ModalHeader, Sheet } from '../../components/Overlay'
import { useModel } from '../../lib/observable'
import { useStore } from '../../store/context'
import { MemoryStore, type MemoryDraft, type MemoryFact } from '../../store/memory-store'
import './memory.css'
+const FILTERS = [
+ { id: 'all', label: 'All' }, { id: 'profile', label: 'About you' },
+ { id: 'pinned', label: 'Pinned' }, { id: 'review', label: 'Needs review' },
+]
+
export function MemoryCard({ botId }: { botId: string }) {
const host = useStore()
const memory = useModel(useMemo(() => new MemoryStore(botId, () => host.ready()), [botId, host]))
@@ -22,37 +28,39 @@ export function MemoryCard({ botId }: { botId: string }) {
})
return <>
- <CardSection title="Memory" accessory={<button className="press" onClick={() => edit()} disabled={memory.busy}>Add</button>}>
- <div className="memory-actions">
- <input aria-label="Search memories" placeholder="Search memories" value={memory.query} onChange={e => memory.search(e.target.value)} />
- <button className="press" onClick={() => void memory.load()}>Refresh</button>
- </div>
- <div className="memory-actions" role="group" aria-label="Memory filter">
- {(['all', 'profile', 'pinned', 'review'] as const).map(filter => <button key={filter} className="press" aria-pressed={memory.filter === filter}
- onClick={() => memory.search(memory.query, filter)}>{({ all: 'All', profile: 'About you', pinned: 'Pinned', review: 'Needs review' })[filter]}</button>)}
+ <CardSection title="Memory" accessory={<div className="memory-header-actions">
+ <IconButton title="Add memory" icon="plus" onClick={() => edit()} disabled={memory.busy} />
+ <DropdownMenu className="icon-button memory-menu" title="More" items={() => [
+ { title: 'Refresh', icon: 'arrow.clockwise', action: () => void memory.load() },
+ { title: 'Export', icon: 'square.and.arrow.up', action: () => { setBackupMode('export'); void memory.export() } },
+ { title: 'Import', icon: 'arrow.down.circle', action: () => setBackupMode('import') },
+ { title: 'Forget everything', icon: 'trash', destructive: true, divider: true, action: () => setConfirmClear(true) },
+ ]}><Icon name="ellipsis" size={14} weight="medium" /></DropdownMenu>
+ </div>}>
+ <div className="memory-search">
+ <SearchField prompt="Search memories" value={memory.query} onChange={q => memory.search(q)} />
+ <ChoicePicker selection={memory.filter} options={FILTERS} fill="var(--bubble-agent)" onChange={f => memory.search(memory.query, f)} />
</div>
{memory.error && <p role="alert" className="memory-error">{memory.error}</p>}
- {!memory.loaded && !memory.error && <p>Loading memory…</p>}
- {memory.loaded && !memory.facts.length && <p className="memory-muted">{memory.query || memory.filter !== 'all' ? 'No matching memories.' : 'Nothing yet. Important details are remembered as you chat.'}</p>}
+ {!memory.loaded && !memory.error && <p className="memory-muted">Loading memory…</p>}
+ {memory.loaded && !memory.facts.length && <div className="memory-empty">
+ <Icon name="brain" size={20} color="var(--tertiary)" />
+ <span>{memory.query || memory.filter !== 'all' ? 'No matching memories.' : 'Nothing yet. Important details are remembered as you chat.'}</span>
+ </div>}
{memory.facts.map(fact => <div className="memory-item fade-in" key={fact.id}>
<button className="press memory-content" onClick={() => edit(fact)}>
- <strong>{fact.pinned ? '● ' : ''}{fact.title}</strong>
+ <strong>{fact.pinned && <Icon name="pin.fill" size={10} color="var(--secondary)" />}{fact.title}</strong>
<span>{fact.content}</span>
<small>{fact.kind === 'profile' ? 'About you' : fact.memoryType} · {new Date(fact.createdAt).toLocaleDateString()} · {fact.revisionCount} revisions</small>
</button>
- <div className="memory-actions">
- <button className="press" onClick={() => void memory.mutate('pinMemory', { id: fact.id, pinned: !fact.pinned })} disabled={memory.busy}>{fact.pinned ? 'Unpin' : 'Pin'}</button>
- <button className="press" onClick={() => { setShowDetail(true); void memory.inspect(fact) }}>History</button>
- {fact.reviewAfter && <button className="press" onClick={() => void memory.mutate('reviewMemory', { id: fact.id })} disabled={memory.busy}>Mark reviewed</button>}
- <button className="press" onClick={() => void memory.mutate('forgetMemory', { id: fact.id })} disabled={memory.busy}>Forget</button>
- </div>
+ <DropdownMenu className="icon-button memory-menu" title="Memory actions" items={() => [
+ { title: fact.pinned ? 'Unpin' : 'Pin', icon: fact.pinned ? 'pin.slash' : 'pin', action: () => void memory.mutate('pinMemory', { id: fact.id, pinned: !fact.pinned }) },
+ { title: 'History', icon: 'clock.arrow.circlepath', action: () => { setShowDetail(true); void memory.inspect(fact) } },
+ ...(fact.reviewAfter ? [{ title: 'Mark reviewed', icon: 'checkmark.circle', action: () => void memory.mutate('reviewMemory', { id: fact.id }) }] : []),
+ { title: 'Forget', icon: 'trash', destructive: true, divider: true, action: () => void memory.mutate('forgetMemory', { id: fact.id }) },
+ ]}><Icon name="ellipsis" size={14} weight="medium" /></DropdownMenu>
</div>)}
- {memory.nextOffset !== null && <button className="press" onClick={() => void memory.load(true)}>Load more ({memory.total})</button>}
- <div className="memory-actions">
- <button className="press" onClick={() => { setBackupMode('export'); void memory.export() }}>Export</button>
- <button className="press" onClick={() => setBackupMode('import')}>Import</button>
- <button className="press" onClick={() => setConfirmClear(true)} disabled={memory.busy}>Forget everything</button>
- </div>
+ {memory.nextOffset !== null && <button className="press memory-more" onClick={() => void memory.load(true)}>Load more ({memory.total})</button>}
</CardSection>
<Sheet open={draft !== null} onClose={() => setDraft(null)} width={560}>
<ModalHeader title={draft?.id ? 'Edit memory' : 'Add memory'} />
diff --git a/apps/desktop/src/renderer/views/bots/memory.css b/apps/desktop/src/renderer/views/bots/memory.css
index aab56d3c..43b0aa37 100644
--- a/apps/desktop/src/renderer/views/bots/memory.css
+++ b/apps/desktop/src/renderer/views/bots/memory.css
@@ -1,14 +1,21 @@
+.memory-header-actions { display: flex; align-items: center; gap: 2px; }
+.memory-menu { width: 28px; height: 28px; border-radius: 8px; }
+.memory-search { display: flex; align-items: center; gap: 8px; }
+.memory-search .search-field { flex: 1; min-width: 0; }
+.memory-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px; text-align: center; color: var(--secondary); line-height: 1.45; }
+.memory-item { display: flex; align-items: flex-start; gap: 8px; }
+.memory-item .memory-menu { margin: -4px -6px 0 0; }
+.memory-content { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; text-align: left; }
+.memory-content strong { display: flex; align-items: center; gap: 6px; }
+.memory-content span { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
+.memory-content small, .memory-muted { color: var(--secondary); }
+.memory-more { color: var(--secondary); text-align: center; }
.memory-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.memory-actions button { color: var(--secondary); font-size: 12px; }
.memory-actions button[aria-pressed="true"] { color: var(--text); font-weight: 650; }
-.memory-actions input { flex: 1; min-width: 100px; }
-.memory-item { padding: 8px 0; }
-.memory-content { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; margin-bottom: 8px; }
-.memory-content span { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
-.memory-content small, .memory-muted { color: var(--secondary); }
.memory-editor { display: flex; flex-direction: column; gap: 16px; padding: 20px; max-height: 70vh; overflow: auto; }
.memory-editor label { display: flex; flex-direction: column; gap: 6px; }
-.memory-editor input, .memory-editor textarea, .memory-actions input { padding: 10px; background: var(--surface); color: var(--text); border: 0; border-radius: 8px; font: inherit; }
+.memory-editor input, .memory-editor textarea { padding: 10px; background: var(--surface); color: var(--text); border: 0; border-radius: 8px; font: inherit; }
.memory-editor textarea { resize: vertical; }
.memory-history { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; user-select: text; }
.memory-error { color: var(--danger, #df665e); white-space: pre-wrap; }
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift
index 605988ad..84834afd 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift
@@ -15,8 +15,11 @@ struct MemoryCard: View {
if let memory { contents(memory) }
else { Text("Loading memory…").foregroundStyle(Palette.secondary) }
} accessory: {
- IconButton("Add memory", systemImage: "plus") { openEditor() }
- .disabled(memory == nil || memory?.busy == true)
+ HStack(spacing: 2) {
+ IconButton("Add memory", systemImage: "plus") { openEditor() }
+ .disabled(memory == nil || memory?.busy == true)
+ if let memory { moreMenu(memory) }
+ }
}
.task(id: botId) {
let store = MemoryStore(botId: botId) { try await host.ready() }
@@ -40,31 +43,33 @@ struct MemoryCard: View {
}
@ViewBuilder private func contents(_ memory: MemoryStore) -> some View {
- SearchField("Search memories", text: Binding(get: { memory.query }, set: { memory.search($0) }))
- ScrollView(.horizontal) {
- HStack(spacing: 14) {
- ForEach(["all", "profile", "pinned", "review"], id: \.self) { filter in
- Button(["all": "All", "profile": "About you", "pinned": "Pinned", "review": "Needs review"][filter] ?? filter) {
- withAnimation(Motion.layout) { memory.search(memory.query, filter: filter) }
- }
- .fontWeight(memory.filter == filter ? .semibold : .regular)
- .foregroundStyle(memory.filter == filter ? Palette.text : Palette.secondary)
- }
- }
- .buttonStyle(.plain)
+ HStack(spacing: 8) {
+ SearchField("Search memories", text: Binding(get: { memory.query }, set: { memory.search($0) }))
+ ChoicePicker(selection: Binding(get: { memory.filter }, set: { filter in
+ withAnimation(Motion.layout) { memory.search(memory.query, filter: filter) }
+ }), options: Self.filters, fill: Palette.bubbleAgent)
}
if let error = memory.error { Text(error).foregroundStyle(Palette.danger).textSelection(.enabled) }
if !memory.loaded && memory.error == nil { Text("Loading memory…").foregroundStyle(Palette.secondary) }
if memory.loaded && memory.facts.isEmpty {
- Text(memory.query.isEmpty && memory.filter == "all"
- ? "Nothing yet. Important details are remembered as you chat." : "No matching memories.")
- .foregroundStyle(Palette.secondary)
+ VStack(spacing: 8) {
+ Image(systemName: "brain").font(.title3).foregroundStyle(Palette.tertiary)
+ Text(memory.query.isEmpty && memory.filter == "all"
+ ? "Nothing yet. Important details are remembered as you chat." : "No matching memories.")
+ .multilineTextAlignment(.center)
+ .foregroundStyle(Palette.secondary)
+ }
+ .frame(maxWidth: .infinity)
+ .padding(.vertical, 18)
}
ForEach(memory.facts) { fact in
- VStack(alignment: .leading, spacing: 8) {
+ HStack(alignment: .top, spacing: 8) {
Button { openEditor(fact) } label: {
VStack(alignment: .leading, spacing: 4) {
- Text((fact.pinned ? "● " : "") + fact.title).fontWeight(.semibold)
+ HStack(spacing: 6) {
+ if fact.pinned { Image(systemName: "pin.fill").font(.caption2).foregroundStyle(Palette.secondary) }
+ Text(fact.title).fontWeight(.semibold)
+ }
Text(fact.content).lineLimit(3)
Text("\(fact.kind == "profile" ? "About you" : fact.memoryType) · \(Date(timeIntervalSince1970: Double(fact.createdAt) / 1000).formatted(date: .abbreviated, time: .omitted)) · \(fact.revisionCount) revisions")
.font(.caption).foregroundStyle(Palette.secondary)
@@ -73,42 +78,61 @@ struct MemoryCard: View {
.contentShape(Rectangle())
}
.buttonStyle(.plain)
- ScrollView(.horizontal) {
- HStack(spacing: 14) {
- Button(fact.pinned ? "Unpin" : "Pin") { Task { await memory.action("pinMemory", fact: fact) } }
- Button("History") {
- withAnimation(Motion.layout) { showDetail = true }
- Task { await memory.inspect(fact) }
- }
- if fact.reviewAfter != nil {
- Button("Mark reviewed") { Task { await memory.action("reviewMemory", fact: fact) } }
- }
- Button("Forget") { Task { await memory.action("forgetMemory", fact: fact) } }
- }
- .buttonStyle(.plain).font(.caption).foregroundStyle(Palette.secondary)
- .disabled(memory.busy)
- }
+ factMenu(memory, fact)
}
.padding(.vertical, 6)
}
if memory.nextOffset != nil {
- Button("Load more (\(memory.total))") { Task { await memory.load(more: true) } }.buttonStyle(.plain)
- }
- ScrollView(.horizontal) {
- HStack(spacing: 14) {
- Button("Refresh") { Task { await memory.load() } }
- Button("Export") {
- withAnimation(Motion.layout) { backupMode = .export }
- Task { await memory.export() }
- }
- Button("Import") { withAnimation(Motion.layout) { backupMode = .import } }
- Button("Forget everything") { withAnimation(Motion.layout) { confirmClear = true } }
- .disabled(memory.busy)
- }
- .buttonStyle(.plain).font(.caption).foregroundStyle(Palette.secondary)
+ Button("Load more (\(memory.total))") { Task { await memory.load(more: true) } }
+ .buttonStyle(.plain).foregroundStyle(Palette.secondary).frame(maxWidth: .infinity)
}
}
+ private static let filters = [("all", "All"), ("profile", "About you"), ("pinned", "Pinned"), ("review", "Needs review")]
+ .map { (id: $0.0, label: $0.1) }
+
+ private func moreMenu(_ memory: MemoryStore) -> some View {
+ DropdownMenu {
+ [MenuItem("Refresh", icon: "arrow.clockwise") { Task { await memory.load() } },
+ MenuItem("Export", icon: "square.and.arrow.up") {
+ withAnimation(Motion.layout) { backupMode = .export }
+ Task { await memory.export() }
+ },
+ MenuItem("Import", icon: "square.and.arrow.down") { withAnimation(Motion.layout) { backupMode = .import } },
+ MenuItem("Forget everything", icon: "trash", destructive: true, divider: true) {
+ withAnimation(Motion.layout) { confirmClear = true }
+ }]
+ } label: { menuLabel("More") }
+ }
+
+ private func factMenu(_ memory: MemoryStore, _ fact: MemoryFact) -> some View {
+ DropdownMenu {
+ [MenuItem(fact.pinned ? "Unpin" : "Pin", icon: fact.pinned ? "pin.slash" : "pin") {
+ Task { await memory.action("pinMemory", fact: fact) }
+ },
+ MenuItem("History", icon: "clock.arrow.circlepath") {
+ withAnimation(Motion.layout) { showDetail = true }
+ Task { await memory.inspect(fact) }
+ }]
+ + (fact.reviewAfter != nil ? [MenuItem("Mark reviewed", icon: "checkmark.circle") {
+ Task { await memory.action("reviewMemory", fact: fact) }
+ }] : [])
+ + [MenuItem("Forget", icon: "trash", destructive: true, divider: true) {
+ Task { await memory.action("forgetMemory", fact: fact) }
+ }]
+ } label: { menuLabel("Memory actions") }
+ .disabled(memory.busy)
+ }
+
+ private func menuLabel(_ title: String) -> some View {
+ Image(systemName: "ellipsis")
+ .font(.body.weight(.medium))
+ .foregroundStyle(Palette.secondary)
+ .frame(width: 32, height: 32)
+ .contentShape(Rectangle())
+ .accessibilityLabel(title)
+ }
+
private func openEditor(_ fact: MemoryFact? = nil) {
withAnimation(Motion.layout) { editor = MemoryEditorTarget(draft: MemoryDraft(botId: botId, fact: fact)) }
}