Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(breadcrumbs): resume-where-you-left-off card on project activation

Mina Samehfe580a261faf
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index e7cc3154e..3c713d6d5 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -151,6 +151,7 @@ import { viewportAtZoom1 } from '../lib/zoomReset'
import { isSpaceRelease, spacePanKeydown } from '../lib/spacePan'
import { UpdateCard } from '../components/UpdateCard'
import { AnnouncementBanner } from '../components/AnnouncementBanner'
+import { ResumeCard } from '../components/ResumeCard'
import { TmuxBanner } from '../components/TmuxBanner'
import { PtyPressureBanner } from '../components/PtyPressureBanner'
import { ShortcutCaptureBanner } from '../components/ShortcutCaptureBanner'
@@ -581,6 +582,14 @@ const LAUNCH_RETRY_MS = 400
// first, and the active-project effect hydrates React Flow ASYNCHRONOUSLY — so the handler waits
// for the node to appear instead of reading an empty canvas one tick too early. Bounded well under
// the CLI's 120s timeout: a canvas that never arrives becomes a plain "not on an open canvas".
+/**
+ * Which projects have already shown their resume card THIS APP RUN. Module-level so it survives
+ * Canvas re-renders and project switches, and IN-MEMORY on purpose: persisting it would leave one
+ * localStorage entry per project forever, while forgetting on reload is exactly what "the resume
+ * card comes back next launch" means (docs/superpowers/specs/2026-08-20-breadcrumb-trail-design.md).
+ */
+const resumeCardShown = new Set<string>()
+
const CONTROL_TRAVEL_TIMEOUT_MS = 8000
const CONTROL_TRAVEL_POLL_MS = 60
async function waitForCanvasNode(
@@ -1143,6 +1152,14 @@ export function Canvas() {
// re-render happens to notice. Its own counter rather than bumpHist's: the two stacks are
// separate facts (node-array history vs camera history) and move at different times.
const [, bumpNav] = useState(0)
+ /**
+ * The project whose resume card is currently up, or null for "no card". A SNAPSHOT of the project
+ * as it was at activation (the card offers where you left off, so its rows must not re-shuffle
+ * under the user as new breadcrumbs are recorded), and holding the project itself rather than a
+ * boolean keeps Canvas off a `useProjects` subscription for the active project object — that
+ * object is rebuilt on every node serialization and would re-render the whole canvas per edit.
+ */
+ const [resumeProject, setResumeProject] = useState<Project | null>(null)
const {
setViewport,
getViewport,
@@ -1973,6 +1990,17 @@ export function Canvas() {
if (useSettings.getState().settings.phoneAccessEnabled) {
window.nodeTerminal.remoteHost.sendCanvasState({ nodes: flowToNodeStates(nodesRef.current) })
}
+ // Offer the resume card once per project per app run. "Once" is only spent on a card that
+ // could actually render: a project whose breadcrumbs ALL point at nodes deleted since must
+ // not burn its one-shot slot on an empty card the user never saw.
+ const liveIds = new Set(flow.map((n) => n.id))
+ const hasLiveStop = (project.breadcrumbs ?? []).some((b) => liveIds.has(b.nodeId))
+ if (!resumeCardShown.has(project.id) && hasLiveStop) {
+ resumeCardShown.add(project.id)
+ setResumeProject(project)
+ } else {
+ setResumeProject(null)
+ }
// Consume a cross-project focus request (notification click on a background node).
const pending = pendingFocusRef.current
if (pending) {
@@ -10410,6 +10438,25 @@ export function Canvas() {
<UsageIndicator overBoard={kanbanOpen} onSetDefaultAccount={setProjectDefaultAccount} />
</div>
+ {/* Canvas-mounted, deliberately NOT in the .top-banners column: this is about THIS canvas,
+ not an app-wide message. Opening a row records a new breadcrumb through goToNode — which
+ is correct, it is a deliberate landing like any other. */}
+ {resumeProject && (
+ <ResumeCard
+ // Keyed by project: switching from a project whose card was DISMISSED straight to one
+ // that qualifies never passes through null, so without a key React would reuse the
+ // instance and the new project's card would inherit the old one's dismissal.
+ key={resumeProject.id}
+ project={resumeProject}
+ nodes={nodesRef.current}
+ onOpen={(nodeId) => {
+ const node = nodesRef.current.find((n) => n.id === nodeId)
+ if (node) goToNode(node)
+ setResumeProject(null)
+ }}
+ />
+ )}
+
<PresenceNamePrompt />
{(!hasProjects || welcomeOpen) && (
diff --git a/src/renderer/components/ResumeCard.test.tsx b/src/renderer/components/ResumeCard.test.tsx
new file mode 100644
index 000000000..f7fb49cf5
--- /dev/null
+++ b/src/renderer/components/ResumeCard.test.tsx
@@ -0,0 +1,131 @@
+// @vitest-environment jsdom
+import { act } from 'react'
+import { createRoot, type Root } from 'react-dom/client'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import type { NavStop, Project } from '@shared/types'
+import { ResumeCard } from './ResumeCard'
+
+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
+
+function project(breadcrumbs: NavStop[] = []): Project {
+ return {
+ id: 'p1',
+ name: 'p',
+ color: '#0a84ff',
+ viewport: { x: 0, y: 0, zoom: 1 },
+ nodes: [],
+ breadcrumbs
+ }
+}
+
+describe('ResumeCard', () => {
+ let root: Root
+ let host: HTMLElement
+
+ beforeEach(() => {
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+ })
+
+ afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+ })
+
+ const renderCard = async (
+ p: Project,
+ nodes: { id: string }[],
+ onOpen: (id: string) => void
+ ): Promise<void> => {
+ await act(async () => {
+ root.render(<ResumeCard project={p} nodes={nodes} onOpen={onOpen} />)
+ })
+ }
+
+ const click = async (el: Element): Promise<void> => {
+ await act(async () => {
+ el.dispatchEvent(new MouseEvent('click', { bubbles: true }))
+ })
+ }
+
+ const rows = (): NodeListOf<HTMLElement> =>
+ host.querySelectorAll<HTMLElement>('[data-testid="resume-card-row"]')
+
+ it('renders nothing when there are no breadcrumbs', async () => {
+ await renderCard(project([]), [], () => {})
+ expect(host.querySelector('.resume-card')).toBeNull()
+ })
+
+ it('renders nothing when every breadcrumb points at a deleted node', async () => {
+ await renderCard(project([{ nodeId: 'gone', at: 1000, note: 'terminal · t' }]), [], () => {})
+ expect(host.querySelector('.resume-card')).toBeNull()
+ })
+
+ it('shows the last 3 live breadcrumbs, newest first', async () => {
+ const breadcrumbs: NavStop[] = [
+ { nodeId: 'a', at: 1000, note: 'terminal · A' },
+ { nodeId: 'b', at: 2000, note: 'terminal · B' },
+ { nodeId: 'c', at: 3000, note: 'terminal · C' },
+ { nodeId: 'd', at: 4000, note: 'terminal · D' }
+ ]
+ await renderCard(
+ project(breadcrumbs),
+ [{ id: 'a' }, { id: 'b' }, { id: 'c' }, { id: 'd' }],
+ () => {}
+ )
+ expect(rows()).toHaveLength(3)
+ expect(rows()[0].textContent).toContain('terminal · D')
+ expect(rows()[2].textContent).toContain('terminal · B')
+ })
+
+ it('skips breadcrumbs whose node is gone when picking the last 3', async () => {
+ // The cap is over LIVE stops, not over the raw tail: filtering after slicing would show
+ // fewer than three rows on a trail whose newest entries point at deleted nodes.
+ const breadcrumbs: NavStop[] = [
+ { nodeId: 'a', at: 1000, note: 'terminal · A' },
+ { nodeId: 'b', at: 2000, note: 'terminal · B' },
+ { nodeId: 'dead', at: 3000, note: 'terminal · X' },
+ { nodeId: 'c', at: 4000, note: 'terminal · C' }
+ ]
+ await renderCard(project(breadcrumbs), [{ id: 'a' }, { id: 'b' }, { id: 'c' }], () => {})
+ expect(rows()).toHaveLength(3)
+ expect(rows()[0].textContent).toContain('terminal · C')
+ expect(rows()[1].textContent).toContain('terminal · B')
+ expect(rows()[2].textContent).toContain('terminal · A')
+ })
+
+ it('clicking a row calls onOpen with the node id', async () => {
+ const onOpen = vi.fn<(id: string) => void>()
+ await renderCard(
+ project([{ nodeId: 'a', at: 1000, note: 'terminal · A' }]),
+ [{ id: 'a' }],
+ onOpen
+ )
+ await click(rows()[0])
+ expect(onOpen).toHaveBeenCalledWith('a')
+ })
+
+ it('the dismiss button hides the card', async () => {
+ await renderCard(
+ project([{ nodeId: 'a', at: 1000, note: 'terminal · A' }]),
+ [{ id: 'a' }],
+ () => {}
+ )
+ await click(host.querySelector('.resume-card__close')!)
+ expect(host.querySelector('.resume-card')).toBeNull()
+ })
+
+ it('stays dismissed when the parent re-renders with a new breadcrumb', async () => {
+ // A breadcrumb recorded while the card is up must not resurrect a card the user just closed.
+ const p1 = project([{ nodeId: 'a', at: 1000, note: 'terminal · A' }])
+ await renderCard(p1, [{ id: 'a' }], () => {})
+ await click(host.querySelector('.resume-card__close')!)
+ const p2 = project([
+ { nodeId: 'a', at: 1000, note: 'terminal · A' },
+ { nodeId: 'b', at: 2000, note: 'terminal · B' }
+ ])
+ await renderCard(p2, [{ id: 'a' }, { id: 'b' }], () => {})
+ expect(host.querySelector('.resume-card')).toBeNull()
+ })
+})
diff --git a/src/renderer/components/ResumeCard.tsx b/src/renderer/components/ResumeCard.tsx
new file mode 100644
index 000000000..0a218c26b
--- /dev/null
+++ b/src/renderer/components/ResumeCard.tsx
@@ -0,0 +1,70 @@
+import { useMemo, useState } from 'react'
+import type { Project } from '@shared/types'
+import { relativeTime } from '../lib/relativeTime'
+
+/** How many stops the card offers. Small on purpose: this is "where was I?", not the whole trail. */
+const RESUME_CARD_COUNT = 3
+
+interface ResumeCardProps {
+ project: Project
+ /** The project's LIVE canvas nodes — a breadcrumb whose node is gone is never offered. */
+ nodes: readonly { id: string }[]
+ onOpen: (nodeId: string) => void
+}
+
+/**
+ * Canvas-mounted "resume where you left off" card: the last few deliberate node landings for the
+ * ACTIVE project (breadcrumbs are per-project — see `NavStop`), each a click away.
+ *
+ * WHO decides it is shown: the caller. Canvas mounts this once per project activation per app run
+ * and unmounts it afterwards, so the once-only rule lives there, not here. The one piece of state
+ * this component owns is its OWN dismissal — a breadcrumb recorded while the card is up re-renders
+ * the parent with a new `project` object, and without a local flag that would resurrect a card the
+ * user just closed in the same activation.
+ *
+ * The rows are filtered BEFORE they are capped: slicing the raw tail first would show fewer than
+ * `RESUME_CARD_COUNT` rows whenever the newest stops point at nodes that have since been deleted.
+ */
+export function ResumeCard({ project, nodes, onOpen }: ResumeCardProps): JSX.Element | null {
+ const [dismissed, setDismissed] = useState(false)
+ const liveIds = useMemo(() => new Set(nodes.map((n) => n.id)), [nodes])
+ const rows = useMemo(
+ () =>
+ (project.breadcrumbs ?? [])
+ .filter((stop) => liveIds.has(stop.nodeId))
+ .slice(-RESUME_CARD_COUNT)
+ .reverse(),
+ [project.breadcrumbs, liveIds]
+ )
+
+ if (dismissed || rows.length === 0) return null
+
+ return (
+ <div className="resume-card">
+ <div className="resume-card__header">
+ <span className="resume-card__title">Resume where you left off</span>
+ <button
+ className="resume-card__close"
+ title="Dismiss"
+ aria-label="Dismiss"
+ onClick={() => setDismissed(true)}
+ >
+ ✕
+ </button>
+ </div>
+ <div className="resume-card__rows">
+ {rows.map((stop) => (
+ <button
+ key={stop.nodeId}
+ className="resume-card__row"
+ data-testid="resume-card-row"
+ onClick={() => onOpen(stop.nodeId)}
+ >
+ <span className="resume-card__note">{stop.note}</span>
+ <span className="resume-card__time">{relativeTime(stop.at, Date.now())}</span>
+ </button>
+ ))}
+ </div>
+ </div>
+ )
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 8ddf8fc14..a9ec4db4a 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -6028,6 +6028,101 @@ button.group-node__setup:disabled {
gap: 8px;
}
+/* ---- Resume-where-you-left-off card (breadcrumb trail, once per project activation) ---- */
+/* Anchored in .flow-wrap under the controls cluster (top: 54px, 34px tall) rather than beside it,
+ so the two never overlap; the left side is the sessions sidebar's (top: 54px, left: 14px).
+ z-index 11 sits above the canvas and BELOW the sidebar (12) — a card the user has not dismissed
+ must never cover a panel they deliberately opened — and below the kanban overlay (25), where the
+ canvas and everything on it is correctly hidden. */
+.resume-card {
+ position: absolute;
+ top: 100px;
+ right: 14px;
+ z-index: 11;
+ width: 260px;
+ max-width: calc(100vw - 28px);
+ padding: 8px 8px 6px;
+ background: rgba(var(--menu-rgb), 0.96);
+ border: 1px solid var(--border);
+ border-left: 3px solid var(--accent);
+ border-radius: 10px;
+ box-shadow: 0 8px 28px rgba(0, 0, 0, calc(0.45 * var(--shadow-k)));
+ font-size: 12.5px;
+ color: var(--text);
+}
+
+.resume-card__header {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 0 2px 6px 4px;
+}
+
+.resume-card__title {
+ flex: 1;
+ min-width: 0;
+ font-weight: 600;
+ color: var(--muted);
+}
+
+.resume-card__close {
+ flex: none;
+ width: 18px;
+ height: 18px;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ background: transparent;
+ border: none;
+ border-radius: 5px;
+ color: var(--muted);
+ font-size: 11px;
+ cursor: pointer;
+}
+
+.resume-card__close:hover {
+ background: var(--panel-header);
+ color: var(--text);
+}
+
+.resume-card__rows {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+
+.resume-card__row {
+ display: flex;
+ align-items: baseline;
+ gap: 8px;
+ padding: 5px 6px;
+ background: transparent;
+ border: none;
+ border-radius: 7px;
+ color: var(--text);
+ font-size: 12.5px;
+ text-align: left;
+ cursor: pointer;
+}
+
+.resume-card__row:hover {
+ background: var(--panel-header);
+}
+
+.resume-card__note {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.resume-card__time {
+ flex: none;
+ color: var(--muted-2);
+ font-size: 11px;
+}
+
/* ---- Claude usage indicator (in the bottom-left cluster) ---- */
.usage-indicator {
/* Positioned — so the z-index rules below still apply and the popover anchors here — but PLACED