The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Windows: read Claude Code's '>' composer as its prompt (#1649)
0xken155616846c5c04
diff --git a/cli/src/engines/claude/composer.ts b/cli/src/engines/claude/composer.tsindex 783e6f8d9..9552edbed 100644--- a/cli/src/engines/claude/composer.ts+++ b/cli/src/engines/claude/composer.ts@@ -1,12 +1,15 @@import type { ComposerState } from '../facets/screen.js'import { screenLines, typedToken } from '../kit/composer.js'+import { claudeWindowsComposer } from '../kit/pane.js'/** A row of Claude Code's rule: all `─`, or `─` at both ends with text set in it. */const CLAUDE_RULE = /^─{3,}$|^─{3,}.*─{3,}$/export function composerState(capture: string): ComposerState {const { lines } = screenLines(capture)- let prompt = lines.findLastIndex((line) => /^❯(?:\s|$)/.test(line))+ // On Windows its marker can be `>` (kit/pane.ts `claudeWindowsComposer`): a resent Super Tab message was refused as+ // `prompt_hidden` there (DESKTOP-0TFH0OJ, 2026-10-23).+ let prompt = Math.max(lines.findLastIndex((line) => /^❯(?:\s|$)/.test(line)), claudeWindowsComposer(lines))let bottom = lines.findIndex((line, index) => index > prompt && CLAUDE_RULE.test(line.trim()))if (prompt < 1 || !CLAUDE_RULE.test(lines[prompt - 1].trim()) || bottom < 0) {// A draft taller than the pane: Claude Code does not cap the prompt's height outside its fullscreen@@ -21,7 +24,7 @@ export function composerState(capture: string): ComposerState {const below = lines.slice(bottom + 1)// Nothing ruled under the box: a dialog of Claude Code's own is drawn ruled, in its place.if (below.some((line) => CLAUDE_RULE.test(line.trim()))) return 'absent'- const draft = [prompt < 0 ? '' : lines[prompt].replace(/^❯\s?/, ''), ...lines.slice(prompt + 1, bottom).map((line) => line.trim())].join(' ').trim()+ const draft = [prompt < 0 ? '' : lines[prompt].replace(/^[❯>]\s?/, ''), ...lines.slice(prompt + 1, bottom).map((line) => line.trim())].join(' ').trim()const token = typedToken(draft)const rows = below.map((line) => line.trim()).filter(Boolean)if (token.startsWith('/') && rows.some((row) => /^\/[\w:.-]/.test(row))) return 'popup'diff --git a/cli/src/engines/kit/pane.spec.ts b/cli/src/engines/kit/pane.spec.tsnew file mode 100644index 000000000..b4ad566f6--- /dev/null+++ b/cli/src/engines/kit/pane.spec.ts@@ -0,0 +1,71 @@+import { afterEach, describe, expect, it } from 'vitest'+import { composerState } from '../claude/composer.js'+import { inspectPane } from './pane.js'+import { teamHold } from './screen.js'++const rule = '─'.repeat(60)+const footer = ' ⏵⏵ bypass permissions on (shift+tab to cycle)'+/** Claude Code's composer between its two rules, as read from DESKTOP-0TFH0OJ on 2026-10-23: in the Harness terminal on+ * Windows it draws `>` and a no-break space where it draws `❯` elsewhere. */+const claudeScreen = (marker: string, draft = '') => ['✻ Crunched for 4m 6s · done 12:33 AM', '', rule,+ `${marker}\u00a0${draft}`.padEnd(60), rule, footer, ''].join('\n')++const platform = Object.getOwnPropertyDescriptor(process, 'platform')!+const on = (name: NodeJS.Platform) => Object.defineProperty(process, 'platform', { ...platform, value: name })+afterEach(() => { Object.defineProperty(process, 'platform', platform) })++const read = (capture: string) => ({ pane: inspectPane('claude', capture), hold: teamHold('claude', capture, inspectPane('claude', capture), null) })++describe("Claude Code's composer on Windows", () => {+ // With the `>` unread, the pane never read idle, and the Flutter assignment for DESKTOP setup was held from 07:42 UTC.+ it('reads `>` inside the composer frame as its prompt: idle when empty, a draft when typed into', () => {+ on('win32')+ expect(read(claudeScreen('>'))).toEqual({ pane: { idle: true, plan: false, dialog: false, draft: false }, hold: null })+ expect(read(claudeScreen('>', 'install flutter'))).toMatchObject({ pane: { idle: false, draft: true }, hold: 'team_waiting_draft' })+ })++ // The resent assignment (08:27 UTC) then reached the pane and was refused as `prompt_hidden`: the composer reader looked+ // for `❯` alone too.+ it('finds the composer there, so input is typed into it', () => {+ on('win32')+ expect(composerState(claudeScreen('>'))).toBe('ready')+ expect(composerState(claudeScreen('>', '/mo'))).toBe('ready')+ on('darwin')+ expect(composerState(claudeScreen('>'))).toBe('absent')+ })++ it('never reads a shell prompt or a `>` in the transcript as an idle Claude Code', () => {+ on('win32')+ const shell = ['Windows PowerShell', '', 'PS C:\\Users\\DELL> ', ''].join('\n')+ expect(read(shell)).toMatchObject({ pane: { idle: false }, hold: 'team_waiting_idle' })+ const quoted = ['⏺ The log says:', rule, '> rename observers.json.next -> observers.json', 'EPERM', '', '✻ Working… (esc to interrupt)', ''].join('\n')+ expect(read(quoted)).toMatchObject({ pane: { idle: false }, hold: 'team_waiting_idle' })+ })++ // Review of #1649: a framed `>` in output (a quoted screen) above more output is not the input box. Only the last box,+ // with nothing under it but Claude Code's indented footer, is.+ it('reads only the bottom box with its footer as the composer, never a framed `>` in output', () => {+ on('win32')+ const quoted = ['⏺ The pane showed:', rule, '>\u00a0', rule, '⏺ and then it stopped.', ''].join('\n')+ expect(read(quoted)).toMatchObject({ pane: { idle: false }, hold: 'team_waiting_idle' })+ expect(composerState(quoted)).not.toBe('ready')+ const shellAfter = ['⏺ Done.', rule, '>\u00a0', rule, ' ⏵⏵ bypass permissions on (shift+tab to cycle)', 'PS C:\\Users\\DELL> ', ''].join('\n')+ expect(read(shellAfter)).toMatchObject({ pane: { idle: false } })+ expect(composerState(shellAfter)).not.toBe('ready')+ // Re-review: indented output under a framed quote is not a footer; only Claude Code's own footer rows are.+ const indentedAfter = ['⏺ The pane showed:', rule, '>\u00a0', rule, ' continued output', ' - and a list item', ''].join('\n')+ expect(read(indentedAfter)).toMatchObject({ pane: { idle: false }, hold: 'team_waiting_idle' })+ expect(composerState(indentedAfter)).not.toBe('ready')+ const defaultMode = [rule, '>\u00a0', rule, ' ? for shortcuts', ''].join('\n')+ expect(read(defaultMode)).toEqual({ pane: { idle: true, plan: false, dialog: false, draft: false }, hold: null })+ expect(composerState(defaultMode)).toBe('ready')+ })++ it('reads Mac and Linux screens as before', () => {+ on('darwin')+ expect(read(claudeScreen('>'))).toMatchObject({ pane: { idle: false }, hold: 'team_waiting_idle' })+ expect(read(claudeScreen('❯'))).toEqual({ pane: { idle: true, plan: false, dialog: false, draft: false }, hold: null })+ on('win32')+ expect(read(claudeScreen('❯'))).toEqual({ pane: { idle: true, plan: false, dialog: false, draft: false }, hold: null })+ })+})diff --git a/cli/src/engines/kit/pane.ts b/cli/src/engines/kit/pane.tsindex 877901819..76c2c734d 100644--- a/cli/src/engines/kit/pane.ts+++ b/cli/src/engines/kit/pane.ts@@ -213,20 +213,43 @@ function promptMarker(engine: AgentEngine): RegExp {return /[›❯]/u}+const COMPOSER_RULE = /^[─━]{3,}(?:.*[─━]{3,})?\s*$/+/** A row only Claude Code's own footer draws: its shortcut hint, or its permission mode with the key that cycles it. */+const CLAUDE_FOOTER = /^\s+(?:\? for shortcuts|.*\(shift\+tab to cycle\))/+/**+ * The line of Claude Code's composer when it draws `>` for its marker, or -1. In the Harness terminal on Windows it draws+ * `>` and a no-break space where it draws `❯` elsewhere, so the pane never read idle and every Super Tab delivery to it+ * was held (DESKTOP-0TFH0OJ, 2026-10-23). Only the bottom box counts: `>` at the start of the line under its top rule,+ * and under its bottom rule Claude Code's own footer, with nothing but indented rows. A shell prompt (`PS C:\>`), or a+ * `>` quoted or framed in output above more output, indented or not, must never read as an idle Claude Code (review of+ * #1649). A box whose footer is not drawn reads as no composer: held, never typed into. Mac and Linux are unchanged.+ */+export function claudeWindowsComposer(lines: string[]): number {+ if (process.platform !== 'win32') return -1+ const visible = lines.map(stripAnsi)+ const bottom = visible.findLastIndex((line) => COMPOSER_RULE.test(line))+ const below = visible.slice(bottom + 1)+ if (bottom < 2 || below.some((line) => line.trim() && !/^\s/.test(line)) || !below.some((line) => CLAUDE_FOOTER.test(line))) return -1+ const top = visible.slice(0, bottom).findLastIndex((line) => COMPOSER_RULE.test(line))+ return top >= 0 && top + 1 < bottom && /^>(?:[\u00a0 ]|$)/.test(visible[top + 1]) ? top + 1 : -1+}+export function inspectPane(engine: AgentEngine, capture: string, takeover: Takeover = () => null, planPattern = /\bplan mode on\b/i): PaneInspection {if (engine === 'opencode') return inspectGutterBoxPane(capture, true)if (engine === 'copilot') return inspectGutterBoxPane(capture, false)if (engine === 'grok') return inspectGrokPane(capture)const rawLines = capture.split('\n')- const marks = promptMarker(engine)- const promptIndex = latestPromptLine(rawLines, marks)+ const boxed = engine === 'claude' ? claudeWindowsComposer(rawLines) : -1+ const promptIndex = Math.max(latestPromptLine(rawLines, promptMarker(engine)), boxed)+ // ANSI before a boxed `>` is not text, so the raw line is searched for the first `>`.+ const [marks, rawMarks] = promptIndex === boxed && boxed >= 0 ? [/^>/, />/] : [promptMarker(engine), promptMarker(engine)]const prompt = promptIndex >= 0 ? rawLines[promptIndex] : ''const currentUi = currentPaneUi(rawLines, promptIndex)const dialog = DIALOG_UI.test(currentUi) || takeover(capture, currentUi) !== nullconst plan = planPattern.test(currentUi)const marker = stripAnsi(prompt).search(marks)let visible = marker >= 0 ? stripAnsi(prompt).slice(marker + 1).replace(/\u00a0/g, ' ').trim() : ''- const rawMarker = prompt.search(marks)+ const rawMarker = prompt.search(rawMarks)const rawTail = rawMarker >= 0 ? prompt.slice(rawMarker + 1) : ''const placeholder = hasPlaceholderSgr(rawTail)if (placeholder || IDE_CONTEXT_CHIPS.test(visible)) visible = ''diff --git a/cli/src/engines/kit/screen.ts b/cli/src/engines/kit/screen.tsindex bfda17cfa..e583ba63f 100644--- a/cli/src/engines/kit/screen.ts+++ b/cli/src/engines/kit/screen.ts@@ -1,7 +1,7 @@import { stripVTControlCharacters } from 'node:util'import type { AgentEngine } from '../types.js'import type { ComposerState, MessageHold, PaneInspection, PaneModal, PaneView, ScreenReading } from '../facets/screen.js'-import { inspectPane } from './pane.js'+import { claudeWindowsComposer, inspectPane } from './pane.js'import { isApprovalDialog, parseQuestionPane } from './questionPane.js'const HOLDS: Record<NonNullable<PaneModal>, MessageHold> = {rewind: 'rewind_picker_open', transcript: 'transcript_open', search: 'search_open', trust: 'trust_open',@@ -25,7 +25,7 @@ export function teamHold(engine: AgentEngine, capture: string, pane: PaneInspect// These composers permit an empty first line followed by a multiline human draft.// The general profile inspector only needs the first line; team delivery needs every line.if (['claude', 'codex', 'cursor', 'hermes'].includes(engine)) {- const index = lines.findLastIndex(line => /^\s*[›❯→]/u.test(line))+ const index = Math.max(lines.findLastIndex(line => /^\s*[›❯→]/u.test(line)), engine === 'claude' ? claudeWindowsComposer(lines) : -1)if (index < 0) return 'team_waiting_idle'// Codex shows its styled placeholder only when the whole composer is empty.// Its configurable model/cwd/task footer below that placeholder is not draft