Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Claude Desktop Code handoff

`createClaudeDesktopAdapter()` accepts optional qualification, runtime and prompt builder. Without all three it returns a full adapter with `qualification: undefined`. Detection remains available, while native operations fail closed or direct the user to configure the target. The target catalog presents manual setup or export until the target is qualified. Bundle detection checks the macOS app identity, executable, version and declared `claude` scheme, and does not establish Code runtime readiness or code-signing trust. An unqualified adapter can detect any version; a qualified adapter rejects a version different from its evidence.

`createClaudeDesktopAdapterWithIntegration` constructs the shared `createClaudeIntegration` service using an explicitly selected candidate configuration directory. Desktop and CLI receive the same canonical configuration key for the same directory. When a qualified Desktop runtime is also supplied, preflight checks the registered `claude://` handler and shared doctor before that runtime's independent verification. A successful CLI doctor alone is not evidence that Desktop uses the profile or loads the plugin. An unverified candidate must not be used to write settings. The Desktop adapter's installation action directs the user to the [Desktop plugin manager](https://code.claude.com/docs/en/desktop), which supports interactive plugin installation and enablement without installing the CLI. The existing PowerContext `ClaudeInstaller` and doctor require `claude`; they are reused only through the shared integration when explicitly configured.

Desktop's local Code sessions can load MCP definitions from `claude_desktop_config.json` alongside `~/.claude.json` and project `.mcp.json`; Desktop's definition wins for a duplicate server name against those files. Standalone Claude CLI does not read the Desktop file. Shared settings and a successful CLI check therefore do not prove Desktop will use the same MCP endpoint or principal. See [Desktop MCP configuration](https://code.claude.com/docs/en/desktop#shared-configuration).

The optional in-process `ClaudeDesktopRuntimeProbe` must observe the actual Desktop Code runtime. Its configuration key must identify the real installer write domain, and must match the Claude CLI adapter's key if they share that domain. Its integration check must verify plugin loading, required Handoff, Continue and receipt tools, Server connectivity and user actions such as restart or sign-in. Its environment check must establish the effective directory, Server, Scope, configuration generation, new-session behavior, unsent prefill and package access. Its package check must verify the exact delivery path against the actual target sandbox. Host filesystem readability, a CLI check, and plugin files alone are insufficient.

Claude's [Code link](https://support.claude.com/en/articles/14729294-open-claude-desktop-with-a-link) supplies the `folder` and `q` parameters; Desktop asks the user to confirm the folder. A link does not prove whether the selected runtime is local, remote or SSH. Desktop can store local environment variables in encrypted application settings, so the DSH process environment and default settings file cannot establish the next session's effective configuration. The Claude integration resolves an explicit Scope first, then session and workspace bindings, then the Server default. A prompt cannot correct a hook that already resolved a different Scope.

Qualification records tested app, OS, DSH, plugin and Server versions and access mode, and evidence of real launch, unsent prefill, package read, Continue and exact ACK. Fixture tests and bundle inspection are not qualification. If the probe or evidence is unavailable, keep the target unavailable and use the existing manual export path. Do not modify Desktop's private database, create a receipt on its behalf, or replace Code with ordinary chat.

## Desktop 4.29.0 runtime investigation

Read-only inspection of the installed macOS 4.29.0 app's packaged `app.asar` (SHA-256 `ea870e28ca2e14d994b45e1d871a832ee5895c0274ae5747feac6b9ed135a45e`) found a Code binary manager with build pin 2.1.309. It resolves a local override, a preseed, a managed target or an installed fallback, and can initiate a repair download. This is an implementation observation for that package, not a stable public API or a guarantee that 2.1.309 will run. A binary at a known location does not prove runtime selection or qualification.

The packaged Code session manager constructs its launch environment and MCP servers, loads local plugins, and applies managed settings at session creation. Desktop documents saved local environments and host-managed policy; a static inspection of `~/.claude` or a CLI doctor cannot establish the future session's environment, effective Scope, enabled MCP tools, or package read permissions. The documented deep link does not select Local or specify an environment. There is no verified public API here that returns those facts for the not-yet-created session. A restart and a static settings fingerprint alone do not solve selection, managed policy changes, or package access.

A viable next step requires a two-stage Host flow and real acceptance: open a fresh Code session without submitting a task, have the user select Local and approve the folder, and observe a one-time, nonce-bound readiness message from a supported PowerContext session hook or other documented receiver-side mechanism. The observation must bind the actual session, effective directory, Server, Scope, required MCP capabilities, configuration generation and a read of the exact package; it is not a Handoff ACK. Verify whether Desktop runs such a hook before any user prompt and whether it permits that package read. If it does not, preserve manual export rather than treating a previous session's evidence as proof. The current preflight contract requires readiness before preparation, so this sequence also needs a Host state transition; adapter-only static checks cannot supply it.

### Reproducible 4.29.0 evidence and contract gap

The following observations are from the installed 4.29.0 `app.asar` identified by the hash above. Entry names and byte offsets are for this exact package and are not public interfaces:

| ASAR entry | Byte offset within entry | Observed behavior |
| --- | ---: | --- |
| `.vite/build/index.chunk-C7NkbHFq.js` | 1,611,365 | Build manifest pins Code 2.1.309 and includes platform checksums. |
| same entry | 4,035,114 and 4,065,135 | The Code manager places binaries under app `userData/claude-code` and resolves local override, preseed, required version or fallback. The manager can update its target; the manifest is not proof of the next executable. |
| same entry | 5,355,974 | Host environment construction combines Desktop process and shell-derived values and normalizes the config directory. A separate Code session may add other host/session settings. |
| same entry | 5,321,566 and 5,323,141 | Effective managed settings and read restrictions are applied according to host/session context. |
| `.vite/build/index.chunk-BbMIW0DP.js` | 635,270 and 636,010 | Session setup constructs MCP servers and resolves enabled local plugins for the actual session and working directory. |
| same entry | 737,830 and 740,701 | SDK options include user/project/local settings, session environment, permission mode, host hooks and additional MCP/plugin setup. These are assembled inside Desktop, not supplied by the deep link. |

Offsets can be independently checked by reading the ASAR header, extracting the named entry without executing it, and searching for the relevant identifiers. They do not qualify a different app build. Current [Desktop documentation](https://code.claude.com/docs/en/desktop#shared-configuration) states that local Code imports MCP definitions from `claude_desktop_config.json`; a same-name definition can override another Code configuration. A CLI-only doctor cannot determine the Desktop connection selected by this precedence.

The existing Claude integration registers a `SessionStart` hook, but its current implementation is fail-open and does not emit a receiver-readiness attestation. The [hook contract](https://code.claude.com/docs/en/hooks#sessionstart) supplies session ID and working directory when the Code runtime actually starts; it does not promise that merely displaying an unsent Desktop composer has started that runtime, or prove the effective MCP tools or Read-tool permission. This distinction must be tested in the real Desktop version rather than inferred from invoking the hook directly.

A minimal implementation needs: (1) an explicit provisional Host state before automatic readiness, then a user-opened Local session; (2) a bounded, authenticated, one-time challenge tied to the exact delivery and actual receiver session; (3) a receiver-side observation of effective Scope, connection identity and package access, plus a supported verification that the relevant MCP tools and Read access actually apply; and (4) final Host revalidation before asking the user to submit the prefill. The observation must be invalidated on relevant version, policy, environment, directory or process changes and must not be reported as a Handoff ACK. If the session runtime only starts on first submission, or the available hook cannot establish effective tool access, keep the automatic action unavailable and offer manual delivery. A Host-readable file, a CLI doctor, a prior session, or an unverified evidence string is insufficient.
Loading