---
title: "Keep search on the phone"
lesson_id: "01"
---

# Keep search on the phone

- **Lesson ID:** 01
- **Goal:** Separate SpotlightSearchTool from an owned BM25 + dense + rerank stack.
- **Human lesson:** [01-keep-search-on-the-phone.html](01-keep-search-on-the-phone.html)

## Prerequisites

- iOS 27 or macOS 27 as the only targets.

## Inputs, outputs, and artifacts

- **Inputs:** Private notes that must not leave the device.
- **Outputs:** A written choice of Path A, Path B, or both.

## Agent build steps

1. State that public cloud search is out of scope.
2. Describe SpotlightSearchTool as Apple's local RAG tool over Core Spotlight ([WWDC26 246](https://developer.apple.com/videos/play/wwdc2026/246/)).
3. Show an illustrative Swift LanguageModelSession with SpotlightSearchTool.
4. Describe BM25 + dense + rerank as a stack the app owns. Mac index build may be Python.
5. Allow using both without merging their type names.

## Constraints

Do not invent an Apple BM25 API. Mark SpotlightSearchTool Swift as illustrative. No em dashes. Swift on the session. Python only for later Mac indexing.

## Key concepts

- Path A donates to Core Spotlight and adds `SpotlightSearchTool` to the session.
- Path B is chunk, BM25 you write, Core AI embed, merge rerank, then pack.
- `SpotlightSearchTool` is local RAG, not BM25 or a Core AI index you control.
- Both paths can coexist.

## Takeaways

- If a lesson says BM25, the code is yours. If it says `SpotlightSearchTool`, the type is Apple's.
- Users will not put private notes into a public search API.
- Owned stack is for testable rankers and hidden files.

## Acceptance checks

- Both paths are named.
- Honesty rule is present.
- Agent brief link is present.
