Skip to content

feat(desktop): connect-flow upgrades — live Notion MCP connection, guided Obsidian/Notion screens, Claude Code restart button - #10205

Merged
undivisible merged 4 commits into
mainfrom
worktree-onboarding-mcp-connect
Jul 21, 2026
Merged

undivisible merged 4 commits into
mainfrom
worktree-onboarding-mcp-connect

Conversation

@skanderkaroui

@skanderkaroui skanderkaroui commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Connect-flow upgrades: Claude Code restart, guided Obsidian/Notion screens, live Notion MCP connection

What

Improvements to the "Connect your AI" / memory export flow:

  1. Notion becomes a live connection over Notion's hosted MCP server (mcp.notion.com), replacing the copy-paste memory pack. NotionMCPConnector performs the standard MCP OAuth (dynamic client registration + PKCE + loopback redirect — no pre-registered client, no Notion app review), stores tokens in the Keychain with refresh handling, and syncs the markdown pack to an "Omi Memories" page: notion-create-pages on first sync, replace_content updates after, recreation if the user deleted the page. The connect sheet shows guided numbered steps (same pattern as Obsidian below), a connection state card, and Connect/Sync actions. The granted token also covers notion-search/notion-fetch for a future Notion→Omi read direction.

  2. Claude Code completion card is now state-aware with a restart button. After "Do it for me" completes, the card previously always said "Restart Claude Code to load Omi Memory" — wrong when no session is running, and unactionable when one is. Now the card detects the current user's running Claude Code CLI sessions:

    • none running → "You're all set — Omi Memory loads automatically in your next Claude Code session." (nothing to restart, no button)
    • sessions running → the restart note plus an explicit "Restart N running sessions" button that SIGTERMs them and then points at claude --continue to resume. The kill is only ever user-initiated.

    Detection matches the process basename claude/claude.exe for the current uid only, which covers native and pnpm/bun CLI installs while never matching Claude Desktop or its helpers ("Claude", "Claude Helper", chrome-native-host).

  3. Obsidian connect gets guided numbered steps (same pattern as the Claude connector): choose vault, where memories land + Sync to refresh, and that Obsidian's first-open "Do you trust the author of this vault?" prompt is about the vault's own plugins — either choice works, Omi only adds a Markdown note.

  4. Manual-setup copy cards copy the paste-able value, not the display label. In the grouped connect sheet, the Copy button under Claude (cloud)'s manual steps wrote Server URL: https://… (and Key: …) to the clipboard — label included — which breaks pasting into Claude's connector form. Display text keeps the label; the clipboard now gets just the URL/key. Command/config snippets (Claude Code, Codex, Hermes, OpenClaw) still copy their full text, which is correct for them.

Product invariants affected

  • INV-INT-1 (path glob Desktop/Sources/**/MemoryExport*): compliant — Claude Code session detection/stop is deterministic (ps parse + kill), the Notion connection is a deterministic API/MCP client (no agent sent to do an API-reachable job, no element-anchoring heuristics), and the Notion setup flow ends with a functional probe (the sync itself creates/updates the page and stores its URL).
  • INV-MEM-1 (path glob desktop/macos/Desktop/Sources/MemoryExportService.swift): compliant — no tier changes; the Notion export reuses the existing fetchMemories path and default access policy, exactly as the Obsidian export does.

Verification

  • xcrun swift build -c debug --package-path Desktop — build complete.
  • xcrun swift test --package-path Desktop --filter ClaudeCodeSessionsTests — 2 tests, 0 failures (CLI-vs-Desktop process matching, completion-subtitle states).
  • Detection filter validated against live ps output: matched 5 running claude.exe CLI sessions, excluded Claude.app and all its helpers.
  • Exercised in-app on a local named bundle (omi-v5): connect sheet shows the state-aware completion card and the value-only copy behaves as described.
  • make preflight — green.

Failure-Class: none

…y copy in connect cards

After 'Do it for me' completes for Claude Code, the completion card now
detects running CLI sessions (ps comm basename == claude/claude.exe, current
user only — never Claude Desktop): none running shows 'you're all set',
running sessions get an explicit 'Restart N running sessions' button that
SIGTERMs them and points at 'claude --continue'.

Also fixes the manual-setup copy cards in the grouped connect sheet copying
the display label ('Server URL: https://…') instead of just the URL/key
value, which broke pasting into Claude's connector form.

Verification:
- xcrun swift build -c debug --package-path Desktop: Build complete
- swift test --filter ClaudeCodeSessionsTests: 2 tests, 0 failures
- Detection filter validated against live ps output on this machine:
  matches 5 running claude.exe CLI sessions, excludes Claude.app + helpers
- Not yet exercised in-app (sheet click-through pending a named-bundle run)
…he vault trust prompt

Obsidian's connect sheet had only a vault picker and one caption; users hit
Obsidian's first-open 'Do you trust the author of this vault?' dialog with no
framing. Add the same numbered-steps guidance the Claude connector uses:
choose vault, where memories land + Sync to refresh, and that the trust
prompt is about the vault's own plugins (either choice works, Omi only adds
a Markdown note).

Verification:
- xcrun swift build -c debug --package-path Desktop: Build complete
- Presentation-only static copy; no behavior change, no test added
…nect screen

Replaces Notion's copy-paste memory pack with a real connection:
NotionMCPConnector does the full MCP OAuth against mcp.notion.com
(dynamic client registration + PKCE + loopback redirect — no pre-registered
client or Notion app review needed), stores tokens in the Keychain with
refresh handling, and syncs the markdown memory pack to an 'Omi Memories'
page (notion-create-pages on first sync, replace_content after; recreates
if the user deleted the page). The connect sheet gets the same guided
numbered steps as Obsidian, a connected/not-connected card, and
Connect/Sync actions. The stored token also covers notion-search and
notion-fetch for the upcoming Notion-to-Omi read direction.

Verification:
- Full protocol sequence proven live against mcp.notion.com before porting
  to Swift: DCR registration, browser consent, PKCE token exchange
  (8h access + refresh), tools/list (20 tools), notion-create-pages from
  markdown produced a real page in the test workspace, update-page schema
  captured for replace_content
- xcrun swift build -c debug --package-path Desktop: Build complete
- swift test --filter NotionMCPConnectorTests: 3 tests, 0 failures
  (SSE frame parsing, create-result parsing, refresh window)
- Swift in-app click-through not yet exercised (needs named-bundle run)
@skanderkaroui skanderkaroui changed the title feat(desktop): Claude Code restart button after MCP setup + value-only copy in connect cards feat(desktop): connect-flow upgrades — live Notion MCP connection, guided Obsidian/Notion screens, Claude Code restart button Jul 21, 2026
@skanderkaroui

Copy link
Copy Markdown
Contributor Author

Related: #10208 (onboarding connects over live MCP). Complementary, no overlapping files — #10208 makes onboarding present the shared ConnectDestinationSheet this PR upgrades. Verified both merge cleanly onto current main together (no conflicts) and the combined tree builds (xcrun swift build).

storeAuth ignored DesktopKeychainStore.setString Bool, so locked Keychain
could report success then disconnect next launch.

Failure-Class: none

@undivisible undivisible left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

Notion finally gets a real connection instead of a clipboard cosplay act — PKCE + loopback + Keychain, create-once/replace/recreate. Claude Code restart only SIGTERMs basename claude/claude.exe (Desktop stays alive), and Copy now pastes the value instead of Server URL: … fanfic.

Pushed a one-liner on top: storeAuth no longer ignores DesktopKeychainStore.setString failing — locked Keychain can’t fake a successful connect. Land this before #10208 so onboarding inherits live Notion, not the pack path.

@undivisible
undivisible merged commit abc6a50 into main Jul 21, 2026
27 of 28 checks passed
@undivisible
undivisible deleted the worktree-onboarding-mcp-connect branch July 21, 2026 17:04
Git-on-my-level added a commit that referenced this pull request Jul 22, 2026
…n redesign (#10340)

## Summary

Restores onboarding functionality that the Second Brain redesign
(#10218) dropped, re-implemented on top of the new conversational design
(no old UI brought back). Each fix is its own commit:

- **Auto-detect user name** (#9919) — seed the name field from the known
`givenName`, kick a backend name fetch, and adopt an async name arrival
(Apple sends the name only on first auth), so onboarding greets by name
instead of a generic placeholder. Also re-hydrates name/language/role
drafts on resume.
- **Clear onboarding state on sign-out** (#10108) —
`sbOnboardingResumeStep` + `onboardingRole` were added by the redesign
but left out of the shared clearing list, leaking the prior user's
resume step + role to the next account on the same Mac. Added both, plus
a regression test.
- **Drag-to-grant Full Disk Access** (#9742) — the drag-to-grant helper
was wired for Screen Recording but not FDA; now both use it.
- **Connector brand marks + Claude Code restart** (#10210 / #10205) —
connect rows show each connector's brand icon, and Claude Code shows a
restart prompt once connected so running sessions reload the new MCP
config.
- **Remove post-onboarding walkthrough** — the coach-mark tour that ran
after onboarding (spotlighting each nav pill) is deleted; a
just-onboarded user lands straight on Home.
- **Pin the drag-to-grant card under System Settings** — the permission
drag card was pinned to the screen's bottom quarter; it now anchors
directly beneath the live Settings window (flipping above it when
there's no room below) so it follows the window and never covers the
drop target.

## Verification

Build/manual verification pending — depends on #10334 (restores the
`Package.swift`/`Package.resolved` that a stray "fixture" commit gutted
on `main`, which currently breaks the desktop Swift build). This PR
carries no Package changes; once #10334 lands and this rebases, it
builds on the repaired manifest.

## Product invariants affected

- INV-INT-1

## Failure class (fixes)

Failure-Class: none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10340?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants