LearnNewsExamplesServices
Frontmatter
id10660
titleAdd Claude bridge Space focus seed
stateClosed
labels
bugaitestingregression
assigneesneo-gpt
createdAtMay 3, 2026, 8:54 PM
updatedAtMay 3, 2026, 9:12 PM
githubUrlhttps://github.com/neomjs/neo/issues/10660
authorneo-gpt
commentsCount1
parentIssue10658
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 3, 2026, 9:12 PM

Add Claude bridge Space focus seed

Closedbugaitestingregression
neo-gpt
neo-gpt commented on May 3, 2026, 8:54 PM

Context

Child of #10658. The Claude Desktop Shape C bridge path regressed after the wake/recovery work exposed a bad implicit invariant: Cmd+3 reliably selects the Claude Code tab, but it does not reliably focus the Claude Code prompt field.

Operator observations during the #10658 forensic thread:

  • Cmd+3 is stable for selecting the Claude Code tab.
  • Starting the bridge prep sequence with Cmd+A can select chat-history/session text when the prompt is not already focused.
  • Typing a normal key inside the Code tab moves focus into the input field.
  • Space is the safest focus seed observed so far: when the prompt is not focused, Space focuses the input without writing a visible character.
  • Read-only System Events / Accessibility probes could detect AXFocusedWindow, but not prompt focus. AXFocusedUIElement returned missing value both before and after the operator manually focused the prompt.

Duplicate sweep notes:

  • ask_knowledge_base(type: 'ticket', query='existing ticket Claude Desktop Space focus seed bridge daemon prompt focus Cmd+A transcript history') returned no relevant ticket.
  • Local resource sweep across resources/content/issues, resources/content/issue-archive, and resources/content/discussions found adjacent tickets but no equivalent Space focus-seed ticket.
  • Live latest-20 open GitHub issue sweep was read with title/author/labels. Adjacent entries included #10658 (broad Claude prompt-focus parent), #10647 (wake-stability epic), #10643 (Gemini parallel checkSunsetted originSessionId work), #10517 (HarnessPresence/wakePolicy), and #10422 (older AppleScript focus-steal bleed). None owns this minimal Claude Space focus seed.

The Problem

ai/scripts/bridge-daemon.mjs currently prepares the target prompt after tab selection by starting with destructive selection/cut chords:

activate Claude -> Cmd+3 -> Cmd+A -> Cmd+X -> paste wake -> Enter

When Claude Code tab owns focus but the prompt composer does not, Cmd+A can select transcript/history text instead of prompt text. This matches the hard-stop observation in #10658: the bridge selected active session text content rather than the input field.

The bridge therefore needs a non-destructive prompt-focus seed between Cmd+3 and Cmd+A for Claude Desktop.

The Architectural Reality

This is a Shape C bridge-daemon issue, not a fresh-session recovery issue and not a generic Claude API search.

Relevant current code:

  • ai/scripts/bridge-daemon.mjs:575-583 resolves tabShortcut, with Claude defaulting to 3.
  • ai/scripts/bridge-daemon.mjs:613-620 emits the tab-selection shortcut.
  • ai/scripts/bridge-daemon.mjs:623-628 immediately runs Cmd+A / Cmd+X.
  • ai/docs/wake-prompt-landing-matrix.md:5-7 states that adapter success is not enough; prompt landing is the observable success criterion.
  • learn/agentos/tooling/WakeSubstrateIncidentProtocol.md:110-123 requires loop-level evidence before reactivation.

The known-good route before the regression was still osascript; the mistake was treating tab selection as prompt focus. tabShortcut: '3' remains correct as a tab selector. It is not a prompt-focus primitive.

The Fix

For Claude Desktop only, insert a Space focus seed after Cmd+3 and before any Cmd+A / Cmd+X sequence.

Target sequence:

activate Claude -> Cmd+3 -> Space -> Cmd+A -> Cmd+X -> paste wake -> Enter

Implementation expectations:

  • Add the Space seed only for appName === 'Claude' or an explicit Claude-specific metadata primitive.
  • Keep Antigravity's Cmd+Shift+I path untouched.
  • Prefer key code 49 or an equivalent unambiguous AppleScript representation for Space.
  • Add adapter-intent regression coverage in test/playwright/unit/ai/scripts/bridge-daemon.spec.mjs proving the Space seed is emitted after Claude Cmd+3 and before Cmd+A.
  • Preserve the existing clipboard/user-draft restoration behavior.

Acceptance Criteria

  • Claude bridge osascript sequence emits Cmd+3, then Space focus seed, then Cmd+A / Cmd+X.
  • Antigravity bridge sequence remains unchanged and still emits Cmd+Shift+I for its focus path.
  • A Playwright unit test covers the Claude osascript argument order: tab selection before Space, Space before Cmd+A.
  • Live validation evidence is recorded against #10649 / #10658 for Claude Desktop with Code tab selected and transcript/history focused before wake.
  • Live validation evidence confirms the payload lands in the Claude prompt field, not transcript/history text.
  • Live validation explicitly notes the residual case where the prompt is already focused and contains a human draft; if Space mutates the draft, document the residual risk or add mitigation before wake reactivation.
  • Wake safety gate remains tripped until #10649 matrix requirements are satisfied or @tobiu explicitly accepts a bounded override.

Out of Scope

  • Implementing Claude Channels or CLI/session-target delivery.
  • Implementing a deep native Accessibility inspector beyond the read-only probes already attempted.
  • Fixing checkSunsetted originSessionId extraction; Gemini is already working #10643 in parallel.
  • Changing fresh-session resumeHarness.mjs behavior.
  • Reactivating bridge or heartbeat globally.

Avoided Traps

  • Trap: Cmd+3 means prompt focus. Rejected. It means Code-tab selection only.
  • Trap: start with Cmd+A and trust adapter success. Rejected. It can select transcript/history text.
  • Trap: wait for Channels before restoring the known-good Shape C route. Rejected for this quick win. Channels remains strategic, but this ticket restores the osascript path that worked before.
  • Trap: unit test equals reactivation proof. Rejected. Unit coverage proves adapter intent; #10649 live matrix proves loop safety.

Related

Origin Session ID: d9cd4943-3285-47a6-b629-c05a9a2a38e4

Retrieval Hint: "Claude Desktop Space focus seed bridge daemon Cmd+3 Cmd+A transcript prompt focus #10658"

tobiu referenced in commit c6269a8 - "fix(ai): add Claude focus seed primitive (#10660) (#10661) on May 3, 2026, 9:12 PM
tobiu closed this issue on May 3, 2026, 9:12 PM