[BUG] Claude Desktop (macOS): every Spotlight OS-entry refresh deletes the whole `com.anthropic.claude.os-entry` domain and re-indexes it, bloating the CoreSpotlight index and slowing all Spotlight searches
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 15/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- macos, swift, typescript
- Ambito
- desktop, operating-systems
Direzione di ricerca
The refresh lives in the Swift ClaudeSwift.OsEntryPoints async path (setSpotlightEntries), which first calls deleteSearchableItemsWithDomainIdentifiers and then indexSearchableItems for every entry, and the JS caller r$a() in the desktop app bundle. Start by reading the Swift refresh and the JS trigger, then confirm the churn by counting deleteSearchableItemsWithDomainIdentifiers log lines for a session. Done would mean refreshes update items by identifier and only delete identifiers that disappeared, and unchanged refreshes are skipped. Reproducing needs macOS with the desktop app and Spotlight, so it is not a quick first-timer task.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The desktop app's "OS entry points" feature lists recent Code sessions in Spotlight. Each refresh (setSpotlightEntries) first calls deleteSearchableItemsWithDomainIdentifiers(["com.anthropic.claude.os-entry"]), then re-indexes every entry: the 50 most recent sessions plus "New Claude Code session", "Ask Claude" and "Waiting for you". The JS side calls it whenever its session-list key changes.
The items already have stable uniqueIdentifiers. Even so, the domain-wide delete removes every item and re-inserts it as a new document. Over weeks of normal use, the app-content stores fill with dead document slots. Spotlight queries against those stores spend their time in bitmap operations over the whole ID range, and Spotlight doesn't show any results (even plain app launches) until that query returns. I measured a consistent 2–2.5 s delay.
Environment
- Claude Desktop 7.37095.0 (macOS, Apple Silicon), Code tab in regular use
- macOS 27.2 (Darwin 27.2.0)
Code path (decompiled app.asar.unpacked/node_modules/@ant/claude-swift/build/Release/swift_addon.node, arm64)
- JS (
app.asar):r$a()builds{model, entries, key}. Ifkey !== IQ, it runsawait $Qa(e => e.setSpotlightEntries(o)).Fea()produces the entries: 3 fixed URLs plus up toSea = 50non-archived sessions. - Swift
ClaudeSwift.OsEntryPoints, async refresh with entrysub_BF6EC:sub_BF780:[CSSearchableIndex defaultSearchableIndex] deleteSearchableItemsWithDomainIdentifiers:@[OsEntryPoints.spotlightDomain] completionHandler:, then awaits the result. The domain array is a static object containingcom.anthropic.claude.os-entry.- On success,
sub_BF88Ccontinues tosub_BF8E4. sub_BF8E4loops over allSpotlightEntryvalues and builds aCSSearchableItemAttributeSet(contentType: .item)with title, displayName and contentDescription. It createsCSSearchableItem(uniqueIdentifier: entry.<first field>, domainIdentifier: "com.anthropic.claude.os-entry", attributeSet:), then callsindexSearchableItems:completionHandler:with the full array.
- There is no diff against the previously indexed set. Every refresh is a full delete plus a full re-insert.
clearSpotlight(sub_BFE54) also deletes the domain. That one is fine.
Measurements
- Spotlight UI log (
Siri AIprocess,com.apple.SpotlightServices): the Metadata (files/apps) leg finishes in about 0.2 s, but results aren't drawn until[CoreSpotlight][priorityComplete]arrives. Over 12 h, that took a median of 1947 ms (max 2502 ms) on every search that ran to the end. Log line:Found no top hit from early priority index response. Not sending response early. sample corespotlightdduring a search: about 22.5k thread-samples across roughly 12 user-interactive threads inprocessNodes→_ContentIndexDocSetIteratorProcessIterHits→_CIIndexSetAddRange_Bitmap_Src_SparseDst/_CIIndexSetEnumeratorNext.- Store sizes (
~/Library/Metadata/CoreSpotlight/<store>/index.spotlightV3/live.2.indexIds): 29.8 MB inNSFileProtectionCompleteUntilFirstUserAuthentication, roughly 7.4 M ID slots. Bundle-ID strings in that store's files:com.anthropic.claudefordesktop× 5,432,com.anthropic.claude.os-entry× 1,345. The next largest,com.apple.MobileSMS, appears × 438. - Write churn, attributed to the app: the CoreSpotlight client library logs inside the Claude process itself (
Claude[<pid>] [com.apple.corespotlight:index] deleteSearchableItemsWithDomainIdentifiers, domainIdentifiers number:1). Over one hour of normal Code-tab use there were 276 of these, roughly one every 13 s, and up to 74 in a single 10-minute window. Each one wipes and re-adds all ~53 entries, which is about 14,000 new document IDs an hour. Reproduce with:log show --last 1h --predicate 'process == "Claude" AND subsystem == "com.apple.corespotlight"'
Workaround / confirmation
Moving the bloated stores aside and restarting corespotlightd brought priorityComplete from about 2.0 s down to 37–177 ms. Expect the delay to come back as the churn continues.
A caveat: the Priority store (15.2 MB of IDs) was also bloated, but Claude's entries are only a small part of it. Part of the slowdown is Apple's index design, which apparently doesn't compact dead slots and blocks the UI on the priority leg. That part is being reported to Apple separately.
Suggested fix
- Drop the domain-wide delete. The
uniqueIdentifiers are already stable, soindexSearchableItemson the current entries updates them in place. CalldeleteSearchableItemsWithIdentifiersonly for identifiers that disappeared since the last refresh. - Skip the refresh entirely when titles, details and IDs are unchanged, and debounce bursts.
- Optionally, add a user setting to turn off the Spotlight and Dock OS entries. Today only the
disableDeepLinkspolicy turns them off.
- Lingua principale
- TypeScript
- Stelle
- 157k
- Fork
- 25.1k
- Merge medio
- 20h 25m
- PR unite (30g)
- 4
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di anthropics/claude-code
-
area:tui enhancement platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anthropics/claude-code#112838 ·
-
area:docs area:plugins bug documentation low-priority platform:windows
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
anthropics/claude-code#112676 ·
-
area:docs area:hooks area:skills bug platform:windows
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
anthropics/claude-code#112675 ·
-
[DOCS] Private Azure DevOps plugin marketplaces work in the Claude desktop app – please documentApertaarea:docs area:plugins documentation enhancement platform:windows
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
anthropics/claude-code#112663 ·
-
area:agents bug has repro platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anthropics/claude-code#112605 ·
Tutte le issue di anthropics/claude-code
Issue simili
-
sumHorizontal, maxHorizontal, minHorizontal, allHorizontal, anyHorizontal, struct and argSortBy treat strings as literals instead of column namesForse già presa @tomaionescu l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pola-rs/nodejs-polars#486 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
jaegertracing/jaeger-ui#4853 ·
I maintainer di solito rispondono entro 1 giorno
-
area/plugins platform/linux reproduced type/bug version/v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anomalyco/opencode#66970 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Add: Sports First TV (US)Apertaapproved check:passed streams:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
RequirementAgent treats list -> add -> list as a tool call cycle and drops the second list call (Python)Forse già presa @chaitanya0305 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
i-am-bee/beeai-framework#2049 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno