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(canvas-control): orchestration recipe + --group on open-claude/open-agent

enesea294846be97
diff --git a/src/main/canvas-control-core.ts b/src/main/canvas-control-core.ts
index e671db61c..a2dbecac8 100644
--- a/src/main/canvas-control-core.ts
+++ b/src/main/canvas-control-core.ts
@@ -122,8 +122,10 @@ export function buildCanvasControlInstructions(shimPath: string): string {
'Verbs:',
'- `list` — current nodes (id, kind, title). Start here when you need a node id.',
'- `open-terminal [--cwd P] [--cmd C]` — open a terminal node.',
- '- `open-claude [--count N] [--cwd P] [--prompt T]` — open N Claude sessions.',
- '- `open-agent --agent claude|codex|gemini|<custom-id> [--count N] [--cwd P] [--prompt T]` — open any agent CLI.',
+ '- `open-claude [--count N] [--cwd P] [--prompt T] [--group <id>]` — open N Claude sessions.',
+ '- `open-agent --agent claude|codex|gemini|<custom-id> [--count N] [--cwd P] [--prompt T] [--group <id>]` — open',
+ ' any agent CLI. `--group` parents the node(s) into a group frame; a worktree-bound group also',
+ ' hands its worktree path down as the cwd.',
'- `show-image <path>` / `show-video <path>` — open a media file as a node.',
'- `show-web (--url U | --file P.html | --html "<...>")` — open a web viewer.',
'- `open-browser --url U` — open a navigable browser node.',
@@ -138,7 +140,13 @@ export function buildCanvasControlInstructions(shimPath: string): string {
'- `branch --node <id>` — branch a Claude node\'s conversation (Claude nodes only).',
'- `rename --node <id> --title "New Name"` — rename any node (terminals, groups, stickies…).',
'- `write --node <id> --text "..."` / `close --node <id>` — type into / close a node.',
- ' Both ask the user to confirm a dialog and may be denied.'
+ ' Both ask the user to confirm a dialog and may be denied.',
+ '',
+ 'Orchestration ("Build with Nodeterm orchestration"): break the task into 2-5 independent',
+ 'workstreams; per stream `open-worktree --branch <slug>` then `open-agent --agent claude',
+ '--group <groupId> --prompt "<concrete task>"` (each stream on its own branch, no tree',
+ 'conflicts); `rename`/`arrange` the groups; the user merges when a stream is done, and',
+ '`close-worktree --group <id>` releases a finished station.'
].join('\n')
}
diff --git a/src/main/canvas-control.ts b/src/main/canvas-control.ts
index e36d0e74e..86718cb4f 100644
--- a/src/main/canvas-control.ts
+++ b/src/main/canvas-control.ts
@@ -45,7 +45,7 @@ ELECTRON_RUN_AS_NODE=1 exec "${process.execPath}" "${cliScriptPath()}" "$@"
function skillBody(): string {
return `---
name: manage-nodeterm-canvas
-description: Create, organize and control nodes on the nodeterm canvas — open Claude Code / Codex / Gemini / terminal nodes, spawn a team of agents that divide up a task, wrap nodes in labeled groups, arrange/align/rename them, show an image/video/web page, write to or close a terminal. Use whenever the user asks to create or open nodes/sessions, build something using multiple Claude (or other agent) sessions, split work across agents, organize the canvas into groups by topic, or visualize code/output you produced. Only works inside a nodeterm Claude session.
+description: Create, organize and control nodes on the nodeterm canvas — open Claude Code / Codex / Gemini / terminal nodes, spawn a team of agents that divide up a task, create git worktrees as bound groups, wrap nodes in labeled groups, arrange/align/rename them, show an image/video/web page, write to or close a terminal. Use whenever the user says "Build with Nodeterm orchestration", asks to create or open nodes/sessions, build something using multiple Claude (or other agent) sessions, split work across agents or worktrees, organize the canvas into groups by topic, or visualize code/output you produced. Only works inside a nodeterm Claude session.
---
# Manage the nodeterm canvas
@@ -62,8 +62,10 @@ sh "${shimPath()}" <verb> [args]
Verbs:
- \`list\` — list current nodes (id, kind, title). Start here when you need a node id.
- \`open-terminal [--cwd P] [--cmd C]\` — open a terminal node.
-- \`open-claude [--count N] [--cwd P] [--prompt T]\` — open N Claude sessions (default 1).
-- \`open-agent --agent claude|codex|gemini|<custom-id> [--count N] [--cwd P] [--prompt T]\` — open N sessions of any agent CLI.
+- \`open-claude [--count N] [--cwd P] [--prompt T] [--group <id>]\` — open N Claude sessions (default 1).
+- \`open-agent --agent claude|codex|gemini|<custom-id> [--count N] [--cwd P] [--prompt T] [--group <id>]\` — open N sessions of any agent CLI.
+ \`--group\` parents the node(s) into an existing group frame; a worktree-bound group also
+ hands its worktree path down as the cwd.
- \`show-image <path>\` — open an image file as a node.
- \`show-video <path>\` — open a video file as a player node.
- \`show-web (--url U | --file P.html | --html "<...>")\` — open a web viewer (live URL or local HTML you wrote).
@@ -101,6 +103,22 @@ Typical requests this skill covers:
- "Open a codex/gemini session" → \`open-agent --agent codex|gemini\`.
- "Tidy up / group my terminals" → \`list\`, then \`group\` + \`arrange\` + \`align\`.
- "Rename this node/group" → \`rename\`.
+
+## Nodeterm orchestration ("Build with Nodeterm orchestration")
+
+When the user says "Build with Nodeterm orchestration" (or asks you to orchestrate a build
+across Nodeterm sessions), be the orchestration chef — plan the kitchen, then run it:
+
+1. Break the task into 2–5 independent workstreams (by subsystem, not by file).
+2. Per workstream, give it its own branch + kitchen station:
+ \`open-worktree --branch <slug>\` → note the returned \`groupId\`, then
+ \`open-agent --agent claude --group <groupId> --prompt "<concrete, self-contained task>"\`.
+ Each stream now works on its own branch in its own worktree group — no tree conflicts.
+3. \`rename\` each group by subject and \`arrange\` its members; open extra sessions into the
+ same group with \`--group\` as a stream grows.
+4. Track progress (their status badges show working/waiting) and coordinate: when a stream
+ finishes, the user merges from the group's chip (never merge for them); release a finished
+ station with \`close-worktree --group <id>\` (unbind keeps the directory).
`
}
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index f4437a3b4..d58a81e07 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -2903,14 +2903,16 @@ export function Canvas() {
attachWorktree,
releaseWorktreeBinding,
clearWorktreeBinding,
- requestRemoveWorktree
+ requestRemoveWorktree,
+ cwdForNewNodeIn
})
useEffect(() => {
worktreeControlRef.current = {
attachWorktree,
releaseWorktreeBinding,
clearWorktreeBinding,
- requestRemoveWorktree
+ requestRemoveWorktree,
+ cwdForNewNodeIn
}
})
@@ -3848,6 +3850,21 @@ export function Canvas() {
// (claude/codex/gemini) or custom agent id — resolveAgent falls back for the rest.
const agentId = (verb === 'open-agent' ? args.agent : 'claude') as AgentId
const count = Math.max(1, Math.min(5, parseInt(args.count || '1', 10) || 1))
+ // --group parents the new node(s) into an existing group frame; a worktree-bound
+ // group also hands its worktree path down as the cwd (same inheritance as
+ // UI-created nodes — cwdForNewNodeIn is the one resolver for that).
+ let intoGroupId: string | undefined
+ if (args.group) {
+ const g = nodesRef.current.find((nd) => nd.id === args.group)
+ if (!g || g.type !== 'group') {
+ reply({ ok: false, error: `${verb}: --group must name an existing group frame` })
+ return
+ }
+ intoGroupId = g.id
+ }
+ const groupCwd = intoGroupId
+ ? worktreeControlRef.current.cwdForNewNodeIn(intoGroupId)
+ : undefined
// Inherit the source node's managed account, else the project default, else system —
// the same funnel as addAgentNode (the factory drops accounts on non-claude agents).
const projStore = useProjects.getState()
@@ -3858,20 +3875,17 @@ export function Canvas() {
)
const ids: string[] = []
for (let i = 0; i < count; i++) {
- ids.push(
- addAndConnect(
- createAgentNode(
- agentId,
- nodesRef.current.length + i,
- args.cwd || srcCwd,
- placeBelow(i),
- args.prompt,
- undefined,
- account,
- activePermissionMode()
- )
- )
+ const node = createAgentNode(
+ agentId,
+ nodesRef.current.length + i,
+ args.cwd || groupCwd || srcCwd,
+ placeBelow(i),
+ args.prompt,
+ undefined,
+ account,
+ activePermissionMode()
)
+ ids.push(addAndConnect(intoGroupId ? parentInto(node, intoGroupId) : node))
}
reply({
ok: true,