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): skip ephemeral nodes, name agent nodes by title, document the trail

Mina Sameh430a131270a8
diff --git a/CLAUDE.md b/CLAUDE.md
index a0938a8c1..501dbc1d5 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1724,6 +1724,29 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea
(`getInternalNode`), not our node object — `measured` reaches our state one render later (via
`onNodesChange`), so our copy lies about nodes the store has long sized. Unknowable size ⇒ the
camera **stands still**; never fall back to a bare `fitView` there, that IS the origin jump.
+- **Breadcrumb trail** (`renderer/lib/breadcrumbs.ts` — all the pure logic lives there) — every
+ deliberate `goToNode` landing records a `NavStop` ({nodeId, at, note}) for the ACTIVE project, and
+ **Cmd+[ / Cmd+]** (`canvas.goBack` / `canvas.goForward`, bound in `shared/keybindings.ts`) plus the
+ two Dock buttons walk that trail; on a project activation a once-per-app-run **`ResumeCard`** offers
+ the last few distinct stops ("resume where you left off"). Load-bearing facts:
+ - **The trail is MACHINE-LOCAL and rides `IndexEntryV3.breadcrumbs`, never `.nodeterm/project.json`** —
+ the same tier as `viewport` / `defaultAccountId` / `capabilityAck`, for the same reason: a repo must
+ 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.
+ - **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
+ like a browser tab.
+ - **`stepBreadcrumb` skips stops whose node is gone** (never lands on a dead entry; no reachable stop
+ ⇒ `null` ⇒ the camera stands still), and `goToNode` **refuses to record ephemeral `subagent` / `loop`
+ nodes**: they are merged into the `<ReactFlow nodes>` prop but never persisted (cleared on the next
+ turn), so a breadcrumb for one is an id nothing can ever resolve, burning a slot forever.
+ - 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.
- **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 3c713d6d5..5834529ad 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -5646,7 +5646,11 @@ export function Canvas() {
// minimap double-click), and recording is independent of which framing branch runs below —
// including the branch that deliberately leaves the camera where it is.
const activeId = useProjects.getState().activeProjectId
- if (activeId) {
+ // …with ONE exclusion: the ephemeral `subagent`/`loop` viz nodes. They are merged into the
+ // <ReactFlow nodes> prop but NEVER persisted — they are cleared on the next turn — and both
+ // double-click focus and the minimap's double-click land here. A breadcrumb for one is a
+ // permanently unresolvable id burning one of the 20 slots, so it is never recorded.
+ if (activeId && node.type !== 'subagent' && node.type !== 'loop') {
const target: BreadcrumbTarget = {
id: node.id,
kind: node.type as BreadcrumbTarget['kind'],
diff --git a/src/renderer/components/ResumeCard.tsx b/src/renderer/components/ResumeCard.tsx
index 7bea6c87d..6dd4198c2 100644
--- a/src/renderer/components/ResumeCard.tsx
+++ b/src/renderer/components/ResumeCard.tsx
@@ -50,7 +50,10 @@ export function ResumeCard({ project, nodes, onOpen }: ResumeCardProps): JSX.Ele
if (dismissed || rows.length === 0) return null
return (
- <div className="resume-card">
+ // `data-canvas-chrome` is fitView's obstacle-avoidance opt-in (same attribute .canvas-pills
+ // carries): the card occupies screen space over the canvas, so a fit must not park a node
+ // underneath it.
+ <div className="resume-card" data-canvas-chrome>
<div className="resume-card__header">
<span className="resume-card__title">Resume where you left off</span>
<button
diff --git a/src/renderer/lib/breadcrumbs.test.ts b/src/renderer/lib/breadcrumbs.test.ts
index ba9745b64..85113d9bb 100644
--- a/src/renderer/lib/breadcrumbs.test.ts
+++ b/src/renderer/lib/breadcrumbs.test.ts
@@ -15,22 +15,33 @@ describe('buildNote', () => {
.toBe('sticky · Deploy notes')
})
- it('agent node with no live status falls back to the agent label', () => {
- expect(buildNote(target({ agentId: 'claude' }), undefined)).toBe('Claude Code · Unknown')
+ it('agent node with no session and no title falls back to the agent label', () => {
+ expect(buildNote(target({ agentId: 'claude', title: '' }), undefined))
+ .toBe('Claude Code · Unknown')
+ })
+
+ it('agent node with no session names the NODE rather than the bare agent label', () => {
+ // The common case right after an app restart: `agentStatus.state` is transient, so neither a
+ // session name nor a live state exists — "Claude Code · Unknown" would name neither the node
+ // nor what was happening. The node's title auto-tracks the session name via `titleAuto`.
+ expect(buildNote(target({ agentId: 'claude', title: 'fix-auth-bug' }), undefined))
+ .toBe('fix-auth-bug · Unknown')
})
it('agent node with a live state uses the sessions-sidebar phrasing', () => {
const status: AgentNodeStatus = { state: 'waiting', unread: false }
- expect(buildNote(target({ agentId: 'claude' }), status)).toBe('Claude Code · Waiting for your response')
+ expect(buildNote(target({ agentId: 'claude', title: '' }), status))
+ .toBe('Claude Code · Waiting for your response')
})
- it('agent node with a session name prefers it over the agent label', () => {
+ it('agent node with a session name prefers it over the node title', () => {
const status: AgentNodeStatus = { state: 'working', unread: false, session: 'fix-auth-bug' }
- expect(buildNote(target({ agentId: 'claude' }), status)).toBe('fix-auth-bug · Running')
+ expect(buildNote(target({ agentId: 'claude', title: 'stale name' }), status))
+ .toBe('fix-auth-bug · Running')
})
it('custom agent id with no builtin config falls back to the raw id', () => {
- expect(buildNote(target({ agentId: 'my-custom-agent' }), undefined))
+ expect(buildNote(target({ agentId: 'my-custom-agent', title: '' }), undefined))
.toBe('my-custom-agent · Unknown')
})
diff --git a/src/renderer/lib/breadcrumbs.ts b/src/renderer/lib/breadcrumbs.ts
index 5ea9aa428..0f89c31da 100644
--- a/src/renderer/lib/breadcrumbs.ts
+++ b/src/renderer/lib/breadcrumbs.ts
@@ -52,7 +52,11 @@ export function buildNote(target: BreadcrumbTarget, status: AgentNodeStatus | un
// custom agent's id), and AGENT_CONFIG is only keyed by the builtin subset — indexing it
// directly with a custom id fails to typecheck. agentConfig(id) exists for exactly this.
const agentLabel = agentConfig(target.agentId)?.label ?? target.agentId
- const name = status?.session || agentLabel
+ // The node's own title comes before the bare agent label: it auto-tracks the session name
+ // (`titleAuto`) and carries any manual rename, so an agent node with no live session AND no
+ // hook state (the norm right after an app restart — `agentStatus.state` is transient) still
+ // names the node instead of degrading to a generic "Claude Code · Unknown".
+ const name = status?.session || target.title || agentLabel
const stateLabel = STATE_LABEL[sessionStatusKind(status?.state)]
return `${name} · ${stateLabel}`
}