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.

revert(canvas-control): drop the auto-injected per-session discovery note

enes8eb378ba90f6
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 61a9df59a..0df5d6c8e 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -164,7 +164,7 @@ import {
reconnectRelayTab,
type RelayTab,
} from '../session/relay-tab'
-import { buildBackgroundLinkMaps, buildCanvasControlNote, buildContextLinkNote, buildLinkMap, buildNotePushMessage, classifyLink, shouldPushControlNote, type LinkEndpoint } from '../lib/noteLink'
+import { buildBackgroundLinkMaps, buildContextLinkNote, buildLinkMap, buildNotePushMessage, classifyLink, type LinkEndpoint } from '../lib/noteLink'
import { useSettings } from '../state/settings'
import { activePermissionMode } from '../state/permissionMode'
import { useContextWindow } from '../state/contextWindow'
@@ -4854,20 +4854,6 @@ export function Canvas() {
// the turn didn't complete, so it isn't a loop iteration either.
cs.bumpLoop(e.nodeId, e.lastMessage) // count loop iterations + summary (no-op if not looping)
alert('finished', `${agentLabel} finished its turn.`)
- // First completed turn of a controllable session → one-shot discovery note.
- // Idle now, so the sendText (which submits) can't interrupt a turn; keyed by
- // sessionId so a resume never repeats it. See buildCanvasControlNote.
- const st = cs.byId[e.nodeId]
- if (
- shouldPushControlNote({
- sessionId: st?.sessionId,
- controlNoted: st?.controlNoted,
- canControl: canControlCanvas(e.agentId)
- })
- ) {
- cs.setControlNoted(e.nodeId, st!.sessionId!)
- void api.pty.sendText(e.nodeId, buildCanvasControlNote(e.agentId))
- }
}
if (e.state === 'blocked') alert('needs input', `${agentLabel} needs permission to continue.`)
else if (e.state === 'waiting') alert('needs input', `${agentLabel} is waiting for your response.`)
diff --git a/src/renderer/lib/noteLink.test.ts b/src/renderer/lib/noteLink.test.ts
index 311671bf9..f7b785469 100644
--- a/src/renderer/lib/noteLink.test.ts
+++ b/src/renderer/lib/noteLink.test.ts
@@ -1,12 +1,10 @@
import { describe, it, expect } from 'vitest'
import {
buildBackgroundLinkMaps,
- buildCanvasControlNote,
buildContextLinkNote,
buildLinkMap,
buildNotePushMessage,
- classifyLink,
- shouldPushControlNote
+ classifyLink
} from './noteLink'
import type { CanvasNodeState } from '@shared/types'
@@ -129,37 +127,6 @@ describe('buildContextLinkNote', () => {
})
})
-describe('buildCanvasControlNote', () => {
- it('points claude at the skill and self-defuses', () => {
- const msg = buildCanvasControlNote('claude')
- expect(msg).toContain('manage-nodeterm-canvas')
- expect(msg).toContain('No action needed now')
- expect(msg).not.toContain('\n') // pty.sendText submits — a newline would split the prompt
- })
- it('points codex/gemini at their global instructions section', () => {
- const msg = buildCanvasControlNote('codex')
- expect(msg).toContain('manage-nodeterm-canvas')
- expect(msg).toContain('global agent instructions')
- expect(msg).not.toContain('\n')
- })
-})
-
-describe('shouldPushControlNote', () => {
- it('pushes once per session for a controllable agent', () => {
- expect(shouldPushControlNote({ sessionId: 's1', canControl: true })).toBe(true)
- })
- it('never re-pushes the same session', () => {
- expect(shouldPushControlNote({ sessionId: 's1', controlNoted: 's1', canControl: true })).toBe(false)
- })
- it('pushes again for a NEW session of the same node', () => {
- expect(shouldPushControlNote({ sessionId: 's2', controlNoted: 's1', canControl: true })).toBe(true)
- })
- it('skips non-controllable agents and unknown sessions', () => {
- expect(shouldPushControlNote({ sessionId: 's1', canControl: false })).toBe(false)
- expect(shouldPushControlNote({ canControl: true })).toBe(false)
- })
-})
-
describe('buildBackgroundLinkMaps', () => {
const node = (over: Partial<CanvasNodeState>): CanvasNodeState =>
({
diff --git a/src/renderer/lib/noteLink.ts b/src/renderer/lib/noteLink.ts
index a2b5604e9..020b8162c 100644
--- a/src/renderer/lib/noteLink.ts
+++ b/src/renderer/lib/noteLink.ts
@@ -63,30 +63,6 @@ export function buildContextLinkNote(
return `[nodeterm] You are now linked to "${otherTitle}". When you need its context (and only then) run: sh "${shimPath}" list — then summary | transcript | terminal --node <id>. Details are in the get-linked-context section of your global agent instructions. No action needed now — acknowledge briefly and do not run these commands yet.`
}
-/** One-shot discovery note: tells a canvas-controllable agent it can drive the canvas.
- * Pushed on the session's FIRST completed turn (the node is idle then — pty.sendText
- * appends Enter, so a mid-turn push would interrupt), once per sessionId. Model-agnostic
- * on purpose: skill auto-triggering is Claude-Code behavior an alternative backend (GLM
- * et al.) may never exercise, so the session is told directly. Same self-defusing tail
- * as buildContextLinkNote — an agent that reads this as a task starts an unsolicited
- * canvas reorganization. */
-export function buildCanvasControlNote(agentId: string | undefined): string {
- if (!agentId || agentId === 'claude') {
- return `[nodeterm] This session can control the nodeterm canvas: open agent/terminal nodes, spawn a team that divides up a task, create worktree groups, organize nodes. Use the manage-nodeterm-canvas skill when asked to parallelize, delegate or organize work. No action needed now — just acknowledge briefly.`
- }
- return `[nodeterm] This session can control the nodeterm canvas: open agent/terminal nodes, spawn a team that divides up a task, group and arrange nodes. See the "Managing the nodeterm canvas (manage-nodeterm-canvas)" section of your global agent instructions for the CLI. No action needed now — acknowledge briefly.`
-}
-
-/** Gate for the discovery push: controllable agent, session known, not yet noted for THIS
- * session (a resumed session keeps its id → no re-push; a fresh session gets one). */
-export function shouldPushControlNote(s: {
- sessionId?: string
- controlNoted?: string
- canControl: boolean
-}): boolean {
- return s.canControl && !!s.sessionId && s.controlNoted !== s.sessionId
-}
-
export interface LinkNodeInfo {
id: string
title: string
diff --git a/src/renderer/state/agentStatus.persist.test.ts b/src/renderer/state/agentStatus.persist.test.ts
index 7af39dc91..997f6bb8e 100644
--- a/src/renderer/state/agentStatus.persist.test.ts
+++ b/src/renderer/state/agentStatus.persist.test.ts
@@ -48,19 +48,6 @@ describe('loop persistence (cron/schedule survive an app restart)', () => {
})
})
- it('round-trips controlNoted (canvas-control discovery, once per session)', async () => {
- const store = memStorage()
- vi.stubGlobal('localStorage', store)
- const { useAgentStatus } = await import('./agentStatus')
- useAgentStatus.getState().setControlNoted('n4', 'sess-1')
- const saved = JSON.parse(store.getItem('nodeterm.agentStatus')!)
- expect(saved.n4.controlNoted).toBe('sess-1')
- // A fresh module load restores it, so a restart never re-pushes the note.
- vi.resetModules()
- const reloaded = await import('./agentStatus')
- expect(reloaded.useAgentStatus.getState().byId['n4']?.controlNoted).toBe('sess-1')
- })
-
it('tolerates a persisted entry without loop (older format)', async () => {
vi.stubGlobal(
'localStorage',
diff --git a/src/renderer/state/agentStatus.ts b/src/renderer/state/agentStatus.ts
index 911a7ce58..1d1de16d5 100644
--- a/src/renderer/state/agentStatus.ts
+++ b/src/renderer/state/agentStatus.ts
@@ -45,8 +45,6 @@ export interface AgentNodeStatus {
session?: string
/** Claude session id (from hooks) — used to resume/branch the conversation. */
sessionId?: string
- /** SessionId the one-shot canvas-control discovery note was already pushed for. */
- controlNoted?: string
/** Set when running /loop, /schedule or /cron (heuristic); shown as a connected node. */
loop?: {
count: number
@@ -71,8 +69,6 @@ export interface AgentStatusStore {
sweepStaleWorking(staleMs?: number): void
setSession(id: string, session: string): void
setSessionId(id: string, sessionId: string): void
- /** Record that the canvas-control discovery note went out for this session. */
- setControlNoted(id: string, sessionId: string): void
markUnread(id: string): void
clearUnread(id: string): void
/** Start (active=true, resets) or stop a /loop, /schedule or /cron indicator. */
@@ -149,12 +145,7 @@ export function createAgentStatusSession(persistKey?: string): AgentStatusSessio
const data = JSON.parse(raw) as Record<string, Partial<AgentNodeStatus>>
const out: Record<string, AgentNodeStatus> = {}
for (const [id, v] of Object.entries(data)) {
- out[id] = {
- unread: !!v.unread,
- session: v.session,
- sessionId: v.sessionId,
- controlNoted: v.controlNoted
- }
+ out[id] = { unread: !!v.unread, session: v.session, sessionId: v.sessionId }
// A recurring job (cron/schedule — and tmux keeps in-session loops alive too) outlives
// the app: restore its card. Minimal shape check so a corrupt entry can't break load.
if (v.loop && typeof v.loop === 'object' && v.loop.kind) {
@@ -179,14 +170,8 @@ export function createAgentStatusSession(persistKey?: string): AgentStatusSessio
try {
const out: Record<string, Partial<AgentNodeStatus>> = {}
for (const [id, v] of Object.entries(byId)) {
- if (v.unread || v.session || v.sessionId || v.loop || v.controlNoted) {
- out[id] = {
- unread: v.unread,
- session: v.session,
- sessionId: v.sessionId,
- loop: v.loop,
- controlNoted: v.controlNoted
- }
+ if (v.unread || v.session || v.sessionId || v.loop) {
+ out[id] = { unread: v.unread, session: v.session, sessionId: v.sessionId, loop: v.loop }
}
}
localStorage.setItem(persistKey, JSON.stringify(out))
@@ -263,15 +248,6 @@ export function createAgentStatusSession(persistKey?: string): AgentStatusSessio
return { byId }
}),
- setControlNoted: (id, sessionId) =>
- set((s) => {
- const prev = s.byId[id] ?? EMPTY
- if (prev.controlNoted === sessionId) return s
- const byId = { ...s.byId, [id]: { ...prev, controlNoted: sessionId } }
- save(byId)
- return { byId }
- }),
-
markUnread: (id) =>
set((s) => {
const prev = s.byId[id] ?? EMPTY