---
title: "Chunk notes you can retrieve"
lesson_id: "02"
---

# Chunk notes you can retrieve

- **Lesson ID:** 02
- **Goal:** Split sandbox notes into overlapping passages with stable ids. Swift on device. Python on a Mac for a first folder index.
- **Human lesson:** [02-chunk-private-notes.html](02-chunk-private-notes.html)

## Prerequisites

- Lesson 01 path choice.

## Inputs, outputs, and artifacts

- **Inputs:** Note text and a document id.
- **Outputs:** Chunks with docId, chunkId, text, and start.

## Agent build steps

1. Split on words with a size and overlap in Swift for on-device edits.
2. Show a Python folder indexer that writes chunks.jsonl with the same ids.
3. Keep stable ids you can donate to Spotlight later.
4. Rebuild chunks when a file changes.
5. Keep files in the app sandbox.

## Constraints

No cloud ingest. No em dashes. Swift for on-device chunk. Python for Mac batch index.

## Key concepts

- Chunks are about 200 to 400 tokens with overlap.
- Store `docId`, `chunkId`, start offset, and raw text.
- Rebuild chunks when a note is edited.
- The same id can link a Spotlight item to your owned chunk.

## Takeaways

- Do not embed a whole book as one vector.
- Stale chunks are silent wrong answers.
- Keep notes in the app sandbox. Do not upload them.

## Acceptance checks

- Swift chunk type and function are shown.
- Python Mac indexer is shown.
- Rebuild-on-edit is stated.
- Agent brief link is present.
