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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
docs(canvas-control): say that --prompt arrives on one line
Artem457c395bced2
diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.tsindex b4a60eb71..1a6fef57f 100644--- a/src/main/canvas-control-core.test.ts+++ b/src/main/canvas-control-core.test.ts@@ -292,6 +292,19 @@ describe('parseControlRequest', () => {expect(isDestructiveVerb('sticky')).toBe(false)})+ it('both agent-facing texts warn that --prompt is one line and must not start with a slash', () => {+ for (const body of [buildCanvasSkillBody('/x/shim.sh'), buildCanvasControlInstructions('/tmp/nodeterm.sh')]) {+ // `assembleLaunchCommand` collapses every whitespace run in the prompt, because the prompt+ // rides argv on a line that is typed into the pane. An agent that does not know this writes+ // a numbered brief and gets one paragraph.+ expect(body.toLowerCase()).toContain('one line')+ // The failure that costs a whole station: flattened, a leading slash command swallows the+ // task as its argument, and the node then reads as idle to `--after`. Silence here is what+ // let that ship.+ expect(body).toMatch(/start a prompt with `\/`|begin a prompt with `\/`/i)+ }+ })+it('both agent-facing texts document --model on the open verbs and per-role model on spawn-team', () => {for (const body of [buildCanvasSkillBody('/x/shim.sh'), buildCanvasControlInstructions('/tmp/nodeterm.sh')]) {// The flag is the only cost lever an orchestrator has: without it every station it opensdiff --git a/src/main/canvas-control-core.ts b/src/main/canvas-control-core.tsindex 95a04e38c..e78e8ad4e 100644--- a/src/main/canvas-control-core.ts+++ b/src/main/canvas-control-core.ts@@ -303,6 +303,13 @@ export function buildCanvasControlInstructions(shimPath: string): string {' included); or an id `open-project` returned to YOU in this session, which never switches the',' user\'s view. A session opened into a non-active project starts when the user next views that',' project — do not poll for it. `--group`/`--after` cannot be combined with `--project`.',+ ' `--prompt` arrives on ONE LINE: every run of whitespace in it, newlines included, is',+ ' collapsed to a single space before the session starts. Write the task as continuous prose',+ ' and use sentences where you would have used bullets — a numbered list arrives as one',+ ' paragraph. Never begin a prompt with `/`: once flattened, the agent reads the whole prompt',+ ' as arguments to that slash command, your task is never seen, and the node then sits idle',+ ' looking healthy. To pick a model use `--model`, not a leading `/model`. To send a long or',+ ' structured brief, open the node and follow up with `send --node <id> --text "..."`.',' `--model <id>` picks the model the session launches with, instead of inheriting the',' default. Use it to keep a cheap station cheap: a node whose whole job is editing a README',' does not need the model you give the node rewriting a test suite. Honoured by claude, codex',@@ -670,6 +677,19 @@ Verbs:TARGET project's (its cwd, its default account and permission mode). A session opened into anon-active project starts when the user next views that project — do not poll for it; the replysays so. \`--group\`/\`--after\` cannot be combined with \`--project\`.+ \`--prompt\` arrives on ONE LINE. Every run of whitespace in it — newlines included — is+ collapsed to a single space before the session starts, because the prompt is passed as an+ argument on the agent CLI's launch command line and that line is typed into the pane. So write+ the task as continuous prose: a numbered list or a markdown heading arrives as one paragraph,+ and indentation is lost. Two consequences worth planning around:+ - **Never start a prompt with \`/\`.** Flattened, \`/model sonnet\` followed by your task reads+ to the agent as one slash command whose argument is the entire rest of the prompt. The+ command fails, your task is never seen, and the node then sits at an idle prompt looking+ perfectly healthy — including to \`--after\`, which will arm everything behind it. Use+ \`--model\` for the model; there is no supported way to run a slash command at launch.+ - **For a long or structured brief, split it.** Open the node with a short \`--prompt\` (or+ none), then deliver the body with \`send --node <id> --text "..."\`, which preserves the text+ as written.\`--model <id>\` decides which model the session LAUNCHES with, instead of inheriting theproject default. This is the lever for cost: a station whose job is editing a README does notneed the model you give the station rewriting a 1000-line test suite, and without this flagdiff --git a/src/shared/agents/launch.ts b/src/shared/agents/launch.tsindex ecf6b1416..42cbd4de6 100644--- a/src/shared/agents/launch.ts+++ b/src/shared/agents/launch.ts@@ -154,6 +154,14 @@ export function assembleLaunchCommand(const { fragment: argsFragment, missing: m2 } = expandedArgs(inputs.customAgent?.args ?? '', env)const baseCmd = argsFragment ? `${program} ${argsFragment}` : program+ // The prompt becomes a POSITIONAL ARGUMENT on a command line that is then typed into the pane+ // (`writeWhenShellReady` -> `deliverCommand`, which echo-verifies the line before submitting it).+ // A newline inside it would submit the half-typed line and fail that verification, so every run+ // of whitespace is collapsed to a single space. Load-bearing for this delivery path, not tidying:+ // preserving structure means delivering the prompt as a MESSAGE after launch (sendText, which+ // frames multi-line text through tmux `paste-buffer -p`) rather than as argv. Callers that let a+ // user or an agent supply the prompt must say the text arrives on one line -- see+ // `buildCanvasSkillBody` / `buildCanvasControlInstructions`.const promptArg = inputs.initialPrompt? shellSingleQuote(inputs.initialPrompt.replace(/\s+/g, ' ').trim()): null