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.

fix(breadcrumbs): close the review findings — one framing implementation, honest Dock arrows, wiring pins

enes6c29251c3076
diff --git a/CLAUDE.md b/CLAUDE.md
index cc8301b32..2a431aa60 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1763,8 +1763,9 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea
not carry one person's camera history to everyone who clones it. `fileToProject` therefore ignores a
`breadcrumbs` field found in the shared file (a forgery), and `projectToFile` never writes one.
- **The cursor is not persisted either.** Only `list` rides the entry; `BreadcrumbState.index` is
- renderer-only and resets to the tip on activation, so stepping back and forth writes NO project
- state and marks nothing dirty — walking the camera must not queue a `project.json` write.
+ renderer-only and resets to the tip on activation. A step records no breadcrumb and rewrites no
+ `project.json` — the only persistence it triggers is the ordinary `onMove` viewport persist
+ (machine-local, same as any camera move; see the Zoom-chords bullet).
- **Cap 20** (`BREADCRUMB_CAP`, oldest dropped) and a **3 s dedupe** (`BREADCRUMB_DEDUPE_MS`, so a
re-triggered focus on the already-current node is a no-op — `recordBreadcrumb` returns the SAME
object, which is the caller's skip test). Recording past a back-step drops the forward tail, exactly
@@ -1776,6 +1777,10 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea
- The `note` is a **snapshot** taken at record time (agent nodes reuse the sessions sidebar's own
`sessionStatusKind` + `STATE_LABEL` phrasing, preferring session name → node title → agent label), so
a later state change never retroactively rewrites history.
+ - **Surfaces:** Server Edition works as-is (shared renderer code + `WorkspaceStore`, which both
+ shells boot — no new bridge member); mobile is N/A (no canvas, no camera); the kanban board is
+ likewise N/A, and a project that activates ON the board neither shows nor spends its
+ once-per-run resume card (it would sit invisible under the opaque overlay).
- **Command palette** (`CommandPalette.tsx`): ⌘/Ctrl+K; `Canvas.buildCommands` (create,
switch project, jump to node by title/tag, open file…).
- **Explorer** (`ExplorerPanel.tsx`, 🗂 / ⌘⇧E): lazy file tree of the active project `cwd`
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 55994138a..906a0e48e 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -600,7 +600,7 @@ const LAUNCH_RETRY_MS = 400
* 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).
+ * card comes back next launch" means.
*/
const resumeCardShown = new Set<string>()
@@ -2010,10 +2010,12 @@ export function Canvas() {
}
// 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.
+ // not burn its one-shot slot on an empty card the user never saw — and neither must a
+ // project that activates ON the kanban board, where the card (z 11) sits invisible under
+ // the opaque overlay (z 25). Same failure mode, same rule.
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) {
+ if (!resumeCardShown.has(project.id) && hasLiveStop && !isKanbanOpen(project.id)) {
resumeCardShown.add(project.id)
setResumeProject(project)
} else {
@@ -5661,6 +5663,60 @@ export function Canvas() {
[setNodes, markDirty]
)
+ /**
+ * The ONE framing implementation behind both deliberate focus (`goToNode`) and breadcrumb
+ * back/forward (`stepAndFrame`) — extracted so CLAUDE.md's "Go to node" invariant has a single
+ * copy to regress. Fit the node in view instead of centering at a fixed zoom — `zoom:
+ * max(current, 1)` overshot large terminals (their body never fit the viewport). fitView sizes
+ * the zoom to the node and resolves group-relative positions itself; the clamp keeps a small
+ * node from filling the whole screen and a huge one from being fit microscopic.
+ *
+ * …but ONLY once React Flow has MEASURED the node. Its fit set is filtered by `measured`
+ * (no width/height fallback in there), so an unmeasured node leaves the set EMPTY, the
+ * bounds collapse to {0,0,0,0} and the camera flies to the canvas ORIGIN at max zoom —
+ * empty canvas, node off-screen. That is precisely the state a node is in for the first
+ * tick after its project loads, i.e. on every CROSS-PROJECT focus (OS-notification click,
+ * sessions sidebar, ⌘K jump, presence travel): the load and the focus happen in the same
+ * tick, so measuring can lose the race and only a second attempt would work. In that
+ * window we frame the node ourselves from its persisted size — see lib/nodeFocus.
+ *
+ * The measured check must read React Flow's OWN store (`getInternalNode`), not our node
+ * object: `measured` only reaches our state one render later, when `onNodesChange` applies
+ * the dimensions change, so our copy says "unmeasured" for nodes the store has long sized.
+ *
+ * The framing itself is solved against the CURRENT chrome layout, exactly like `fitAll`:
+ * a flat 20% ratio has to reserve enough slack for the dock/minimap on EVERY side, which
+ * is what kept a big node (a group frame most of all) further away than it needed to be.
+ * The free-rect solver reclaims the space the chrome does not actually occupy, so the node
+ * is framed tighter without sliding underneath anything. Falls back to the flat ratio when
+ * there is nothing sensible to solve — the same ratio the unmeasured branch uses.
+ */
+ const frameNode = useCallback(
+ (node: Node) => {
+ const internal = getInternalNode(node.id)
+ if (isMeasured(internal)) {
+ const wrap = flowWrapRef.current
+ const size = internal?.measured
+ const solved =
+ wrap && size?.width && size?.height ? solveFitPadding(wrap, size.width, size.height) : null
+ void fitView({
+ nodes: [{ id: node.id }],
+ duration: 300,
+ ...FIT_NODE_OPTIONS,
+ padding: solved ?? FIT_NODE_OPTIONS.padding
+ })
+ return
+ }
+ const rect = nodeFitRect(node as FocusableNode, nodesRef.current as FocusableNode[])
+ const wrap = flowWrapRef.current?.getBoundingClientRect()
+ const viewport = rect && wrap ? viewportForRect(rect, wrap.width, wrap.height) : null
+ // Size unknowable / no pane yet: leave the camera where it is. Standing still beats
+ // teleporting the user to the origin, which is the bug this branch exists for.
+ if (viewport) void setViewport(viewport, { duration: 300 })
+ },
+ [fitView, setViewport, getInternalNode]
+ )
+
const goToNode = useCallback(
(node: Node) => {
// Record the landing FIRST, and unconditionally: this is the one funnel every deliberate
@@ -5689,62 +5745,16 @@ export function Canvas() {
markDirty()
}
}
- // Fit the node in view instead of centering at a fixed zoom — `zoom: max(current, 1)`
- // overshot large terminals (their body never fit the viewport). fitView sizes the zoom
- // to the node and resolves group-relative positions itself; the clamp keeps a small
- // node from filling the whole screen and a huge one from being fit microscopic.
- //
- // …but ONLY once React Flow has MEASURED the node. Its fit set is filtered by `measured`
- // (no width/height fallback in there), so an unmeasured node leaves the set EMPTY, the
- // bounds collapse to {0,0,0,0} and the camera flies to the canvas ORIGIN at max zoom —
- // empty canvas, node off-screen. That is precisely the state a node is in for the first
- // tick after its project loads, i.e. on every CROSS-PROJECT focus (OS-notification click,
- // sessions sidebar, ⌘K jump, presence travel): the load and the focus happen in the same
- // tick, so measuring can lose the race and only a second attempt would work. In that
- // window we frame the node ourselves from its persisted size — see lib/nodeFocus.
- //
- // The measured check must read React Flow's OWN store (`getInternalNode`), not our node
- // object: `measured` only reaches our state one render later, when `onNodesChange` applies
- // the dimensions change, so our copy says "unmeasured" for nodes the store has long sized.
- //
- // The framing itself is solved against the CURRENT chrome layout, exactly like `fitAll`:
- // a flat 20% ratio has to reserve enough slack for the dock/minimap on EVERY side, which
- // is what kept a big node (a group frame most of all) further away than it needed to be.
- // The free-rect solver reclaims the space the chrome does not actually occupy, so the node
- // is framed tighter without sliding underneath anything. Falls back to the flat ratio when
- // there is nothing sensible to solve — the same ratio the unmeasured branch below uses.
- const internal = getInternalNode(node.id)
- if (isMeasured(internal)) {
- const wrap = flowWrapRef.current
- const size = internal?.measured
- const solved =
- wrap && size?.width && size?.height ? solveFitPadding(wrap, size.width, size.height) : null
- void fitView({
- nodes: [{ id: node.id }],
- duration: 300,
- ...FIT_NODE_OPTIONS,
- padding: solved ?? FIT_NODE_OPTIONS.padding
- })
- return
- }
- const rect = nodeFitRect(node as FocusableNode, nodesRef.current as FocusableNode[])
- const wrap = flowWrapRef.current?.getBoundingClientRect()
- const viewport = rect && wrap ? viewportForRect(rect, wrap.width, wrap.height) : null
- // Size unknowable / no pane yet: leave the camera where it is. Standing still beats
- // teleporting the user to the origin, which is the bug this branch exists for.
- if (viewport) void setViewport(viewport, { duration: 300 })
+ frameNode(node)
},
- [fitView, setViewport, getInternalNode, markDirty]
+ [frameNode, markDirty]
)
/**
* Walks the breadcrumb cursor one stop and flies the camera there. Browser back/forward for the
* canvas: this is the ONE path that must NOT record a stop — calling goToNode would append the
- * landing and turn every step into a new tip, so the framing block below is deliberately a copy
- * of goToNode's (measured ⇒ fitView, unmeasured ⇒ frame from the persisted size, unknowable ⇒
- * stand still) rather than a call into it. A shared `frameNode` helper is the obvious follow-up;
- * it is not done here because goToNode's measured check carries reasoning (it reads React Flow's
- * OWN store, not our node copy) that a hasty extraction is likely to lose.
+ * landing and turn every step into a new tip — so it shares `frameNode` (the single framing
+ * implementation) and never goToNode itself.
*
* stepBreadcrumb skips stops whose node is gone, so a deleted node is walked THROUGH silently.
*/
@@ -5763,26 +5773,9 @@ export function Canvas() {
bumpNav((v) => v + 1)
const target = nodesRef.current.find((n) => n.id === next.list[next.index].nodeId)
if (!target) return
- const internal = getInternalNode(target.id)
- if (isMeasured(internal)) {
- const wrap = flowWrapRef.current
- const size = internal?.measured
- const solved =
- wrap && size?.width && size?.height ? solveFitPadding(wrap, size.width, size.height) : null
- void fitView({
- nodes: [{ id: target.id }],
- duration: 300,
- ...FIT_NODE_OPTIONS,
- padding: solved ?? FIT_NODE_OPTIONS.padding
- })
- return
- }
- const rect = nodeFitRect(target as FocusableNode, nodesRef.current as FocusableNode[])
- const wrap = flowWrapRef.current?.getBoundingClientRect()
- const viewport = rect && wrap ? viewportForRect(rect, wrap.width, wrap.height) : null
- if (viewport) void setViewport(viewport, { duration: 300 })
+ frameNode(target)
},
- [fitView, setViewport, getInternalNode]
+ [frameNode]
)
const goBack = useCallback(() => stepAndFrame('back'), [stepAndFrame])
const goForward = useCallback(() => stepAndFrame('forward'), [stepAndFrame])
@@ -11235,8 +11228,20 @@ export function Canvas() {
zoomPct={zoomPct}
canUndo={pastRef.current.length > 0}
canRedo={futureRef.current.length > 0}
- canGoBack={navRef.current.index > 0}
- canGoForward={navRef.current.index < navRef.current.list.length - 1}
+ // Enabled state must agree with what a click will DO: stepBreadcrumb skips deleted stops
+ // and answers null when every stop in that direction is dead, so a raw index comparison
+ // renders an enabled arrow that does nothing. Cheap at the 20-entry cap, and it stays
+ // honest as nodes are deleted (Canvas re-renders on both bumpNav and nodes).
+ canGoBack={
+ !!stepBreadcrumb(navRef.current, 'back', (id) =>
+ nodesRef.current.some((n) => n.id === id)
+ )
+ }
+ canGoForward={
+ !!stepBreadcrumb(navRef.current, 'forward', (id) =>
+ nodesRef.current.some((n) => n.id === id)
+ )
+ }
onUndo={undo}
onRedo={redo}
onGoBack={goBack}
diff --git a/src/renderer/canvas/canvas-wiring.test.tsx b/src/renderer/canvas/canvas-wiring.test.tsx
index f04404e49..b6f4f2fe4 100644
--- a/src/renderer/canvas/canvas-wiring.test.tsx
+++ b/src/renderer/canvas/canvas-wiring.test.tsx
@@ -126,3 +126,39 @@ describe('the end-session confirm describes both things it does', () => {
}
})
})
+
+describe('breadcrumb wiring the CLAUDE.md bullet calls load-bearing', () => {
+ // Same discipline as the dispatch-map pins above: Canvas has no render harness, and each of
+ // these rules failed silently once (or would) — a source read is the only net.
+
+ it('goToNode refuses to record the ephemeral subagent/loop viz nodes', () => {
+ // A breadcrumb for one is an id nothing can ever resolve (they are cleared on the next turn),
+ // permanently burning one of the 20 slots.
+ expect(CANVAS_SRC).toContain("node.type !== 'subagent' && node.type !== 'loop'")
+ })
+
+ it('stepAndFrame never records — it frames through the shared frameNode, not goToNode', () => {
+ const step = CANVAS_SRC.slice(
+ CANVAS_SRC.indexOf('const stepAndFrame = useCallback'),
+ CANVAS_SRC.indexOf('const goBack = useCallback')
+ )
+ expect(step.length).toBeGreaterThan(0)
+ // Recording inside a step would turn every back-step into a new tip.
+ expect(step).not.toContain('recordBreadcrumb')
+ expect(step).not.toContain('goToNode(')
+ // The single framing implementation — the "Go to node" origin-jump invariant has ONE copy.
+ expect(step).toContain('frameNode(target)')
+ })
+
+ it('there is exactly ONE framing implementation (frameNode) shared by focus and steps', () => {
+ // The measured-check-reads-the-store rule regresses through a second copy first.
+ expect(CANVAS_SRC.match(/isMeasured\(internal\)/g) ?? []).toHaveLength(1)
+ })
+
+ it('the resume card slot is spent only on a card that can render', () => {
+ // Once per app run, only with a live stop, and never under the opaque kanban overlay.
+ expect(CANVAS_SRC).toContain(
+ '!resumeCardShown.has(project.id) && hasLiveStop && !isKanbanOpen(project.id)'
+ )
+ })
+})
diff --git a/src/renderer/lib/breadcrumbs.test.ts b/src/renderer/lib/breadcrumbs.test.ts
index 85113d9bb..7391418e1 100644
--- a/src/renderer/lib/breadcrumbs.test.ts
+++ b/src/renderer/lib/breadcrumbs.test.ts
@@ -45,7 +45,7 @@ describe('buildNote', () => {
.toBe('my-custom-agent · Unknown')
})
- it('an unknown node kind degrades to a generic label rather than inventing one', () => {
+ it('a missing kind defaults to the terminal label', () => {
expect(buildNote(target({ kind: undefined, title: 'Untitled' }), undefined))
.toBe('terminal · Untitled')
})
diff --git a/src/renderer/lib/breadcrumbs.ts b/src/renderer/lib/breadcrumbs.ts
index 0f89c31da..1b8605a83 100644
--- a/src/renderer/lib/breadcrumbs.ts
+++ b/src/renderer/lib/breadcrumbs.ts
@@ -60,7 +60,10 @@ export function buildNote(target: BreadcrumbTarget, status: AgentNodeStatus | un
const stateLabel = STATE_LABEL[sessionStatusKind(status?.state)]
return `${name} · ${stateLabel}`
}
- const kindLabel = KIND_LABEL[target.kind ?? 'terminal'] ?? 'node'
+ // A missing kind defaults to 'terminal'; there is deliberately NO generic fallback beyond it —
+ // goToNode refuses the only kinds KIND_LABEL omits (subagent/loop), so a dead `?? 'node'` arm
+ // would just be an untestable claim.
+ const kindLabel = KIND_LABEL[target.kind ?? 'terminal']
return `${kindLabel} · ${target.title}`
}
diff --git a/src/shared/keybindings.ts b/src/shared/keybindings.ts
index 1f39c54e1..6607ed97c 100644
--- a/src/shared/keybindings.ts
+++ b/src/shared/keybindings.ts
@@ -116,7 +116,9 @@ export const COMMAND_DEFINITIONS: readonly CommandDefinition[] = [
// Camera history (breadcrumb trail), not node-array history: `[` / `]` are the literal keys
// `e.key` reports, which is what the resolver compares against — `BracketLeft`/`BracketRight`
// are `KeyboardEvent.code` values and would never match (shortcut.ts's KEY_ALIASES covers only
- // Comma/Slash/Period, so brackets have no word-form spelling here).
+ // Comma/Slash/Period, so brackets have no word-form spelling here). Off-mac the binding is
+ // Ctrl+[, which terminals read as ESC — safe here because scope 'canvas' without
+ // allowWhileTyping means the resolver refuses it whenever a terminal or input has focus.
{ id: 'canvas.goBack', title: 'Go back', group: 'Canvas', scope: 'canvas',
defaultBindings: both('Cmd+[') },
{ id: 'canvas.goForward', title: 'Go forward', group: 'Canvas', scope: 'canvas',
diff --git a/src/shared/types.ts b/src/shared/types.ts
index adda6fc9d..a76ddb381 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -656,7 +656,7 @@ export interface Project {
ropes?: BridgeLink[]
/** Camera navigation history — deliberate node landings, newest last. MACHINE-LOCAL: rides
* `IndexEntryV3.breadcrumbs`, never emitted into the shared project file (a repo must not carry
- * one person's wandering camera history). See docs/superpowers/specs/2026-08-20-breadcrumb-trail-design.md. */
+ * one person's wandering camera history). */
breadcrumbs?: NavStop[]
/**
* Closed projects are hidden from the tab bar but kept on disk with all their nodes (and their