Sync Apple Notes with AI Knowledge Base

Apple Notes does not have an API, but it does support AppleScript. This guide shows how to export your Apple Notes to JSON, import them into REM Labs, and query your entire notes library with semantic search. Works on macOS with iCloud-synced notes.

The Approach

Apple Notes is locked inside macOS with no public API. The workaround: use AppleScript to extract note content, save to a JSON file, then import into REM Labs with the Node.js SDK. Run the export script whenever you want to refresh your AI memory with the latest notes.

Step 1: Export Notes with AppleScript

Save this as export-notes.scpt and run with osascript:

-- export-notes.scpt set output to "[" tell application "Notes" set allNotes to every note set noteCount to count of allNotes repeat with i from 1 to noteCount set n to item i of allNotes set noteTitle to name of n set noteBody to plaintext of n set noteFolder to name of container of n set modDate to modification date of n -- Escape quotes in content set noteBody to my replaceText(noteBody, "\"", "\\\"") set noteTitle to my replaceText(noteTitle, "\"", "\\\"") set output to output & "{\"title\":\"" & noteTitle set output to output & "\",\"body\":\"" & noteBody set output to output & "\",\"folder\":\"" & noteFolder set output to output & "\",\"modified\":\"" & (modDate as string) & "\"}" if i < noteCount then set output to output & "," end repeat end tell set output to output & "]" return output
# Run the export osascript export-notes.scpt > apple-notes.json

Step 2: Import into REM Labs

import { RemClient } from "@remlabs/sdk"; import fs from "fs"; const rem = new RemClient({ apiKey: process.env.REMLABS_API_KEY }); const notes = JSON.parse(fs.readFileSync("apple-notes.json", "utf-8")); let count = 0; for (const note of notes) { if (!note.body || note.body.length < 10) continue; await rem.remember({ content: `${note.title}\n\n${note.body}`, namespace: "apple-notes", tags: [note.folder].filter(Boolean), metadata: { title: note.title, folder: note.folder, modified: note.modified, source: "apple-notes" } }); count++; } console.log(`Imported ${count} notes into REM Labs`);

Step 3: Query Your Notes

const results = await rem.recall({ query: "recipe for sourdough bread", namespace: "apple-notes", limit: 5 }); results.forEach(m => { console.log(`[${m.metadata.folder}] ${m.metadata.title}`); console.log(` ${m.content.slice(0, 120)}...`); console.log(); });

Automate with a LaunchAgent

Create a macOS LaunchAgent to run the sync daily:

<!-- ~/Library/LaunchAgents/com.remlabs.apple-notes-sync.plist --> <plist version="1.0"> <dict> <key>Label</key> <string>com.remlabs.apple-notes-sync</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/node</string> <string>/Users/you/scripts/sync-apple-notes.js</string> </array> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>8</integer> <key>Minute</key> <integer>0</integer> </dict> </dict> </plist>

macOS only: AppleScript access to Notes requires macOS. If your notes sync via iCloud, you only need to run this on one Mac -- the exported data covers all iCloud-synced notes across devices.

Make your Apple Notes searchable by AI

Free tier. AppleScript export. Semantic search on your notes library.

Get Started